nimbbl-mobile-react-native-sdk 1.3.1 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -18
- package/android/build.gradle +7 -7
- package/android/src/main/java/com/nimbbl/reactnative/NimbblReactNativeSDKModule.kt +0 -122
- package/ios/NimbblReactNativeSDK.swift +0 -63
- package/lib/NimbblSDK.d.ts +0 -17
- package/lib/NimbblSDK.js +4 -35
- package/lib/types.d.ts +8 -1
- package/nimbbl-mobile-react-native-sdk.podspec +2 -1
- package/package.json +4 -4
- package/ios/NimbblReactNativeSDK.podspec +0 -38
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Nimbbl React Native SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**✅ Stable Release v1.3.2 - Production Ready!**
|
|
4
4
|
|
|
5
5
|
A comprehensive React Native SDK for integrating Nimbbl payment gateway into your mobile applications. This SDK provides a seamless bridge between React Native and native payment functionality, offering a unified API for both iOS and Android platforms.
|
|
6
6
|
|
|
@@ -14,7 +14,7 @@ A comprehensive React Native SDK for integrating Nimbbl payment gateway into you
|
|
|
14
14
|
- 🛡️ **Type Safety** - Comprehensive TypeScript definitions for better development experience
|
|
15
15
|
- 📊 **Production Ready** - Built-in analytics, logging, and error handling
|
|
16
16
|
- 🔄 **Unified Event Handling** - Single callback system for all payment responses
|
|
17
|
-
- 🎯 **Latest Native SDKs** - Built on iOS 2.0.
|
|
17
|
+
- 🎯 **Latest Native SDKs** - Built on iOS 2.0.16 and Android 4.0.9
|
|
18
18
|
|
|
19
19
|
## 🚀 Quick Start
|
|
20
20
|
|
|
@@ -98,10 +98,10 @@ await nimbblSDK.checkout({
|
|
|
98
98
|
|
|
99
99
|
## 🎯 Why Choose Nimbbl React Native SDK?
|
|
100
100
|
|
|
101
|
-
- ✅ **
|
|
101
|
+
- ✅ **Stable Release**: Production-ready SDK with comprehensive testing and bug fixes
|
|
102
102
|
- ✅ **Production Ready**: Thoroughly tested and optimized for production environments
|
|
103
103
|
- ✅ **Cross-Platform Consistency**: Identical behavior on iOS and Android
|
|
104
|
-
- ✅ **Latest Native SDKs**: Built on the most recent iOS (2.0.
|
|
104
|
+
- ✅ **Latest Native SDKs**: Built on the most recent iOS (2.0.16) and Android (4.0.9) SDKs
|
|
105
105
|
- ✅ **TypeScript First**: Full TypeScript support with comprehensive type definitions
|
|
106
106
|
- ✅ **Simple Integration**: Get started in minutes with our straightforward API
|
|
107
107
|
|
|
@@ -323,7 +323,7 @@ class PaymentManager {
|
|
|
323
323
|
**Problem**: WebView opens and closes, but payment status screen doesn't appear.
|
|
324
324
|
|
|
325
325
|
**Solution**:
|
|
326
|
-
- Ensure you're using the latest SDK version (`^1.
|
|
326
|
+
- Ensure you're using the latest SDK version (`^1.3.2`)
|
|
327
327
|
- The SDK automatically manages event listeners - no manual setup required
|
|
328
328
|
- Check that your app properly handles the payment success/failure events
|
|
329
329
|
|
|
@@ -424,19 +424,20 @@ npm install nimbbl-mobile-react-native-sdk@1.0.0-alpha.3
|
|
|
424
424
|
**✅ Stable version is now available!**
|
|
425
425
|
|
|
426
426
|
```bash
|
|
427
|
-
# Upgrade
|
|
428
|
-
npm install nimbbl-mobile-react-native-sdk@^1.
|
|
427
|
+
# Upgrade to latest stable version
|
|
428
|
+
npm install nimbbl-mobile-react-native-sdk@^1.3.2
|
|
429
429
|
|
|
430
430
|
# Update your package.json
|
|
431
431
|
# Change from: "nimbbl-mobile-react-native-sdk": "^1.0.0-alpha.12"
|
|
432
|
-
# To: "nimbbl-mobile-react-native-sdk": "^1.
|
|
432
|
+
# To: "nimbbl-mobile-react-native-sdk": "^1.3.2"
|
|
433
433
|
```
|
|
434
434
|
|
|
435
|
-
**Key Changes in
|
|
436
|
-
- ✅ **Automatic Event Listener Management**: SDK
|
|
435
|
+
**Key Changes in Stable Versions:**
|
|
436
|
+
- ✅ **Automatic Event Listener Management**: SDK automatically manages event listeners for optimal performance
|
|
437
437
|
- ✅ **Simplified Integration**: No need to manually add/remove event listeners
|
|
438
438
|
- ✅ **Enhanced Error Handling**: Improved error messages and debugging capabilities
|
|
439
439
|
- ✅ **Production Ready**: Fully tested and optimized for production use
|
|
440
|
+
- ✅ **Updated Native SDKs**: Latest iOS (2.0.16) and Android (4.0.9) SDK integrations
|
|
440
441
|
|
|
441
442
|
### Breaking Changes Migration
|
|
442
443
|
|
|
@@ -453,7 +454,7 @@ For production applications, consider locking to specific versions:
|
|
|
453
454
|
```json
|
|
454
455
|
{
|
|
455
456
|
"dependencies": {
|
|
456
|
-
"nimbbl-mobile-react-native-sdk": "1.
|
|
457
|
+
"nimbbl-mobile-react-native-sdk": "1.3.2"
|
|
457
458
|
}
|
|
458
459
|
}
|
|
459
460
|
```
|
|
@@ -466,7 +467,37 @@ For production applications, consider locking to specific versions:
|
|
|
466
467
|
|
|
467
468
|
## 📝 Release Notes
|
|
468
469
|
|
|
469
|
-
### v1.3.
|
|
470
|
+
### v1.3.2 - Stable Release ✅
|
|
471
|
+
|
|
472
|
+
**🚀 Stable Production-Ready React Native SDK for Nimbbl Payments**
|
|
473
|
+
|
|
474
|
+
#### 🔧 Updates & Fixes
|
|
475
|
+
- **Updated iOS Native SDK**: Upgraded to iOS SDK v2.0.16 for improved stability and features
|
|
476
|
+
- **Updated Android Native SDK**: Upgraded to Android SDK v4.0.9 for enhanced performance
|
|
477
|
+
- **Podspec Improvements**: Updated podspec configuration for better CocoaPods integration
|
|
478
|
+
- **Test Fixes**: Fixed test expectations to match actual SDK behavior
|
|
479
|
+
- **Code Quality**: Improved code formatting and linting compliance
|
|
480
|
+
|
|
481
|
+
#### ✨ Features
|
|
482
|
+
- **Unified API**: Single API for both iOS and Android platforms
|
|
483
|
+
- **Latest Native SDKs**: Built on iOS 2.0.16 and Android 4.0.9
|
|
484
|
+
- **TypeScript Support**: Full TypeScript definitions for better development experience
|
|
485
|
+
- **Cross-Platform Consistency**: Identical behavior on iOS and Android
|
|
486
|
+
- **Production Ready**: Optimized for production environments with comprehensive error handling
|
|
487
|
+
|
|
488
|
+
#### 🛠️ Technical Highlights
|
|
489
|
+
- **Modern Architecture**: Built with React Native best practices
|
|
490
|
+
- **Native Bridge**: Seamless communication between React Native and native SDKs
|
|
491
|
+
- **Performance Optimized**: Efficient memory management and callback handling
|
|
492
|
+
- **Clean Codebase**: Production-ready code with no debug artifacts
|
|
493
|
+
- **Comprehensive Testing**: Full test coverage with 20+ test cases (all passing)
|
|
494
|
+
|
|
495
|
+
#### 📱 Platform Support
|
|
496
|
+
- **iOS**: iOS 13.0+ with Swift implementation
|
|
497
|
+
- **Android**: API Level 21+ (Android 5.0) with Kotlin implementation
|
|
498
|
+
- **React Native**: 0.70.0+ support with 0.76.0 recommended
|
|
499
|
+
|
|
500
|
+
### v1.3.0 - Initial Stable Release 🎉
|
|
470
501
|
|
|
471
502
|
**🚀 Production-Ready React Native SDK for Nimbbl Payments**
|
|
472
503
|
|
|
@@ -491,14 +522,9 @@ For production applications, consider locking to specific versions:
|
|
|
491
522
|
- **Clean Codebase**: Production-ready code with no debug artifacts
|
|
492
523
|
- **Comprehensive Testing**: Full test coverage with 20+ test cases
|
|
493
524
|
|
|
494
|
-
#### 📱 Platform Support
|
|
495
|
-
- **iOS**: iOS 13.0+ with Swift implementation
|
|
496
|
-
- **Android**: API Level 21+ (Android 5.0) with Kotlin implementation
|
|
497
|
-
- **React Native**: 0.70.0+ support with 0.76.0 recommended
|
|
498
|
-
|
|
499
525
|
## 🎯 What's Next?
|
|
500
526
|
|
|
501
|
-
|
|
527
|
+
Future releases will include:
|
|
502
528
|
|
|
503
529
|
- 🔄 **Enhanced Features**: Additional payment methods and customization options
|
|
504
530
|
- 🚀 **Performance Improvements**: Optimizations based on real-world usage
|
package/android/build.gradle
CHANGED
|
@@ -24,7 +24,7 @@ allprojects {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
group = 'com.nimbbl.reactnative'
|
|
27
|
-
version = '1.3.
|
|
27
|
+
version = '1.3.2'
|
|
28
28
|
|
|
29
29
|
android {
|
|
30
30
|
namespace 'com.nimbbl.reactnative'
|
|
@@ -35,7 +35,7 @@ android {
|
|
|
35
35
|
minSdkVersion 24
|
|
36
36
|
targetSdkVersion 36
|
|
37
37
|
versionCode 1
|
|
38
|
-
versionName "1.3.
|
|
38
|
+
versionName "1.3.2"
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
buildTypes {
|
|
@@ -64,11 +64,11 @@ dependencies {
|
|
|
64
64
|
compileOnly 'com.facebook.react:react-native:+'
|
|
65
65
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
66
66
|
|
|
67
|
-
// Nimbbl WebView SDK dependency
|
|
68
|
-
|
|
67
|
+
// Nimbbl WebView SDK dependency - aligned with Flutter WebView SDK
|
|
68
|
+
// Uses Maven coordinate tech.nimbbl:webview-sdk:4.0.13 (same as Flutter)
|
|
69
|
+
implementation 'tech.nimbbl:webview-sdk:4.0.13'
|
|
69
70
|
|
|
70
|
-
// Add
|
|
71
|
-
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
|
71
|
+
// Add Coroutines dependency for Android SDK
|
|
72
72
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -79,7 +79,7 @@ afterEvaluate {
|
|
|
79
79
|
from components.release
|
|
80
80
|
groupId = 'com.nimbbl.reactnative'
|
|
81
81
|
artifactId = 'nimbbl-react-native-sdk'
|
|
82
|
-
version = '1.3.
|
|
82
|
+
version = '1.3.2'
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -4,12 +4,9 @@ import android.app.Activity
|
|
|
4
4
|
import android.content.Intent
|
|
5
5
|
import com.facebook.react.bridge.*
|
|
6
6
|
import tech.nimbbl.webviewsdk.core.NimbblCheckoutSDK
|
|
7
|
-
import tech.nimbbl.webviewsdk.core.NimbblShopOrderCreation
|
|
8
7
|
import tech.nimbbl.webviewsdk.models.NimbblCheckoutOptions
|
|
9
8
|
import tech.nimbbl.webviewsdk.models.interfaces.NimbblCheckoutPaymentListener
|
|
10
9
|
import kotlinx.coroutines.*
|
|
11
|
-
import retrofit2.Response
|
|
12
|
-
import java.io.Serializable
|
|
13
10
|
import org.json.JSONObject
|
|
14
11
|
import org.json.JSONException
|
|
15
12
|
|
|
@@ -171,125 +168,6 @@ class NimbblReactNativeSDKModule(private val reactContext: ReactApplicationConte
|
|
|
171
168
|
}
|
|
172
169
|
}
|
|
173
170
|
|
|
174
|
-
@ReactMethod
|
|
175
|
-
fun createShopOrder(orderData: ReadableMap, promise: Promise) {
|
|
176
|
-
try {
|
|
177
|
-
if (!isInitialized) {
|
|
178
|
-
promise.reject("NOT_INITIALIZED", "SDK must be initialized before creating orders")
|
|
179
|
-
return
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Extract order data
|
|
183
|
-
val currency = orderData.getString("currency") ?: "INR"
|
|
184
|
-
val amountString = orderData.getString("amount") ?: "0"
|
|
185
|
-
val amount = amountString.toDoubleOrNull() ?: 0.0
|
|
186
|
-
val productId = orderData.getString("product_id") ?: "11"
|
|
187
|
-
val paymentMode = orderData.getString("payment_mode") ?: ""
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
// Validate required fields
|
|
191
|
-
if (amountString.isEmpty() || currency.isEmpty()) {
|
|
192
|
-
promise.reject("INVALID_ORDER_DATA", "Amount and currency are required")
|
|
193
|
-
return
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Handle user parameter - it might be undefined, null, or valid data from React Native
|
|
197
|
-
val userMap = orderData.getMap("user")
|
|
198
|
-
val user: Map<String, Any>? = if (userMap != null && !userMap.toHashMap().isEmpty()) {
|
|
199
|
-
userMap.toHashMap()
|
|
200
|
-
} else {
|
|
201
|
-
null
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Use the actual Nimbbl Android SDK to create order
|
|
205
|
-
// Set environment URL if provided
|
|
206
|
-
val apiBaseUrl = config["api_base_url"] as? String
|
|
207
|
-
if (!apiBaseUrl.isNullOrEmpty()) {
|
|
208
|
-
NimbblCheckoutSDK.getInstance().setEnvironmentUrl(apiBaseUrl)
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Extract user details for order creation
|
|
212
|
-
val userEmail = user?.get("email") as? String ?: ""
|
|
213
|
-
val userName = user?.get("name") as? String ?: ""
|
|
214
|
-
val userMobile = user?.get("mobile_number") as? String ?: ""
|
|
215
|
-
|
|
216
|
-
// Try to use the actual Android SDK for order creation
|
|
217
|
-
try {
|
|
218
|
-
// Get the API base URL from config
|
|
219
|
-
val orderApiBaseUrl = config["api_base_url"] as? String ?: "https://api.nimbbl.tech/"
|
|
220
|
-
|
|
221
|
-
// Use direct method call with coroutine (since createOrder is a suspend function)
|
|
222
|
-
// Convert amount string to int
|
|
223
|
-
val amountInt = amountString.toIntOrNull() ?: 0
|
|
224
|
-
|
|
225
|
-
// Use coroutine to call suspend function
|
|
226
|
-
val orderResult = runBlocking {
|
|
227
|
-
NimbblShopOrderCreation.createShopOrder(
|
|
228
|
-
orderApiBaseUrl,
|
|
229
|
-
amountInt, // Use amount as int
|
|
230
|
-
userEmail,
|
|
231
|
-
userName,
|
|
232
|
-
userMobile,
|
|
233
|
-
productId,
|
|
234
|
-
paymentMode, // Use paymentMode as paymentModeCode
|
|
235
|
-
"" // bankCode (empty for now)
|
|
236
|
-
)
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// The result should be a Response object
|
|
240
|
-
if (orderResult != null) {
|
|
241
|
-
// Check if the response is successful
|
|
242
|
-
if (orderResult.isSuccessful) {
|
|
243
|
-
// Get the response body
|
|
244
|
-
val responseBody = orderResult.body()
|
|
245
|
-
|
|
246
|
-
if (responseBody != null) {
|
|
247
|
-
// Extract token from response body
|
|
248
|
-
val token = responseBody.token
|
|
249
|
-
val orderId = responseBody.orderId
|
|
250
|
-
|
|
251
|
-
if (!token.isNullOrEmpty()) {
|
|
252
|
-
val result = Arguments.createMap().apply {
|
|
253
|
-
putString("order_id", orderId)
|
|
254
|
-
putString("token", token)
|
|
255
|
-
putString("status", "created")
|
|
256
|
-
putDouble("amount", amount)
|
|
257
|
-
putString("currency", currency)
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
promise.resolve(result)
|
|
261
|
-
return
|
|
262
|
-
} else {
|
|
263
|
-
promise.reject("INVALID_RESPONSE", "Token is null or empty in response")
|
|
264
|
-
return
|
|
265
|
-
}
|
|
266
|
-
} else {
|
|
267
|
-
promise.reject("INVALID_RESPONSE", "Response body is null")
|
|
268
|
-
return
|
|
269
|
-
}
|
|
270
|
-
} else {
|
|
271
|
-
// Get error body for logging
|
|
272
|
-
val errorBody = orderResult.errorBody()
|
|
273
|
-
promise.reject("ORDER_CREATION_FAILED", "Order creation failed: $errorBody")
|
|
274
|
-
return
|
|
275
|
-
}
|
|
276
|
-
} else {
|
|
277
|
-
promise.reject("ORDER_CREATION_FAILED", "Order creation result is null")
|
|
278
|
-
return
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
} catch (e: Exception) {
|
|
282
|
-
promise.reject("ORDER_CREATION_FAILED", "Android SDK order creation failed: ${e.message}")
|
|
283
|
-
return
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
} catch (e: Exception) {
|
|
287
|
-
promise.reject("ORDER_CREATION_FAILED", e.message)
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
171
|
@ReactMethod
|
|
294
172
|
fun checkout(options: ReadableMap, promise: Promise) {
|
|
295
173
|
try {
|
|
@@ -71,69 +71,6 @@ class NimbblReactNativeSDK: RCTEventEmitter, NimbblCheckoutSDKDelegate {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
@objc
|
|
75
|
-
func createShopOrder(_ orderData: [String: Any], resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
76
|
-
do {
|
|
77
|
-
guard isInitialized else {
|
|
78
|
-
reject("NOT_INITIALIZED", "SDK must be initialized before creating orders", nil)
|
|
79
|
-
return
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// Validate required fields
|
|
84
|
-
guard let amount = orderData["amount"] as? String,
|
|
85
|
-
let currency = orderData["currency"] as? String else {
|
|
86
|
-
reject("INVALID_ORDER_DATA", "Amount and currency are required", nil)
|
|
87
|
-
return
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Extract order data
|
|
91
|
-
let productId = orderData["product_id"] as? String ?? "11"
|
|
92
|
-
let orderLineItems = orderData["orderLineItems"] as? Bool ?? true
|
|
93
|
-
let checkoutExperience = orderData["checkout_experience"] as? String ?? "redirect"
|
|
94
|
-
let paymentMode = orderData["payment_mode"] as? String ?? ""
|
|
95
|
-
let subPaymentMode = orderData["subPaymentMode"] as? String ?? ""
|
|
96
|
-
|
|
97
|
-
// Handle user parameter - it might be undefined, empty object, or valid data from React Native
|
|
98
|
-
var user: [String: Any]? = nil
|
|
99
|
-
if let userData = orderData["user"] {
|
|
100
|
-
if userData is NSNull {
|
|
101
|
-
// user is null/undefined, pass nil to native SDK
|
|
102
|
-
user = nil
|
|
103
|
-
} else if let userDict = userData as? [String: Any] {
|
|
104
|
-
// Check if it's an empty object
|
|
105
|
-
if userDict.isEmpty {
|
|
106
|
-
user = nil // Empty object, pass nil to native SDK
|
|
107
|
-
} else {
|
|
108
|
-
user = userDict // Valid user data
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Create order using Nimbbl WebView SDK with correct parameter order
|
|
114
|
-
NimbblCheckoutSDK.shared.createShopOrder(
|
|
115
|
-
currency: currency,
|
|
116
|
-
amount: amount,
|
|
117
|
-
productId: productId,
|
|
118
|
-
orderLineItems: orderLineItems,
|
|
119
|
-
checkoutExperience: checkoutExperience,
|
|
120
|
-
paymentMode: paymentMode,
|
|
121
|
-
subPaymentMode: subPaymentMode,
|
|
122
|
-
user: user
|
|
123
|
-
) { result in
|
|
124
|
-
switch result {
|
|
125
|
-
case .success(let orderResult):
|
|
126
|
-
resolve(orderResult)
|
|
127
|
-
case .failure(let error):
|
|
128
|
-
reject("ORDER_CREATION_FAILED", error.localizedDescription, error)
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
} catch {
|
|
133
|
-
reject("ORDER_CREATION_FAILED", error.localizedDescription, error)
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
74
|
@objc
|
|
138
75
|
func checkout(_ options: [String: Any], resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) {
|
|
139
76
|
do {
|
package/lib/NimbblSDK.d.ts
CHANGED
|
@@ -29,23 +29,6 @@ export default class NimbblSDK {
|
|
|
29
29
|
success: boolean;
|
|
30
30
|
message: string;
|
|
31
31
|
}>;
|
|
32
|
-
/**
|
|
33
|
-
* Create shop order (matching iOS SDK pattern)
|
|
34
|
-
* @param currency - Currency code
|
|
35
|
-
* @param amount - Order amount
|
|
36
|
-
* @param productId - Product ID for header customization
|
|
37
|
-
* @param orderLineItems - Whether to enable order line items
|
|
38
|
-
* @param checkoutExperience - Checkout experience type
|
|
39
|
-
* @param paymentMode - Payment mode code
|
|
40
|
-
* @param subPaymentMode - Sub payment mode code
|
|
41
|
-
* @param user - User details object
|
|
42
|
-
* @returns Promise resolving to order response
|
|
43
|
-
*/
|
|
44
|
-
createShopOrder(currency: string, amount: string, productId: string, orderLineItems: boolean, checkoutExperience: string, paymentMode: string, subPaymentMode: string, user?: Record<string, any>): Promise<{
|
|
45
|
-
success: boolean;
|
|
46
|
-
data?: any;
|
|
47
|
-
error?: any;
|
|
48
|
-
}>;
|
|
49
32
|
/**
|
|
50
33
|
* Checkout with options (matching iOS SDK pattern)
|
|
51
34
|
* @param options - Checkout options
|
package/lib/NimbblSDK.js
CHANGED
|
@@ -53,41 +53,6 @@ class NimbblSDK {
|
|
|
53
53
|
}
|
|
54
54
|
return result;
|
|
55
55
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Create shop order (matching iOS SDK pattern)
|
|
58
|
-
* @param currency - Currency code
|
|
59
|
-
* @param amount - Order amount
|
|
60
|
-
* @param productId - Product ID for header customization
|
|
61
|
-
* @param orderLineItems - Whether to enable order line items
|
|
62
|
-
* @param checkoutExperience - Checkout experience type
|
|
63
|
-
* @param paymentMode - Payment mode code
|
|
64
|
-
* @param subPaymentMode - Sub payment mode code
|
|
65
|
-
* @param user - User details object
|
|
66
|
-
* @returns Promise resolving to order response
|
|
67
|
-
*/
|
|
68
|
-
async createShopOrder(currency, amount, productId, orderLineItems, checkoutExperience, paymentMode, subPaymentMode, user) {
|
|
69
|
-
if (!this.isInitialized) {
|
|
70
|
-
throw new Error(constants_1.ERROR_MESSAGES[constants_1.ERROR_CODES.SDK_NOT_INITIALIZED]);
|
|
71
|
-
}
|
|
72
|
-
try {
|
|
73
|
-
// Build order data matching iOS sample app exactly
|
|
74
|
-
const orderData = {
|
|
75
|
-
currency,
|
|
76
|
-
amount, // Keep as string to match iOS
|
|
77
|
-
product_id: productId,
|
|
78
|
-
orderLineItems,
|
|
79
|
-
checkout_experience: checkoutExperience,
|
|
80
|
-
payment_mode: paymentMode,
|
|
81
|
-
subPaymentMode,
|
|
82
|
-
user: user || {}, // Always include user, empty object if not provided
|
|
83
|
-
};
|
|
84
|
-
const response = await NimbblReactNativeSDK.createShopOrder(orderData);
|
|
85
|
-
return { success: true, data: response };
|
|
86
|
-
}
|
|
87
|
-
catch (error) {
|
|
88
|
-
return { success: false, error };
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
56
|
/**
|
|
92
57
|
* Checkout with options (matching iOS SDK pattern)
|
|
93
58
|
* @param options - Checkout options
|
|
@@ -104,6 +69,10 @@ class NimbblSDK {
|
|
|
104
69
|
bank_code: options.bankCode || '',
|
|
105
70
|
wallet_code: options.walletCode || '',
|
|
106
71
|
payment_flow: options.paymentFlow || '',
|
|
72
|
+
checkout_experience: options.checkoutExperience || 'redirect',
|
|
73
|
+
upi_id: options.upiId || '',
|
|
74
|
+
upi_app_code: options.upiAppCode || '',
|
|
75
|
+
emi_code: options.emiCode || '',
|
|
107
76
|
};
|
|
108
77
|
// Use callback-based approach - SDK will always return a response
|
|
109
78
|
return new Promise((resolve) => {
|
package/lib/types.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export interface SDKConfig {
|
|
|
17
17
|
*/
|
|
18
18
|
export interface NimbblReactNativeSDKInterface {
|
|
19
19
|
initialize(config: any): Promise<any>;
|
|
20
|
-
createShopOrder(options: any): Promise<any>;
|
|
21
20
|
checkout(options: any): Promise<any>;
|
|
22
21
|
setCheckoutCallback(callback: (result: any) => void): void;
|
|
23
22
|
addListener(eventName: string): void;
|
|
@@ -32,5 +31,13 @@ export interface CheckoutOptions {
|
|
|
32
31
|
bankCode?: string;
|
|
33
32
|
walletCode?: string;
|
|
34
33
|
paymentFlow?: string;
|
|
34
|
+
/** Checkout experience type: 'pop_up' or 'redirect' */
|
|
35
|
+
checkoutExperience?: string;
|
|
36
|
+
/** UPI collect flow VPA */
|
|
37
|
+
upiId?: string;
|
|
38
|
+
/** UPI intent app code (e.g. 'phonepe', 'gpay') */
|
|
39
|
+
upiAppCode?: string;
|
|
40
|
+
/** EMI type (e.g. 'debit', 'credit', 'cardless') */
|
|
41
|
+
emiCode?: string;
|
|
35
42
|
}
|
|
36
43
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -23,5 +23,6 @@ Pod::Spec.new do |s|
|
|
|
23
23
|
s.swift_version = "5.0"
|
|
24
24
|
|
|
25
25
|
# Nimbbl iOS SDK dependency
|
|
26
|
-
|
|
26
|
+
# Align with Flutter WebView SDK, which currently uses 2.0.17 snapshot
|
|
27
|
+
s.dependency "nimbbl_mobile_kit_ios_webview_sdk", "2.0.17"
|
|
27
28
|
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nimbbl-mobile-react-native-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.3",
|
|
4
4
|
"description": "Nimbbl React Native SDK for payment integration",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
],
|
|
42
42
|
"author": "Nimbbl Tech",
|
|
43
43
|
"license": "MIT",
|
|
44
|
-
"homepage": "https://
|
|
44
|
+
"homepage": "https://github.com/nimbbl-tech/nimbbl_mobile_kit_react_native_sdk",
|
|
45
45
|
"repository": {
|
|
46
46
|
"type": "git",
|
|
47
|
-
"url": "https://
|
|
47
|
+
"url": "https://github.com/nimbbl-tech/nimbbl_mobile_kit_react_native_sdk.git"
|
|
48
48
|
},
|
|
49
49
|
"bugs": {
|
|
50
|
-
"url": "https://
|
|
50
|
+
"url": "https://github.com/nimbbl-tech/nimbbl_mobile_kit_react_native_sdk/issues"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
require 'json'
|
|
2
|
-
|
|
3
|
-
package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
|
|
4
|
-
|
|
5
|
-
Pod::Spec.new do |s|
|
|
6
|
-
s.name = 'NimbblReactNativeSDK'
|
|
7
|
-
s.version = package['version']
|
|
8
|
-
s.summary = package['description']
|
|
9
|
-
s.homepage = package['homepage']
|
|
10
|
-
s.license = package['license']
|
|
11
|
-
s.author = package['author']
|
|
12
|
-
s.platform = :ios, "13.0"
|
|
13
|
-
s.source = { :git => "https://github.com/nimbbl-tech/nimbbl_mobile_kit_react_native_sdk.git", :tag => "#{s.version}" }
|
|
14
|
-
s.source_files = "*.{h,m,swift}"
|
|
15
|
-
s.swift_version = '5.0'
|
|
16
|
-
s.requires_arc = true
|
|
17
|
-
|
|
18
|
-
s.dependency "React-Core"
|
|
19
|
-
|
|
20
|
-
# Nimbbl WebView SDK dependency (includes all necessary dependencies)
|
|
21
|
-
s.dependency "nimbbl_mobile_kit_ios_webview_sdk", "~> 2.0.4"
|
|
22
|
-
|
|
23
|
-
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
24
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
25
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
26
|
-
s.pod_target_xcconfig = {
|
|
27
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
28
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
29
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
30
|
-
}
|
|
31
|
-
s.dependency "React-RCTFabric"
|
|
32
|
-
s.dependency "React-Codegen"
|
|
33
|
-
s.dependency "RCT-Folly"
|
|
34
|
-
s.dependency "RCTRequired"
|
|
35
|
-
s.dependency "RCTTypeSafety"
|
|
36
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
37
|
-
end
|
|
38
|
-
end
|