@jimrising/easymerchantsdk-react-native 2.0.7 → 2.0.9

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 (121) hide show
  1. package/README.md +129 -1806
  2. package/android/build/.transforms/15b6a8a60a6b32d0dcaf609723cf365b/transformed/classes/classes_dex/classes.dex +0 -0
  3. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
  4. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  5. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
  6. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  7. package/android/build/.transforms/eef2d06269ef2e204b4f065513034fca/transformed/classes/classes_dex/classes.dex +0 -0
  8. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
  9. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  10. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
  11. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  12. package/android/build/intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar +0 -0
  13. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  14. package/android/build/intermediates/compile_library_classes_jar/release/bundleLibCompileToJarRelease/classes.jar +0 -0
  15. package/android/build/intermediates/full_jar/release/createFullJarRelease/full.jar +0 -0
  16. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  17. package/android/build/intermediates/incremental/lintVitalAnalyzeRelease/release-artifact-dependencies.xml +4 -4
  18. package/android/build/intermediates/incremental/lintVitalAnalyzeRelease/release-artifact-libraries.xml +4 -4
  19. package/android/build/intermediates/incremental/release/mergeReleaseResources/compile-file-map.properties +838 -838
  20. package/android/build/intermediates/incremental/release/mergeReleaseResources/merger.xml +3 -3
  21. package/android/build/intermediates/incremental/release/packageReleaseResources/compile-file-map.properties +1 -1
  22. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  23. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  24. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  25. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  26. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  27. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  28. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  29. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  30. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/androidx/core/group-index.xml +4 -3
  31. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/androidx/lifecycle/group-index.xml +165 -165
  32. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/com/android/tools/build/group-index.xml +15 -15
  33. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/sdk_index/snapshot.gz +0 -0
  34. package/android/build/intermediates/lint_model/release/generateReleaseLintModel/release-artifact-dependencies.xml +4 -4
  35. package/android/build/intermediates/lint_model/release/generateReleaseLintModel/release-artifact-libraries.xml +4 -4
  36. package/android/build/intermediates/lint_vital_lint_model/release/generateReleaseLintVitalModel/release-artifact-dependencies.xml +4 -4
  37. package/android/build/intermediates/lint_vital_lint_model/release/generateReleaseLintVitalModel/release-artifact-libraries.xml +4 -4
  38. package/android/build/intermediates/local_aar_for_lint/release/out.aar +0 -0
  39. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_addition_ifo.xml +1 -0
  40. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_billing_info.xml +1 -0
  41. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_scan.xml +1 -0
  42. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_payment_done.xml +1 -0
  43. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_payment_done_url.xml +1 -0
  44. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_payment_error.xml +1 -0
  45. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_select_payment_method.xml +1 -0
  46. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_verify_email.xml +1 -0
  47. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/multi-v2/values-night-v8.json +19 -19
  48. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/multi-v2/values.json +38 -38
  49. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/anim-v21.json +9 -9
  50. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/anim.json +24 -24
  51. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/animator-v21.json +1 -1
  52. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/animator.json +34 -34
  53. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/color-night-v8.json +3 -3
  54. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/color-v31.json +10 -10
  55. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/color.json +153 -153
  56. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-hdpi-v4.json +1 -1
  57. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-mdpi-v4.json +1 -1
  58. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-v21.json +3 -3
  59. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-v23.json +7 -7
  60. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-xhdpi-v4.json +1 -1
  61. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-xxhdpi-v4.json +1 -1
  62. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable-xxxhdpi-v4.json +1 -1
  63. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable.json +391 -391
  64. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/font.json +9 -9
  65. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/interpolator-v21.json +10 -10
  66. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/interpolator.json +11 -11
  67. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout-land.json +3 -3
  68. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout-sw600dp-v13.json +2 -2
  69. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout-v26.json +1 -1
  70. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout.json +98 -98
  71. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-anydpi-v26.json +2 -2
  72. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-hdpi-v4.json +2 -2
  73. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-mdpi-v4.json +2 -2
  74. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xhdpi-v4.json +2 -2
  75. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xxhdpi-v4.json +2 -2
  76. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xxxhdpi-v4.json +2 -2
  77. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/raw.json +46 -46
  78. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/xml.json +3 -3
  79. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  80. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  81. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  82. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  83. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  84. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  85. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  86. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  87. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  88. package/android/build/intermediates/runtime_library_classes_jar/release/bundleLibRuntimeToJarRelease/classes.jar +0 -0
  89. package/android/build/intermediates/source_set_path_map/release/mapReleaseSourceSetPaths/file-map.txt +24 -24
  90. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_addition_ifo.xml.flat +0 -0
  91. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_billing_info.xml.flat +0 -0
  92. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_scan.xml.flat +0 -0
  93. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_payment_done.xml.flat +0 -0
  94. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_payment_done_url.xml.flat +0 -0
  95. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_payment_error.xml.flat +0 -0
  96. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_select_payment_method.xml.flat +0 -0
  97. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_verify_email.xml.flat +0 -0
  98. package/android/build/outputs/aar/jimrising_easymerchantsdk-react-native-release.aar +0 -0
  99. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1$1.class.uniqueId1 +0 -0
  100. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId0 +0 -0
  101. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId3 +0 -0
  102. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId2 +0 -0
  103. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId4 +0 -0
  104. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  105. package/android/build/tmp/compileReleaseJavaWithJavac/previous-compilation-data.bin +0 -0
  106. package/android/build.gradle +1 -1
  107. package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +93 -26
  108. package/ios/Classes/EasyMerchantSdk.m +4 -4
  109. package/ios/Classes/EasyMerchantSdk.swift +116 -60
  110. package/ios/Classes/EasyPayViewController.swift +3 -5
  111. package/ios/CustomComponents/CheckboxButton.swift +66 -0
  112. package/ios/Helper/GrailPayHelper.swift +1 -0
  113. package/ios/Models/Request.swift +8 -8
  114. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +233 -97
  115. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +376 -104
  116. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +28 -27
  117. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +22 -25
  118. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +575 -190
  119. package/ios/easymerchantsdk.podspec +1 -1
  120. package/ios/easymerchantsdk.storyboard +15 -15
  121. package/package.json +1 -1
@@ -148,8 +148,8 @@ public struct FieldSection: Codable {
148
148
  public final class Request: NSObject {
149
149
  public let amount: Double?
150
150
  public let currency: String?
151
- public let billingInfoData: Data?
152
- public let themeConfiguration: ThemeConfiguration?
151
+ public let fields: Data?
152
+ public let appearanceSettings: ThemeConfiguration?
153
153
  public let selectedPaymentMethods: [PaymentMethod]
154
154
  public let tokenOnly: Bool?
155
155
  public let saveCard: Bool?
@@ -177,9 +177,9 @@ public final class Request: NSObject {
177
177
  public init(
178
178
  amount: Double? = nil,
179
179
  currency: String? = nil,
180
- billingInfoData: Data? = nil,
180
+ fields: Data? = nil,
181
181
  paymentMethods: [PaymentMethod]? = nil,
182
- themeConfiguration: ThemeConfiguration? = nil,
182
+ appearanceSettings: ThemeConfiguration? = nil,
183
183
  tokenOnly: Bool = false,
184
184
  saveCard: Bool = false,
185
185
  saveAccount: Bool = false,
@@ -225,8 +225,8 @@ public final class Request: NSObject {
225
225
 
226
226
  self.amount = amount
227
227
  self.currency = currency
228
- self.billingInfoData = billingInfoData
229
- self.themeConfiguration = themeConfiguration
228
+ self.fields = fields
229
+ self.appearanceSettings = appearanceSettings
230
230
  self.tokenOnly = tokenOnly
231
231
  self.saveCard = saveCard
232
232
  self.saveAccount = saveAccount
@@ -273,7 +273,7 @@ public final class Request: NSObject {
273
273
  self.selectedPaymentMethods = savedMethods.compactMap { PaymentMethod(rawValue: $0) }
274
274
  }
275
275
  // ✅ Save theme configuration in UserStoreSingleton only if themeConfiguration is not nil or empty
276
- if let themeConfig = themeConfiguration {
276
+ if let themeConfig = appearanceSettings {
277
277
  UserStoreSingleton.shared.body_bg_col = themeConfig.bodyBackgroundColor
278
278
  UserStoreSingleton.shared.container_bg_col = themeConfig.containerBackgroundColor
279
279
  UserStoreSingleton.shared.primary_font_col = themeConfig.primaryFontColor
@@ -624,7 +624,7 @@ public final class Request: NSObject {
624
624
  print("Saved payment methods: \(paymentMethodNames)")
625
625
  }
626
626
 
627
- if self.themeConfiguration == nil, let appearanceSettings = dataObject["apperance_settings"] as? [String: Any] {
627
+ if self.appearanceSettings == nil, let appearanceSettings = dataObject["apperance_settings"] as? [String: Any] {
628
628
  UserStoreSingleton.shared.body_bg_col = appearanceSettings["body_bg_col"] as? String
629
629
  UserStoreSingleton.shared.border_radious = appearanceSettings["border_radious"] as? String
630
630
  UserStoreSingleton.shared.container_bg_col = appearanceSettings["container_bg_col"] as? String
@@ -318,80 +318,130 @@ class AdditionalInfoVC: BaseVC {
318
318
  return
319
319
  }
320
320
 
321
+ // MARK: - Flow Based on Conditions
322
+ // if isSavedForFuture {
323
+ // if selectedPaymentMethod == "NewGrailPayAccount" {
324
+ // // Only call API, do NOT navigate
325
+ // grailPayAccountChargeApi(customerId: UserStoreSingleton.shared.customerId)
326
+ // } else {
327
+ // // Navigate to EmailVerificationVC for all other payment methods
328
+ // if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
329
+ //
330
+ // emailVerificationVC.billingInfoData = billingInfoData
331
+ // emailVerificationVC.selectedPaymentMethod = selectedPaymentMethod
332
+ // emailVerificationVC.easyPayDelegate = easyPayDelegate
333
+ // emailVerificationVC.request = request
334
+ // emailVerificationVC.chosenPlan = chosenPlan
335
+ // emailVerificationVC.startDate = startDate
336
+ // emailVerificationVC.userEmail = userEmail
337
+ // emailVerificationVC.billingInfo = fieldSection?.billing
338
+ // emailVerificationVC.additionalInfo = fieldSection?.additional
339
+ // emailVerificationVC.visibility = fieldSection?.visibility
340
+ // emailVerificationVC.amount = amount
341
+ // emailVerificationVC.email = userEmail
342
+ //
343
+ // // Payment method-specific data
344
+ // switch selectedPaymentMethod {
345
+ // case "Card":
346
+ // emailVerificationVC.cardNumber = cardNumber
347
+ // emailVerificationVC.expiryDate = expiryDate
348
+ // emailVerificationVC.cvv = cvv
349
+ // emailVerificationVC.nameOnCard = nameOnCard
350
+ //
351
+ // case "Bank":
352
+ // emailVerificationVC.accountName = accountName
353
+ // emailVerificationVC.routingNumber = routingNumber
354
+ // emailVerificationVC.accountType = accountType
355
+ // emailVerificationVC.accountNumber = accountNumber
356
+ //
357
+ // case "GrailPay":
358
+ // emailVerificationVC.grailPayAccountID = grailPayAccountID
359
+ // emailVerificationVC.selectedGrailPayAccountType = selectedGrailPayAccountType
360
+ // emailVerificationVC.selectedGrailPayAccountName = selectedGrailPayAccountName
361
+ // emailVerificationVC.isSavedForFuture = true
362
+ //
363
+ // default:
364
+ // break
365
+ // }
366
+ //
367
+ // navigationController?.pushViewController(emailVerificationVC, animated: true)
368
+ // }
369
+ // }
370
+ // }
371
+
321
372
  // MARK: - Flow Based on Conditions
322
373
  if isSavedForFuture {
323
- if selectedPaymentMethod == "NewGrailPayAccount" {
324
- // Only call API, do NOT navigate
325
- grailPayAccountChargeApi(customerId: UserStoreSingleton.shared.customerId)
326
- } else {
327
- // Navigate to EmailVerificationVC for all other payment methods
328
- // if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "EmailVerificationVC") as? EmailVerificationVC {
329
- if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
374
+ // If logged in → Call API directly, no navigation
375
+ if UserStoreSingleton.shared.isLoggedIn == true {
376
+ switch selectedPaymentMethod {
377
+ case "Card":
378
+ if request.secureAuthentication == true {
379
+ threeDSecurePaymentApi()
380
+ } else {
381
+ paymentIntentApi()
382
+ }
330
383
 
331
- emailVerificationVC.billingInfoData = billingInfoData
332
- emailVerificationVC.selectedPaymentMethod = selectedPaymentMethod
333
- emailVerificationVC.easyPayDelegate = easyPayDelegate
334
- emailVerificationVC.request = request
335
- emailVerificationVC.chosenPlan = chosenPlan
336
- emailVerificationVC.startDate = startDate
337
- emailVerificationVC.userEmail = userEmail
338
- emailVerificationVC.billingInfo = fieldSection?.billing
339
- emailVerificationVC.additionalInfo = fieldSection?.additional
340
- emailVerificationVC.visibility = fieldSection?.visibility
341
- emailVerificationVC.amount = amount
342
- emailVerificationVC.email = userEmail
384
+ case "Bank":
385
+ accountChargeApi()
343
386
 
344
- // Payment method-specific data
345
- switch selectedPaymentMethod {
346
- case "Card":
347
- emailVerificationVC.cardNumber = cardNumber
348
- emailVerificationVC.expiryDate = expiryDate
349
- emailVerificationVC.cvv = cvv
350
- emailVerificationVC.nameOnCard = nameOnCard
351
-
352
- case "Bank":
353
- emailVerificationVC.accountName = accountName
354
- emailVerificationVC.routingNumber = routingNumber
355
- emailVerificationVC.accountType = accountType
356
- emailVerificationVC.accountNumber = accountNumber
357
-
358
- case "GrailPay":
359
- emailVerificationVC.grailPayAccountID = grailPayAccountID
360
- emailVerificationVC.selectedGrailPayAccountType = selectedGrailPayAccountType
361
- emailVerificationVC.selectedGrailPayAccountName = selectedGrailPayAccountName
362
- emailVerificationVC.isSavedForFuture = true
363
-
364
- default:
365
- break
366
- }
387
+ case "GrailPay":
388
+ grailPayAccountChargeApi()
389
+
390
+ case "NewGrailPayAccount":
391
+ grailPayAccountChargeApi(customerId: UserStoreSingleton.shared.customerId)
392
+
393
+ default:
394
+ print("Unknown payment method for logged-in user")
395
+ }
396
+ return
397
+ }
398
+
399
+ // Not logged in → Always navigate to OTPVerificationVC
400
+ if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
401
+
402
+ emailVerificationVC.billingInfoData = billingInfoData
403
+ emailVerificationVC.selectedPaymentMethod = selectedPaymentMethod
404
+ emailVerificationVC.easyPayDelegate = easyPayDelegate
405
+ emailVerificationVC.request = request
406
+ emailVerificationVC.chosenPlan = chosenPlan
407
+ emailVerificationVC.startDate = startDate
408
+ emailVerificationVC.userEmail = userEmail
409
+ emailVerificationVC.billingInfo = fieldSection?.billing
410
+ emailVerificationVC.additionalInfo = fieldSection?.additional
411
+ emailVerificationVC.visibility = fieldSection?.visibility
412
+ emailVerificationVC.amount = amount
413
+ emailVerificationVC.email = userEmail
414
+
415
+ // Payment method-specific data
416
+ switch selectedPaymentMethod {
417
+ case "Card":
418
+ emailVerificationVC.cardNumber = cardNumber
419
+ emailVerificationVC.expiryDate = expiryDate
420
+ emailVerificationVC.cvv = cvv
421
+ emailVerificationVC.nameOnCard = nameOnCard
422
+
423
+ case "Bank":
424
+ emailVerificationVC.accountName = accountName
425
+ emailVerificationVC.routingNumber = routingNumber
426
+ emailVerificationVC.accountType = accountType
427
+ emailVerificationVC.accountNumber = accountNumber
428
+
429
+ case "GrailPay":
430
+ emailVerificationVC.grailPayAccountID = grailPayAccountID
431
+ emailVerificationVC.selectedGrailPayAccountType = selectedGrailPayAccountType
432
+ emailVerificationVC.selectedGrailPayAccountName = selectedGrailPayAccountName
433
+ emailVerificationVC.isSavedForFuture = true
367
434
 
368
- navigationController?.pushViewController(emailVerificationVC, animated: true)
435
+ default:
436
+ break
369
437
  }
438
+
439
+ navigationController?.pushViewController(emailVerificationVC, animated: true)
370
440
  }
371
441
  }
442
+
372
443
  else {
373
444
  // 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
- // }
395
445
  if selectedPaymentMethod == "Card" {
396
446
  if isFrom == "SavedCards" {
397
447
  paymentIntentFromShowCardApi()
@@ -480,6 +530,28 @@ class AdditionalInfoVC: BaseVC {
480
530
  "currency": "usd"
481
531
  ]
482
532
 
533
+ // ✅ Only for logged-in users
534
+ if UserStoreSingleton.shared.isLoggedIn == true {
535
+ let emailText = userEmail
536
+ let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
537
+
538
+ params["save_card"] = 1
539
+ params["is_default"] = "1"
540
+ params["tokenize"] = request.tokenOnly ?? ""
541
+ params["username"] = emailPrefix
542
+
543
+ if let customerId = UserStoreSingleton.shared.customerId {
544
+ params["customer"] = customerId
545
+ params["customer_id"] = customerId
546
+ } else {
547
+ params["create_customer"] = "1"
548
+ }
549
+
550
+ if UserStoreSingleton.shared.customerId == nil {
551
+ params["create_customer"] = "1"
552
+ }
553
+ }
554
+
483
555
  // Conditionally add billing info
484
556
  if let visibility = visibility, visibility.billing == true,
485
557
  let billing = billingInfo, !billing.isEmpty {
@@ -526,17 +598,10 @@ class AdditionalInfoVC: BaseVC {
526
598
  params["interval"] = chosenPlan?.lowercased()
527
599
  }
528
600
 
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
- }
601
+ // ✅ Include metadata only if it has at least 1 key-value pair
602
+ if let metadata = request?.metadata, !metadata.isEmpty {
603
+ params["metadata"] = metadata
604
+ }
540
605
 
541
606
  print(params)
542
607
 
@@ -753,17 +818,10 @@ class AdditionalInfoVC: BaseVC {
753
818
  params["interval"] = chosenPlan?.lowercased()
754
819
  }
755
820
 
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
- }
821
+ // ✅ Include metadata only if it has at least 1 key-value pair
822
+ if let metadata = request?.metadata, !metadata.isEmpty {
823
+ params["metadata"] = metadata
824
+ }
767
825
 
768
826
  print(params)
769
827
 
@@ -962,17 +1020,10 @@ class AdditionalInfoVC: BaseVC {
962
1020
  params["email"] = UserStoreSingleton.shared.verificationEmail
963
1021
  }
964
1022
 
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
- }
1023
+ // ✅ Include metadata only if it has at least 1 key-value pair
1024
+ if let metadata = request?.metadata, !metadata.isEmpty {
1025
+ params["metadata"] = metadata
1026
+ }
976
1027
 
977
1028
  print(params)
978
1029
 
@@ -1115,6 +1166,24 @@ class AdditionalInfoVC: BaseVC {
1115
1166
  "levelIndicator": 1,
1116
1167
  ]
1117
1168
 
1169
+ // ✅ Only for logged-in users
1170
+ if UserStoreSingleton.shared.isLoggedIn == true {
1171
+ let emailText = userEmail
1172
+ let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
1173
+
1174
+ params["save_account"] = 1
1175
+
1176
+ if let customerId = UserStoreSingleton.shared.customerId, !customerId.isEmpty {
1177
+ params["customer"] = customerId
1178
+ } else {
1179
+ params["username"] = emailPrefix
1180
+ }
1181
+
1182
+ if UserStoreSingleton.shared.customerId == nil {
1183
+ params["create_customer"] = "1"
1184
+ }
1185
+ }
1186
+
1118
1187
  // Conditionally add billing info
1119
1188
  if let visibility = visibility, visibility.billing == true,
1120
1189
  let billing = billingInfo, !billing.isEmpty {
@@ -1161,6 +1230,11 @@ class AdditionalInfoVC: BaseVC {
1161
1230
  params["interval"] = chosenPlan?.lowercased()
1162
1231
  }
1163
1232
 
1233
+ // ✅ Include metadata only if it has at least 1 key-value pair
1234
+ if let metadata = request?.metadata, !metadata.isEmpty {
1235
+ params["metadata"] = metadata
1236
+ }
1237
+
1164
1238
  print(params)
1165
1239
 
1166
1240
  do {
@@ -1342,6 +1416,11 @@ class AdditionalInfoVC: BaseVC {
1342
1416
  params["interval"] = chosenPlan?.lowercased()
1343
1417
  }
1344
1418
 
1419
+ // ✅ Include metadata only if it has at least 1 key-value pair
1420
+ if let metadata = request?.metadata, !metadata.isEmpty {
1421
+ params["metadata"] = metadata
1422
+ }
1423
+
1345
1424
  print(params)
1346
1425
 
1347
1426
  do {
@@ -1542,6 +1621,11 @@ class AdditionalInfoVC: BaseVC {
1542
1621
  params["interval"] = chosenPlan?.lowercased()
1543
1622
  }
1544
1623
 
1624
+ // ✅ Include metadata only if it has at least 1 key-value pair
1625
+ if let metadata = request?.metadata, !metadata.isEmpty {
1626
+ params["metadata"] = metadata
1627
+ }
1628
+
1545
1629
  print(params)
1546
1630
 
1547
1631
  do {
@@ -1687,6 +1771,28 @@ class AdditionalInfoVC: BaseVC {
1687
1771
  "tokenize": request.tokenOnly ?? false
1688
1772
  ]
1689
1773
 
1774
+ // ✅ Only for logged-in users
1775
+ if UserStoreSingleton.shared.isLoggedIn == true {
1776
+ let emailText = userEmail
1777
+ let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
1778
+
1779
+ params["save_card"] = 1
1780
+ params["is_default"] = "1"
1781
+ params["tokenize"] = request.tokenOnly ?? ""
1782
+ params["username"] = emailPrefix
1783
+
1784
+ if let customerId = UserStoreSingleton.shared.customerId {
1785
+ params["customer"] = customerId
1786
+ params["customer_id"] = customerId
1787
+ } else {
1788
+ params["create_customer"] = "1"
1789
+ }
1790
+
1791
+ if UserStoreSingleton.shared.customerId == nil {
1792
+ params["create_customer"] = "1"
1793
+ }
1794
+ }
1795
+
1690
1796
  // Conditionally add billing info
1691
1797
  if let visibility = visibility, visibility.billing == true,
1692
1798
  let billing = billingInfo, !billing.isEmpty {
@@ -2074,6 +2180,26 @@ class AdditionalInfoVC: BaseVC {
2074
2180
  "email": userEmail ?? ""
2075
2181
  ]
2076
2182
 
2183
+ // ✅ Only add these params for logged-in users
2184
+ if UserStoreSingleton.shared.isLoggedIn == true {
2185
+ let emailText = userEmail
2186
+ let emailPrefix = emailText?.components(separatedBy: "@").first ?? ""
2187
+
2188
+ params["save_account"] = 1
2189
+ params["is_default"] = 1
2190
+ params["customer_id"] = UserStoreSingleton.shared.customerId ?? ""
2191
+
2192
+ if let customerId = UserStoreSingleton.shared.customerId, !customerId.isEmpty {
2193
+ params["customer"] = customerId
2194
+ } else {
2195
+ params["username"] = emailPrefix
2196
+ }
2197
+
2198
+ if UserStoreSingleton.shared.customerId == nil {
2199
+ params["create_customer"] = "1"
2200
+ }
2201
+ }
2202
+
2077
2203
  // Conditionally add billing info
2078
2204
  if let visibility = visibility, visibility.billing == true,
2079
2205
  let billing = billingInfo, !billing.isEmpty {
@@ -2131,6 +2257,11 @@ class AdditionalInfoVC: BaseVC {
2131
2257
  params["interval"] = chosenPlan?.lowercased()
2132
2258
  }
2133
2259
 
2260
+ // ✅ Include metadata only if it has at least 1 key-value pair
2261
+ if let metadata = request?.metadata, !metadata.isEmpty {
2262
+ params["metadata"] = metadata
2263
+ }
2264
+
2134
2265
  print(params)
2135
2266
 
2136
2267
  do {
@@ -2360,6 +2491,11 @@ class AdditionalInfoVC: BaseVC {
2360
2491
  params["interval"] = chosenPlan?.lowercased()
2361
2492
  }
2362
2493
 
2494
+ // ✅ Include metadata only if it has at least 1 key-value pair
2495
+ if let metadata = request?.metadata, !metadata.isEmpty {
2496
+ params["metadata"] = metadata
2497
+ }
2498
+
2363
2499
  print(params)
2364
2500
 
2365
2501
  do {