@jimrising/easymerchantsdk-react-native 2.3.3 → 2.3.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 (62) hide show
  1. package/README.md +1 -1
  2. package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  3. package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/transformed/classes/classes_dex/classes.dex +0 -0
  4. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  5. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  6. package/android/build.gradle +1 -1
  7. package/ios/ApiManager/APIRequest.swift +1 -4
  8. package/ios/Bundle/EasyPayBundle.swift +1 -1
  9. package/ios/Classes/EasyMerchantSdk.m +2 -2
  10. package/ios/Classes/EasyMerchantSdk.swift +3 -3
  11. package/ios/CustomComponents/PlanSelector.swift +1 -1
  12. package/ios/Example/Base.lproj/Main.storyboard +183 -22
  13. package/ios/Example/ViewController.swift +208 -182
  14. package/ios/Helper/GrailPayHelper.swift +0 -1
  15. package/ios/Models/Request.swift +242 -51
  16. package/ios/Models/SDKResult.swift +32 -25
  17. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +59 -60
  18. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +360 -150
  19. package/ios/Pods/ViewControllers/BaseVC.swift +2 -1
  20. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +401 -196
  21. package/ios/Pods/ViewControllers/Clean Runner_2025-07-23T14-58-05.txt +13 -0
  22. package/ios/Pods/ViewControllers/EmailVerificationVC.swift +0 -7
  23. package/ios/Pods/ViewControllers/GrailPayVC.swift +11 -3
  24. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +252 -105
  25. package/ios/Pods/ViewControllers/PaymentDoneVC.swift +20 -5
  26. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +2 -2
  27. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +804 -347
  28. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +0 -1
  29. package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +1 -1
  30. package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +68 -66
  31. package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/Contents.json +3 -0
  32. package/ios/easymerchantsdk.podspec +1 -1
  33. package/package.json +1 -1
  34. package/ios/CustomComponents/CheckboxButton.swift +0 -66
  35. package/ios/Models/AdditionalInfo.swift +0 -53
  36. package/ios/Models/BillingInfo.swift +0 -60
  37. package/ios/Pods/ViewControllers/CustomOverlay.swift +0 -199
  38. package/ios/Resources/Assets.xcassets/Card/Amex.imageset/206682_american_express_method_card_payment_icon.svg +0 -1
  39. package/ios/Resources/Assets.xcassets/Card/Amex.imageset/Contents.json +0 -12
  40. package/ios/Resources/Assets.xcassets/Card/Contents.json +0 -6
  41. package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/472318_card_club_diners_dinner_payment_icon.svg +0 -1
  42. package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/Contents.json +0 -12
  43. package/ios/Resources/Assets.xcassets/Card/Discover.imageset/206686_network_payment_discover_card_method_icon.svg +0 -1
  44. package/ios/Resources/Assets.xcassets/Card/Discover.imageset/Contents.json +0 -12
  45. package/ios/Resources/Assets.xcassets/Card/JCB.imageset/358102_card_jcb_payment_icon.svg +0 -1
  46. package/ios/Resources/Assets.xcassets/Card/JCB.imageset/Contents.json +0 -12
  47. package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/206680_master_method_card_payment_icon.svg +0 -1
  48. package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/Contents.json +0 -12
  49. package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/1468976_card_payment_unionpay_icon.svg +0 -1
  50. package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/Contents.json +0 -12
  51. package/ios/Resources/Assets.xcassets/Card/Visa.imageset/206684_visa_method_card_payment_icon.svg +0 -1
  52. package/ios/Resources/Assets.xcassets/Card/Visa.imageset/Contents.json +0 -12
  53. package/ios/Resources/Assets.xcassets/Card/maestro.imageset/Contents.json +0 -12
  54. package/ios/Resources/Assets.xcassets/Card/maestro.imageset/maestro.svg +0 -1
  55. package/ios/Resources/Assets.xcassets/Card/paypal.imageset/206675_paypal_method_payment_icon.svg +0 -1
  56. package/ios/Resources/Assets.xcassets/Card/paypal.imageset/Contents.json +0 -12
  57. package/ios/Resources/Assets.xcassets/Card/rupay.imageset/Contents.json +0 -12
  58. package/ios/Resources/Assets.xcassets/Card/rupay.imageset/rupay.svg +0 -1
  59. package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/4635000_card_credit_digital_money_icon.svg +0 -1
  60. package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/Contents.json +0 -12
  61. package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/Contents.json +0 -12
  62. package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/worldpay.svg +0 -1
@@ -459,7 +459,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
459
459
  //MARK: - View Did Load
460
460
  override func viewDidLoad() {
461
461
  super.viewDidLoad()
462
-
462
+ logOut()
463
463
  // Add and center the loader
464
464
  view.addSubview(loadingIndicator)
465
465
  NSLayoutConstraint.activate([
@@ -477,11 +477,11 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
477
477
  // DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
478
478
  // if let clientToken = self.request.clientToken,
479
479
  // !clientToken.isEmpty {
480
- //
480
+ //
481
481
  // // Save clientToken in singleton
482
482
  // UserStoreSingleton.shared.clientToken = clientToken
483
483
  // print("Saved clientToken in UserStoreSingleton: \(clientToken)")
484
- //
484
+ //
485
485
  // // Case 1: Already exist → Directly call hostedCheckout
486
486
  // print("Skipping paymentIntentApi, using existing values")
487
487
  // self.request.hostedCheckoutsApi { success in
@@ -490,7 +490,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
490
490
  // self.setupUI()
491
491
  // } else {
492
492
  // print("Hosted Checkout failed. Blocking SDK UI.")
493
- //
493
+ //
494
494
  // // Stop flow and notify failure
495
495
  // let result = SDKResult(
496
496
  // type: .error,
@@ -514,7 +514,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
514
514
  // self.setupUI()
515
515
  // } else {
516
516
  // print("Payment Intent failed. Blocking SDK UI.")
517
- //
517
+ //
518
518
  // // Stop flow and notify failure
519
519
  // let result = SDKResult(
520
520
  // type: .error,
@@ -589,14 +589,59 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
589
589
  self.request.selectedPaymentMethods = savedMethods.compactMap { PaymentMethod(rawValue: $0) }
590
590
  }
591
591
  self.setupUI()
592
+
593
+ if let billingInfoData = self.request.fields,
594
+ let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
595
+
596
+ let billingVisible = fieldSection.visibility.billing
597
+ let additionalVisible = fieldSection.visibility.additional
598
+ let submitText = self.request?.submitButtonText?.isEmpty == false ? self.request!.submitButtonText! : "Pay Now"
599
+
600
+ // ❌ old way (was re-reading from request)
601
+ // let rawAmount = Double(self.request?.amount ?? 0)
602
+ // let amountText = String(format: "$%.2f", rawAmount)
603
+
604
+ // ✅ new way: use parsedAmount immediately
605
+ let resolvedAmount = self.amount // already set above
606
+ let amountText = String(format: "$%.2f", resolvedAmount ?? 00.00)
607
+
608
+ var buttonText: String
609
+ if !billingVisible && !additionalVisible {
610
+ buttonText = "\(submitText) (\(amountText))"
611
+ } else if billingVisible {
612
+ buttonText = "\(submitText) (Billing Info)"
613
+ } else if additionalVisible {
614
+ buttonText = "\(submitText) (Additional Info)"
615
+ } else {
616
+ buttonText = "\(submitText) (\(amountText))"
617
+ }
618
+
619
+ self.btnNext.setTitle(buttonText, for: .normal)
620
+ self.btnPayNowNewCardView.setTitle(buttonText, for: .normal)
621
+ self.btnPayNowNewAccountView.setTitle(buttonText, for: .normal)
622
+ self.btnPayNowSingleCard.setTitle(buttonText, for: .normal)
623
+ self.btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
624
+ } else {
625
+ /// When no billingInfoData present
626
+ let resolvedAmount = self.amount
627
+ let amountText = String(format: "$%.2f", resolvedAmount ?? 00.00)
628
+
629
+ let submitText = self.request?.submitButtonText?.isEmpty == false ? self.request!.submitButtonText! : "Pay Now"
630
+ let defaultTitle = "\(submitText) (\(amountText))"
631
+
632
+ self.btnNext.setTitle(defaultTitle, for: .normal)
633
+ self.btnPayNowNewCardView.setTitle(defaultTitle, for: .normal)
634
+ self.btnPayNowNewAccountView.setTitle(defaultTitle, for: .normal)
635
+ self.btnPayNowSingleCard.setTitle(defaultTitle, for: .normal)
636
+ self.btnPayNowSingleAccountView.setTitle(defaultTitle, for: .normal)
637
+ }
638
+
592
639
  } else {
593
640
  print("Hosted Checkout failed. Blocking SDK UI.")
594
641
  // Notify failure
595
642
  let result = SDKResult(
596
643
  type: .error,
597
- chargeData: ["status": false, "message": "Hosted Checkout failed"],
598
- billingInfo: nil,
599
- additionalInfo: nil
644
+ data: ["status": false, "message": "Hosted Checkout failed"] as NSDictionary
600
645
  )
601
646
  NotificationCenter.default.post(name: NSNotification.Name("EasyPayResult"), object: result)
602
647
  self.dismiss(animated: true)
@@ -619,9 +664,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
619
664
  // Notify failure
620
665
  let result = SDKResult(
621
666
  type: .error,
622
- chargeData: ["status": false, "message": "Payment Intent failed"],
623
- billingInfo: nil,
624
- additionalInfo: nil
667
+ data: ["status": false, "message": "Payment Intent failed"] as NSDictionary
625
668
  )
626
669
  NotificationCenter.default.post(name: NSNotification.Name("EasyPayResult"), object: result)
627
670
  self.dismiss(animated: true)
@@ -649,52 +692,52 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
649
692
  tapGesture.cancelsTouchesInView = false
650
693
  self.view.addGestureRecognizer(tapGesture)
651
694
 
652
- if let billingInfoData = request.fields,
653
- let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
654
-
655
- let billingVisible = fieldSection.visibility.billing
656
- let additionalVisible = fieldSection.visibility.additional
657
- let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
658
- // let amountText = String(format: "$%.2f", request?.amount ?? 0)
659
-
660
- let rawAmount = Double(request?.amount ?? 0)
661
- let amountText = String(format: "$%.2f", rawAmount)
662
-
663
- var buttonText: String
664
-
665
- if !billingVisible && !additionalVisible {
666
- // Both visibility false – show submitText with amount only
667
- buttonText = "\(submitText) (\(amountText))"
668
- } else if billingVisible {
669
- buttonText = "\(submitText) (Billing Info)"
670
- } else if additionalVisible {
671
- buttonText = "\(submitText) (Additional Info)"
672
- } else {
673
- // Fallback
674
- buttonText = "\(submitText) (\(amountText))"
675
- }
676
-
677
- btnNext.setTitle(buttonText, for: .normal)
678
- btnPayNowNewCardView.setTitle(buttonText, for: .normal)
679
- btnPayNowNewAccountView.setTitle(buttonText, for: .normal)
680
- btnPayNowSingleCard.setTitle(buttonText, for: .normal)
681
- btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
682
- } else {
683
- /// When no billingInfoData present
684
- // let amountText = String(format: "$%.2f", request?.amount ?? 0)
685
-
686
- let rawAmount = Double(request?.amount ?? 0)
687
- let amountText = String(format: "$%.2f", rawAmount)
688
-
689
- let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
690
- let defaultTitle = "\(submitText) (\(amountText))"
691
-
692
- btnNext.setTitle(defaultTitle, for: .normal)
693
- btnPayNowNewCardView.setTitle(defaultTitle, for: .normal)
694
- btnPayNowNewAccountView.setTitle(defaultTitle, for: .normal)
695
- btnPayNowSingleCard.setTitle(defaultTitle, for: .normal)
696
- btnPayNowSingleAccountView.setTitle(defaultTitle, for: .normal)
697
- }
695
+ // if let billingInfoData = request.fields,
696
+ // let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
697
+ //
698
+ // let billingVisible = fieldSection.visibility.billing
699
+ // let additionalVisible = fieldSection.visibility.additional
700
+ // let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
701
+ // // let amountText = String(format: "$%.2f", request?.amount ?? 0)
702
+ //
703
+ // let rawAmount = Double(request?.amount ?? 0)
704
+ // let amountText = String(format: "$%.2f", rawAmount)
705
+ //
706
+ // var buttonText: String
707
+ //
708
+ // if !billingVisible && !additionalVisible {
709
+ // // Both visibility false – show submitText with amount only
710
+ // buttonText = "\(submitText) (\(amountText))"
711
+ // } else if billingVisible {
712
+ // buttonText = "\(submitText) (Billing Info)"
713
+ // } else if additionalVisible {
714
+ // buttonText = "\(submitText) (Additional Info)"
715
+ // } else {
716
+ // // Fallback
717
+ // buttonText = "\(submitText) (\(amountText))"
718
+ // }
719
+ //
720
+ // btnNext.setTitle(buttonText, for: .normal)
721
+ // btnPayNowNewCardView.setTitle(buttonText, for: .normal)
722
+ // btnPayNowNewAccountView.setTitle(buttonText, for: .normal)
723
+ // btnPayNowSingleCard.setTitle(buttonText, for: .normal)
724
+ // btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
725
+ // } else {
726
+ // /// When no billingInfoData present
727
+ // // let amountText = String(format: "$%.2f", request?.amount ?? 0)
728
+ //
729
+ // let rawAmount = Double(request?.amount ?? 0)
730
+ // let amountText = String(format: "$%.2f", rawAmount)
731
+ //
732
+ // let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
733
+ // let defaultTitle = "\(submitText) (\(amountText))"
734
+ //
735
+ // btnNext.setTitle(defaultTitle, for: .normal)
736
+ // btnPayNowNewCardView.setTitle(defaultTitle, for: .normal)
737
+ // btnPayNowNewAccountView.setTitle(defaultTitle, for: .normal)
738
+ // btnPayNowSingleCard.setTitle(defaultTitle, for: .normal)
739
+ // btnPayNowSingleAccountView.setTitle(defaultTitle, for: .normal)
740
+ // }
698
741
 
699
742
  lblEasyMerchantOne.text = "POWERED BY \(UserStoreSingleton.shared.companyName?.uppercased() ?? "")"
700
743
  txtFieldEmailCardView.textField.text = request.email
@@ -862,7 +905,6 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
862
905
  self.viewCrypto.isHidden = true
863
906
 
864
907
  if request.is_recurring == true {
865
-
866
908
  // Check if there is only one recurring interval
867
909
  if let intervals = request.recurringIntervals, intervals.count == 1, let singleInterval = intervals.first {
868
910
  // Set the text field to the single interval's display name
@@ -1166,7 +1208,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
1166
1208
  self.heightViewNewCardFields.constant = 458
1167
1209
  }
1168
1210
 
1169
- self.heightSubViewNewAccountFields.constant = 662
1211
+ self.heightSubViewNewAccountFields.constant = 702
1170
1212
  }
1171
1213
 
1172
1214
  if selectedPaymentMethod == "Card" {
@@ -2327,7 +2369,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
2327
2369
  "message": "User cancelled the payment."
2328
2370
  ]
2329
2371
 
2330
- let result = SDKResult(type: .cancelled, chargeData: cancelData)
2372
+ let result = SDKResult(type: .cancelled, data: cancelData as NSDictionary)
2331
2373
  self.delegate?.easyPayController(self.navigationController as! EasyPayViewController, didFinishWith: result)
2332
2374
 
2333
2375
  self.dismiss(animated: true)
@@ -3607,6 +3649,21 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
3607
3649
  self.showErrorOnce(errorMessage: errorMsg)
3608
3650
  return
3609
3651
 
3652
+ // if let chargeData = result.chargeData,
3653
+ // let data = chargeData["data"] as? [String: Any],
3654
+ // let status = data["status"] as? String,
3655
+ // status == "ACTION_ABANDONED" {
3656
+ //
3657
+ // let reason = data["reason"] as? String ?? "User abandoned the action."
3658
+ // print("⚠️ GrailPay abandoned: \(reason)")
3659
+ // self.showErrorOnce(errorMessage: reason)
3660
+ // } else {
3661
+ // print("⚠️ GrailPay cancelled by user")
3662
+ // let errorMsg = "User cancelled GrailPay account linking."
3663
+ // self.showErrorOnce(errorMessage: errorMsg)
3664
+ // }
3665
+ // return
3666
+
3610
3667
  case .error:
3611
3668
  let errorMsg = result.error?.localizedDescription ?? "An unknown error occurred while launching GrailPay."
3612
3669
  print("❌ GrailPay error: \(errorMsg)")
@@ -3735,26 +3792,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
3735
3792
  params["description"] = "Hosted payment checkout"
3736
3793
  }
3737
3794
 
3795
+ // // Add these if recurring is enabled
3796
+ // if let req = request, req.is_recurring == true {
3797
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
3798
+ // // Only send start_date if type is .custom and field is not empty
3799
+ // if let startDateText = txtFieldSelectDateGrailPayBankView?.text, !startDateText.isEmpty {
3800
+ // let inputFormatter = DateFormatter()
3801
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
3802
+ //
3803
+ // let outputFormatter = DateFormatter()
3804
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
3805
+ //
3806
+ // if let date = inputFormatter.date(from: startDateText) {
3807
+ // let apiFormattedDate = outputFormatter.string(from: date)
3808
+ // params["start_date"] = apiFormattedDate
3809
+ // } else {
3810
+ // print("Invalid date format in startDateText")
3811
+ // }
3812
+ // }
3813
+ // }
3814
+ //
3815
+ // params["interval"] = txtFieldChosePlanGrailPayBankView.text.lowercased()
3816
+ // }
3817
+
3738
3818
  // Add these if recurring is enabled
3739
3819
  if let req = request, req.is_recurring == true {
3740
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
3741
- // Only send start_date if type is .custom and field is not empty
3742
- if let startDateText = txtFieldSelectDateGrailPayBankView?.text, !startDateText.isEmpty {
3743
- let inputFormatter = DateFormatter()
3744
- inputFormatter.dateFormat = "dd/MM/yyyy"
3745
-
3746
- let outputFormatter = DateFormatter()
3747
- outputFormatter.dateFormat = "MM/dd/yyyy"
3748
-
3749
- if let date = inputFormatter.date(from: startDateText) {
3750
- let apiFormattedDate = outputFormatter.string(from: date)
3751
- params["start_date"] = apiFormattedDate
3752
- } else {
3753
- print("Invalid date format in startDateText")
3754
- }
3820
+ if let startDateText = txtFieldSelectDateGrailPayBankView?.text, !startDateText.isEmpty {
3821
+ let inputFormatter = DateFormatter()
3822
+ inputFormatter.dateFormat = "dd/MM/yyyy"
3823
+
3824
+ let outputFormatter = DateFormatter()
3825
+ outputFormatter.dateFormat = "MM/dd/yyyy"
3826
+
3827
+ if let date = inputFormatter.date(from: startDateText) {
3828
+ let apiFormattedDate = outputFormatter.string(from: date)
3829
+ params["start_date"] = apiFormattedDate
3830
+ } else {
3831
+ print("Invalid date format in startDateText")
3755
3832
  }
3756
3833
  }
3757
3834
 
3835
+ // interval is still required
3758
3836
  params["interval"] = txtFieldChosePlanGrailPayBankView.text.lowercased()
3759
3837
  }
3760
3838
 
@@ -3958,26 +4036,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
3958
4036
  params["description"] = "Hosted payment checkout"
3959
4037
  }
3960
4038
 
4039
+ // Add these if recurring is enabled
4040
+ // if let req = request, req.is_recurring == true {
4041
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
4042
+ // // Only send start_date if type is .custom and field is not empty
4043
+ // if let startDateText = txtFieldSelectDateGrailPayBankView?.text, !startDateText.isEmpty {
4044
+ // let inputFormatter = DateFormatter()
4045
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
4046
+ //
4047
+ // let outputFormatter = DateFormatter()
4048
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
4049
+ //
4050
+ // if let date = inputFormatter.date(from: startDateText) {
4051
+ // let apiFormattedDate = outputFormatter.string(from: date)
4052
+ // params["start_date"] = apiFormattedDate
4053
+ // } else {
4054
+ // print("Invalid date format in startDateText")
4055
+ // }
4056
+ // }
4057
+ // }
4058
+ //
4059
+ // params["interval"] = txtFieldChosePlanGrailPayBankView.text.lowercased()
4060
+ // }
4061
+
3961
4062
  // Add these if recurring is enabled
3962
4063
  if let req = request, req.is_recurring == true {
3963
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
3964
- // Only send start_date if type is .custom and field is not empty
3965
- if let startDateText = txtFieldSelectDateGrailPayBankView?.text, !startDateText.isEmpty {
3966
- let inputFormatter = DateFormatter()
3967
- inputFormatter.dateFormat = "dd/MM/yyyy"
3968
-
3969
- let outputFormatter = DateFormatter()
3970
- outputFormatter.dateFormat = "MM/dd/yyyy"
3971
-
3972
- if let date = inputFormatter.date(from: startDateText) {
3973
- let apiFormattedDate = outputFormatter.string(from: date)
3974
- params["start_date"] = apiFormattedDate
3975
- } else {
3976
- print("Invalid date format in startDateText")
3977
- }
4064
+ if let startDateText = txtFieldSelectDateGrailPayBankView?.text, !startDateText.isEmpty {
4065
+ let inputFormatter = DateFormatter()
4066
+ inputFormatter.dateFormat = "dd/MM/yyyy"
4067
+
4068
+ let outputFormatter = DateFormatter()
4069
+ outputFormatter.dateFormat = "MM/dd/yyyy"
4070
+
4071
+ if let date = inputFormatter.date(from: startDateText) {
4072
+ let apiFormattedDate = outputFormatter.string(from: date)
4073
+ params["start_date"] = apiFormattedDate
4074
+ } else {
4075
+ print("Invalid date format in startDateText")
3978
4076
  }
3979
4077
  }
3980
4078
 
4079
+ // interval is still required
3981
4080
  params["interval"] = txtFieldChosePlanGrailPayBankView.text.lowercased()
3982
4081
  }
3983
4082
 
@@ -4171,26 +4270,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
4171
4270
  params["description"] = "Hosted payment checkout"
4172
4271
  }
4173
4272
 
4273
+ // Add these if recurring is enabled
4274
+ // if let req = request, req.is_recurring == true {
4275
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
4276
+ // // Only send start_date if type is .custom and field is not empty
4277
+ // if let startDateText = txtFieldSelectDateNewGrailPayBankView?.text, !startDateText.isEmpty {
4278
+ // let inputFormatter = DateFormatter()
4279
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
4280
+ //
4281
+ // let outputFormatter = DateFormatter()
4282
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
4283
+ //
4284
+ // if let date = inputFormatter.date(from: startDateText) {
4285
+ // let apiFormattedDate = outputFormatter.string(from: date)
4286
+ // params["start_date"] = apiFormattedDate
4287
+ // } else {
4288
+ // print("Invalid date format in startDateText")
4289
+ // }
4290
+ // }
4291
+ // }
4292
+ //
4293
+ // params["interval"] = txtFieldChosePlanNewGrailPayBankView.text.lowercased()
4294
+ // }
4295
+
4174
4296
  // Add these if recurring is enabled
4175
4297
  if let req = request, req.is_recurring == true {
4176
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
4177
- // Only send start_date if type is .custom and field is not empty
4178
- if let startDateText = txtFieldSelectDateNewGrailPayBankView?.text, !startDateText.isEmpty {
4179
- let inputFormatter = DateFormatter()
4180
- inputFormatter.dateFormat = "dd/MM/yyyy"
4181
-
4182
- let outputFormatter = DateFormatter()
4183
- outputFormatter.dateFormat = "MM/dd/yyyy"
4184
-
4185
- if let date = inputFormatter.date(from: startDateText) {
4186
- let apiFormattedDate = outputFormatter.string(from: date)
4187
- params["start_date"] = apiFormattedDate
4188
- } else {
4189
- print("Invalid date format in startDateText")
4190
- }
4298
+ if let startDateText = txtFieldSelectDateNewGrailPayBankView?.text, !startDateText.isEmpty {
4299
+ let inputFormatter = DateFormatter()
4300
+ inputFormatter.dateFormat = "dd/MM/yyyy"
4301
+
4302
+ let outputFormatter = DateFormatter()
4303
+ outputFormatter.dateFormat = "MM/dd/yyyy"
4304
+
4305
+ if let date = inputFormatter.date(from: startDateText) {
4306
+ let apiFormattedDate = outputFormatter.string(from: date)
4307
+ params["start_date"] = apiFormattedDate
4308
+ } else {
4309
+ print("Invalid date format in startDateText")
4191
4310
  }
4192
4311
  }
4193
4312
 
4313
+ // interval is still required
4194
4314
  params["interval"] = txtFieldChosePlanNewGrailPayBankView.text.lowercased()
4195
4315
  }
4196
4316
 
@@ -4379,26 +4499,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
4379
4499
  params["description"] = "Hosted payment checkout"
4380
4500
  }
4381
4501
 
4502
+ // Add these if recurring is enabled
4503
+ // if let req = request, req.is_recurring == true {
4504
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
4505
+ // // Only send start_date if type is .custom and field is not empty
4506
+ // if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
4507
+ // let inputFormatter = DateFormatter()
4508
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
4509
+ //
4510
+ // let outputFormatter = DateFormatter()
4511
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
4512
+ //
4513
+ // if let date = inputFormatter.date(from: startDateText) {
4514
+ // let apiFormattedDate = outputFormatter.string(from: date)
4515
+ // params["start_date"] = apiFormattedDate
4516
+ // } else {
4517
+ // print("Invalid date format in startDateText")
4518
+ // }
4519
+ // }
4520
+ // }
4521
+ //
4522
+ // params["interval"] = txtFieldSelectPlanSingleSavedBankView.text.lowercased()
4523
+ // }
4524
+
4382
4525
  // Add these if recurring is enabled
4383
4526
  if let req = request, req.is_recurring == true {
4384
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
4385
- // Only send start_date if type is .custom and field is not empty
4386
- if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
4387
- let inputFormatter = DateFormatter()
4388
- inputFormatter.dateFormat = "dd/MM/yyyy"
4389
-
4390
- let outputFormatter = DateFormatter()
4391
- outputFormatter.dateFormat = "MM/dd/yyyy"
4392
-
4393
- if let date = inputFormatter.date(from: startDateText) {
4394
- let apiFormattedDate = outputFormatter.string(from: date)
4395
- params["start_date"] = apiFormattedDate
4396
- } else {
4397
- print("Invalid date format in startDateText")
4398
- }
4527
+ if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
4528
+ let inputFormatter = DateFormatter()
4529
+ inputFormatter.dateFormat = "dd/MM/yyyy"
4530
+
4531
+ let outputFormatter = DateFormatter()
4532
+ outputFormatter.dateFormat = "MM/dd/yyyy"
4533
+
4534
+ if let date = inputFormatter.date(from: startDateText) {
4535
+ let apiFormattedDate = outputFormatter.string(from: date)
4536
+ params["start_date"] = apiFormattedDate
4537
+ } else {
4538
+ print("Invalid date format in startDateText")
4399
4539
  }
4400
4540
  }
4401
4541
 
4542
+ // interval is still required
4402
4543
  params["interval"] = txtFieldSelectPlanSingleSavedBankView.text.lowercased()
4403
4544
  }
4404
4545
 
@@ -5980,7 +6121,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5980
6121
  uRLRequest.addValue("application/json", forHTTPHeaderField: "Content-Type")
5981
6122
 
5982
6123
  let token = UserStoreSingleton.shared.customerToken
5983
- print("🔑 Setting customerToken header: \(token ?? "None")")
6124
+ // print("🔑 Setting customerToken header: \(token ?? "None")")
5984
6125
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Customer-Token")
5985
6126
 
5986
6127
  let session = URLSession.shared
@@ -6001,10 +6142,10 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6001
6142
  }
6002
6143
 
6003
6144
  do {
6004
- // Print raw JSON string for inspection
6005
- if let rawJSON = String(data: data, encoding: .utf8) {
6006
- print("📦 Raw JSON Response:\n\(rawJSON)")
6007
- }
6145
+ // // Print raw JSON string for inspection
6146
+ // if let rawJSON = String(data: data, encoding: .utf8) {
6147
+ // print("📦 Raw JSON Response:\n\(rawJSON)")
6148
+ // }
6008
6149
 
6009
6150
  if let jsonResponse = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any],
6010
6151
  let cards = jsonResponse["Cards"] as? [[String: Any]] {
@@ -6096,9 +6237,10 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6096
6237
  self.txtFieldSelectDateSingleSavedCard.isHidden = true
6097
6238
  }
6098
6239
  }
6099
- } else {
6100
- print("⚠️ JSON structure unexpected or 'Cards' key missing")
6101
6240
  }
6241
+ // else {
6242
+ // print("⚠️ JSON structure unexpected or 'Cards' key missing")
6243
+ // }
6102
6244
  } catch {
6103
6245
  print("❌ JSON parsing failed: \(error.localizedDescription)")
6104
6246
  }
@@ -6142,9 +6284,30 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6142
6284
  }
6143
6285
  }
6144
6286
 
6287
+ // if let req = request, req.is_recurring == true {
6288
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom,
6289
+ // let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
6290
+ // let inputFormatter = DateFormatter()
6291
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
6292
+ //
6293
+ // let outputFormatter = DateFormatter()
6294
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
6295
+ //
6296
+ // if let date = inputFormatter.date(from: startDateText) {
6297
+ // requestBody["start_date"] = outputFormatter.string(from: date)
6298
+ // } else {
6299
+ // print("Invalid start date format.")
6300
+ // }
6301
+ // }
6302
+ //
6303
+ // if let plan = txtFieldChosePlanCard?.text, !plan.isEmpty {
6304
+ // requestBody["interval"] = plan.lowercased()
6305
+ // }
6306
+ // }
6307
+
6308
+ // Add these if recurring is enabled
6145
6309
  if let req = request, req.is_recurring == true {
6146
- if let recurringType = req.recurringStartDateType, recurringType == .custom,
6147
- let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
6310
+ if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
6148
6311
  let inputFormatter = DateFormatter()
6149
6312
  inputFormatter.dateFormat = "dd/MM/yyyy"
6150
6313
 
@@ -6152,15 +6315,15 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6152
6315
  outputFormatter.dateFormat = "MM/dd/yyyy"
6153
6316
 
6154
6317
  if let date = inputFormatter.date(from: startDateText) {
6155
- requestBody["start_date"] = outputFormatter.string(from: date)
6318
+ let apiFormattedDate = outputFormatter.string(from: date)
6319
+ requestBody["start_date"] = apiFormattedDate
6156
6320
  } else {
6157
- print("Invalid start date format.")
6321
+ print("Invalid date format in startDateText")
6158
6322
  }
6159
6323
  }
6160
6324
 
6161
- if let plan = txtFieldChosePlanCard?.text, !plan.isEmpty {
6162
- requestBody["interval"] = plan.lowercased()
6163
- }
6325
+ // interval is still required
6326
+ requestBody["interval"] = txtFieldChosePlanCard.text.lowercased()
6164
6327
  }
6165
6328
 
6166
6329
  // ✅ Include metadata only if it has at least 1 key-value pair
@@ -6311,26 +6474,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6311
6474
  params["description"] = "Hosted payment checkout"
6312
6475
  }
6313
6476
 
6477
+ // Add these if recurring is enabled
6478
+ // if let req = request, req.is_recurring == true {
6479
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
6480
+ // // Only send start_date if type is .custom and field is not empty
6481
+ // if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
6482
+ // let inputFormatter = DateFormatter()
6483
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
6484
+ //
6485
+ // let outputFormatter = DateFormatter()
6486
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
6487
+ //
6488
+ // if let date = inputFormatter.date(from: startDateText) {
6489
+ // let apiFormattedDate = outputFormatter.string(from: date)
6490
+ // params["start_date"] = apiFormattedDate
6491
+ // } else {
6492
+ // print("Invalid date format in startDateText")
6493
+ // }
6494
+ // }
6495
+ // }
6496
+ //
6497
+ // params["interval"] = txtFieldChosePlanCard.text.lowercased()
6498
+ // }
6499
+
6314
6500
  // Add these if recurring is enabled
6315
6501
  if let req = request, req.is_recurring == true {
6316
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
6317
- // Only send start_date if type is .custom and field is not empty
6318
- if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
6319
- let inputFormatter = DateFormatter()
6320
- inputFormatter.dateFormat = "dd/MM/yyyy"
6321
-
6322
- let outputFormatter = DateFormatter()
6323
- outputFormatter.dateFormat = "MM/dd/yyyy"
6324
-
6325
- if let date = inputFormatter.date(from: startDateText) {
6326
- let apiFormattedDate = outputFormatter.string(from: date)
6327
- params["start_date"] = apiFormattedDate
6328
- } else {
6329
- print("Invalid date format in startDateText")
6330
- }
6502
+ if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
6503
+ let inputFormatter = DateFormatter()
6504
+ inputFormatter.dateFormat = "dd/MM/yyyy"
6505
+
6506
+ let outputFormatter = DateFormatter()
6507
+ outputFormatter.dateFormat = "MM/dd/yyyy"
6508
+
6509
+ if let date = inputFormatter.date(from: startDateText) {
6510
+ let apiFormattedDate = outputFormatter.string(from: date)
6511
+ params["start_date"] = apiFormattedDate
6512
+ } else {
6513
+ print("Invalid date format in startDateText")
6331
6514
  }
6332
6515
  }
6333
6516
 
6517
+ // interval is still required
6334
6518
  params["interval"] = txtFieldChosePlanCard.text.lowercased()
6335
6519
  }
6336
6520
 
@@ -6446,26 +6630,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6446
6630
  "email": UserStoreSingleton.shared.verificationEmail ?? ""
6447
6631
  ]
6448
6632
 
6633
+ // Add these if recurring is enabled
6634
+ // if let req = request, req.is_recurring == true {
6635
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
6636
+ // // Only send start_date if type is .custom and field is not empty
6637
+ // if let startDateText = txtFieldSelectDateSingleSavedCard?.text, !startDateText.isEmpty {
6638
+ // let inputFormatter = DateFormatter()
6639
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
6640
+ //
6641
+ // let outputFormatter = DateFormatter()
6642
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
6643
+ //
6644
+ // if let date = inputFormatter.date(from: startDateText) {
6645
+ // let apiFormattedDate = outputFormatter.string(from: date)
6646
+ // params["start_date"] = apiFormattedDate
6647
+ // } else {
6648
+ // print("Invalid date format in startDateText")
6649
+ // }
6650
+ // }
6651
+ // }
6652
+ //
6653
+ // params["interval"] = txtFieldSelectPlanSingleSavedCard.text.lowercased()
6654
+ // }
6655
+
6449
6656
  // Add these if recurring is enabled
6450
6657
  if let req = request, req.is_recurring == true {
6451
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
6452
- // Only send start_date if type is .custom and field is not empty
6453
- if let startDateText = txtFieldSelectDateSingleSavedCard?.text, !startDateText.isEmpty {
6454
- let inputFormatter = DateFormatter()
6455
- inputFormatter.dateFormat = "dd/MM/yyyy"
6456
-
6457
- let outputFormatter = DateFormatter()
6458
- outputFormatter.dateFormat = "MM/dd/yyyy"
6459
-
6460
- if let date = inputFormatter.date(from: startDateText) {
6461
- let apiFormattedDate = outputFormatter.string(from: date)
6462
- params["start_date"] = apiFormattedDate
6463
- } else {
6464
- print("Invalid date format in startDateText")
6465
- }
6658
+ if let startDateText = txtFieldSelectDateSingleSavedCard?.text, !startDateText.isEmpty {
6659
+ let inputFormatter = DateFormatter()
6660
+ inputFormatter.dateFormat = "dd/MM/yyyy"
6661
+
6662
+ let outputFormatter = DateFormatter()
6663
+ outputFormatter.dateFormat = "MM/dd/yyyy"
6664
+
6665
+ if let date = inputFormatter.date(from: startDateText) {
6666
+ let apiFormattedDate = outputFormatter.string(from: date)
6667
+ params["start_date"] = apiFormattedDate
6668
+ } else {
6669
+ print("Invalid date format in startDateText")
6466
6670
  }
6467
6671
  }
6468
6672
 
6673
+ // interval is still required
6469
6674
  params["interval"] = txtFieldSelectPlanSingleSavedCard.text.lowercased()
6470
6675
  }
6471
6676
 
@@ -6634,26 +6839,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6634
6839
  params["description"] = "Hosted payment checkout"
6635
6840
  }
6636
6841
 
6842
+ // Add these if recurring is enabled
6843
+ // if let req = request, req.is_recurring == true {
6844
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
6845
+ // // Only send start_date if type is .custom and field is not empty
6846
+ // if let startDateText = txtFieldSelectDateSingleSavedCard?.text, !startDateText.isEmpty {
6847
+ // let inputFormatter = DateFormatter()
6848
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
6849
+ //
6850
+ // let outputFormatter = DateFormatter()
6851
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
6852
+ //
6853
+ // if let date = inputFormatter.date(from: startDateText) {
6854
+ // let apiFormattedDate = outputFormatter.string(from: date)
6855
+ // params["start_date"] = apiFormattedDate
6856
+ // } else {
6857
+ // print("Invalid date format in startDateText")
6858
+ // }
6859
+ // }
6860
+ // }
6861
+ //
6862
+ // params["interval"] = txtFieldSelectPlanSingleSavedCard.text.lowercased()
6863
+ // }
6864
+
6637
6865
  // Add these if recurring is enabled
6638
6866
  if let req = request, req.is_recurring == true {
6639
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
6640
- // Only send start_date if type is .custom and field is not empty
6641
- if let startDateText = txtFieldSelectDateSingleSavedCard?.text, !startDateText.isEmpty {
6642
- let inputFormatter = DateFormatter()
6643
- inputFormatter.dateFormat = "dd/MM/yyyy"
6644
-
6645
- let outputFormatter = DateFormatter()
6646
- outputFormatter.dateFormat = "MM/dd/yyyy"
6647
-
6648
- if let date = inputFormatter.date(from: startDateText) {
6649
- let apiFormattedDate = outputFormatter.string(from: date)
6650
- params["start_date"] = apiFormattedDate
6651
- } else {
6652
- print("Invalid date format in startDateText")
6653
- }
6867
+ if let startDateText = txtFieldSelectDateSingleSavedCard?.text, !startDateText.isEmpty {
6868
+ let inputFormatter = DateFormatter()
6869
+ inputFormatter.dateFormat = "dd/MM/yyyy"
6870
+
6871
+ let outputFormatter = DateFormatter()
6872
+ outputFormatter.dateFormat = "MM/dd/yyyy"
6873
+
6874
+ if let date = inputFormatter.date(from: startDateText) {
6875
+ let apiFormattedDate = outputFormatter.string(from: date)
6876
+ params["start_date"] = apiFormattedDate
6877
+ } else {
6878
+ print("Invalid date format in startDateText")
6654
6879
  }
6655
6880
  }
6656
6881
 
6882
+ // interval is still required
6657
6883
  params["interval"] = txtFieldSelectPlanSingleSavedCard.text.lowercased()
6658
6884
  }
6659
6885
 
@@ -6869,26 +7095,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6869
7095
  params["username"] = emailPrefix
6870
7096
  }
6871
7097
 
7098
+ // Add these if recurring is enabled
7099
+ // if let req = request, req.is_recurring == true {
7100
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
7101
+ // // Only send start_date if type is .custom and field is not empty
7102
+ // if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
7103
+ // let inputFormatter = DateFormatter()
7104
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
7105
+ //
7106
+ // let outputFormatter = DateFormatter()
7107
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
7108
+ //
7109
+ // if let date = inputFormatter.date(from: startDateText) {
7110
+ // let apiFormattedDate = outputFormatter.string(from: date)
7111
+ // params["start_date"] = apiFormattedDate
7112
+ // } else {
7113
+ // print("Invalid date format in startDateText")
7114
+ // }
7115
+ // }
7116
+ // }
7117
+ //
7118
+ // params["interval"] = txtFieldSelectPlanNewCardView.text.lowercased()
7119
+ // }
7120
+
6872
7121
  // Add these if recurring is enabled
6873
7122
  if let req = request, req.is_recurring == true {
6874
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
6875
- // Only send start_date if type is .custom and field is not empty
6876
- if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
6877
- let inputFormatter = DateFormatter()
6878
- inputFormatter.dateFormat = "dd/MM/yyyy"
6879
-
6880
- let outputFormatter = DateFormatter()
6881
- outputFormatter.dateFormat = "MM/dd/yyyy"
6882
-
6883
- if let date = inputFormatter.date(from: startDateText) {
6884
- let apiFormattedDate = outputFormatter.string(from: date)
6885
- params["start_date"] = apiFormattedDate
6886
- } else {
6887
- print("Invalid date format in startDateText")
6888
- }
7123
+ if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
7124
+ let inputFormatter = DateFormatter()
7125
+ inputFormatter.dateFormat = "dd/MM/yyyy"
7126
+
7127
+ let outputFormatter = DateFormatter()
7128
+ outputFormatter.dateFormat = "MM/dd/yyyy"
7129
+
7130
+ if let date = inputFormatter.date(from: startDateText) {
7131
+ let apiFormattedDate = outputFormatter.string(from: date)
7132
+ params["start_date"] = apiFormattedDate
7133
+ } else {
7134
+ print("Invalid date format in startDateText")
6889
7135
  }
6890
7136
  }
6891
7137
 
7138
+ // interval is still required
6892
7139
  params["interval"] = txtFieldSelectPlanNewCardView.text.lowercased()
6893
7140
  }
6894
7141
 
@@ -7105,26 +7352,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7105
7352
  params["description"] = "Hosted payment checkout"
7106
7353
  }
7107
7354
 
7355
+ // Add these if recurring is enabled
7356
+ // if let req = request, req.is_recurring == true {
7357
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
7358
+ // // Only send start_date if type is .custom and field is not empty
7359
+ // if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
7360
+ // let inputFormatter = DateFormatter()
7361
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
7362
+ //
7363
+ // let outputFormatter = DateFormatter()
7364
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
7365
+ //
7366
+ // if let date = inputFormatter.date(from: startDateText) {
7367
+ // let apiFormattedDate = outputFormatter.string(from: date)
7368
+ // params["start_date"] = apiFormattedDate
7369
+ // } else {
7370
+ // print("Invalid date format in startDateText")
7371
+ // }
7372
+ // }
7373
+ // }
7374
+ //
7375
+ // params["interval"] = txtFieldSelectPlanNewCardView.text.lowercased()
7376
+ // }
7377
+
7108
7378
  // Add these if recurring is enabled
7109
7379
  if let req = request, req.is_recurring == true {
7110
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
7111
- // Only send start_date if type is .custom and field is not empty
7112
- if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
7113
- let inputFormatter = DateFormatter()
7114
- inputFormatter.dateFormat = "dd/MM/yyyy"
7115
-
7116
- let outputFormatter = DateFormatter()
7117
- outputFormatter.dateFormat = "MM/dd/yyyy"
7118
-
7119
- if let date = inputFormatter.date(from: startDateText) {
7120
- let apiFormattedDate = outputFormatter.string(from: date)
7121
- params["start_date"] = apiFormattedDate
7122
- } else {
7123
- print("Invalid date format in startDateText")
7124
- }
7380
+ if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
7381
+ let inputFormatter = DateFormatter()
7382
+ inputFormatter.dateFormat = "dd/MM/yyyy"
7383
+
7384
+ let outputFormatter = DateFormatter()
7385
+ outputFormatter.dateFormat = "MM/dd/yyyy"
7386
+
7387
+ if let date = inputFormatter.date(from: startDateText) {
7388
+ let apiFormattedDate = outputFormatter.string(from: date)
7389
+ params["start_date"] = apiFormattedDate
7390
+ } else {
7391
+ print("Invalid date format in startDateText")
7125
7392
  }
7126
7393
  }
7127
7394
 
7395
+ // interval is still required
7128
7396
  params["interval"] = txtFieldSelectPlanNewCardView.text.lowercased()
7129
7397
  }
7130
7398
 
@@ -7250,7 +7518,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7250
7518
  request.addValue("application/json", forHTTPHeaderField: "Content-Type")
7251
7519
 
7252
7520
  let token = UserStoreSingleton.shared.customerToken
7253
- print("Setting customerToken header: \(token ?? "None")")
7521
+ // print("Setting customerToken header: \(token ?? "None")")
7254
7522
  request.addValue(token ?? "", forHTTPHeaderField: "Customer-Token")
7255
7523
 
7256
7524
  // Get the text fields from the selected cell and trim whitespace
@@ -7499,7 +7767,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7499
7767
  return
7500
7768
  }
7501
7769
 
7502
- print("Setting customerToken header: \(token)")
7770
+ // print("Setting customerToken header: \(token)")
7503
7771
  urlRequest.addValue(token, forHTTPHeaderField: "Customer-Token")
7504
7772
 
7505
7773
  let session = URLSession.shared
@@ -7691,26 +7959,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7691
7959
  }
7692
7960
  }
7693
7961
 
7962
+ // Add these if recurring is enabled
7963
+ // if let req = request, req.is_recurring == true {
7964
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
7965
+ // // Only send start_date if type is .custom and field is not empty
7966
+ // if let startDateText = txtFieldSelectDateViewBankFields?.text, !startDateText.isEmpty {
7967
+ // let inputFormatter = DateFormatter()
7968
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
7969
+ //
7970
+ // let outputFormatter = DateFormatter()
7971
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
7972
+ //
7973
+ // if let date = inputFormatter.date(from: startDateText) {
7974
+ // let apiFormattedDate = outputFormatter.string(from: date)
7975
+ // params["start_date"] = apiFormattedDate
7976
+ // } else {
7977
+ // print("Invalid date format in startDateText")
7978
+ // }
7979
+ // }
7980
+ // }
7981
+ //
7982
+ // params["interval"] = txtFieldSelectPlanViewBankFields.text.lowercased()
7983
+ // }
7984
+
7694
7985
  // Add these if recurring is enabled
7695
7986
  if let req = request, req.is_recurring == true {
7696
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
7697
- // Only send start_date if type is .custom and field is not empty
7698
- if let startDateText = txtFieldSelectDateViewBankFields?.text, !startDateText.isEmpty {
7699
- let inputFormatter = DateFormatter()
7700
- inputFormatter.dateFormat = "dd/MM/yyyy"
7701
-
7702
- let outputFormatter = DateFormatter()
7703
- outputFormatter.dateFormat = "MM/dd/yyyy"
7704
-
7705
- if let date = inputFormatter.date(from: startDateText) {
7706
- let apiFormattedDate = outputFormatter.string(from: date)
7707
- params["start_date"] = apiFormattedDate
7708
- } else {
7709
- print("Invalid date format in startDateText")
7710
- }
7987
+ if let startDateText = txtFieldSelectDateViewBankFields?.text, !startDateText.isEmpty {
7988
+ let inputFormatter = DateFormatter()
7989
+ inputFormatter.dateFormat = "dd/MM/yyyy"
7990
+
7991
+ let outputFormatter = DateFormatter()
7992
+ outputFormatter.dateFormat = "MM/dd/yyyy"
7993
+
7994
+ if let date = inputFormatter.date(from: startDateText) {
7995
+ let apiFormattedDate = outputFormatter.string(from: date)
7996
+ params["start_date"] = apiFormattedDate
7997
+ } else {
7998
+ print("Invalid date format in startDateText")
7711
7999
  }
7712
8000
  }
7713
8001
 
8002
+ // interval is still required
7714
8003
  params["interval"] = txtFieldSelectPlanViewBankFields.text.lowercased()
7715
8004
  }
7716
8005
 
@@ -7932,26 +8221,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
7932
8221
  params["description"] = "Hosted payment checkout"
7933
8222
  }
7934
8223
 
8224
+ // Add these if recurring is enabled
8225
+ // if let req = request, req.is_recurring == true {
8226
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
8227
+ // // Only send start_date if type is .custom and field is not empty
8228
+ // if let startDateText = txtFieldSelectDateViewBankFields?.text, !startDateText.isEmpty {
8229
+ // let inputFormatter = DateFormatter()
8230
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
8231
+ //
8232
+ // let outputFormatter = DateFormatter()
8233
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
8234
+ //
8235
+ // if let date = inputFormatter.date(from: startDateText) {
8236
+ // let apiFormattedDate = outputFormatter.string(from: date)
8237
+ // params["start_date"] = apiFormattedDate
8238
+ // } else {
8239
+ // print("Invalid date format in startDateText")
8240
+ // }
8241
+ // }
8242
+ // }
8243
+ //
8244
+ // params["interval"] = txtFieldSelectPlanViewBankFields.text.lowercased()
8245
+ // }
8246
+
7935
8247
  // Add these if recurring is enabled
7936
8248
  if let req = request, req.is_recurring == true {
7937
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
7938
- // Only send start_date if type is .custom and field is not empty
7939
- if let startDateText = txtFieldSelectDateViewBankFields?.text, !startDateText.isEmpty {
7940
- let inputFormatter = DateFormatter()
7941
- inputFormatter.dateFormat = "dd/MM/yyyy"
7942
-
7943
- let outputFormatter = DateFormatter()
7944
- outputFormatter.dateFormat = "MM/dd/yyyy"
7945
-
7946
- if let date = inputFormatter.date(from: startDateText) {
7947
- let apiFormattedDate = outputFormatter.string(from: date)
7948
- params["start_date"] = apiFormattedDate
7949
- } else {
7950
- print("Invalid date format in startDateText")
7951
- }
8249
+ if let startDateText = txtFieldSelectDateViewBankFields?.text, !startDateText.isEmpty {
8250
+ let inputFormatter = DateFormatter()
8251
+ inputFormatter.dateFormat = "dd/MM/yyyy"
8252
+
8253
+ let outputFormatter = DateFormatter()
8254
+ outputFormatter.dateFormat = "MM/dd/yyyy"
8255
+
8256
+ if let date = inputFormatter.date(from: startDateText) {
8257
+ let apiFormattedDate = outputFormatter.string(from: date)
8258
+ params["start_date"] = apiFormattedDate
8259
+ } else {
8260
+ print("Invalid date format in startDateText")
7952
8261
  }
7953
8262
  }
7954
8263
 
8264
+ // interval is still required
7955
8265
  params["interval"] = txtFieldSelectPlanViewBankFields.text.lowercased()
7956
8266
  }
7957
8267
 
@@ -8083,26 +8393,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
8083
8393
  "email": UserStoreSingleton.shared.verificationEmail ?? ""
8084
8394
  ]
8085
8395
 
8396
+ // Add these if recurring is enabled
8397
+ // if let req = request, req.is_recurring == true {
8398
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
8399
+ // // Only send start_date if type is .custom and field is not empty
8400
+ // if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
8401
+ // let inputFormatter = DateFormatter()
8402
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
8403
+ //
8404
+ // let outputFormatter = DateFormatter()
8405
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
8406
+ //
8407
+ // if let date = inputFormatter.date(from: startDateText) {
8408
+ // let apiFormattedDate = outputFormatter.string(from: date)
8409
+ // params["start_date"] = apiFormattedDate
8410
+ // } else {
8411
+ // print("Invalid date format in startDateText")
8412
+ // }
8413
+ // }
8414
+ // }
8415
+ //
8416
+ // params["interval"] = txtFieldSelectPlanSingleSavedBankView.text.lowercased()
8417
+ // }
8418
+
8086
8419
  // Add these if recurring is enabled
8087
8420
  if let req = request, req.is_recurring == true {
8088
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
8089
- // Only send start_date if type is .custom and field is not empty
8090
- if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
8091
- let inputFormatter = DateFormatter()
8092
- inputFormatter.dateFormat = "dd/MM/yyyy"
8093
-
8094
- let outputFormatter = DateFormatter()
8095
- outputFormatter.dateFormat = "MM/dd/yyyy"
8096
-
8097
- if let date = inputFormatter.date(from: startDateText) {
8098
- let apiFormattedDate = outputFormatter.string(from: date)
8099
- params["start_date"] = apiFormattedDate
8100
- } else {
8101
- print("Invalid date format in startDateText")
8102
- }
8421
+ if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
8422
+ let inputFormatter = DateFormatter()
8423
+ inputFormatter.dateFormat = "dd/MM/yyyy"
8424
+
8425
+ let outputFormatter = DateFormatter()
8426
+ outputFormatter.dateFormat = "MM/dd/yyyy"
8427
+
8428
+ if let date = inputFormatter.date(from: startDateText) {
8429
+ let apiFormattedDate = outputFormatter.string(from: date)
8430
+ params["start_date"] = apiFormattedDate
8431
+ } else {
8432
+ print("Invalid date format in startDateText")
8103
8433
  }
8104
8434
  }
8105
8435
 
8436
+ // interval is still required
8106
8437
  params["interval"] = txtFieldSelectPlanSingleSavedBankView.text.lowercased()
8107
8438
  }
8108
8439
 
@@ -8303,26 +8634,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
8303
8634
  params["description"] = "Hosted payment checkout"
8304
8635
  }
8305
8636
 
8637
+ // Add these if recurring is enabled
8638
+ // if let req = request, req.is_recurring == true {
8639
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
8640
+ // // Only send start_date if type is .custom and field is not empty
8641
+ // if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
8642
+ // let inputFormatter = DateFormatter()
8643
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
8644
+ //
8645
+ // let outputFormatter = DateFormatter()
8646
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
8647
+ //
8648
+ // if let date = inputFormatter.date(from: startDateText) {
8649
+ // let apiFormattedDate = outputFormatter.string(from: date)
8650
+ // params["start_date"] = apiFormattedDate
8651
+ // } else {
8652
+ // print("Invalid date format in startDateText")
8653
+ // }
8654
+ // }
8655
+ // }
8656
+ //
8657
+ // params["interval"] = txtFieldSelectPlanSingleSavedBankView.text.lowercased()
8658
+ // }
8659
+
8306
8660
  // Add these if recurring is enabled
8307
8661
  if let req = request, req.is_recurring == true {
8308
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
8309
- // Only send start_date if type is .custom and field is not empty
8310
- if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
8311
- let inputFormatter = DateFormatter()
8312
- inputFormatter.dateFormat = "dd/MM/yyyy"
8313
-
8314
- let outputFormatter = DateFormatter()
8315
- outputFormatter.dateFormat = "MM/dd/yyyy"
8316
-
8317
- if let date = inputFormatter.date(from: startDateText) {
8318
- let apiFormattedDate = outputFormatter.string(from: date)
8319
- params["start_date"] = apiFormattedDate
8320
- } else {
8321
- print("Invalid date format in startDateText")
8322
- }
8662
+ if let startDateText = txtFieldSelectDateSingleSavedBankView?.text, !startDateText.isEmpty {
8663
+ let inputFormatter = DateFormatter()
8664
+ inputFormatter.dateFormat = "dd/MM/yyyy"
8665
+
8666
+ let outputFormatter = DateFormatter()
8667
+ outputFormatter.dateFormat = "MM/dd/yyyy"
8668
+
8669
+ if let date = inputFormatter.date(from: startDateText) {
8670
+ let apiFormattedDate = outputFormatter.string(from: date)
8671
+ params["start_date"] = apiFormattedDate
8672
+ } else {
8673
+ print("Invalid date format in startDateText")
8323
8674
  }
8324
8675
  }
8325
8676
 
8677
+ // interval is still required
8326
8678
  params["interval"] = txtFieldSelectPlanSingleSavedBankView.text.lowercased()
8327
8679
  }
8328
8680
 
@@ -8463,26 +8815,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
8463
8815
  "levelIndicator": 1,
8464
8816
  ]
8465
8817
 
8818
+ // Add these if recurring is enabled
8819
+ // if let req = request, req.is_recurring == true {
8820
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
8821
+ // // Only send start_date if type is .custom and field is not empty
8822
+ // if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
8823
+ // let inputFormatter = DateFormatter()
8824
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
8825
+ //
8826
+ // let outputFormatter = DateFormatter()
8827
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
8828
+ //
8829
+ // if let date = inputFormatter.date(from: startDateText) {
8830
+ // let apiFormattedDate = outputFormatter.string(from: date)
8831
+ // params["start_date"] = apiFormattedDate
8832
+ // } else {
8833
+ // print("Invalid date format in startDateText")
8834
+ // }
8835
+ // }
8836
+ // }
8837
+ //
8838
+ // params["interval"] = txtFieldSelectPlanNewAccountView.text.lowercased()
8839
+ // }
8840
+
8466
8841
  // Add these if recurring is enabled
8467
8842
  if let req = request, req.is_recurring == true {
8468
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
8469
- // Only send start_date if type is .custom and field is not empty
8470
- if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
8471
- let inputFormatter = DateFormatter()
8472
- inputFormatter.dateFormat = "dd/MM/yyyy"
8473
-
8474
- let outputFormatter = DateFormatter()
8475
- outputFormatter.dateFormat = "MM/dd/yyyy"
8476
-
8477
- if let date = inputFormatter.date(from: startDateText) {
8478
- let apiFormattedDate = outputFormatter.string(from: date)
8479
- params["start_date"] = apiFormattedDate
8480
- } else {
8481
- print("Invalid date format in startDateText")
8482
- }
8843
+ if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
8844
+ let inputFormatter = DateFormatter()
8845
+ inputFormatter.dateFormat = "dd/MM/yyyy"
8846
+
8847
+ let outputFormatter = DateFormatter()
8848
+ outputFormatter.dateFormat = "MM/dd/yyyy"
8849
+
8850
+ if let date = inputFormatter.date(from: startDateText) {
8851
+ let apiFormattedDate = outputFormatter.string(from: date)
8852
+ params["start_date"] = apiFormattedDate
8853
+ } else {
8854
+ print("Invalid date format in startDateText")
8483
8855
  }
8484
8856
  }
8485
8857
 
8858
+ // interval is still required
8486
8859
  params["interval"] = txtFieldSelectPlanNewAccountView.text.lowercased()
8487
8860
  }
8488
8861
 
@@ -8691,26 +9064,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
8691
9064
  params["description"] = "Hosted payment checkout"
8692
9065
  }
8693
9066
 
9067
+ // Add these if recurring is enabled
9068
+ // if let req = request, req.is_recurring == true {
9069
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
9070
+ // // Only send start_date if type is .custom and field is not empty
9071
+ // if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
9072
+ // let inputFormatter = DateFormatter()
9073
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
9074
+ //
9075
+ // let outputFormatter = DateFormatter()
9076
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
9077
+ //
9078
+ // if let date = inputFormatter.date(from: startDateText) {
9079
+ // let apiFormattedDate = outputFormatter.string(from: date)
9080
+ // params["start_date"] = apiFormattedDate
9081
+ // } else {
9082
+ // print("Invalid date format in startDateText")
9083
+ // }
9084
+ // }
9085
+ // }
9086
+ //
9087
+ // params["interval"] = txtFieldSelectPlanNewAccountView.text.lowercased()
9088
+ // }
9089
+
8694
9090
  // Add these if recurring is enabled
8695
9091
  if let req = request, req.is_recurring == true {
8696
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
8697
- // Only send start_date if type is .custom and field is not empty
8698
- if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
8699
- let inputFormatter = DateFormatter()
8700
- inputFormatter.dateFormat = "dd/MM/yyyy"
8701
-
8702
- let outputFormatter = DateFormatter()
8703
- outputFormatter.dateFormat = "MM/dd/yyyy"
8704
-
8705
- if let date = inputFormatter.date(from: startDateText) {
8706
- let apiFormattedDate = outputFormatter.string(from: date)
8707
- params["start_date"] = apiFormattedDate
8708
- } else {
8709
- print("Invalid date format in startDateText")
8710
- }
9092
+ if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
9093
+ let inputFormatter = DateFormatter()
9094
+ inputFormatter.dateFormat = "dd/MM/yyyy"
9095
+
9096
+ let outputFormatter = DateFormatter()
9097
+ outputFormatter.dateFormat = "MM/dd/yyyy"
9098
+
9099
+ if let date = inputFormatter.date(from: startDateText) {
9100
+ let apiFormattedDate = outputFormatter.string(from: date)
9101
+ params["start_date"] = apiFormattedDate
9102
+ } else {
9103
+ print("Invalid date format in startDateText")
8711
9104
  }
8712
9105
  }
8713
9106
 
9107
+ // interval is still required
8714
9108
  params["interval"] = txtFieldSelectPlanNewAccountView.text.lowercased()
8715
9109
  }
8716
9110
 
@@ -8861,26 +9255,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
8861
9255
  params["username"] = emailPrefix
8862
9256
  }
8863
9257
 
9258
+ // Add these if recurring is enabled
9259
+ // if let req = request, req.is_recurring == true {
9260
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
9261
+ // // Only send start_date if type is .custom and field is not empty
9262
+ // if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
9263
+ // let inputFormatter = DateFormatter()
9264
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
9265
+ //
9266
+ // let outputFormatter = DateFormatter()
9267
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
9268
+ //
9269
+ // if let date = inputFormatter.date(from: startDateText) {
9270
+ // let apiFormattedDate = outputFormatter.string(from: date)
9271
+ // params["start_date"] = apiFormattedDate
9272
+ // } else {
9273
+ // print("Invalid date format in startDateText")
9274
+ // }
9275
+ // }
9276
+ // }
9277
+ //
9278
+ // params["interval"] = txtFieldSelectPlanNewAccountView.text.lowercased()
9279
+ // }
9280
+
8864
9281
  // Add these if recurring is enabled
8865
9282
  if let req = request, req.is_recurring == true {
8866
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
8867
- // Only send start_date if type is .custom and field is not empty
8868
- if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
8869
- let inputFormatter = DateFormatter()
8870
- inputFormatter.dateFormat = "dd/MM/yyyy"
8871
-
8872
- let outputFormatter = DateFormatter()
8873
- outputFormatter.dateFormat = "MM/dd/yyyy"
8874
-
8875
- if let date = inputFormatter.date(from: startDateText) {
8876
- let apiFormattedDate = outputFormatter.string(from: date)
8877
- params["start_date"] = apiFormattedDate
8878
- } else {
8879
- print("Invalid date format in startDateText")
8880
- }
9283
+ if let startDateText = txtFieldSelectDateNewAccountView?.text, !startDateText.isEmpty {
9284
+ let inputFormatter = DateFormatter()
9285
+ inputFormatter.dateFormat = "dd/MM/yyyy"
9286
+
9287
+ let outputFormatter = DateFormatter()
9288
+ outputFormatter.dateFormat = "MM/dd/yyyy"
9289
+
9290
+ if let date = inputFormatter.date(from: startDateText) {
9291
+ let apiFormattedDate = outputFormatter.string(from: date)
9292
+ params["start_date"] = apiFormattedDate
9293
+ } else {
9294
+ print("Invalid date format in startDateText")
8881
9295
  }
8882
9296
  }
8883
9297
 
9298
+ // interval is still required
8884
9299
  params["interval"] = txtFieldSelectPlanNewAccountView.text.lowercased()
8885
9300
  }
8886
9301
 
@@ -9006,7 +9421,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
9006
9421
  request.addValue("application/json", forHTTPHeaderField: "Content-Type")
9007
9422
 
9008
9423
  let token = UserStoreSingleton.shared.customerToken
9009
- print("Setting customerToken header: \(token ?? "None")")
9424
+ // print("Setting customerToken header: \(token ?? "None")")
9010
9425
  request.addValue(token ?? "", forHTTPHeaderField: "Customer-Token")
9011
9426
 
9012
9427
  let session = URLSession.shared
@@ -9387,26 +9802,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
9387
9802
  params["description"] = "Hosted payment checkout"
9388
9803
  }
9389
9804
 
9805
+ // Add these if recurring is enabled
9806
+ // if let req = request, req.is_recurring == true {
9807
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
9808
+ // // Only send start_date if type is .custom and field is not empty
9809
+ // if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
9810
+ // let inputFormatter = DateFormatter()
9811
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
9812
+ //
9813
+ // let outputFormatter = DateFormatter()
9814
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
9815
+ //
9816
+ // if let date = inputFormatter.date(from: startDateText) {
9817
+ // let apiFormattedDate = outputFormatter.string(from: date)
9818
+ // params["start_date"] = apiFormattedDate
9819
+ // } else {
9820
+ // print("Invalid date format in startDateText")
9821
+ // }
9822
+ // }
9823
+ // }
9824
+ //
9825
+ // params["interval"] = txtFieldChosePlanCard.text.lowercased()
9826
+ // }
9827
+
9390
9828
  // Add these if recurring is enabled
9391
9829
  if let req = request, req.is_recurring == true {
9392
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
9393
- // Only send start_date if type is .custom and field is not empty
9394
- if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
9395
- let inputFormatter = DateFormatter()
9396
- inputFormatter.dateFormat = "dd/MM/yyyy"
9397
-
9398
- let outputFormatter = DateFormatter()
9399
- outputFormatter.dateFormat = "MM/dd/yyyy"
9400
-
9401
- if let date = inputFormatter.date(from: startDateText) {
9402
- let apiFormattedDate = outputFormatter.string(from: date)
9403
- params["start_date"] = apiFormattedDate
9404
- } else {
9405
- print("Invalid date format in startDateText")
9406
- }
9830
+ if let startDateText = txtFieldStartDateCard?.text, !startDateText.isEmpty {
9831
+ let inputFormatter = DateFormatter()
9832
+ inputFormatter.dateFormat = "dd/MM/yyyy"
9833
+
9834
+ let outputFormatter = DateFormatter()
9835
+ outputFormatter.dateFormat = "MM/dd/yyyy"
9836
+
9837
+ if let date = inputFormatter.date(from: startDateText) {
9838
+ let apiFormattedDate = outputFormatter.string(from: date)
9839
+ params["start_date"] = apiFormattedDate
9840
+ } else {
9841
+ print("Invalid date format in startDateText")
9407
9842
  }
9408
9843
  }
9409
9844
 
9845
+ // interval is still required
9410
9846
  params["interval"] = txtFieldChosePlanCard.text.lowercased()
9411
9847
  }
9412
9848
 
@@ -9679,26 +10115,47 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
9679
10115
  params["description"] = "Hosted payment checkout"
9680
10116
  }
9681
10117
 
10118
+ // Add these if recurring is enabled
10119
+ // if let req = request, req.is_recurring == true {
10120
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
10121
+ // // Only send start_date if type is .custom and field is not empty
10122
+ // if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
10123
+ // let inputFormatter = DateFormatter()
10124
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
10125
+ //
10126
+ // let outputFormatter = DateFormatter()
10127
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
10128
+ //
10129
+ // if let date = inputFormatter.date(from: startDateText) {
10130
+ // let apiFormattedDate = outputFormatter.string(from: date)
10131
+ // params["start_date"] = apiFormattedDate
10132
+ // } else {
10133
+ // print("Invalid date format in startDateText")
10134
+ // }
10135
+ // }
10136
+ // }
10137
+ //
10138
+ // params["interval"] = txtFieldSelectPlanNewCardView.text.lowercased()
10139
+ // }
10140
+
9682
10141
  // Add these if recurring is enabled
9683
10142
  if let req = request, req.is_recurring == true {
9684
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
9685
- // Only send start_date if type is .custom and field is not empty
9686
- if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
9687
- let inputFormatter = DateFormatter()
9688
- inputFormatter.dateFormat = "dd/MM/yyyy"
9689
-
9690
- let outputFormatter = DateFormatter()
9691
- outputFormatter.dateFormat = "MM/dd/yyyy"
9692
-
9693
- if let date = inputFormatter.date(from: startDateText) {
9694
- let apiFormattedDate = outputFormatter.string(from: date)
9695
- params["start_date"] = apiFormattedDate
9696
- } else {
9697
- print("Invalid date format in startDateText")
9698
- }
10143
+ if let startDateText = txtFieldSelectDateNewCardView?.text, !startDateText.isEmpty {
10144
+ let inputFormatter = DateFormatter()
10145
+ inputFormatter.dateFormat = "dd/MM/yyyy"
10146
+
10147
+ let outputFormatter = DateFormatter()
10148
+ outputFormatter.dateFormat = "MM/dd/yyyy"
10149
+
10150
+ if let date = inputFormatter.date(from: startDateText) {
10151
+ let apiFormattedDate = outputFormatter.string(from: date)
10152
+ params["start_date"] = apiFormattedDate
10153
+ } else {
10154
+ print("Invalid date format in startDateText")
9699
10155
  }
9700
10156
  }
9701
10157
 
10158
+ // interval is still required
9702
10159
  params["interval"] = txtFieldSelectPlanNewCardView.text.lowercased()
9703
10160
  }
9704
10161