@jimrising/easymerchantsdk-react-native 2.0.4 → 2.0.6

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.
Files changed (51) hide show
  1. package/README.md +1003 -406
  2. package/android/.gradle/8.10/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.10/dependencies-accessors/gc.properties +0 -0
  4. package/android/.gradle/8.10/fileChanges/last-build.bin +0 -0
  5. package/android/.gradle/8.10/fileHashes/fileHashes.bin +0 -0
  6. package/android/.gradle/8.10/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/8.10/gc.properties +0 -0
  8. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  9. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  10. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  11. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  12. package/android/.gradle/8.9/gc.properties +0 -0
  13. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  14. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  15. package/android/.gradle/nb-cache/trust/0B5D6BE682AD6AEE9815EC13516BF075752CAE5AD5BECDCC00315C37622C2FD3 +1 -0
  16. package/android/.gradle/vcs-1/gc.properties +0 -0
  17. package/android/build/.transforms/664c2535aec304a21f4de38c6fe405c3/results.bin +1 -0
  18. package/android/build/.transforms/664c2535aec304a21f4de38c6fe405c3/transformed/classes/classes_dex/classes.dex +0 -0
  19. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/results.bin +1 -0
  20. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
  21. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
  22. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  23. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
  24. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  25. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
  26. package/android/build/.transforms/8b9a31b6d3889f12f1bd8cedf6c6f513/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  27. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  28. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  29. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +1 -1
  30. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  31. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  32. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  33. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  34. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  35. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  36. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  37. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  38. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  39. package/android/build/outputs/logs/manifest-merger-debug-report.txt +10 -10
  40. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  41. package/android/build.gradle +1 -1
  42. package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +9 -0
  43. package/ios/Classes/EasyMerchantSdk.m +2 -0
  44. package/ios/Classes/EasyMerchantSdk.swift +3 -1
  45. package/ios/Models/Request.swift +50 -3
  46. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +74 -6
  47. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +92 -20
  48. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +28 -2
  49. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +73 -564
  50. package/ios/easymerchantsdk.podspec +1 -1
  51. package/package.json +1 -1
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ #Fri Aug 08 13:51:00 IST 2025
2
+ gradle.version=8.9
@@ -0,0 +1 @@
1
+ D9E91BE6371785C74509B60BC851F8287ED60F90F351A013DCA85C8F42CA7665
File without changes
@@ -0,0 +1 @@
1
+ o/bundleLibRuntimeToDirDebug
@@ -1 +1 @@
1
- #Thu Jul 24 11:21:35 IST 2025
1
+ #Thu Aug 07 12:33:01 IST 2025
@@ -1,2 +1,2 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated" generated-set="generated$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/build/generated/res/resValues/debug"/></dataSet><mergedItems/></merger>
2
+ <merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/debug/res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/build/generated/res/resValues/debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="generated" generated-set="generated$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="/Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/build/generated/res/resValues/debug"/></dataSet><mergedItems/></merger>
@@ -1,17 +1,17 @@
1
1
  -- Merging decision tree log ---
2
2
  manifest
3
- ADDED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:1-4:12
4
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:1-4:12
3
+ ADDED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:1-4:12
4
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:1-4:12
5
5
  package
6
- ADDED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:3:11-37
7
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
6
+ ADDED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:3:11-37
7
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
8
8
  xmlns:android
9
- ADDED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:11-69
9
+ ADDED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml:2:11-69
10
10
  uses-sdk
11
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
12
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
13
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
11
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml reason: use-sdk injection requested
12
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
13
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
14
14
  android:targetSdkVersion
15
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
15
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
16
16
  android:minSdkVersion
17
- INJECTED from /Users/appdev/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
17
+ INJECTED from /Users/mony.dhingra/Documents/SampleApp/node_modules/@jimrising/easymerchantsdk-react-native/android/src/main/AndroidManifest.xml
@@ -39,7 +39,7 @@ repositories {
39
39
  }
40
40
 
41
41
  dependencies {
42
- implementation 'com.app:paysdk:1.4.9'
42
+ implementation 'com.app:paysdk:1.5.0'
43
43
  implementation 'com.hbb20:ccp:2.7.3'
44
44
  implementation 'com.github.bumptech.glide:glide:4.16.0'
45
45
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1"
@@ -106,6 +106,15 @@ public class RNEasymerchantsdkModule extends ReactContextBaseJavaModule {
106
106
  jsonConfigMap.hasKey("name") ? jsonConfigMap.getString("name") : ""
107
107
  );
108
108
 
109
+ if (jsonConfigMap.hasKey("metadata")) {
110
+ ReadableMap metadataMap = jsonConfigMap.getMap("metadata");
111
+ JSONObject metadata = new JSONObject();
112
+ for (Map.Entry<String, Object> entry : metadataMap.toHashMap().entrySet()) {
113
+ metadata.put(entry.getKey(), entry.getValue());
114
+ }
115
+ jsonConfig.put("metadata", metadata);
116
+ }
117
+
109
118
 
110
119
  JSONArray paymentMethods = new JSONArray();
111
120
  ReadableArray methods = jsonConfigMap.getArray("paymentMethod");
@@ -52,6 +52,7 @@ RCT_EXPORT_METHOD(
52
52
  isEmail:(BOOL)isEmail
53
53
  email:(NSString *)email
54
54
  name:(NSString *)name
55
+ metadata:(NSDictionary *)metadata
55
56
  resolver:(RCTPromiseResolveBlock)resolve
56
57
  rejecter:(RCTPromiseRejectBlock)reject
57
58
  )
@@ -84,6 +85,7 @@ RCT_EXPORT_METHOD(
84
85
  email:email
85
86
  name:name
86
87
  enable3DS:secureAuthentication
88
+ metadata:metadata
87
89
  resolver:^(id result) {
88
90
  resolve(result);
89
91
  self.sdkPluginInstance = nil;
@@ -80,6 +80,7 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
80
80
  email: String?,
81
81
  name: String?,
82
82
  enable3DS: Bool,
83
+ metadata: [String: Any]?,
83
84
  resolver: @escaping RCTPromiseResolveBlock,
84
85
  rejecter: @escaping RCTPromiseRejectBlock
85
86
  ) {
@@ -230,7 +231,8 @@ public class EasyMerchantSdkPlugin: NSObject, RCTBridgeModule {
230
231
  referenceToken: nil,
231
232
  isEmail : isEmail,
232
233
  email:email,
233
- name: name
234
+ name: name,
235
+ metadata: metadata
234
236
  )
235
237
 
236
238
  // Store resolvers
@@ -171,6 +171,8 @@ public final class Request: NSObject {
171
171
  public let isEmail: Bool?
172
172
  public let email: String?
173
173
  public let name: String?
174
+
175
+ public var metadata: [String: Any]?
174
176
 
175
177
  public init(
176
178
  amount: Double? = nil,
@@ -197,7 +199,9 @@ public final class Request: NSObject {
197
199
  referenceToken: String? = nil,
198
200
  isEmail: Bool = false,
199
201
  email: String? = nil,
200
- name: String? = nil
202
+ name: String? = nil,
203
+
204
+ metadata: [String: Any]? = nil
201
205
  ) {
202
206
  // Validate if amount is provided, must be ≥ 0.50
203
207
  if let amt = amount, amt < 0.50 {
@@ -244,6 +248,8 @@ public final class Request: NSObject {
244
248
  self.email = email
245
249
  self.name = name
246
250
 
251
+ self.metadata = metadata
252
+
247
253
  // Conditionally assign recurring fields only if is_recurring == true
248
254
  if is_recurring {
249
255
  self.is_recurring = true
@@ -284,7 +290,30 @@ public final class Request: NSObject {
284
290
 
285
291
  super.init()
286
292
 
287
- // Validate recurring intervals
293
+ // Validate metadata limits
294
+ if let metadata = metadata {
295
+ if metadata.count > 50 {
296
+ Request.showErrorAndDismissForMetaData(message: "Metadata must contain no more than 50 keys.")
297
+ return
298
+ }
299
+
300
+ for (key, value) in metadata {
301
+ if key.count > 40 {
302
+ Request.showErrorAndDismissForMetaData(message: "Metadata key '\(key)' exceeds 40 characters.")
303
+ return
304
+ }
305
+ if let stringValue = value as? String, stringValue.count > 500 {
306
+ Request.showErrorAndDismissForMetaData(message: "Value for key '\(key)' exceeds 500 characters.")
307
+ return
308
+ }
309
+ }
310
+
311
+ self.metadata = metadata
312
+ } else {
313
+ self.metadata = nil
314
+ }
315
+
316
+ // Validate recurring intervals
288
317
  if is_recurring == true {
289
318
  let intervals = recurringIntervals ?? []
290
319
 
@@ -453,7 +482,25 @@ public final class Request: NSObject {
453
482
  task.resume()
454
483
  }
455
484
 
456
- private func showErrorAndDismiss(message: String) {
485
+ private static func showErrorAndDismissForMetaData(message: String) {
486
+ DispatchQueue.main.async {
487
+ if let topVC = UIApplication.topViewController() {
488
+ let alert = UIAlertController(title: "Payment Error",
489
+ message: message,
490
+ preferredStyle: .alert)
491
+ alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { _ in
492
+ if let easyPayVC = UIApplication.findEasyPayViewController(from: topVC) {
493
+ easyPayVC.dismiss(animated: true)
494
+ } else {
495
+ topVC.dismiss(animated: true)
496
+ }
497
+ }))
498
+ topVC.present(alert, animated: true)
499
+ }
500
+ }
501
+ }
502
+
503
+ private func showErrorAndDismiss(message: String) {
457
504
  DispatchQueue.main.async {
458
505
  if let topVC = UIApplication.topViewController() {
459
506
  let alert = UIAlertController(title: "Payment Error",
@@ -371,11 +371,32 @@ class AdditionalInfoVC: BaseVC {
371
371
  }
372
372
  else {
373
373
  // Direct Payment Flow
374
+ // if selectedPaymentMethod == "Card" {
375
+ // if isFrom == "SavedCards" {
376
+ // paymentIntentFromShowCardApi()
377
+ // }
378
+ // if isSavedNewCard {
379
+ // if isFrom == "AddNewCard" {
380
+ // if request.secureAuthentication == true {
381
+ // threeDSecurePaymentAddNewCardApi(customerId: UserStoreSingleton.shared.customerId)
382
+ // } else {
383
+ // paymentIntentAddNewCardApi(customerId: UserStoreSingleton.shared.customerId)
384
+ // }
385
+ // }
386
+ // }
387
+ // else {
388
+ // if request.secureAuthentication == true {
389
+ // threeDSecurePaymentApi()
390
+ // } else {
391
+ // paymentIntentApi()
392
+ // }
393
+ // }
394
+ // }
374
395
  if selectedPaymentMethod == "Card" {
375
396
  if isFrom == "SavedCards" {
376
397
  paymentIntentFromShowCardApi()
377
398
  }
378
- if isSavedNewCard {
399
+ else if isSavedNewCard {
379
400
  if isFrom == "AddNewCard" {
380
401
  if request.secureAuthentication == true {
381
402
  threeDSecurePaymentAddNewCardApi(customerId: UserStoreSingleton.shared.customerId)
@@ -505,6 +526,18 @@ class AdditionalInfoVC: BaseVC {
505
526
  params["interval"] = chosenPlan?.lowercased()
506
527
  }
507
528
 
529
+ // // ✅ Include metadata only if it has at least 1 key-value pair
530
+ // if let metadata = request?.metadata, !metadata.isEmpty {
531
+ // requestBody["metadata"] = metadata
532
+ // }
533
+
534
+ // ✅ Flatten metadata into requestBody
535
+ if let metadata = request?.metadata, !metadata.isEmpty {
536
+ for (key, value) in metadata {
537
+ params[key] = value
538
+ }
539
+ }
540
+
508
541
  print(params)
509
542
 
510
543
  do {
@@ -608,6 +641,10 @@ class AdditionalInfoVC: BaseVC {
608
641
 
609
642
  //MARK: - Credit Card Charge Api from Saved cards
610
643
  func paymentIntentFromShowCardApi() {
644
+
645
+ print(">>> paymentIntentFromShowCardApi() called")
646
+ Thread.callStackSymbols.forEach { print($0) }
647
+
611
648
  showLoadingIndicator()
612
649
 
613
650
  let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.charges.path()
@@ -638,8 +675,8 @@ class AdditionalInfoVC: BaseVC {
638
675
  "customer_id" : selectedCard?.customerId ?? "",
639
676
  "card_id" : selectedCard?.cardId ?? "",
640
677
  "cvc" : cvvText ?? "",
641
- "name": UserStoreSingleton.shared.merchantName ?? "",
642
- "email": UserStoreSingleton.shared.verificationEmail ?? ""
678
+ "name": nameOnCard ?? "",
679
+ "email": userEmail ?? "",
643
680
  ]
644
681
 
645
682
  // Conditionally add billing info
@@ -716,6 +753,18 @@ class AdditionalInfoVC: BaseVC {
716
753
  params["interval"] = chosenPlan?.lowercased()
717
754
  }
718
755
 
756
+ // // ✅ Include metadata only if it has at least 1 key-value pair
757
+ // if let metadata = request?.metadata, !metadata.isEmpty {
758
+ // requestBody["metadata"] = metadata
759
+ // }
760
+
761
+ // ✅ Flatten metadata into requestBody
762
+ if let metadata = request?.metadata, !metadata.isEmpty {
763
+ for (key, value) in metadata {
764
+ params[key] = value
765
+ }
766
+ }
767
+
719
768
  print(params)
720
769
 
721
770
  do {
@@ -913,6 +962,18 @@ class AdditionalInfoVC: BaseVC {
913
962
  params["email"] = UserStoreSingleton.shared.verificationEmail
914
963
  }
915
964
 
965
+ // // ✅ Include metadata only if it has at least 1 key-value pair
966
+ // if let metadata = request?.metadata, !metadata.isEmpty {
967
+ // requestBody["metadata"] = metadata
968
+ // }
969
+
970
+ // ✅ Flatten metadata into requestBody
971
+ if let metadata = request?.metadata, !metadata.isEmpty {
972
+ for (key, value) in metadata {
973
+ params[key] = value
974
+ }
975
+ }
976
+
916
977
  print(params)
917
978
 
918
979
  do {
@@ -1015,6 +1076,10 @@ class AdditionalInfoVC: BaseVC {
1015
1076
 
1016
1077
  //MARK: - Banking Account Charge Api
1017
1078
  func accountChargeApi() {
1079
+
1080
+ print(">>> accountChargeApi() called")
1081
+ Thread.callStackSymbols.forEach { print($0) }
1082
+
1018
1083
  showLoadingIndicator()
1019
1084
 
1020
1085
  let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.achCharge.path()
@@ -1037,7 +1102,8 @@ class AdditionalInfoVC: BaseVC {
1037
1102
  let localPhone = txtFieldPhoneNumber.text?.components(separatedBy: CharacterSet.decimalDigits.inverted).joined() ?? ""
1038
1103
 
1039
1104
  var params: [String: Any] = [
1040
- "name": accountName ?? "",
1105
+ // "name": accountName ?? "",
1106
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (accountName ?? ""),
1041
1107
  "email": userEmail ?? "",
1042
1108
  "description": txtFieldDescription.text ?? "",
1043
1109
  "currency": "usd",
@@ -1221,7 +1287,8 @@ class AdditionalInfoVC: BaseVC {
1221
1287
  let localPhone = txtFieldPhoneNumber.text?.components(separatedBy: CharacterSet.decimalDigits.inverted).joined() ?? ""
1222
1288
 
1223
1289
  var params: [String: Any] = [
1224
- "name": UserStoreSingleton.shared.merchantName ?? "",
1290
+ // "name": UserStoreSingleton.shared.merchantName ?? "",
1291
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (UserStoreSingleton.shared.merchantName ?? ""),
1225
1292
  "account_id": accountID ?? "",
1226
1293
  "payment_method": "ach",
1227
1294
  "customer": customerID ?? "",
@@ -1403,7 +1470,8 @@ class AdditionalInfoVC: BaseVC {
1403
1470
  let emailPrefix = UserStoreSingleton.shared.verificationEmail?.components(separatedBy: "@").first ?? ""
1404
1471
 
1405
1472
  var params: [String: Any] = [
1406
- "name": accountName ?? "",
1473
+ // "name": accountName ?? "",
1474
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (accountName ?? ""),
1407
1475
  "email": userEmail ?? "",
1408
1476
  "currency": "usd",
1409
1477
  "account_type": accountType?.lowercased() ?? "",
@@ -113,6 +113,8 @@ class BillingInfoVC: BaseVC {
113
113
  var filteredStateList: [[String: Any]] = [] // For search results
114
114
  var isSearchingState = false // Track if user is searching
115
115
 
116
+ private var didApplyInitialCountry = false
117
+
116
118
  override func viewDidLoad() {
117
119
  super.viewDidLoad()
118
120
  updateNextButtonTitle()
@@ -209,6 +211,15 @@ class BillingInfoVC: BaseVC {
209
211
  configureFieldVisibility()
210
212
  }
211
213
 
214
+ override func viewDidAppear(_ animated: Bool) {
215
+ super.viewDidAppear(animated)
216
+
217
+ if !didApplyInitialCountry {
218
+ didApplyInitialCountry = true
219
+ handleCountrySelection(countryName: txtFieldCountry.text ?? "")
220
+ }
221
+ }
222
+
212
223
  override func viewWillDisappear(_ animated: Bool) {
213
224
  super.viewWillDisappear(animated)
214
225
  keyboardObserver.invalidate()
@@ -625,6 +636,32 @@ class BillingInfoVC: BaseVC {
625
636
  task.resume()
626
637
  }
627
638
 
639
+ func handleCountrySelection(countryName: String) {
640
+ var normalizedCountry = countryName
641
+ let lowercased = countryName.lowercased()
642
+
643
+ // Normalize common aliases
644
+ if lowercased == "usa" {
645
+ normalizedCountry = "United States"
646
+ }
647
+
648
+ if lowercased == "us" {
649
+ normalizedCountry = "United States"
650
+ }
651
+
652
+ // Show/hide state dropdown
653
+ if lowercased == "united states" || lowercased == "usa" || lowercased == "canada" {
654
+ btnSelectState.isHidden = false
655
+ txtFieldState.placeholder = "Select State"
656
+ } else {
657
+ btnSelectState.isHidden = true
658
+ txtFieldState.placeholder = "State"
659
+ }
660
+
661
+ // Fetch states using normalized country name
662
+ getStateListApi(for: normalizedCountry)
663
+ }
664
+
628
665
  func updateBillingInfoData() {
629
666
  setFieldValue("address", to: txtFieldAddress.text)
630
667
  setFieldValue("country", to: txtFieldCountry.text)
@@ -1008,6 +1045,18 @@ class BillingInfoVC: BaseVC {
1008
1045
  params["interval"] = chosenPlan?.lowercased()
1009
1046
  }
1010
1047
 
1048
+ // // ✅ Include metadata only if it has at least 1 key-value pair
1049
+ // if let metadata = request?.metadata, !metadata.isEmpty {
1050
+ // requestBody["metadata"] = metadata
1051
+ // }
1052
+
1053
+ // ✅ Flatten metadata into requestBody
1054
+ if let metadata = request?.metadata, !metadata.isEmpty {
1055
+ for (key, value) in metadata {
1056
+ params[key] = value
1057
+ }
1058
+ }
1059
+
1011
1060
  print(params)
1012
1061
 
1013
1062
  do {
@@ -1560,6 +1609,18 @@ class BillingInfoVC: BaseVC {
1560
1609
  params["email"] = UserStoreSingleton.shared.verificationEmail
1561
1610
  }
1562
1611
 
1612
+ // // ✅ Include metadata only if it has at least 1 key-value pair
1613
+ // if let metadata = request?.metadata, !metadata.isEmpty {
1614
+ // requestBody["metadata"] = metadata
1615
+ // }
1616
+
1617
+ // ✅ Flatten metadata into requestBody
1618
+ if let metadata = request?.metadata, !metadata.isEmpty {
1619
+ for (key, value) in metadata {
1620
+ params[key] = value
1621
+ }
1622
+ }
1623
+
1563
1624
  print(params)
1564
1625
 
1565
1626
  do {
@@ -1680,8 +1741,9 @@ class BillingInfoVC: BaseVC {
1680
1741
  "customer_id" : selectedCard?.customerId ?? "",
1681
1742
  "card_id" : selectedCard?.cardId ?? "",
1682
1743
  "cvc" : cvvText ?? "",
1683
- "name": UserStoreSingleton.shared.merchantName ?? "",
1684
- "email": UserStoreSingleton.shared.verificationEmail ?? ""
1744
+ // "name": UserStoreSingleton.shared.merchantName ?? "",
1745
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (UserStoreSingleton.shared.merchantName ?? ""),
1746
+ "email": UserStoreSingleton.shared.verificationEmail ?? "",
1685
1747
  ]
1686
1748
 
1687
1749
  // Conditionally add billing info
@@ -1743,6 +1805,18 @@ class BillingInfoVC: BaseVC {
1743
1805
  params["interval"] = chosenPlan?.lowercased()
1744
1806
  }
1745
1807
 
1808
+ // // ✅ Include metadata only if it has at least 1 key-value pair
1809
+ // if let metadata = request?.metadata, !metadata.isEmpty {
1810
+ // requestBody["metadata"] = metadata
1811
+ // }
1812
+
1813
+ // ✅ Flatten metadata into requestBody
1814
+ if let metadata = request?.metadata, !metadata.isEmpty {
1815
+ for (key, value) in metadata {
1816
+ params[key] = value
1817
+ }
1818
+ }
1819
+
1746
1820
  print(params)
1747
1821
 
1748
1822
  do {
@@ -1855,7 +1929,8 @@ class BillingInfoVC: BaseVC {
1855
1929
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
1856
1930
 
1857
1931
  var params: [String: Any] = [
1858
- "name": UserStoreSingleton.shared.merchantName ?? "",
1932
+ // "name": UserStoreSingleton.shared.merchantName ?? "",
1933
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (UserStoreSingleton.shared.merchantName ?? ""),
1859
1934
  "account_id": accountID ?? "",
1860
1935
  "payment_method": "ach",
1861
1936
  "customer": customerID ?? "",
@@ -2021,7 +2096,8 @@ class BillingInfoVC: BaseVC {
2021
2096
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
2022
2097
 
2023
2098
  var params: [String: Any] = [
2024
- "name": accountName ?? "",
2099
+ //"name": accountName ?? "",
2100
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (accountName ?? ""),
2025
2101
  "email": userEmail ?? "",
2026
2102
  "currency": "usd",
2027
2103
  "account_type": accountType?.lowercased() ?? "",
@@ -2192,7 +2268,8 @@ class BillingInfoVC: BaseVC {
2192
2268
  let emailPrefix = UserStoreSingleton.shared.verificationEmail?.components(separatedBy: "@").first ?? ""
2193
2269
 
2194
2270
  var params: [String: Any] = [
2195
- "name": accountName ?? "",
2271
+ // "name": accountName ?? "",
2272
+ "name": !(request.name?.isEmpty ?? true) ? request.name! : (accountName ?? ""),
2196
2273
  "email": userEmail ?? "",
2197
2274
  "currency": "usd",
2198
2275
  "account_type": accountType?.lowercased() ?? "",
@@ -2805,28 +2882,23 @@ extension BillingInfoVC: UITableViewDelegate, UITableViewDataSource {
2805
2882
  guard indexPath.row < currentList.count else { return }
2806
2883
 
2807
2884
  let selectedCountry = currentList[indexPath.row]["name"] as? String
2808
- // txtFieldCountry.text = selectedCountry
2809
- // viewCountryList.isHidden = true
2810
- //
2811
- // // Fetch states for the selected country
2812
- // if let country = selectedCountry {
2813
- // getStateListApi(for: country)
2814
- // }
2815
2885
 
2816
2886
  txtFieldCountry.text = selectedCountry
2817
2887
  viewCountryList.isHidden = true
2818
2888
 
2819
2889
  // Show/hide state dropdown and update placeholder
2820
2890
  if let country = selectedCountry {
2821
- if country.lowercased() == "united states" || country.lowercased() == "usa" || country.lowercased() == "canada" {
2822
- btnSelectState.isHidden = false
2823
- txtFieldState.placeholder = "Select State"
2824
- } else {
2825
- btnSelectState.isHidden = true
2826
- txtFieldState.placeholder = "State"
2827
- }
2891
+ // if country.lowercased() == "united states" || country.lowercased() == "usa" || country.lowercased() == "canada" {
2892
+ // btnSelectState.isHidden = false
2893
+ // txtFieldState.placeholder = "Select State"
2894
+ // } else {
2895
+ // btnSelectState.isHidden = true
2896
+ // txtFieldState.placeholder = "State"
2897
+ // }
2898
+ //
2899
+ // getStateListApi(for: country)
2828
2900
 
2829
- getStateListApi(for: country)
2901
+ handleCountrySelection(countryName: country)
2830
2902
  }
2831
2903
 
2832
2904