@jimrising/easymerchantsdk-react-native 1.8.2 → 1.8.5

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 (91) hide show
  1. package/.idea/caches/deviceStreaming.xml +22 -0
  2. package/README.md +1014 -257
  3. package/android/build/.transforms/15b6a8a60a6b32d0dcaf609723cf365b/transformed/classes/classes_dex/classes.dex +0 -0
  4. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
  5. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  6. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
  7. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  8. package/android/build/.transforms/8508f1428f740032c45a43f48b1bbe1e/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  9. package/android/build/.transforms/eef2d06269ef2e204b4f065513034fca/transformed/classes/classes_dex/classes.dex +0 -0
  10. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$1$1.dex +0 -0
  11. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  12. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
  13. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/bundleLibRuntimeToDirRelease_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  14. package/android/build/.transforms/ffabb40f9809b32eb9546ce76fc51764/transformed/bundleLibRuntimeToDirRelease/desugar_graph.bin +0 -0
  15. package/android/build/intermediates/aar_main_jar/release/syncReleaseLibJars/classes.jar +0 -0
  16. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  17. package/android/build/intermediates/compile_library_classes_jar/release/bundleLibCompileToJarRelease/classes.jar +0 -0
  18. package/android/build/intermediates/full_jar/release/createFullJarRelease/full.jar +0 -0
  19. package/android/build/intermediates/incremental/lintVitalAnalyzeRelease/release-artifact-dependencies.xml +4 -4
  20. package/android/build/intermediates/incremental/lintVitalAnalyzeRelease/release-artifact-libraries.xml +4 -4
  21. package/android/build/intermediates/incremental/release/mergeReleaseResources/compile-file-map.properties +126 -21
  22. package/android/build/intermediates/incremental/release/mergeReleaseResources/merger.xml +3 -3
  23. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  24. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  25. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  26. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  27. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  28. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  29. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  30. package/android/build/intermediates/javac/release/compileReleaseJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  31. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/androidx/core/group-index.xml +4 -4
  32. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/androidx/lifecycle/group-index.xml +2 -2
  33. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/maven.google/com/android/tools/build/group-index.xml +14 -14
  34. package/android/build/intermediates/lint-cache/lintVitalAnalyzeRelease/sdk_index/snapshot.gz +0 -0
  35. package/android/build/intermediates/lint_model/release/generateReleaseLintModel/release-artifact-dependencies.xml +4 -4
  36. package/android/build/intermediates/lint_model/release/generateReleaseLintModel/release-artifact-libraries.xml +4 -4
  37. package/android/build/intermediates/lint_vital_lint_model/release/generateReleaseLintVitalModel/release-artifact-dependencies.xml +4 -4
  38. package/android/build/intermediates/lint_vital_lint_model/release/generateReleaseLintVitalModel/release-artifact-libraries.xml +4 -4
  39. package/android/build/intermediates/local_aar_for_lint/release/out.aar +0 -0
  40. package/android/build/intermediates/merged_res/release/mergeReleaseResources/layout/activity_card_addition_ifo.xml +4 -5
  41. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/multi-v2/values-night-v8.json +2 -2
  42. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/multi-v2/values.json +38 -38
  43. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/drawable.json +62 -62
  44. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/font.json +9 -9
  45. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/layout.json +20 -20
  46. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-anydpi-v26.json +2 -2
  47. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-hdpi-v4.json +2 -2
  48. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-mdpi-v4.json +2 -2
  49. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xhdpi-v4.json +2 -2
  50. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xxhdpi-v4.json +2 -2
  51. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/mipmap-xxxhdpi-v4.json +2 -2
  52. package/android/build/intermediates/merged_res_blame_folder/release/mergeReleaseResources/out/single/xml.json +2 -2
  53. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  54. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  55. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  56. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  57. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$1$1.class +0 -0
  58. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  59. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
  60. package/android/build/intermediates/runtime_library_classes_dir/release/bundleLibRuntimeToDirRelease/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  61. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  62. package/android/build/intermediates/runtime_library_classes_jar/release/bundleLibRuntimeToJarRelease/classes.jar +0 -0
  63. package/android/build/intermediates/source_set_path_map/release/mapReleaseSourceSetPaths/file-map.txt +2 -2
  64. package/android/build/intermediates/verified_library_resources/release/verifyReleaseResources/compiled/layout_activity_card_addition_ifo.xml.flat +0 -0
  65. package/android/build/outputs/aar/jimrising_easymerchantsdk-react-native-release.aar +0 -0
  66. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1$1.class.uniqueId1 +0 -0
  67. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId0 +0 -0
  68. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId3 +0 -0
  69. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId2 +0 -0
  70. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  71. package/android/build/tmp/compileReleaseJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1$1.class.uniqueId1 +0 -0
  72. package/android/build/tmp/compileReleaseJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId3 +0 -0
  73. package/android/build/tmp/compileReleaseJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId0 +0 -0
  74. package/android/build/tmp/compileReleaseJavaWithJavac/compileTransaction/stash-dir/{RNEasymerchantsdkModule.class.uniqueId1 → RNEasymerchantsdkModule.class.uniqueId2} +0 -0
  75. package/android/build/tmp/compileReleaseJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId4 +0 -0
  76. package/android/build/tmp/compileReleaseJavaWithJavac/previous-compilation-data.bin +0 -0
  77. package/android/build.gradle +1 -1
  78. package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +77 -38
  79. package/ios/Classes/EasyMerchantSdk.m +0 -1
  80. package/ios/Classes/EasyPayViewController.swift +8 -20
  81. package/ios/Models/Request.swift +181 -1
  82. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +40 -11
  83. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +7 -2
  84. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +20 -10
  85. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +9 -3
  86. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +47 -25
  87. package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +4 -3
  88. package/ios/easymerchantsdk.podspec +1 -1
  89. package/package.json +1 -1
  90. package/android/build/tmp/compileReleaseJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId2 +0 -0
  91. /package/android/build/tmp/{compileReleaseJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId3 → compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId4} +0 -0
@@ -171,7 +171,7 @@ public final class Request: NSObject {
171
171
  public let isEmail: Bool?
172
172
  public let email: String?
173
173
  public let name: String?
174
-
174
+
175
175
  public init(
176
176
  amount: Double? = nil,
177
177
  currency: String? = nil,
@@ -351,6 +351,8 @@ public final class Request: NSObject {
351
351
  "recurring_start_date_type": recurringStartDateType?.rawValue ?? ""
352
352
  ]
353
353
 
354
+ print(params)
355
+
354
356
  do {
355
357
  request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
356
358
  } catch {
@@ -372,6 +374,7 @@ public final class Request: NSObject {
372
374
  if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
373
375
  if let clientToken = responseObject["client_token"] as? String {
374
376
  UserStoreSingleton.shared.clientToken = clientToken
377
+ print(clientToken)
375
378
  }
376
379
  if let paymentIntent = responseObject["payment_intent"] as? String {
377
380
  UserStoreSingleton.shared.paymentIntent = paymentIntent
@@ -404,6 +407,149 @@ public final class Request: NSObject {
404
407
  task.resume()
405
408
  }
406
409
 
410
+ // MARK: - Payment Intent Api
411
+ // func paymentIntentApi(completion: @escaping (Bool) -> Void) {
412
+ // // ✅ Show Loader
413
+ // DispatchQueue.main.async {
414
+ // UIApplication.topViewController()?.ep_showLoadingIndicator()
415
+ // }
416
+ //
417
+ // guard let serviceURL = URL(string: EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.paymentIntent.path()) else {
418
+ // DispatchQueue.main.async {
419
+ // UIApplication.topViewController()?.ep_hideLoadingIndicator()
420
+ // self.showErrorAndDismiss(message: "Invalid payment URL.")
421
+ // }
422
+ // completion(false)
423
+ // return
424
+ // }
425
+ //
426
+ // var request = URLRequest(url: serviceURL)
427
+ // request.httpMethod = "POST"
428
+ // request.addValue("application/json", forHTTPHeaderField: "Content-Type")
429
+ // request.addValue(EnvironmentConfig.apiKey ?? "", forHTTPHeaderField: "X-Api-Key")
430
+ // request.addValue(EnvironmentConfig.apiSecret ?? "", forHTTPHeaderField: "X-Api-Secret")
431
+ //
432
+ // // Validate recurring start date
433
+ // if let startDateString = recurringStartDate,
434
+ // let startDate = DateFormatter.recurringDateFormatter.date(from: startDateString) {
435
+ // let today = Calendar.current.startOfDay(for: Date())
436
+ // let startDay = Calendar.current.startOfDay(for: startDate)
437
+ //
438
+ // if startDay < today {
439
+ // DispatchQueue.main.async {
440
+ // UIApplication.topViewController()?.ep_hideLoadingIndicator()
441
+ // self.showErrorAndDismiss(message: "The recurring start date cannot be in the past. Please select today or a future date.")
442
+ // }
443
+ // completion(false)
444
+ // return
445
+ // }
446
+ // }
447
+ //
448
+ // let params: [String: Any] = [
449
+ // "amount": amount ?? 0,
450
+ // "allowed_cycles": numOfCycle ?? 0,
451
+ // "intervals": recurringIntervals?.map { $0.rawValue } ?? [],
452
+ // "is_recurring": self.is_recurring ?? false,
453
+ // "recurring_start_date": recurringStartDate ?? "",
454
+ // "recurring_start_date_type": recurringStartDateType?.rawValue ?? ""
455
+ // ]
456
+ //
457
+ // do {
458
+ // request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
459
+ // } catch {
460
+ // DispatchQueue.main.async {
461
+ // UIApplication.topViewController()?.ep_hideLoadingIndicator()
462
+ // self.showErrorAndDismiss(message: "Failed to encode payment data.")
463
+ // }
464
+ // completion(false)
465
+ // return
466
+ // }
467
+ //
468
+ // URLSession.shared.dataTask(with: request) { data, response, error in
469
+ // defer {
470
+ // DispatchQueue.main.async {
471
+ // UIApplication.topViewController()?.ep_hideLoadingIndicator()
472
+ // }
473
+ // }
474
+ //
475
+ // if let error = error {
476
+ // DispatchQueue.main.async {
477
+ // self.showErrorAndDismiss(message: error.localizedDescription)
478
+ // }
479
+ // completion(false)
480
+ // return
481
+ // }
482
+ //
483
+ // guard let httpResponse = response as? HTTPURLResponse else {
484
+ // DispatchQueue.main.async {
485
+ // self.showErrorAndDismiss(message: "Invalid response.")
486
+ // }
487
+ // completion(false)
488
+ // return
489
+ // }
490
+ //
491
+ // if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
492
+ // guard let data = data else {
493
+ // DispatchQueue.main.async {
494
+ // self.showErrorAndDismiss(message: "No response data received.")
495
+ // }
496
+ // completion(false)
497
+ // return
498
+ // }
499
+ //
500
+ // do {
501
+ // guard let responseObject = try JSONSerialization.jsonObject(with: data) as? [String: Any] else {
502
+ // DispatchQueue.main.async {
503
+ // self.showErrorAndDismiss(message: "Invalid response format.")
504
+ // }
505
+ // completion(false)
506
+ // return
507
+ // }
508
+ //
509
+ // // ✅ Save values into UserStoreSingleton
510
+ // if let clientToken = responseObject["client_token"] as? String {
511
+ // UserStoreSingleton.shared.clientToken = clientToken
512
+ // print("✅ Saved Client Token: \(clientToken)")
513
+ // }
514
+ // if let paymentIntent = responseObject["payment_intent"] as? String {
515
+ // UserStoreSingleton.shared.paymentIntent = paymentIntent
516
+ // print("✅ Saved Payment Intent: \(paymentIntent)")
517
+ // }
518
+ //
519
+ // // ✅ Proceed to next step only after saving
520
+ // self.hostedCheckoutsApi { success in
521
+ // DispatchQueue.main.async {
522
+ // UIApplication.topViewController()?.ep_hideLoadingIndicator()
523
+ // }
524
+ // completion(success)
525
+ // }
526
+ // return
527
+ //
528
+ // } catch {
529
+ // DispatchQueue.main.async {
530
+ // self.showErrorAndDismiss(message: "Failed to parse response.")
531
+ // }
532
+ // completion(false)
533
+ // return
534
+ // }
535
+ //
536
+ // } else {
537
+ // var message = "Payment request failed with status code: \(httpResponse.statusCode)"
538
+ // if let data = data,
539
+ // let responseObj = try? JSONSerialization.jsonObject(with: data) as? [String: Any],
540
+ // let msg = responseObj["message"] as? String {
541
+ // message = msg
542
+ // }
543
+ // DispatchQueue.main.async {
544
+ // self.showErrorAndDismiss(message: message)
545
+ // }
546
+ // }
547
+ //
548
+ // completion(false)
549
+ //
550
+ // }.resume()
551
+ // }
552
+
407
553
  private func showErrorAndDismiss(message: String) {
408
554
  DispatchQueue.main.async {
409
555
  if let topVC = UIApplication.topViewController() {
@@ -443,6 +589,8 @@ public final class Request: NSObject {
443
589
  "amount": amount ?? 0,
444
590
  ]
445
591
 
592
+ print(params)
593
+
446
594
  do {
447
595
  request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
448
596
  } catch {
@@ -663,3 +811,35 @@ extension UIApplication {
663
811
  }
664
812
  }
665
813
 
814
+
815
+ //extension UIViewController {
816
+ //
817
+ // func ep_showLoadingIndicator() {
818
+ // let tag = 99999 // A unique tag so we can identify and remove the loader later
819
+ // if self.view.viewWithTag(tag) == nil {
820
+ // let loader = UIActivityIndicatorView(style: .large)
821
+ // loader.center = self.view.center
822
+ // loader.tag = tag
823
+ // loader.startAnimating()
824
+ // loader.color = .gray
825
+ // loader.hidesWhenStopped = true
826
+ // loader.translatesAutoresizingMaskIntoConstraints = false
827
+ // self.view.addSubview(loader)
828
+ //
829
+ // // Optional: center constraints
830
+ // NSLayoutConstraint.activate([
831
+ // loader.centerXAnchor.constraint(equalTo: self.view.centerXAnchor),
832
+ // loader.centerYAnchor.constraint(equalTo: self.view.centerYAnchor)
833
+ // ])
834
+ // }
835
+ // }
836
+ //
837
+ // func ep_hideLoadingIndicator() {
838
+ // let tag = 99999
839
+ // if let loader = self.view.viewWithTag(tag) as? UIActivityIndicatorView {
840
+ // loader.stopAnimating()
841
+ // loader.removeFromSuperview()
842
+ // }
843
+ // }
844
+ //}
845
+
@@ -234,12 +234,6 @@ class UserStoreSingleton: NSObject {
234
234
  }
235
235
  }
236
236
 
237
- // func updateThemeConfiguration(with json: [String: Any]) {
238
- // json.forEach { key, value in
239
- // UserDefaults.standard.set(value, forKey: key)
240
- // }
241
- // }
242
-
243
237
  func updateThemeConfiguration(with themeConfiguration: ThemeConfiguration) {
244
238
  self.body_bg_col = themeConfiguration.bodyBackgroundColor
245
239
  self.container_bg_col = themeConfiguration.containerBackgroundColor
@@ -256,13 +250,38 @@ class UserStoreSingleton: NSObject {
256
250
  }
257
251
 
258
252
  // Method to clear user data from UserDefaults
253
+ // func clearUserData() {
254
+ // UserDefaults.standard.removeObject(forKey: "customer_id")
255
+ // UserDefaults.standard.removeObject(forKey: "verificationEmail")
256
+ // UserDefaults.standard.removeObject(forKey: "customer_token")
257
+ // UserDefaults.standard.removeObject(forKey: "client_token")
258
+ // UserDefaults.standard.synchronize() // Optional, but can help ensure the changes are applied immediately
259
+ // }
260
+
259
261
  func clearUserData() {
260
- UserDefaults.standard.removeObject(forKey: "customer_id")
261
- UserDefaults.standard.removeObject(forKey: "verificationEmail")
262
- UserDefaults.standard.removeObject(forKey: "customer_token")
263
- UserDefaults.standard.synchronize() // Optional, but can help ensure the changes are applied immediately
262
+ let keysToRemove = [
263
+ "client_token",
264
+ "payment_intent",
265
+ "merchant_email",
266
+ "merchant_name",
267
+ "payment_account",
268
+ "price",
269
+ "isLoggedIn",
270
+ "customer_id",
271
+ "customer_token",
272
+ "verificationEmail",
273
+ "payment_methods",
274
+ "bank_widget_key",
275
+ "vendor_id",
276
+ ]
277
+
278
+ for key in keysToRemove {
279
+ UserDefaults.standard.removeObject(forKey: key)
280
+ }
281
+
282
+ UserDefaults.standard.synchronize()
264
283
  }
265
-
284
+
266
285
  @objc private func handleAppTermination() {
267
286
  print("App is terminating. Clearing user data...")
268
287
  clearUserData()
@@ -273,3 +292,13 @@ class UserStoreSingleton: NSObject {
273
292
  }
274
293
 
275
294
  }
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
@@ -49,7 +49,8 @@ class AdditionalInfoVC: BaseVC {
49
49
  var isSavedForFuture: Bool = false
50
50
 
51
51
  var selectedCard: CardModel?
52
- var amount: Int?
52
+ // var amount: Int?
53
+ var amount: Double?
53
54
  var cvvText: String?
54
55
  var isFrom = String()
55
56
  var isFromm = String()
@@ -324,7 +325,8 @@ class AdditionalInfoVC: BaseVC {
324
325
  grailPayAccountChargeApi(customerId: UserStoreSingleton.shared.customerId)
325
326
  } else {
326
327
  // Navigate to EmailVerificationVC for all other payment methods
327
- if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "EmailVerificationVC") as? EmailVerificationVC {
328
+ // if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "EmailVerificationVC") as? EmailVerificationVC {
329
+ if let emailVerificationVC = self.storyboard?.instantiateViewController(withIdentifier: "OTPVerificationVC") as? OTPVerificationVC {
328
330
 
329
331
  emailVerificationVC.billingInfoData = billingInfoData
330
332
  emailVerificationVC.selectedPaymentMethod = selectedPaymentMethod
@@ -337,6 +339,7 @@ class AdditionalInfoVC: BaseVC {
337
339
  emailVerificationVC.additionalInfo = fieldSection?.additional
338
340
  emailVerificationVC.visibility = fieldSection?.visibility
339
341
  emailVerificationVC.amount = amount
342
+ emailVerificationVC.email = userEmail
340
343
 
341
344
  // Payment method-specific data
342
345
  switch selectedPaymentMethod {
@@ -1710,6 +1713,7 @@ class AdditionalInfoVC: BaseVC {
1710
1713
  paymentDoneVC.visibility = self.visibility
1711
1714
  paymentDoneVC.amount = self.amount
1712
1715
  paymentDoneVC.cardApiParams = params
1716
+
1713
1717
  // if self.visibility?.billing == true {
1714
1718
  paymentDoneVC.billingInfoData = self.billingInfo
1715
1719
  var billingDict: [String: Any] = [:]
@@ -1907,6 +1911,7 @@ class AdditionalInfoVC: BaseVC {
1907
1911
  paymentDoneVC.visibility = self.visibility
1908
1912
  paymentDoneVC.amount = self.amount
1909
1913
  paymentDoneVC.cardApiParams = params
1914
+
1910
1915
  // if self.visibility?.billing == true {
1911
1916
  paymentDoneVC.billingInfoData = self.billingInfo
1912
1917
  var billingDict: [String: Any] = [:]
@@ -75,7 +75,8 @@ class BillingInfoVC: BaseVC {
75
75
 
76
76
  var request: Request!
77
77
  var selectedCard: CardModel?
78
- var amount: Int?
78
+ // var amount: Int?
79
+ var amount: Double?
79
80
  var cvvText: String?
80
81
 
81
82
  var isFrom = String()
@@ -666,7 +667,7 @@ class BillingInfoVC: BaseVC {
666
667
  vc.visibility = updatedFieldSection.visibility
667
668
  vc.selectedPaymentMethod = selectedPaymentMethod
668
669
  vc.isSavedForFuture = isSavedForFuture
669
- vc.amount = Int(request.amount ?? 0)
670
+ vc.amount = Double(self.request.amount ?? 0)
670
671
  vc.request = request
671
672
  vc.chosenPlan = chosenPlan
672
673
  vc.startDate = startDate
@@ -682,7 +683,8 @@ class BillingInfoVC: BaseVC {
682
683
 
683
684
  }
684
685
  else if !isAdditionalVisible && isSavedForFuture {
685
- let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
686
+ // let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
687
+ let vc = easymerchantsdk.instantiateViewController(withIdentifier: "OTPVerificationVC") as! OTPVerificationVC
686
688
  vc.cardNumber = cardNumber
687
689
  vc.expiryDate = expiryDate
688
690
  vc.cvv = cvv
@@ -744,7 +746,7 @@ class BillingInfoVC: BaseVC {
744
746
  vc.accountID = accountID
745
747
  vc.isFrom = isFrom
746
748
  vc.isSavedNewAccount = isSavedNewAccount
747
- vc.amount = Int(request.amount ?? 0)
749
+ vc.amount = Double(self.request.amount ?? 0)
748
750
  vc.request = request
749
751
  vc.chosenPlan = chosenPlan
750
752
  vc.startDate = startDate
@@ -754,7 +756,8 @@ class BillingInfoVC: BaseVC {
754
756
  navigationController?.pushViewController(vc, animated: true)
755
757
  }
756
758
  else if !isAdditionalVisible && isSavedForFuture {
757
- let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
759
+ // let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
760
+ let vc = easymerchantsdk.instantiateViewController(withIdentifier: "OTPVerificationVC") as! OTPVerificationVC
758
761
  vc.accountName = accountName
759
762
  vc.routingNumber = routingNumber
760
763
  vc.accountType = accountType
@@ -764,7 +767,7 @@ class BillingInfoVC: BaseVC {
764
767
  vc.fieldSection = updatedFieldSection
765
768
  vc.selectedPaymentMethod = selectedPaymentMethod
766
769
  vc.easyPayDelegate = easyPayDelegate
767
- vc.request = request
770
+ vc.request = self.request
768
771
  vc.chosenPlan = chosenPlan
769
772
  vc.startDate = startDate
770
773
  vc.billingInfo = updatedFieldSection.billing
@@ -776,6 +779,7 @@ class BillingInfoVC: BaseVC {
776
779
  vc.grailPayAccountID = grailPayAccountID
777
780
  vc.selectedGrailPayAccountType = selectedGrailPayAccountType
778
781
  vc.selectedGrailPayAccountName = selectedGrailPayAccountName
782
+ vc.email = userEmail
779
783
  navigationController?.pushViewController(vc, animated: true)
780
784
  }
781
785
  else if isFrom == "SavedBank" {
@@ -804,7 +808,7 @@ class BillingInfoVC: BaseVC {
804
808
  vc.isSavedForFuture = isSavedForFuture
805
809
  vc.isFrom = isFrom
806
810
  vc.isSavedNewAccount = isSavedNewAccount
807
- vc.amount = Int(request.amount ?? 0)
811
+ vc.amount = Double(self.request.amount ?? 0)
808
812
  vc.request = request
809
813
  vc.chosenPlan = chosenPlan
810
814
  vc.startDate = startDate
@@ -815,7 +819,8 @@ class BillingInfoVC: BaseVC {
815
819
  navigationController?.pushViewController(vc, animated: true)
816
820
  }
817
821
  else if !isAdditionalVisible && isSavedForFuture {
818
- let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
822
+ // let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
823
+ let vc = easymerchantsdk.instantiateViewController(withIdentifier: "OTPVerificationVC") as! OTPVerificationVC
819
824
  vc.billingInfoData = updatedBillingData
820
825
  vc.fieldSection = updatedFieldSection
821
826
  vc.billingInfo = updatedFieldSection.billing
@@ -825,7 +830,7 @@ class BillingInfoVC: BaseVC {
825
830
  vc.isSavedForFuture = isSavedForFuture
826
831
  vc.isFrom = isFrom
827
832
  vc.isSavedNewAccount = isSavedNewAccount
828
- vc.amount = Int(request.amount ?? 0)
833
+ vc.amount = Double(self.request.amount ?? 0)
829
834
  vc.request = request
830
835
  vc.chosenPlan = chosenPlan
831
836
  vc.startDate = startDate
@@ -833,6 +838,11 @@ class BillingInfoVC: BaseVC {
833
838
  vc.selectedGrailPayAccountType = selectedGrailPayAccountType
834
839
  vc.selectedGrailPayAccountName = selectedGrailPayAccountName
835
840
  vc.userEmail = userEmail
841
+ vc.email = userEmail
842
+
843
+ vc.grailPayAccountID = self.grailPayAccountID
844
+ vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
845
+ vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
836
846
  navigationController?.pushViewController(vc, animated: true)
837
847
  }
838
848
  else {
@@ -852,7 +862,7 @@ class BillingInfoVC: BaseVC {
852
862
  vc.isSavedForFuture = isSavedForFuture
853
863
  vc.isFrom = isFrom
854
864
  vc.isSavedNewAccount = isSavedNewAccount
855
- vc.amount = Int(request.amount ?? 0)
865
+ vc.amount = Double(self.request.amount ?? 0)
856
866
  vc.request = request
857
867
  vc.chosenPlan = chosenPlan
858
868
  vc.startDate = startDate
@@ -72,13 +72,17 @@ class OTPVerificationVC: BaseVC {
72
72
  var billingInfo: [FieldItem]?
73
73
  var visibility: FieldsVisibility?
74
74
 
75
- var amount: Int?
75
+ // var amount: Int?
76
+ var amount: Double?
76
77
 
77
78
  var isSavedNewCard: Bool = false
78
79
 
80
+ var isSavedNewAccount: Bool?
81
+ var isFrom = String()
82
+
79
83
  override func viewDidLoad() {
80
84
  super.viewDidLoad()
81
- emailVerificationApi()
85
+ // emailVerificationApi()
82
86
 
83
87
  uiFinishingTouchElements()
84
88
 
@@ -111,6 +115,7 @@ class OTPVerificationVC: BaseVC {
111
115
  }
112
116
 
113
117
  override func viewWillAppear(_ animated: Bool) {
118
+ emailVerificationApi()
114
119
  startTimer()
115
120
  uiFinishingTouchElements()
116
121
  }
@@ -291,7 +296,7 @@ class OTPVerificationVC: BaseVC {
291
296
  let token = UserStoreSingleton.shared.clientToken
292
297
  print("Setting clientToken header: \(token ?? "None")")
293
298
  request.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
294
-
299
+
295
300
  // Add API headers
296
301
  if let apiKey = EnvironmentConfig.apiKey,
297
302
  let apiSecret = EnvironmentConfig.apiSecret {
@@ -1813,6 +1818,7 @@ class OTPVerificationVC: BaseVC {
1813
1818
  paymentDoneVC.visibility = self.visibility
1814
1819
  paymentDoneVC.amount = self.amount
1815
1820
  paymentDoneVC.cardApiParams = params
1821
+
1816
1822
  // if self.visibility?.billing == true {
1817
1823
  paymentDoneVC.billingInfoData = self.billingInfo
1818
1824
  var billingDict: [String: Any] = [:]
@@ -331,8 +331,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
331
331
  private var request: Request!
332
332
  private weak var delegate: EasyPayViewControllerDelegate?
333
333
 
334
- public var amount: Int?
335
-
334
+ // public var amount: Int?
335
+ public var amount: Double?
336
+
336
337
  var arrPaymentMethods: [PaymentsData] = []
337
338
 
338
339
  private var selectedIndex: IndexPath?
@@ -406,7 +407,20 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
406
407
  //MARK: - View Did Load
407
408
  override func viewDidLoad() {
408
409
  super.viewDidLoad()
409
- // logOut()
410
+ logOut()
411
+
412
+ // Then: safely start new API call
413
+ DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
414
+ self.request?.paymentIntentApi { success in
415
+ if success {
416
+ print("Payment Intent completed")
417
+ // Continue flow
418
+ } else {
419
+ print("Payment Intent failed")
420
+ // Handle failure
421
+ }
422
+ }
423
+ }
410
424
 
411
425
  viewAppearanceOn()
412
426
 
@@ -432,7 +446,10 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
432
446
  let billingVisible = fieldSection.visibility.billing
433
447
  let additionalVisible = fieldSection.visibility.additional
434
448
  let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
435
- let amountText = String(format: "$%.2f", request?.amount ?? 0)
449
+ // let amountText = String(format: "$%.2f", request?.amount ?? 0)
450
+
451
+ let rawAmount = Double(request?.amount ?? 0)
452
+ let amountText = String(format: "$%.2f", rawAmount)
436
453
 
437
454
  var buttonText: String
438
455
 
@@ -454,8 +471,12 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
454
471
  btnPayNowSingleCard.setTitle(buttonText, for: .normal)
455
472
  btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
456
473
  } else {
457
- // When no billingInfoData present
458
- let amountText = String(format: "$%.2f", request?.amount ?? 0)
474
+ /// When no billingInfoData present
475
+ // let amountText = String(format: "$%.2f", request?.amount ?? 0)
476
+
477
+ let rawAmount = Double(request?.amount ?? 0)
478
+ let amountText = String(format: "$%.2f", rawAmount)
479
+
459
480
  let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
460
481
  let defaultTitle = "\(submitText) (\(amountText))"
461
482
 
@@ -730,9 +751,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
730
751
  self.viewAddNewCard.isHidden = true
731
752
  }
732
753
  else {
733
- self.getShowCardsApi()
754
+ // self.getShowCardsApi()
734
755
  self.viewCardFields.isHidden = true
735
- self.viewSingleSavedCard.isHidden = false
756
+ // self.viewSingleSavedCard.isHidden = false
736
757
  self.viewBtnShowSavedCards.isHidden = true
737
758
  self.viewBtnShowSavedCardHeight.constant = 0
738
759
  self.viewBtnShowSavedCardTopCon.constant = 0
@@ -1991,7 +2012,8 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
1991
2012
  billingInfoVC.isFrom = "SavedCards"
1992
2013
  billingInfoVC.selectedCard = self.selectedCard // Passing the selected card data
1993
2014
  billingInfoVC.cvvText = cvvText // Passing the CVV text
1994
- billingInfoVC.amount = Int(self.request.amount ?? 0)
2015
+ // billingInfoVC.amount = Int(self.request.amount ?? 0)
2016
+ billingInfoVC.amount = Double(self.request.amount ?? 0)
1995
2017
  billingInfoVC.selectedPaymentMethod = self.selectedPaymentMethod
1996
2018
 
1997
2019
  if let billingInfoData = self.request.billingInfoData {
@@ -2015,7 +2037,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
2015
2037
  additionalInfoVC.isFrom = "SavedCards"
2016
2038
  additionalInfoVC.selectedCard = self.selectedCard // Passing the selected card data
2017
2039
  additionalInfoVC.cvvText = cvvText // Passing the CVV text
2018
- additionalInfoVC.amount = Int(self.request.amount ?? 0)
2040
+ additionalInfoVC.amount = Double(self.request.amount ?? 0)
2019
2041
  additionalInfoVC.selectedPaymentMethod = self.selectedPaymentMethod
2020
2042
 
2021
2043
  if let billingInfoData = self.request.billingInfoData {
@@ -2204,7 +2226,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
2204
2226
  billingInfoVC.isSavedNewCard = self.isSavedNewCardForFuture
2205
2227
 
2206
2228
  billingInfoVC.isFrom = "AddNewCard"
2207
- billingInfoVC.amount = Int(self.request.amount ?? 0)
2229
+ billingInfoVC.amount = Double(self.request.amount ?? 0)
2208
2230
  billingInfoVC.selectedPaymentMethod = self.selectedPaymentMethod
2209
2231
 
2210
2232
  if let billingInfoData = self.request.billingInfoData {
@@ -2231,7 +2253,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
2231
2253
  additionalInfoVC.isSavedNewCard = self.isSavedNewCardForFuture
2232
2254
 
2233
2255
  additionalInfoVC.isFrom = "AddNewCard"
2234
- additionalInfoVC.amount = Int(self.request.amount ?? 0)
2256
+ additionalInfoVC.amount = Double(self.request.amount ?? 0)
2235
2257
  additionalInfoVC.selectedPaymentMethod = self.selectedPaymentMethod
2236
2258
 
2237
2259
  if let billingInfoData = self.request.billingInfoData {
@@ -5207,13 +5229,13 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5207
5229
 
5208
5230
  // MARK: - GET Show Cards API
5209
5231
  func getShowCardsApi() {
5210
- showLoadingIndicator()
5232
+ // showLoadingIndicator()
5211
5233
 
5212
5234
  let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.getCards.path()
5213
5235
 
5214
5236
  guard let serviceURL = URL(string: fullURL) else {
5215
5237
  print("❌ Invalid URL: \(fullURL)")
5216
- hideLoadingIndicator()
5238
+ // hideLoadingIndicator()
5217
5239
  return
5218
5240
  }
5219
5241
 
@@ -5236,11 +5258,11 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5236
5258
  let task = session.dataTask(with: uRLRequest) { [weak self] (data, response, error) in
5237
5259
  guard let self = self else { return }
5238
5260
 
5239
- defer {
5240
- DispatchQueue.main.async {
5241
- self.hideLoadingIndicator()
5242
- }
5243
- }
5261
+ // defer {
5262
+ // DispatchQueue.main.async {
5263
+ // self.hideLoadingIndicator()
5264
+ // }
5265
+ // }
5244
5266
 
5245
5267
  if let error = error {
5246
5268
  print("❌ Error in getShowCardsApi: \(error.localizedDescription)")
@@ -7201,13 +7223,13 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7201
7223
  //MARK: - Bank Api's
7202
7224
  // MARK: - GET Show Bank Accounts API
7203
7225
  func getShowBankAccountsApi() {
7204
- showLoadingIndicator()
7226
+ // showLoadingIndicator()
7205
7227
 
7206
7228
  let fullURL = EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.account.path()
7207
7229
 
7208
7230
  guard let serviceURL = URL(string: fullURL) else {
7209
7231
  print("Invalid URL")
7210
- hideLoadingIndicator()
7232
+ // hideLoadingIndicator()
7211
7233
  return
7212
7234
  }
7213
7235
 
@@ -7218,7 +7240,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7218
7240
  // Retrieve and validate customer token
7219
7241
  guard let token = UserStoreSingleton.shared.customerToken, !token.isEmpty else {
7220
7242
  print("Customer token is missing or empty")
7221
- hideLoadingIndicator()
7243
+ // hideLoadingIndicator()
7222
7244
  showAlert(message: "Session expired. Please log in again.")
7223
7245
  return
7224
7246
  }
@@ -7230,9 +7252,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7230
7252
  let task = session.dataTask(with: urlRequest) { [weak self] (data, response, error) in
7231
7253
  guard let self = self else { return }
7232
7254
 
7233
- DispatchQueue.main.async {
7234
- self.hideLoadingIndicator()
7235
- }
7255
+ // DispatchQueue.main.async {
7256
+ // self.hideLoadingIndicator()
7257
+ // }
7236
7258
 
7237
7259
  if let error = error {
7238
7260
  print("Error: \(error.localizedDescription)")