@jimrising/easymerchantsdk-react-native 1.4.2 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$2.dex +0 -0
- package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
- package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/transformed/classes/classes_dex/classes.dex +0 -0
- package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$2.class +0 -0
- package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
- package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId2 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$2.class.uniqueId0 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId3 +0 -0
- package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +0 -1
- package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +49 -52
- package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +74 -45
- package/ios/Pods/ViewControllers/OTPVerificationVC.swift +109 -33
- package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +1036 -146
- package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +0 -248
- package/ios/easymerchantsdk.podspec +1 -1
- package/ios/easymerchantsdk.storyboard +291 -92
- package/package.json +1 -1
|
@@ -205,6 +205,8 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
205
205
|
@IBOutlet weak var txtFieldSelectDateGrailPayBankView: TextFieldStackView!
|
|
206
206
|
@IBOutlet weak var bankIconGrailPayBankView: UIImageView!
|
|
207
207
|
@IBOutlet weak var viewSaveAccountForFutureGrailPayView: UIStackView!
|
|
208
|
+
@IBOutlet weak var txtFieldEmailGrailPayView: TextFieldStackView!
|
|
209
|
+
@IBOutlet weak var viewTxtFieldEmailGrailPayView: UIView!
|
|
208
210
|
|
|
209
211
|
//New GrailPay Account
|
|
210
212
|
@IBOutlet weak var viewAddNewGrailPayAccount: UIView!
|
|
@@ -274,7 +276,6 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
274
276
|
@IBOutlet weak var heightSubViewNewAccountFields: NSLayoutConstraint!
|
|
275
277
|
@IBOutlet weak var viewSaveAccountForFutureNewAccountView: UIStackView!
|
|
276
278
|
|
|
277
|
-
|
|
278
279
|
//Crypto
|
|
279
280
|
@IBOutlet weak var viewCrypto: UIView!
|
|
280
281
|
@IBOutlet weak var viewCryptoTryAgain: UIView!
|
|
@@ -362,7 +363,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
362
363
|
var isFrom = String()
|
|
363
364
|
|
|
364
365
|
//Blink Card
|
|
365
|
-
//
|
|
366
|
+
// var blinkCardRecognizer: MBCBlinkCardRecognizer!
|
|
366
367
|
|
|
367
368
|
// Variables for Card Scanning Data Back
|
|
368
369
|
var cardNumber: String?
|
|
@@ -422,29 +423,69 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
422
423
|
self.view.addGestureRecognizer(tapGesture)
|
|
423
424
|
|
|
424
425
|
//// Check if billingInfoData is available
|
|
426
|
+
// if let billingInfoData = request.billingInfoData,
|
|
427
|
+
// let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
428
|
+
//
|
|
429
|
+
// let billingVisible = fieldSection.visibility.billing
|
|
430
|
+
// let suffix = billingVisible ? " (Billing Info)" : " (Additional Info)"
|
|
431
|
+
// let buttonText = (request?.submitButtonText?.isEmpty == false
|
|
432
|
+
// ? request!.submitButtonText! + suffix
|
|
433
|
+
// : "Next" + suffix)
|
|
434
|
+
//
|
|
435
|
+
// btnNext.setTitle(buttonText, for: .normal)
|
|
436
|
+
// btnPayNowNewCardView.setTitle(buttonText, for: .normal)
|
|
437
|
+
// btnPayNowNewAccountView.setTitle(buttonText, for: .normal)
|
|
438
|
+
// btnPayNowSingleCard.setTitle(buttonText, for: .normal)
|
|
439
|
+
// btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
|
|
440
|
+
// } else {
|
|
441
|
+
// let amountValue = request?.amount ?? 0
|
|
442
|
+
// let amountText = String(format: "$%.2f", amountValue)
|
|
443
|
+
// let submitText = request?.submitButtonText
|
|
444
|
+
//
|
|
445
|
+
// let defaultTitle = (submitText?.isEmpty == false)
|
|
446
|
+
// ? "\(submitText!) (\(amountText))"
|
|
447
|
+
// : "Pay Now (\(amountText))"
|
|
448
|
+
//
|
|
449
|
+
// btnNext.setTitle(defaultTitle, for: .normal)
|
|
450
|
+
// btnPayNowNewCardView.setTitle(defaultTitle, for: .normal)
|
|
451
|
+
// btnPayNowNewAccountView.setTitle(defaultTitle, for: .normal)
|
|
452
|
+
// btnPayNowSingleCard.setTitle(defaultTitle, for: .normal)
|
|
453
|
+
// btnPayNowSingleAccountView.setTitle(defaultTitle, for: .normal)
|
|
454
|
+
// }
|
|
455
|
+
|
|
425
456
|
if let billingInfoData = request.billingInfoData,
|
|
426
457
|
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
427
458
|
|
|
428
459
|
let billingVisible = fieldSection.visibility.billing
|
|
429
|
-
let
|
|
430
|
-
let
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
460
|
+
let additionalVisible = fieldSection.visibility.additional
|
|
461
|
+
let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
|
|
462
|
+
let amountText = String(format: "$%.2f", request?.amount ?? 0)
|
|
463
|
+
|
|
464
|
+
var buttonText: String
|
|
465
|
+
|
|
466
|
+
if !billingVisible && !additionalVisible {
|
|
467
|
+
// Both visibility false – show submitText with amount only
|
|
468
|
+
buttonText = "\(submitText) (\(amountText))"
|
|
469
|
+
} else if billingVisible {
|
|
470
|
+
buttonText = "\(submitText) (Billing Info)"
|
|
471
|
+
} else if additionalVisible {
|
|
472
|
+
buttonText = "\(submitText) (Additional Info)"
|
|
473
|
+
} else {
|
|
474
|
+
// Fallback
|
|
475
|
+
buttonText = "\(submitText) (\(amountText))"
|
|
476
|
+
}
|
|
477
|
+
|
|
434
478
|
btnNext.setTitle(buttonText, for: .normal)
|
|
435
479
|
btnPayNowNewCardView.setTitle(buttonText, for: .normal)
|
|
436
480
|
btnPayNowNewAccountView.setTitle(buttonText, for: .normal)
|
|
437
481
|
btnPayNowSingleCard.setTitle(buttonText, for: .normal)
|
|
438
482
|
btnPayNowSingleAccountView.setTitle(buttonText, for: .normal)
|
|
439
483
|
} else {
|
|
440
|
-
|
|
441
|
-
let amountText = String(format: "$%.2f",
|
|
442
|
-
let submitText = request?.submitButtonText
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
? "\(submitText!) (\(amountText))"
|
|
446
|
-
: "Pay Now (\(amountText))"
|
|
447
|
-
|
|
484
|
+
// When no billingInfoData present
|
|
485
|
+
let amountText = String(format: "$%.2f", request?.amount ?? 0)
|
|
486
|
+
let submitText = request?.submitButtonText?.isEmpty == false ? request!.submitButtonText! : "Pay Now"
|
|
487
|
+
let defaultTitle = "\(submitText) (\(amountText))"
|
|
488
|
+
|
|
448
489
|
btnNext.setTitle(defaultTitle, for: .normal)
|
|
449
490
|
btnPayNowNewCardView.setTitle(defaultTitle, for: .normal)
|
|
450
491
|
btnPayNowNewAccountView.setTitle(defaultTitle, for: .normal)
|
|
@@ -989,6 +1030,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
989
1030
|
txtFieldRoutingNumberNewAccountView.tintColor = uiColor
|
|
990
1031
|
txtFieldNameOnCardNewCardView.tintColor = uiColor
|
|
991
1032
|
txtFieldNameOnCardUpdateCardView.tintColor = uiColor
|
|
1033
|
+
txtFieldEmailGrailPayView.tintColor = uiColor
|
|
1034
|
+
txtFieldEmailCardView.tintColor = uiColor
|
|
1035
|
+
txtFieldEmailAccountView.tintColor = uiColor
|
|
992
1036
|
cardNumberTextField.tintColor = uiColor
|
|
993
1037
|
cardExpiryTextField.tintColor = uiColor
|
|
994
1038
|
cardCvvTextField.tintColor = uiColor
|
|
@@ -1260,6 +1304,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
1260
1304
|
txtFieldAccountNumber.delegate = self
|
|
1261
1305
|
txtFieldConfirmBankAccount.delegate = self
|
|
1262
1306
|
txtFieldEmailAccountView.textField.delegate = self
|
|
1307
|
+
txtFieldEmailGrailPayView.textField.delegate = self
|
|
1263
1308
|
}
|
|
1264
1309
|
|
|
1265
1310
|
private func updateSaveButtons() {
|
|
@@ -2086,10 +2131,75 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2086
2131
|
}
|
|
2087
2132
|
|
|
2088
2133
|
// Redirect based on billing visibility
|
|
2089
|
-
if fieldSection.visibility.billing {
|
|
2090
|
-
// Instantiate BillingInfoVC and pass the card details
|
|
2091
|
-
let billingInfoVC = UIStoryboard(name: "easymerchantsdk", bundle: .easyPayBundle).instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2092
|
-
|
|
2134
|
+
// if fieldSection.visibility.billing {
|
|
2135
|
+
// // Instantiate BillingInfoVC and pass the card details
|
|
2136
|
+
// let billingInfoVC = UIStoryboard(name: "easymerchantsdk", bundle: .easyPayBundle).instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2137
|
+
//
|
|
2138
|
+
// // Pass the card details
|
|
2139
|
+
// billingInfoVC.cardNumber = cardNumber
|
|
2140
|
+
// billingInfoVC.expiryDate = expiryDate
|
|
2141
|
+
// billingInfoVC.cvv = cvv
|
|
2142
|
+
// billingInfoVC.nameOnCard = nameOnCard
|
|
2143
|
+
// billingInfoVC.isSavedNewCard = self.isSavedNewCardForFuture
|
|
2144
|
+
//
|
|
2145
|
+
// billingInfoVC.isFrom = "AddNewCard"
|
|
2146
|
+
// billingInfoVC.amount = Int(self.request.amount ?? 0)
|
|
2147
|
+
// billingInfoVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
2148
|
+
//
|
|
2149
|
+
// if let billingInfoData = self.request.billingInfoData {
|
|
2150
|
+
// billingInfoVC.billingInfoData = billingInfoData
|
|
2151
|
+
// }
|
|
2152
|
+
//
|
|
2153
|
+
// billingInfoVC.request = self.request
|
|
2154
|
+
// billingInfoVC.chosenPlan = self.txtFieldSelectPlanNewCardView.text
|
|
2155
|
+
// billingInfoVC.startDate = self.txtFieldSelectDateNewCardView.text
|
|
2156
|
+
//
|
|
2157
|
+
// billingInfoVC.billingInfo = fieldSection.billing
|
|
2158
|
+
// billingInfoVC.additionalInfo = fieldSection.additional
|
|
2159
|
+
// billingInfoVC.visibility = fieldSection.visibility
|
|
2160
|
+
//
|
|
2161
|
+
// // Navigate to BillingInfoVC
|
|
2162
|
+
// self.navigationController?.pushViewController(billingInfoVC, animated: true)
|
|
2163
|
+
// }
|
|
2164
|
+
// else {
|
|
2165
|
+
// let additionalInfoVC = UIStoryboard(name: "easymerchantsdk", bundle: .easyPayBundle).instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2166
|
+
//
|
|
2167
|
+
// // Pass the card details
|
|
2168
|
+
// additionalInfoVC.cardNumber = cardNumber
|
|
2169
|
+
// additionalInfoVC.expiryDate = expiryDate
|
|
2170
|
+
// additionalInfoVC.cvv = cvv
|
|
2171
|
+
// additionalInfoVC.nameOnCard = nameOnCard
|
|
2172
|
+
// additionalInfoVC.isSavedNewCard = self.isSavedNewCardForFuture
|
|
2173
|
+
//
|
|
2174
|
+
// additionalInfoVC.isFrom = "AddNewCard"
|
|
2175
|
+
// additionalInfoVC.amount = Int(self.request.amount ?? 0)
|
|
2176
|
+
// additionalInfoVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
2177
|
+
//
|
|
2178
|
+
// if let billingInfoData = self.request.billingInfoData {
|
|
2179
|
+
// additionalInfoVC.billingInfoData = billingInfoData
|
|
2180
|
+
// }
|
|
2181
|
+
//
|
|
2182
|
+
// additionalInfoVC.request = self.request
|
|
2183
|
+
// additionalInfoVC.chosenPlan = self.txtFieldSelectPlanNewCardView.text
|
|
2184
|
+
// additionalInfoVC.startDate = self.txtFieldSelectDateNewCardView.text
|
|
2185
|
+
//
|
|
2186
|
+
// additionalInfoVC.billingInfo = fieldSection.billing
|
|
2187
|
+
// additionalInfoVC.additionalInfo = fieldSection.additional
|
|
2188
|
+
// additionalInfoVC.visibility = fieldSection.visibility
|
|
2189
|
+
//
|
|
2190
|
+
// self.navigationController?.pushViewController(additionalInfoVC, animated: true)
|
|
2191
|
+
// }
|
|
2192
|
+
|
|
2193
|
+
|
|
2194
|
+
let showBilling = fieldSection.visibility.billing
|
|
2195
|
+
let showAdditional = fieldSection.visibility.additional
|
|
2196
|
+
|
|
2197
|
+
if !showBilling && !showAdditional {
|
|
2198
|
+
self.threeDSecurePaymentNewCardApi(customerId: UserStoreSingleton.shared.customerId ?? "")
|
|
2199
|
+
}
|
|
2200
|
+
else if showBilling {
|
|
2201
|
+
// Push to BillingInfoVC
|
|
2202
|
+
let billingInfoVC = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2093
2203
|
// Pass the card details
|
|
2094
2204
|
billingInfoVC.cardNumber = cardNumber
|
|
2095
2205
|
billingInfoVC.expiryDate = expiryDate
|
|
@@ -2112,13 +2222,11 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2112
2222
|
billingInfoVC.billingInfo = fieldSection.billing
|
|
2113
2223
|
billingInfoVC.additionalInfo = fieldSection.additional
|
|
2114
2224
|
billingInfoVC.visibility = fieldSection.visibility
|
|
2115
|
-
|
|
2116
|
-
// Navigate to BillingInfoVC
|
|
2117
2225
|
self.navigationController?.pushViewController(billingInfoVC, animated: true)
|
|
2118
2226
|
}
|
|
2119
2227
|
else {
|
|
2120
|
-
|
|
2121
|
-
|
|
2228
|
+
// Push to AdditionalInfoVC
|
|
2229
|
+
let additionalInfoVC = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2122
2230
|
// Pass the card details
|
|
2123
2231
|
additionalInfoVC.cardNumber = cardNumber
|
|
2124
2232
|
additionalInfoVC.expiryDate = expiryDate
|
|
@@ -2141,7 +2249,6 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2141
2249
|
additionalInfoVC.billingInfo = fieldSection.billing
|
|
2142
2250
|
additionalInfoVC.additionalInfo = fieldSection.additional
|
|
2143
2251
|
additionalInfoVC.visibility = fieldSection.visibility
|
|
2144
|
-
|
|
2145
2252
|
self.navigationController?.pushViewController(additionalInfoVC, animated: true)
|
|
2146
2253
|
}
|
|
2147
2254
|
}
|
|
@@ -2554,6 +2661,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2554
2661
|
|
|
2555
2662
|
@IBAction private func actionBtnLinkGrailPayBankAccount(_ sender: UIButton) {
|
|
2556
2663
|
if isBankAccountConnected {
|
|
2664
|
+
|
|
2665
|
+
let email = self.txtFieldEmailGrailPayView.text.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
2666
|
+
|
|
2557
2667
|
// Recurring Plan + Date Validation (only if is_recurring is true)
|
|
2558
2668
|
if let req = self.request, req.is_recurring == true {
|
|
2559
2669
|
if self.txtFieldChosePlanGrailPayBankView.text.isEmpty {
|
|
@@ -2569,6 +2679,15 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2569
2679
|
}
|
|
2570
2680
|
}
|
|
2571
2681
|
|
|
2682
|
+
if email.isEmpty {
|
|
2683
|
+
self.showAlert(title: "Missing Information", message: "Please enter an email address.")
|
|
2684
|
+
return
|
|
2685
|
+
}
|
|
2686
|
+
else if !self.isValidEmail(email) {
|
|
2687
|
+
self.showAlert(title: "Invalid Email", message: "Please enter a valid email address.")
|
|
2688
|
+
return
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2572
2691
|
guard agreeTermsAndCondtition else {
|
|
2573
2692
|
self.showAlert(title: "Terms and Conditions", message: "Please agree to the terms and conditions.")
|
|
2574
2693
|
return
|
|
@@ -2588,7 +2707,69 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2588
2707
|
print("Billing Info Data: \(jsonDict)")
|
|
2589
2708
|
|
|
2590
2709
|
// Redirect based on billing visibility
|
|
2591
|
-
if fieldSection.visibility.billing {
|
|
2710
|
+
// if fieldSection.visibility.billing {
|
|
2711
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2712
|
+
// vc.billingInfoData = billingInfoData
|
|
2713
|
+
// vc.request = self.request
|
|
2714
|
+
// vc.chosenPlan = self.txtFieldChosePlanGrailPayBankView.text
|
|
2715
|
+
// vc.startDate = self.txtFieldSelectDateGrailPayBankView.text
|
|
2716
|
+
// vc.selectedPaymentMethod = "GrailPay"
|
|
2717
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
2718
|
+
// vc.grailPayAccountID = self.grailPayAccountID
|
|
2719
|
+
// vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
2720
|
+
// vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
2721
|
+
// vc.amount = self.amount
|
|
2722
|
+
// vc.billingInfo = fieldSection.billing
|
|
2723
|
+
// vc.additionalInfo = fieldSection.additional
|
|
2724
|
+
// vc.visibility = fieldSection.visibility
|
|
2725
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
2726
|
+
// vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2727
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
2728
|
+
// }
|
|
2729
|
+
// else {
|
|
2730
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2731
|
+
// vc.billingInfoData = billingInfoData
|
|
2732
|
+
// vc.request = self.request
|
|
2733
|
+
// vc.chosenPlan = self.txtFieldChosePlanGrailPayBankView.text
|
|
2734
|
+
// vc.startDate = self.txtFieldSelectDateGrailPayBankView.text
|
|
2735
|
+
// vc.selectedPaymentMethod = "GrailPay"
|
|
2736
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
2737
|
+
// vc.grailPayAccountID = self.grailPayAccountID
|
|
2738
|
+
// vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
2739
|
+
// vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
2740
|
+
// vc.amount = self.amount
|
|
2741
|
+
// vc.billingInfo = fieldSection.billing
|
|
2742
|
+
// vc.additionalInfo = fieldSection.additional
|
|
2743
|
+
// vc.visibility = fieldSection.visibility
|
|
2744
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
2745
|
+
// vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2746
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
2747
|
+
// }
|
|
2748
|
+
|
|
2749
|
+
let showBilling = fieldSection.visibility.billing
|
|
2750
|
+
let showAdditional = fieldSection.visibility.additional
|
|
2751
|
+
|
|
2752
|
+
if !showBilling && !showAdditional {
|
|
2753
|
+
// Navigate directly to EmailVerificationVC
|
|
2754
|
+
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "EmailVerificationVC") as! EmailVerificationVC
|
|
2755
|
+
vc.easyPayDelegate = self.easyPayDelegate
|
|
2756
|
+
vc.grailPayAccountID = self.grailPayAccountID
|
|
2757
|
+
vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
2758
|
+
vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
2759
|
+
vc.chosenPlan = self.txtFieldChosePlanGrailPayBankView.text
|
|
2760
|
+
vc.startDate = self.txtFieldSelectDateGrailPayBankView.text
|
|
2761
|
+
vc.request = self.request
|
|
2762
|
+
vc.isSavedForFuture = self.isSavedForFuture
|
|
2763
|
+
vc.selectedPaymentMethod = "GrailPay"
|
|
2764
|
+
vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2765
|
+
vc.billingInfoData = billingInfoData // Send the data even if not shown
|
|
2766
|
+
vc.billingInfo = fieldSection.billing
|
|
2767
|
+
vc.additionalInfo = fieldSection.additional
|
|
2768
|
+
vc.visibility = fieldSection.visibility
|
|
2769
|
+
self.navigationController?.pushViewController(vc, animated: true)
|
|
2770
|
+
}
|
|
2771
|
+
else if showBilling {
|
|
2772
|
+
// Push to BillingInfoVC
|
|
2592
2773
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2593
2774
|
vc.billingInfoData = billingInfoData
|
|
2594
2775
|
vc.request = self.request
|
|
@@ -2604,9 +2785,11 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2604
2785
|
vc.additionalInfo = fieldSection.additional
|
|
2605
2786
|
vc.visibility = fieldSection.visibility
|
|
2606
2787
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
2788
|
+
vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2607
2789
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2608
2790
|
}
|
|
2609
2791
|
else {
|
|
2792
|
+
// Push to AdditionalInfoVC
|
|
2610
2793
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2611
2794
|
vc.billingInfoData = billingInfoData
|
|
2612
2795
|
vc.request = self.request
|
|
@@ -2622,8 +2805,10 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2622
2805
|
vc.additionalInfo = fieldSection.additional
|
|
2623
2806
|
vc.visibility = fieldSection.visibility
|
|
2624
2807
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
2808
|
+
vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2625
2809
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2626
2810
|
}
|
|
2811
|
+
|
|
2627
2812
|
}
|
|
2628
2813
|
}
|
|
2629
2814
|
}
|
|
@@ -2644,6 +2829,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2644
2829
|
vc.request = self.request
|
|
2645
2830
|
vc.isSavedForFuture = self.isSavedForFuture
|
|
2646
2831
|
vc.selectedPaymentMethod = "GrailPay"
|
|
2832
|
+
vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2647
2833
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2648
2834
|
}
|
|
2649
2835
|
} else {
|
|
@@ -2660,7 +2846,54 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2660
2846
|
print("Billing Info Data: \(jsonDict)")
|
|
2661
2847
|
|
|
2662
2848
|
// Redirect based on billing visibility
|
|
2663
|
-
if fieldSection.visibility.billing {
|
|
2849
|
+
// if fieldSection.visibility.billing {
|
|
2850
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2851
|
+
// vc.billingInfoData = billingInfoData
|
|
2852
|
+
// vc.request = self.request
|
|
2853
|
+
// vc.chosenPlan = self.txtFieldChosePlanGrailPayBankView.text
|
|
2854
|
+
// vc.startDate = self.txtFieldSelectDateGrailPayBankView.text
|
|
2855
|
+
// vc.selectedPaymentMethod = "GrailPay"
|
|
2856
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
2857
|
+
// vc.grailPayAccountID = self.grailPayAccountID
|
|
2858
|
+
// vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
2859
|
+
// vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
2860
|
+
// vc.amount = self.amount
|
|
2861
|
+
// vc.billingInfo = fieldSection.billing
|
|
2862
|
+
// vc.additionalInfo = fieldSection.additional
|
|
2863
|
+
// vc.visibility = fieldSection.visibility
|
|
2864
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
2865
|
+
// vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2866
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
2867
|
+
// }
|
|
2868
|
+
// else {
|
|
2869
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2870
|
+
// vc.billingInfoData = billingInfoData
|
|
2871
|
+
// vc.request = self.request
|
|
2872
|
+
// vc.chosenPlan = self.txtFieldChosePlanGrailPayBankView.text
|
|
2873
|
+
// vc.startDate = self.txtFieldSelectDateGrailPayBankView.text
|
|
2874
|
+
// vc.selectedPaymentMethod = "GrailPay"
|
|
2875
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
2876
|
+
// vc.grailPayAccountID = self.grailPayAccountID
|
|
2877
|
+
// vc.selectedGrailPayAccountType = self.selectedGrailPayAccountType
|
|
2878
|
+
// vc.selectedGrailPayAccountName = self.selectedGrailPayAccountName
|
|
2879
|
+
// vc.amount = self.amount
|
|
2880
|
+
// vc.billingInfo = fieldSection.billing
|
|
2881
|
+
// vc.additionalInfo = fieldSection.additional
|
|
2882
|
+
// vc.visibility = fieldSection.visibility
|
|
2883
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
2884
|
+
// vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2885
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
2886
|
+
// }
|
|
2887
|
+
|
|
2888
|
+
|
|
2889
|
+
let showBilling = fieldSection.visibility.billing
|
|
2890
|
+
let showAdditional = fieldSection.visibility.additional
|
|
2891
|
+
|
|
2892
|
+
if !showBilling && !showAdditional {
|
|
2893
|
+
self.grailPayAccountChargeApi()
|
|
2894
|
+
}
|
|
2895
|
+
else if showBilling {
|
|
2896
|
+
// Push to BillingInfoVC
|
|
2664
2897
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2665
2898
|
vc.billingInfoData = billingInfoData
|
|
2666
2899
|
vc.request = self.request
|
|
@@ -2676,9 +2909,11 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2676
2909
|
vc.additionalInfo = fieldSection.additional
|
|
2677
2910
|
vc.visibility = fieldSection.visibility
|
|
2678
2911
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
2912
|
+
vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2679
2913
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2680
2914
|
}
|
|
2681
2915
|
else {
|
|
2916
|
+
// Push to AdditionalInfoVC
|
|
2682
2917
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2683
2918
|
vc.billingInfoData = billingInfoData
|
|
2684
2919
|
vc.request = self.request
|
|
@@ -2694,6 +2929,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2694
2929
|
vc.additionalInfo = fieldSection.additional
|
|
2695
2930
|
vc.visibility = fieldSection.visibility
|
|
2696
2931
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
2932
|
+
vc.userEmail = self.txtFieldEmailGrailPayView.text
|
|
2697
2933
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2698
2934
|
}
|
|
2699
2935
|
}
|
|
@@ -2751,7 +2987,52 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2751
2987
|
print("Billing Info Data: \(jsonDict)")
|
|
2752
2988
|
|
|
2753
2989
|
// Redirect based on billing visibility
|
|
2754
|
-
if fieldSection.visibility.billing {
|
|
2990
|
+
// if fieldSection.visibility.billing {
|
|
2991
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2992
|
+
// vc.billingInfoData = billingInfoData
|
|
2993
|
+
// vc.request = self.request
|
|
2994
|
+
// vc.chosenPlan = self.txtFieldChosePlanNewGrailPayBankView.text
|
|
2995
|
+
// vc.startDate = self.txtFieldSelectDateNewGrailPayBankView.text
|
|
2996
|
+
// vc.selectedPaymentMethod = "NewGrailPayAccount"
|
|
2997
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
2998
|
+
// vc.grailPayAccountID = self.newGrailPayAccountID
|
|
2999
|
+
// vc.selectedGrailPayAccountType = self.selectedNewGrailPayAccountType
|
|
3000
|
+
// vc.selectedGrailPayAccountName = self.selectedNewGrailPayAccountName
|
|
3001
|
+
// vc.amount = self.amount
|
|
3002
|
+
// vc.billingInfo = fieldSection.billing
|
|
3003
|
+
// vc.additionalInfo = fieldSection.additional
|
|
3004
|
+
// vc.visibility = fieldSection.visibility
|
|
3005
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
3006
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
3007
|
+
// }
|
|
3008
|
+
// else {
|
|
3009
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
3010
|
+
// vc.billingInfoData = billingInfoData
|
|
3011
|
+
// vc.request = self.request
|
|
3012
|
+
// vc.chosenPlan = self.txtFieldChosePlanNewGrailPayBankView.text
|
|
3013
|
+
// vc.startDate = self.txtFieldSelectDateNewGrailPayBankView.text
|
|
3014
|
+
// vc.selectedPaymentMethod = "NewGrailPayAccount"
|
|
3015
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
3016
|
+
// vc.grailPayAccountID = self.newGrailPayAccountID
|
|
3017
|
+
// vc.selectedGrailPayAccountType = self.selectedNewGrailPayAccountType
|
|
3018
|
+
// vc.selectedGrailPayAccountName = self.selectedNewGrailPayAccountName
|
|
3019
|
+
// vc.amount = self.amount
|
|
3020
|
+
// vc.billingInfo = fieldSection.billing
|
|
3021
|
+
// vc.additionalInfo = fieldSection.additional
|
|
3022
|
+
// vc.visibility = fieldSection.visibility
|
|
3023
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
3024
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
3025
|
+
// }
|
|
3026
|
+
|
|
3027
|
+
|
|
3028
|
+
let showBilling = fieldSection.visibility.billing
|
|
3029
|
+
let showAdditional = fieldSection.visibility.additional
|
|
3030
|
+
|
|
3031
|
+
if !showBilling && !showAdditional {
|
|
3032
|
+
self.grailPayNewAccountChargeApi()
|
|
3033
|
+
}
|
|
3034
|
+
else if showBilling {
|
|
3035
|
+
// Push to BillingInfoVC
|
|
2755
3036
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2756
3037
|
vc.billingInfoData = billingInfoData
|
|
2757
3038
|
vc.request = self.request
|
|
@@ -2770,6 +3051,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2770
3051
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2771
3052
|
}
|
|
2772
3053
|
else {
|
|
3054
|
+
// Push to AdditionalInfoVC
|
|
2773
3055
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2774
3056
|
vc.billingInfoData = billingInfoData
|
|
2775
3057
|
vc.request = self.request
|
|
@@ -2787,6 +3069,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2787
3069
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
2788
3070
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2789
3071
|
}
|
|
3072
|
+
|
|
2790
3073
|
}
|
|
2791
3074
|
}
|
|
2792
3075
|
}
|
|
@@ -2809,7 +3092,51 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2809
3092
|
print("Billing Info Data: \(jsonDict)")
|
|
2810
3093
|
|
|
2811
3094
|
// Redirect based on billing visibility
|
|
2812
|
-
if fieldSection.visibility.billing {
|
|
3095
|
+
// if fieldSection.visibility.billing {
|
|
3096
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
3097
|
+
// vc.billingInfoData = billingInfoData
|
|
3098
|
+
// vc.request = self.request
|
|
3099
|
+
// vc.chosenPlan = self.txtFieldChosePlanNewGrailPayBankView.text
|
|
3100
|
+
// vc.startDate = self.txtFieldSelectDateNewGrailPayBankView.text
|
|
3101
|
+
// vc.selectedPaymentMethod = "NewGrailPayAccount"
|
|
3102
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
3103
|
+
// vc.grailPayAccountID = self.newGrailPayAccountID
|
|
3104
|
+
// vc.selectedGrailPayAccountType = self.selectedNewGrailPayAccountType
|
|
3105
|
+
// vc.selectedGrailPayAccountName = self.selectedNewGrailPayAccountName
|
|
3106
|
+
// vc.amount = self.amount
|
|
3107
|
+
// vc.billingInfo = fieldSection.billing
|
|
3108
|
+
// vc.additionalInfo = fieldSection.additional
|
|
3109
|
+
// vc.visibility = fieldSection.visibility
|
|
3110
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
3111
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
3112
|
+
// }
|
|
3113
|
+
// else {
|
|
3114
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
3115
|
+
// vc.billingInfoData = billingInfoData
|
|
3116
|
+
// vc.request = self.request
|
|
3117
|
+
// vc.chosenPlan = self.txtFieldChosePlanNewGrailPayBankView.text
|
|
3118
|
+
// vc.startDate = self.txtFieldSelectDateNewGrailPayBankView.text
|
|
3119
|
+
// vc.selectedPaymentMethod = "NewGrailPayAccount"
|
|
3120
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
3121
|
+
// vc.grailPayAccountID = self.newGrailPayAccountID
|
|
3122
|
+
// vc.selectedGrailPayAccountType = self.selectedNewGrailPayAccountType
|
|
3123
|
+
// vc.selectedGrailPayAccountName = self.selectedNewGrailPayAccountName
|
|
3124
|
+
// vc.amount = self.amount
|
|
3125
|
+
// vc.billingInfo = fieldSection.billing
|
|
3126
|
+
// vc.additionalInfo = fieldSection.additional
|
|
3127
|
+
// vc.visibility = fieldSection.visibility
|
|
3128
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
3129
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
3130
|
+
// }
|
|
3131
|
+
|
|
3132
|
+
let showBilling = fieldSection.visibility.billing
|
|
3133
|
+
let showAdditional = fieldSection.visibility.additional
|
|
3134
|
+
|
|
3135
|
+
if !showBilling && !showAdditional {
|
|
3136
|
+
self.grailPayNewAccountChargeApi()
|
|
3137
|
+
}
|
|
3138
|
+
else if showBilling {
|
|
3139
|
+
// Push to BillingInfoVC
|
|
2813
3140
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
2814
3141
|
vc.billingInfoData = billingInfoData
|
|
2815
3142
|
vc.request = self.request
|
|
@@ -2828,6 +3155,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2828
3155
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2829
3156
|
}
|
|
2830
3157
|
else {
|
|
3158
|
+
// Push to AdditionalInfoVC
|
|
2831
3159
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
2832
3160
|
vc.billingInfoData = billingInfoData
|
|
2833
3161
|
vc.request = self.request
|
|
@@ -2845,6 +3173,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2845
3173
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
2846
3174
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
2847
3175
|
}
|
|
3176
|
+
|
|
2848
3177
|
}
|
|
2849
3178
|
}
|
|
2850
3179
|
}
|
|
@@ -2982,6 +3311,120 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2982
3311
|
"email": UserStoreSingleton.shared.merchantEmail ?? ""
|
|
2983
3312
|
]
|
|
2984
3313
|
|
|
3314
|
+
// if let billingInfoData = request.billingInfoData {
|
|
3315
|
+
// do {
|
|
3316
|
+
// let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
3317
|
+
//
|
|
3318
|
+
// // Process Billing Info if available and contains any non-empty value
|
|
3319
|
+
// let billing = fieldSection.billing.filter { !($0.value.trimmingCharacters(in: .whitespaces).isEmpty) }
|
|
3320
|
+
// if !billing.isEmpty {
|
|
3321
|
+
// var billingDict: [String: Any] = [:]
|
|
3322
|
+
// billing.forEach { billingDict[$0.name] = $0.value }
|
|
3323
|
+
//
|
|
3324
|
+
// if let address = billingDict["address"] as? String { params["address"] = address }
|
|
3325
|
+
// if let country = billingDict["country"] as? String { params["country"] = country }
|
|
3326
|
+
// if let state = billingDict["state"] as? String { params["state"] = state }
|
|
3327
|
+
// if let city = billingDict["city"] as? String { params["city"] = city }
|
|
3328
|
+
// if let postalCode = billingDict["postal_code"] as? String { params["zip"] = postalCode }
|
|
3329
|
+
// }
|
|
3330
|
+
//
|
|
3331
|
+
// // Process Additional Info if available and contains any non-empty value
|
|
3332
|
+
// let additional = fieldSection.additional.filter { !($0.value.trimmingCharacters(in: .whitespaces).isEmpty) }
|
|
3333
|
+
// if !additional.isEmpty {
|
|
3334
|
+
// var additionalDict: [String: Any] = [:]
|
|
3335
|
+
// additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3336
|
+
//
|
|
3337
|
+
// if let desc = additionalDict["description"] as? String {
|
|
3338
|
+
// params["description"] = desc
|
|
3339
|
+
// }
|
|
3340
|
+
//
|
|
3341
|
+
// if let phone = additionalDict["phone_number"] as? String {
|
|
3342
|
+
// params["phone_number"] = phone
|
|
3343
|
+
// }
|
|
3344
|
+
// if let email = additionalDict["email"] as? String {
|
|
3345
|
+
// params["email"] = email
|
|
3346
|
+
// }
|
|
3347
|
+
// if let name = additionalDict["name"] as? String {
|
|
3348
|
+
// params["name"] = name
|
|
3349
|
+
// }
|
|
3350
|
+
// }
|
|
3351
|
+
//
|
|
3352
|
+
// // Set default description only if not already set
|
|
3353
|
+
// if params["description"] == nil {
|
|
3354
|
+
// params["description"] = "Hosted payment checkout"
|
|
3355
|
+
// }
|
|
3356
|
+
//
|
|
3357
|
+
// } catch {
|
|
3358
|
+
// print("Failed to decode FieldSection: \(error)")
|
|
3359
|
+
// params["description"] = "Hosted payment checkout"
|
|
3360
|
+
// }
|
|
3361
|
+
// } else {
|
|
3362
|
+
// params["description"] = "Hosted payment checkout"
|
|
3363
|
+
// }
|
|
3364
|
+
|
|
3365
|
+
|
|
3366
|
+
if let billingInfoData = request.billingInfoData {
|
|
3367
|
+
do {
|
|
3368
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
3369
|
+
|
|
3370
|
+
// Billing Info
|
|
3371
|
+
let billing = fieldSection.billing
|
|
3372
|
+
if !billing.isEmpty {
|
|
3373
|
+
var billingDict: [String: Any] = [:]
|
|
3374
|
+
billing.forEach { billingDict[$0.name] = $0.value }
|
|
3375
|
+
|
|
3376
|
+
if let address = billingDict["address"] as? String, !address.isEmpty {
|
|
3377
|
+
params["address"] = address
|
|
3378
|
+
}
|
|
3379
|
+
if let country = billingDict["country"] as? String, !country.isEmpty {
|
|
3380
|
+
params["country"] = country
|
|
3381
|
+
}
|
|
3382
|
+
if let state = billingDict["state"] as? String, !state.isEmpty {
|
|
3383
|
+
params["state"] = state
|
|
3384
|
+
}
|
|
3385
|
+
if let city = billingDict["city"] as? String, !city.isEmpty {
|
|
3386
|
+
params["city"] = city
|
|
3387
|
+
}
|
|
3388
|
+
if let postalCode = billingDict["postal_code"] as? String, !postalCode.isEmpty {
|
|
3389
|
+
params["zip"] = postalCode
|
|
3390
|
+
}
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
// Additional Info
|
|
3394
|
+
let additional = fieldSection.additional
|
|
3395
|
+
if !additional.isEmpty {
|
|
3396
|
+
var additionalDict: [String: Any] = [:]
|
|
3397
|
+
additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3398
|
+
|
|
3399
|
+
if let desc = additionalDict["description"] as? String, !desc.isEmpty {
|
|
3400
|
+
params["description"] = desc
|
|
3401
|
+
} else {
|
|
3402
|
+
params["description"] = "Hosted payment checkout"
|
|
3403
|
+
}
|
|
3404
|
+
|
|
3405
|
+
if let phone = additionalDict["phone_number"] as? String, !phone.isEmpty {
|
|
3406
|
+
params["phone_number"] = phone
|
|
3407
|
+
}
|
|
3408
|
+
if let email = additionalDict["email"] as? String, !email.isEmpty {
|
|
3409
|
+
params["email"] = email
|
|
3410
|
+
}
|
|
3411
|
+
if let name = additionalDict["name"] as? String, !name.isEmpty {
|
|
3412
|
+
params["name"] = name
|
|
3413
|
+
}
|
|
3414
|
+
} else {
|
|
3415
|
+
// If no description in additional info, set default
|
|
3416
|
+
params["description"] = "Hosted payment checkout"
|
|
3417
|
+
}
|
|
3418
|
+
|
|
3419
|
+
} catch {
|
|
3420
|
+
print("Failed to decode FieldSection: \(error)")
|
|
3421
|
+
params["description"] = "Hosted payment checkout"
|
|
3422
|
+
}
|
|
3423
|
+
} else {
|
|
3424
|
+
// Fallback if billingInfoData is missing
|
|
3425
|
+
params["description"] = "Hosted payment checkout"
|
|
3426
|
+
}
|
|
3427
|
+
|
|
2985
3428
|
// Add these if recurring is enabled
|
|
2986
3429
|
if let req = request, req.is_recurring == true {
|
|
2987
3430
|
if let recurringType = req.recurringStartDateType, recurringType == .custom {
|
|
@@ -3053,30 +3496,19 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3053
3496
|
// Pass the selected payment method
|
|
3054
3497
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
3055
3498
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
3056
|
-
// Pass
|
|
3057
|
-
if let
|
|
3058
|
-
let
|
|
3499
|
+
// Pass billing info and additional info if available
|
|
3500
|
+
if let billingInfoData = self.request.billingInfoData,
|
|
3501
|
+
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
3059
3502
|
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
"city": billingInfoDict["city"] ?? "",
|
|
3065
|
-
"address": billingInfoDict["address"] ?? "",
|
|
3066
|
-
"state": billingInfoDict["state"] ?? ""
|
|
3067
|
-
]
|
|
3068
|
-
paymentDoneVC.billingInfo = cleanBillingInfo
|
|
3503
|
+
paymentDoneVC.billingInfoData = fieldSection.billing
|
|
3504
|
+
var billingDict: [String: Any] = [:]
|
|
3505
|
+
fieldSection.billing.forEach { billingDict[$0.name] = $0.value }
|
|
3506
|
+
paymentDoneVC.billingInfo = billingDict
|
|
3069
3507
|
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
"phone_number": additional["phone_number"] ?? "",
|
|
3075
|
-
"name": additional["name"] ?? "",
|
|
3076
|
-
"country_code": additional["country_code"] ?? ""
|
|
3077
|
-
]
|
|
3078
|
-
paymentDoneVC.additionalInfo = cleanAdditionalInfo
|
|
3079
|
-
}
|
|
3508
|
+
paymentDoneVC.additionalInfoData = fieldSection.additional
|
|
3509
|
+
var additionalDict: [String: Any] = [:]
|
|
3510
|
+
fieldSection.additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3511
|
+
paymentDoneVC.additionalInfo = additionalDict
|
|
3080
3512
|
}
|
|
3081
3513
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
3082
3514
|
}
|
|
@@ -3135,9 +3567,77 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3135
3567
|
"account_type": self.selectedNewGrailPayAccountType ?? "",
|
|
3136
3568
|
"name": self.selectedNewGrailPayAccountName ?? "",
|
|
3137
3569
|
"description": "payment checkout",
|
|
3138
|
-
"customer_id": self.grailPayNewAccountCustomerID ?? ""
|
|
3570
|
+
"customer_id": self.grailPayNewAccountCustomerID ?? "",
|
|
3571
|
+
"save_account": isSavedForFuture ? 1 : 0
|
|
3139
3572
|
]
|
|
3140
3573
|
|
|
3574
|
+
// Add is_default parameter if save_card is 1
|
|
3575
|
+
if isSavedForFuture {
|
|
3576
|
+
params["is_default"] = 1
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3579
|
+
if let billingInfoData = request.billingInfoData {
|
|
3580
|
+
do {
|
|
3581
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
3582
|
+
|
|
3583
|
+
// Billing Info
|
|
3584
|
+
let billing = fieldSection.billing
|
|
3585
|
+
if !billing.isEmpty {
|
|
3586
|
+
var billingDict: [String: Any] = [:]
|
|
3587
|
+
billing.forEach { billingDict[$0.name] = $0.value }
|
|
3588
|
+
|
|
3589
|
+
if let address = billingDict["address"] as? String, !address.isEmpty {
|
|
3590
|
+
params["address"] = address
|
|
3591
|
+
}
|
|
3592
|
+
if let country = billingDict["country"] as? String, !country.isEmpty {
|
|
3593
|
+
params["country"] = country
|
|
3594
|
+
}
|
|
3595
|
+
if let state = billingDict["state"] as? String, !state.isEmpty {
|
|
3596
|
+
params["state"] = state
|
|
3597
|
+
}
|
|
3598
|
+
if let city = billingDict["city"] as? String, !city.isEmpty {
|
|
3599
|
+
params["city"] = city
|
|
3600
|
+
}
|
|
3601
|
+
if let postalCode = billingDict["postal_code"] as? String, !postalCode.isEmpty {
|
|
3602
|
+
params["zip"] = postalCode
|
|
3603
|
+
}
|
|
3604
|
+
}
|
|
3605
|
+
|
|
3606
|
+
// Additional Info
|
|
3607
|
+
let additional = fieldSection.additional
|
|
3608
|
+
if !additional.isEmpty {
|
|
3609
|
+
var additionalDict: [String: Any] = [:]
|
|
3610
|
+
additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3611
|
+
|
|
3612
|
+
if let desc = additionalDict["description"] as? String, !desc.isEmpty {
|
|
3613
|
+
params["description"] = desc
|
|
3614
|
+
} else {
|
|
3615
|
+
params["description"] = "Hosted payment checkout"
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
if let phone = additionalDict["phone_number"] as? String, !phone.isEmpty {
|
|
3619
|
+
params["phone_number"] = phone
|
|
3620
|
+
}
|
|
3621
|
+
if let email = additionalDict["email"] as? String, !email.isEmpty {
|
|
3622
|
+
params["email"] = email
|
|
3623
|
+
}
|
|
3624
|
+
if let name = additionalDict["name"] as? String, !name.isEmpty {
|
|
3625
|
+
params["name"] = name
|
|
3626
|
+
}
|
|
3627
|
+
} else {
|
|
3628
|
+
// If no description in additional info, set default
|
|
3629
|
+
params["description"] = "Hosted payment checkout"
|
|
3630
|
+
}
|
|
3631
|
+
|
|
3632
|
+
} catch {
|
|
3633
|
+
print("Failed to decode FieldSection: \(error)")
|
|
3634
|
+
params["description"] = "Hosted payment checkout"
|
|
3635
|
+
}
|
|
3636
|
+
} else {
|
|
3637
|
+
// Fallback if billingInfoData is missing
|
|
3638
|
+
params["description"] = "Hosted payment checkout"
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3141
3641
|
// Add these if recurring is enabled
|
|
3142
3642
|
if let req = request, req.is_recurring == true {
|
|
3143
3643
|
if let recurringType = req.recurringStartDateType, recurringType == .custom {
|
|
@@ -3209,30 +3709,45 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3209
3709
|
// Pass the selected payment method
|
|
3210
3710
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
3211
3711
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
3212
|
-
// Pass billingInfo and additionalInfo
|
|
3213
|
-
if let billingData = self.request.billingInfoData,
|
|
3214
|
-
let billingInfoDict = try? JSONSerialization.jsonObject(with: billingData, options: []) as? [String: Any] {
|
|
3712
|
+
// // Pass billingInfo and additionalInfo
|
|
3713
|
+
// if let billingData = self.request.billingInfoData,
|
|
3714
|
+
// let billingInfoDict = try? JSONSerialization.jsonObject(with: billingData, options: []) as? [String: Any] {
|
|
3715
|
+
//
|
|
3716
|
+
// // Extract main billing fields
|
|
3717
|
+
// let cleanBillingInfo: [String: Any] = [
|
|
3718
|
+
// "postal_code": billingInfoDict["postal_code"] ?? "",
|
|
3719
|
+
// "country": billingInfoDict["country"] ?? "",
|
|
3720
|
+
// "city": billingInfoDict["city"] ?? "",
|
|
3721
|
+
// "address": billingInfoDict["address"] ?? "",
|
|
3722
|
+
// "state": billingInfoDict["state"] ?? ""
|
|
3723
|
+
// ]
|
|
3724
|
+
// paymentDoneVC.billingInfo = cleanBillingInfo
|
|
3725
|
+
//
|
|
3726
|
+
// // Extract additional_info
|
|
3727
|
+
// if let additional = billingInfoDict["additional_info"] as? [String: Any] {
|
|
3728
|
+
// let cleanAdditionalInfo: [String: Any] = [
|
|
3729
|
+
// "email": additional["email"] ?? "",
|
|
3730
|
+
// "phone_number": additional["phone_number"] ?? "",
|
|
3731
|
+
// "name": additional["name"] ?? "",
|
|
3732
|
+
// "country_code": additional["country_code"] ?? ""
|
|
3733
|
+
// ]
|
|
3734
|
+
// paymentDoneVC.additionalInfo = cleanAdditionalInfo
|
|
3735
|
+
// }
|
|
3736
|
+
// }
|
|
3737
|
+
|
|
3738
|
+
// Pass billing info and additional info if available
|
|
3739
|
+
if let billingInfoData = self.request.billingInfoData,
|
|
3740
|
+
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
3215
3741
|
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
"city": billingInfoDict["city"] ?? "",
|
|
3221
|
-
"address": billingInfoDict["address"] ?? "",
|
|
3222
|
-
"state": billingInfoDict["state"] ?? ""
|
|
3223
|
-
]
|
|
3224
|
-
paymentDoneVC.billingInfo = cleanBillingInfo
|
|
3742
|
+
paymentDoneVC.billingInfoData = fieldSection.billing
|
|
3743
|
+
var billingDict: [String: Any] = [:]
|
|
3744
|
+
fieldSection.billing.forEach { billingDict[$0.name] = $0.value }
|
|
3745
|
+
paymentDoneVC.billingInfo = billingDict
|
|
3225
3746
|
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
"phone_number": additional["phone_number"] ?? "",
|
|
3231
|
-
"name": additional["name"] ?? "",
|
|
3232
|
-
"country_code": additional["country_code"] ?? ""
|
|
3233
|
-
]
|
|
3234
|
-
paymentDoneVC.additionalInfo = cleanAdditionalInfo
|
|
3235
|
-
}
|
|
3747
|
+
paymentDoneVC.additionalInfoData = fieldSection.additional
|
|
3748
|
+
var additionalDict: [String: Any] = [:]
|
|
3749
|
+
fieldSection.additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3750
|
+
paymentDoneVC.additionalInfo = additionalDict
|
|
3236
3751
|
}
|
|
3237
3752
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
3238
3753
|
}
|
|
@@ -3294,6 +3809,68 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3294
3809
|
"currency": "usd",
|
|
3295
3810
|
]
|
|
3296
3811
|
|
|
3812
|
+
if let billingInfoData = request.billingInfoData {
|
|
3813
|
+
do {
|
|
3814
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
3815
|
+
|
|
3816
|
+
// Billing Info
|
|
3817
|
+
let billing = fieldSection.billing
|
|
3818
|
+
if !billing.isEmpty {
|
|
3819
|
+
var billingDict: [String: Any] = [:]
|
|
3820
|
+
billing.forEach { billingDict[$0.name] = $0.value }
|
|
3821
|
+
|
|
3822
|
+
if let address = billingDict["address"] as? String, !address.isEmpty {
|
|
3823
|
+
params["address"] = address
|
|
3824
|
+
}
|
|
3825
|
+
if let country = billingDict["country"] as? String, !country.isEmpty {
|
|
3826
|
+
params["country"] = country
|
|
3827
|
+
}
|
|
3828
|
+
if let state = billingDict["state"] as? String, !state.isEmpty {
|
|
3829
|
+
params["state"] = state
|
|
3830
|
+
}
|
|
3831
|
+
if let city = billingDict["city"] as? String, !city.isEmpty {
|
|
3832
|
+
params["city"] = city
|
|
3833
|
+
}
|
|
3834
|
+
if let postalCode = billingDict["postal_code"] as? String, !postalCode.isEmpty {
|
|
3835
|
+
params["zip"] = postalCode
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
|
|
3839
|
+
// Additional Info
|
|
3840
|
+
let additional = fieldSection.additional
|
|
3841
|
+
if !additional.isEmpty {
|
|
3842
|
+
var additionalDict: [String: Any] = [:]
|
|
3843
|
+
additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3844
|
+
|
|
3845
|
+
if let desc = additionalDict["description"] as? String, !desc.isEmpty {
|
|
3846
|
+
params["description"] = desc
|
|
3847
|
+
} else {
|
|
3848
|
+
params["description"] = "Hosted payment checkout"
|
|
3849
|
+
}
|
|
3850
|
+
|
|
3851
|
+
if let phone = additionalDict["phone_number"] as? String, !phone.isEmpty {
|
|
3852
|
+
params["phone_number"] = phone
|
|
3853
|
+
}
|
|
3854
|
+
if let email = additionalDict["email"] as? String, !email.isEmpty {
|
|
3855
|
+
params["email"] = email
|
|
3856
|
+
}
|
|
3857
|
+
if let name = additionalDict["name"] as? String, !name.isEmpty {
|
|
3858
|
+
params["name"] = name
|
|
3859
|
+
}
|
|
3860
|
+
} else {
|
|
3861
|
+
// If no description in additional info, set default
|
|
3862
|
+
params["description"] = "Hosted payment checkout"
|
|
3863
|
+
}
|
|
3864
|
+
|
|
3865
|
+
} catch {
|
|
3866
|
+
print("Failed to decode FieldSection: \(error)")
|
|
3867
|
+
params["description"] = "Hosted payment checkout"
|
|
3868
|
+
}
|
|
3869
|
+
} else {
|
|
3870
|
+
// Fallback if billingInfoData is missing
|
|
3871
|
+
params["description"] = "Hosted payment checkout"
|
|
3872
|
+
}
|
|
3873
|
+
|
|
3297
3874
|
// Add these if recurring is enabled
|
|
3298
3875
|
if let req = request, req.is_recurring == true {
|
|
3299
3876
|
if let recurringType = req.recurringStartDateType, recurringType == .custom {
|
|
@@ -3365,6 +3942,21 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3365
3942
|
// Pass the selected payment method
|
|
3366
3943
|
paymentDoneVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
3367
3944
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate // Pass the delegate
|
|
3945
|
+
|
|
3946
|
+
// Pass billing info and additional info if available
|
|
3947
|
+
if let billingInfoData = self.request.billingInfoData,
|
|
3948
|
+
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
3949
|
+
|
|
3950
|
+
paymentDoneVC.billingInfoData = fieldSection.billing
|
|
3951
|
+
var billingDict: [String: Any] = [:]
|
|
3952
|
+
fieldSection.billing.forEach { billingDict[$0.name] = $0.value }
|
|
3953
|
+
paymentDoneVC.billingInfo = billingDict
|
|
3954
|
+
|
|
3955
|
+
paymentDoneVC.additionalInfoData = fieldSection.additional
|
|
3956
|
+
var additionalDict: [String: Any] = [:]
|
|
3957
|
+
fieldSection.additional.forEach { additionalDict[$0.name] = $0.value }
|
|
3958
|
+
paymentDoneVC.additionalInfo = additionalDict
|
|
3959
|
+
}
|
|
3368
3960
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
3369
3961
|
}
|
|
3370
3962
|
}
|
|
@@ -3475,10 +4067,57 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3475
4067
|
}
|
|
3476
4068
|
}
|
|
3477
4069
|
|
|
3478
|
-
// Redirect based on billing visibility
|
|
3479
|
-
if fieldSection.visibility.billing {
|
|
4070
|
+
// // Redirect based on billing visibility
|
|
4071
|
+
// if fieldSection.visibility.billing {
|
|
4072
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
4073
|
+
// vc.cardNumber = cardNumber
|
|
4074
|
+
// vc.expiryDate = expiryDate
|
|
4075
|
+
// vc.cvv = cvv
|
|
4076
|
+
// vc.nameOnCard = cardName
|
|
4077
|
+
// vc.selectedPaymentMethod = self.selectedPaymentMethod
|
|
4078
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
4079
|
+
// vc.request = self.request
|
|
4080
|
+
// vc.chosenPlan = self.txtFieldChosePlanCard.text
|
|
4081
|
+
// vc.startDate = self.txtFieldStartDateCard.text
|
|
4082
|
+
// vc.userEmail = self.txtFieldEmailCardView.text
|
|
4083
|
+
// vc.amount = self.amount
|
|
4084
|
+
// vc.billingInfoData = billingInfoData
|
|
4085
|
+
// vc.billingInfo = fieldSection.billing
|
|
4086
|
+
// vc.additionalInfo = fieldSection.additional
|
|
4087
|
+
// vc.visibility = fieldSection.visibility
|
|
4088
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
4089
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
4090
|
+
// } else {
|
|
4091
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
4092
|
+
// vc.billingInfoData = billingInfoData
|
|
4093
|
+
// vc.cardNumber = cardNumber
|
|
4094
|
+
// vc.expiryDate = expiryDate
|
|
4095
|
+
// vc.cvv = cvv
|
|
4096
|
+
// vc.nameOnCard = cardName
|
|
4097
|
+
// vc.selectedPaymentMethod = self.selectedPaymentMethod
|
|
4098
|
+
// vc.isSavedForFuture = self.isSavedForFuture
|
|
4099
|
+
// vc.request = self.request
|
|
4100
|
+
// vc.chosenPlan = self.txtFieldChosePlanCard.text
|
|
4101
|
+
// vc.startDate = self.txtFieldStartDateCard.text
|
|
4102
|
+
// vc.userEmail = self.txtFieldEmailCardView.text
|
|
4103
|
+
// vc.billingInfo = fieldSection.billing
|
|
4104
|
+
// vc.additionalInfo = fieldSection.additional
|
|
4105
|
+
// vc.amount = self.amount
|
|
4106
|
+
// vc.visibility = fieldSection.visibility
|
|
4107
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
4108
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
4109
|
+
// }
|
|
4110
|
+
|
|
4111
|
+
|
|
4112
|
+
let showBilling = fieldSection.visibility.billing
|
|
4113
|
+
let showAdditional = fieldSection.visibility.additional
|
|
4114
|
+
|
|
4115
|
+
if !showBilling && !showAdditional {
|
|
4116
|
+
self.threeDSecurePaymentApi()
|
|
4117
|
+
}
|
|
4118
|
+
else if showBilling {
|
|
4119
|
+
// Push to BillingInfoVC
|
|
3480
4120
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
3481
|
-
vc.billingInfoData = billingInfoData
|
|
3482
4121
|
vc.cardNumber = cardNumber
|
|
3483
4122
|
vc.expiryDate = expiryDate
|
|
3484
4123
|
vc.cvv = cvv
|
|
@@ -3490,12 +4129,15 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3490
4129
|
vc.startDate = self.txtFieldStartDateCard.text
|
|
3491
4130
|
vc.userEmail = self.txtFieldEmailCardView.text
|
|
3492
4131
|
vc.amount = self.amount
|
|
4132
|
+
vc.billingInfoData = billingInfoData
|
|
3493
4133
|
vc.billingInfo = fieldSection.billing
|
|
3494
4134
|
vc.additionalInfo = fieldSection.additional
|
|
3495
4135
|
vc.visibility = fieldSection.visibility
|
|
3496
4136
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
3497
4137
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
3498
|
-
}
|
|
4138
|
+
}
|
|
4139
|
+
else {
|
|
4140
|
+
// Push to AdditionalInfoVC
|
|
3499
4141
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
3500
4142
|
vc.billingInfoData = billingInfoData
|
|
3501
4143
|
vc.cardNumber = cardNumber
|
|
@@ -3803,32 +4445,59 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
3803
4445
|
// Function to navigate to EmailVerificationVC
|
|
3804
4446
|
func navigateCardDataToEmailVerificationVC() {
|
|
3805
4447
|
if let emailVerificationVC = storyboard?.instantiateViewController(withIdentifier: "EmailVerificationVC") as? EmailVerificationVC {
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
4448
|
+
if let billingInfoData = request.billingInfoData {
|
|
4449
|
+
do {
|
|
4450
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
4451
|
+
emailVerificationVC.billingInfoData = billingInfoData
|
|
4452
|
+
emailVerificationVC.billingInfo = fieldSection.billing
|
|
4453
|
+
emailVerificationVC.additionalInfo = fieldSection.additional
|
|
4454
|
+
emailVerificationVC.visibility = fieldSection.visibility
|
|
4455
|
+
|
|
4456
|
+
emailVerificationVC.cardNumber = self.cardNumberTextField.text
|
|
4457
|
+
emailVerificationVC.expiryDate = self.cardExpiryTextField.text
|
|
4458
|
+
emailVerificationVC.cvv = self.cardCvvTextField.text
|
|
4459
|
+
emailVerificationVC.nameOnCard = self.cardNameTextField.text
|
|
4460
|
+
emailVerificationVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
4461
|
+
emailVerificationVC.isSavedForFuture = isSavedForFuture
|
|
4462
|
+
emailVerificationVC.easyPayDelegate = self.easyPayDelegate // Pass delegate if needed
|
|
4463
|
+
emailVerificationVC.request = self.request
|
|
4464
|
+
emailVerificationVC.chosenPlan = self.txtFieldChosePlanCard.text
|
|
4465
|
+
emailVerificationVC.startDate = self.txtFieldStartDateCard.text
|
|
4466
|
+
}
|
|
4467
|
+
catch {
|
|
4468
|
+
print("Failed to decode billingInfoData: \(error.localizedDescription)")
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
|
|
3816
4472
|
self.navigationController?.pushViewController(emailVerificationVC, animated: true)
|
|
3817
4473
|
}
|
|
3818
4474
|
}
|
|
3819
4475
|
|
|
3820
4476
|
func navigateBankDataToEmailVerificationVC() {
|
|
3821
4477
|
if let emailVerificationVC = storyboard?.instantiateViewController(withIdentifier: "EmailVerificationVC") as? EmailVerificationVC {
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
4478
|
+
if let billingInfoData = request.billingInfoData {
|
|
4479
|
+
do {
|
|
4480
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
4481
|
+
emailVerificationVC.billingInfoData = billingInfoData
|
|
4482
|
+
emailVerificationVC.billingInfo = fieldSection.billing
|
|
4483
|
+
emailVerificationVC.additionalInfo = fieldSection.additional
|
|
4484
|
+
emailVerificationVC.visibility = fieldSection.visibility
|
|
4485
|
+
|
|
4486
|
+
emailVerificationVC.accountName = txtFieldAccountName.text
|
|
4487
|
+
emailVerificationVC.routingNumber = txtFieldRoutingNumber.text
|
|
4488
|
+
emailVerificationVC.accountType = txtFieldAccountType.text
|
|
4489
|
+
emailVerificationVC.accountNumber = txtFieldAccountNumber.text
|
|
4490
|
+
emailVerificationVC.selectedPaymentMethod = self.selectedPaymentMethod
|
|
4491
|
+
emailVerificationVC.isSavedForFuture = isSavedForFuture
|
|
4492
|
+
emailVerificationVC.easyPayDelegate = self.easyPayDelegate // Pass delegate if needed
|
|
4493
|
+
emailVerificationVC.chosenPlan = self.txtFieldSelectPlanViewBankFields.text
|
|
4494
|
+
emailVerificationVC.startDate = self.txtFieldSelectDateViewBankFields.text
|
|
4495
|
+
emailVerificationVC.request = self.request
|
|
4496
|
+
}
|
|
4497
|
+
catch {
|
|
4498
|
+
print("Failed to decode billingInfoData: \(error.localizedDescription)")
|
|
4499
|
+
}
|
|
4500
|
+
}
|
|
3832
4501
|
self.navigationController?.pushViewController(emailVerificationVC, animated: true)
|
|
3833
4502
|
}
|
|
3834
4503
|
}
|
|
@@ -4076,11 +4745,54 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
4076
4745
|
return
|
|
4077
4746
|
}
|
|
4078
4747
|
|
|
4079
|
-
// Redirect based on billing visibility
|
|
4080
|
-
if fieldSection.visibility.billing {
|
|
4081
|
-
// Proceed with the Pay Now action
|
|
4748
|
+
// // Redirect based on billing visibility
|
|
4749
|
+
// if fieldSection.visibility.billing {
|
|
4750
|
+
// // Proceed with the Pay Now action
|
|
4751
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
4752
|
+
// // Pass the customer_id and account_id to BillingInfoVC
|
|
4753
|
+
// vc.customerID = self.selectedbankAccounts?.customer_id
|
|
4754
|
+
// vc.accountID = self.selectedbankAccounts?.account_id
|
|
4755
|
+
// vc.billingInfoData = billingInfoData
|
|
4756
|
+
// vc.isFrom = "SavedBank"
|
|
4757
|
+
// vc.selectedPaymentMethod = "Bank"
|
|
4758
|
+
// vc.chosenPlan = self.txtFieldSelectPlanSingleSavedBankView.text
|
|
4759
|
+
// vc.startDate = self.txtFieldSelectDateSingleSavedBankView.text
|
|
4760
|
+
// vc.request = self.request
|
|
4761
|
+
// vc.amount = self.amount
|
|
4762
|
+
// vc.billingInfo = fieldSection.billing
|
|
4763
|
+
// vc.additionalInfo = fieldSection.additional
|
|
4764
|
+
// vc.visibility = fieldSection.visibility
|
|
4765
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
4766
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
4767
|
+
// }
|
|
4768
|
+
// else {
|
|
4769
|
+
// let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
4770
|
+
// vc.customerID = self.selectedbankAccounts?.customer_id
|
|
4771
|
+
// vc.accountID = self.selectedbankAccounts?.account_id
|
|
4772
|
+
// vc.billingInfoData = billingInfoData
|
|
4773
|
+
// vc.isFrom = "SavedBank"
|
|
4774
|
+
// vc.selectedPaymentMethod = "Bank"
|
|
4775
|
+
// vc.chosenPlan = self.txtFieldSelectPlanSingleSavedBankView.text
|
|
4776
|
+
// vc.startDate = self.txtFieldSelectDateSingleSavedBankView.text
|
|
4777
|
+
// vc.request = self.request
|
|
4778
|
+
// vc.amount = self.amount
|
|
4779
|
+
// vc.billingInfo = fieldSection.billing
|
|
4780
|
+
// vc.additionalInfo = fieldSection.additional
|
|
4781
|
+
// vc.visibility = fieldSection.visibility
|
|
4782
|
+
// vc.easyPayDelegate = self.easyPayDelegate
|
|
4783
|
+
// self.navigationController?.pushViewController(vc, animated: true)
|
|
4784
|
+
// }
|
|
4785
|
+
|
|
4786
|
+
|
|
4787
|
+
let showBilling = fieldSection.visibility.billing
|
|
4788
|
+
let showAdditional = fieldSection.visibility.additional
|
|
4789
|
+
|
|
4790
|
+
if !showBilling && !showAdditional {
|
|
4791
|
+
self.grailPayAaccountChargeSingleSavedAccountApi()
|
|
4792
|
+
}
|
|
4793
|
+
else if showBilling {
|
|
4794
|
+
// Push to BillingInfoVC
|
|
4082
4795
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "BillingInfoVC") as! BillingInfoVC
|
|
4083
|
-
// Pass the customer_id and account_id to BillingInfoVC
|
|
4084
4796
|
vc.customerID = self.selectedbankAccounts?.customer_id
|
|
4085
4797
|
vc.accountID = self.selectedbankAccounts?.account_id
|
|
4086
4798
|
vc.billingInfoData = billingInfoData
|
|
@@ -4097,6 +4809,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
4097
4809
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
4098
4810
|
}
|
|
4099
4811
|
else {
|
|
4812
|
+
// Push to AdditionalInfoVC
|
|
4100
4813
|
let vc = easymerchantsdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
|
|
4101
4814
|
vc.customerID = self.selectedbankAccounts?.customer_id
|
|
4102
4815
|
vc.accountID = self.selectedbankAccounts?.account_id
|
|
@@ -4113,6 +4826,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
4113
4826
|
vc.easyPayDelegate = self.easyPayDelegate
|
|
4114
4827
|
self.navigationController?.pushViewController(vc, animated: true)
|
|
4115
4828
|
}
|
|
4829
|
+
|
|
4116
4830
|
}
|
|
4117
4831
|
}
|
|
4118
4832
|
}
|
|
@@ -4452,7 +5166,38 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
4452
5166
|
|
|
4453
5167
|
//MARK: - Card Scan Button Action
|
|
4454
5168
|
@IBAction func actionButtonScanCard(_ sender: UIButton) {
|
|
4455
|
-
|
|
5169
|
+
// // Validate BlinkCard License
|
|
5170
|
+
// let licenseErrorMessage = BlinkCardHelper.setupLicense()
|
|
5171
|
+
// if !licenseErrorMessage.isEmpty {
|
|
5172
|
+
// // Show alert if the license is invalid or expired
|
|
5173
|
+
// showLicenseErrorAlert(message: licenseErrorMessage)
|
|
5174
|
+
// return
|
|
5175
|
+
// }
|
|
5176
|
+
//
|
|
5177
|
+
// // Proceed with card scanning if the license is valid
|
|
5178
|
+
// blinkCardRecognizer = MBCBlinkCardRecognizer()
|
|
5179
|
+
// blinkCardRecognizer.returnFullDocumentImage = true
|
|
5180
|
+
//
|
|
5181
|
+
// let recognizerList = [blinkCardRecognizer!]
|
|
5182
|
+
// let recognizerCollection = MBCRecognizerCollection(recognizers: recognizerList)
|
|
5183
|
+
//
|
|
5184
|
+
// let customOverlayViewController: CustomOverlay = CustomOverlay.initFromStoryboard()
|
|
5185
|
+
//
|
|
5186
|
+
// // Reconfigure recognizers with the overlay
|
|
5187
|
+
// customOverlayViewController.reconfigureRecognizers(recognizerCollection)
|
|
5188
|
+
//
|
|
5189
|
+
// // Create the recognizer runner view controller with custom overlay
|
|
5190
|
+
// guard let recognizerRunnerViewController =
|
|
5191
|
+
// MBCViewControllerFactory.recognizerRunnerViewController(withOverlayViewController: customOverlayViewController) else {
|
|
5192
|
+
// showLicenseErrorAlert(message: "Failed to initialize the recognizer view controller.")
|
|
5193
|
+
// return
|
|
5194
|
+
// }
|
|
5195
|
+
//
|
|
5196
|
+
// customOverlayViewController.delegate = self
|
|
5197
|
+
// recognizerRunnerViewController.modalPresentationStyle = .fullScreen
|
|
5198
|
+
//
|
|
5199
|
+
// // Present the recognizer runner view controller
|
|
5200
|
+
// self.present(recognizerRunnerViewController, animated: true, completion: nil)
|
|
4456
5201
|
}
|
|
4457
5202
|
|
|
4458
5203
|
private func showLicenseErrorAlert(message: String) {
|
|
@@ -6811,6 +7556,68 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
6811
7556
|
"tokenize": request.tokenOnly ?? false,
|
|
6812
7557
|
]
|
|
6813
7558
|
|
|
7559
|
+
if let billingInfoData = request.billingInfoData {
|
|
7560
|
+
do {
|
|
7561
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
7562
|
+
|
|
7563
|
+
// Billing Info
|
|
7564
|
+
let billing = fieldSection.billing
|
|
7565
|
+
if !billing.isEmpty {
|
|
7566
|
+
var billingDict: [String: Any] = [:]
|
|
7567
|
+
billing.forEach { billingDict[$0.name] = $0.value }
|
|
7568
|
+
|
|
7569
|
+
if let address = billingDict["address"] as? String, !address.isEmpty {
|
|
7570
|
+
params["address"] = address
|
|
7571
|
+
}
|
|
7572
|
+
if let country = billingDict["country"] as? String, !country.isEmpty {
|
|
7573
|
+
params["country"] = country
|
|
7574
|
+
}
|
|
7575
|
+
if let state = billingDict["state"] as? String, !state.isEmpty {
|
|
7576
|
+
params["state"] = state
|
|
7577
|
+
}
|
|
7578
|
+
if let city = billingDict["city"] as? String, !city.isEmpty {
|
|
7579
|
+
params["city"] = city
|
|
7580
|
+
}
|
|
7581
|
+
if let postalCode = billingDict["postal_code"] as? String, !postalCode.isEmpty {
|
|
7582
|
+
params["zip"] = postalCode
|
|
7583
|
+
}
|
|
7584
|
+
}
|
|
7585
|
+
|
|
7586
|
+
// Additional Info
|
|
7587
|
+
let additional = fieldSection.additional
|
|
7588
|
+
if !additional.isEmpty {
|
|
7589
|
+
var additionalDict: [String: Any] = [:]
|
|
7590
|
+
additional.forEach { additionalDict[$0.name] = $0.value }
|
|
7591
|
+
|
|
7592
|
+
if let desc = additionalDict["description"] as? String, !desc.isEmpty {
|
|
7593
|
+
params["description"] = desc
|
|
7594
|
+
} else {
|
|
7595
|
+
params["description"] = "Hosted payment checkout"
|
|
7596
|
+
}
|
|
7597
|
+
|
|
7598
|
+
if let phone = additionalDict["phone_number"] as? String, !phone.isEmpty {
|
|
7599
|
+
params["phone_number"] = phone
|
|
7600
|
+
}
|
|
7601
|
+
if let email = additionalDict["email"] as? String, !email.isEmpty {
|
|
7602
|
+
params["email"] = email
|
|
7603
|
+
}
|
|
7604
|
+
if let name = additionalDict["name"] as? String, !name.isEmpty {
|
|
7605
|
+
params["name"] = name
|
|
7606
|
+
}
|
|
7607
|
+
} else {
|
|
7608
|
+
// If no description in additional info, set default
|
|
7609
|
+
params["description"] = "Hosted payment checkout"
|
|
7610
|
+
}
|
|
7611
|
+
|
|
7612
|
+
} catch {
|
|
7613
|
+
print("Failed to decode FieldSection: \(error)")
|
|
7614
|
+
params["description"] = "Hosted payment checkout"
|
|
7615
|
+
}
|
|
7616
|
+
} else {
|
|
7617
|
+
// Fallback if billingInfoData is missing
|
|
7618
|
+
params["description"] = "Hosted payment checkout"
|
|
7619
|
+
}
|
|
7620
|
+
|
|
6814
7621
|
// Add these if recurring is enabled
|
|
6815
7622
|
if let req = request, req.is_recurring == true {
|
|
6816
7623
|
if let recurringType = req.recurringStartDateType, recurringType == .custom {
|
|
@@ -6884,30 +7691,45 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
6884
7691
|
paymentDoneVC.chargeData = responseObject
|
|
6885
7692
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
6886
7693
|
paymentDoneVC.amount = self.amount
|
|
6887
|
-
// Pass billingInfo and additionalInfo
|
|
6888
|
-
if let billingData = self.request.billingInfoData,
|
|
6889
|
-
let billingInfoDict = try? JSONSerialization.jsonObject(with: billingData, options: []) as? [String: Any] {
|
|
7694
|
+
// // Pass billingInfo and additionalInfo
|
|
7695
|
+
// if let billingData = self.request.billingInfoData,
|
|
7696
|
+
// let billingInfoDict = try? JSONSerialization.jsonObject(with: billingData, options: []) as? [String: Any] {
|
|
7697
|
+
//
|
|
7698
|
+
// // Extract main billing fields
|
|
7699
|
+
// let cleanBillingInfo: [String: Any] = [
|
|
7700
|
+
// "postal_code": billingInfoDict["postal_code"] ?? "",
|
|
7701
|
+
// "country": billingInfoDict["country"] ?? "",
|
|
7702
|
+
// "city": billingInfoDict["city"] ?? "",
|
|
7703
|
+
// "address": billingInfoDict["address"] ?? "",
|
|
7704
|
+
// "state": billingInfoDict["state"] ?? ""
|
|
7705
|
+
// ]
|
|
7706
|
+
// paymentDoneVC.billingInfo = cleanBillingInfo
|
|
7707
|
+
//
|
|
7708
|
+
// // Extract additional_info
|
|
7709
|
+
// if let additional = billingInfoDict["additional_info"] as? [String: Any] {
|
|
7710
|
+
// let cleanAdditionalInfo: [String: Any] = [
|
|
7711
|
+
// "email": additional["email"] ?? "",
|
|
7712
|
+
// "phone_number": additional["phone_number"] ?? "",
|
|
7713
|
+
// "name": additional["name"] ?? "",
|
|
7714
|
+
// "country_code": additional["country_code"] ?? ""
|
|
7715
|
+
// ]
|
|
7716
|
+
// paymentDoneVC.additionalInfo = cleanAdditionalInfo
|
|
7717
|
+
// }
|
|
7718
|
+
// }
|
|
7719
|
+
|
|
7720
|
+
// Pass billing info and additional info if available
|
|
7721
|
+
if let billingInfoData = self.request.billingInfoData,
|
|
7722
|
+
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
6890
7723
|
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
"city": billingInfoDict["city"] ?? "",
|
|
6896
|
-
"address": billingInfoDict["address"] ?? "",
|
|
6897
|
-
"state": billingInfoDict["state"] ?? ""
|
|
6898
|
-
]
|
|
6899
|
-
paymentDoneVC.billingInfo = cleanBillingInfo
|
|
7724
|
+
paymentDoneVC.billingInfoData = fieldSection.billing
|
|
7725
|
+
var billingDict: [String: Any] = [:]
|
|
7726
|
+
fieldSection.billing.forEach { billingDict[$0.name] = $0.value }
|
|
7727
|
+
paymentDoneVC.billingInfo = billingDict
|
|
6900
7728
|
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
"phone_number": additional["phone_number"] ?? "",
|
|
6906
|
-
"name": additional["name"] ?? "",
|
|
6907
|
-
"country_code": additional["country_code"] ?? ""
|
|
6908
|
-
]
|
|
6909
|
-
paymentDoneVC.additionalInfo = cleanAdditionalInfo
|
|
6910
|
-
}
|
|
7729
|
+
paymentDoneVC.additionalInfoData = fieldSection.additional
|
|
7730
|
+
var additionalDict: [String: Any] = [:]
|
|
7731
|
+
fieldSection.additional.forEach { additionalDict[$0.name] = $0.value }
|
|
7732
|
+
paymentDoneVC.additionalInfo = additionalDict
|
|
6911
7733
|
}
|
|
6912
7734
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
6913
7735
|
}
|
|
@@ -7048,6 +7870,68 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
7048
7870
|
params["is_default"] = "1"
|
|
7049
7871
|
}
|
|
7050
7872
|
|
|
7873
|
+
if let billingInfoData = request.billingInfoData {
|
|
7874
|
+
do {
|
|
7875
|
+
let fieldSection = try JSONDecoder().decode(FieldSection.self, from: billingInfoData)
|
|
7876
|
+
|
|
7877
|
+
// Billing Info
|
|
7878
|
+
let billing = fieldSection.billing
|
|
7879
|
+
if !billing.isEmpty {
|
|
7880
|
+
var billingDict: [String: Any] = [:]
|
|
7881
|
+
billing.forEach { billingDict[$0.name] = $0.value }
|
|
7882
|
+
|
|
7883
|
+
if let address = billingDict["address"] as? String, !address.isEmpty {
|
|
7884
|
+
params["address"] = address
|
|
7885
|
+
}
|
|
7886
|
+
if let country = billingDict["country"] as? String, !country.isEmpty {
|
|
7887
|
+
params["country"] = country
|
|
7888
|
+
}
|
|
7889
|
+
if let state = billingDict["state"] as? String, !state.isEmpty {
|
|
7890
|
+
params["state"] = state
|
|
7891
|
+
}
|
|
7892
|
+
if let city = billingDict["city"] as? String, !city.isEmpty {
|
|
7893
|
+
params["city"] = city
|
|
7894
|
+
}
|
|
7895
|
+
if let postalCode = billingDict["postal_code"] as? String, !postalCode.isEmpty {
|
|
7896
|
+
params["zip"] = postalCode
|
|
7897
|
+
}
|
|
7898
|
+
}
|
|
7899
|
+
|
|
7900
|
+
// Additional Info
|
|
7901
|
+
let additional = fieldSection.additional
|
|
7902
|
+
if !additional.isEmpty {
|
|
7903
|
+
var additionalDict: [String: Any] = [:]
|
|
7904
|
+
additional.forEach { additionalDict[$0.name] = $0.value }
|
|
7905
|
+
|
|
7906
|
+
if let desc = additionalDict["description"] as? String, !desc.isEmpty {
|
|
7907
|
+
params["description"] = desc
|
|
7908
|
+
} else {
|
|
7909
|
+
params["description"] = "Hosted payment checkout"
|
|
7910
|
+
}
|
|
7911
|
+
|
|
7912
|
+
if let phone = additionalDict["phone_number"] as? String, !phone.isEmpty {
|
|
7913
|
+
params["phone_number"] = phone
|
|
7914
|
+
}
|
|
7915
|
+
if let email = additionalDict["email"] as? String, !email.isEmpty {
|
|
7916
|
+
params["email"] = email
|
|
7917
|
+
}
|
|
7918
|
+
if let name = additionalDict["name"] as? String, !name.isEmpty {
|
|
7919
|
+
params["name"] = name
|
|
7920
|
+
}
|
|
7921
|
+
} else {
|
|
7922
|
+
// If no description in additional info, set default
|
|
7923
|
+
params["description"] = "Hosted payment checkout"
|
|
7924
|
+
}
|
|
7925
|
+
|
|
7926
|
+
} catch {
|
|
7927
|
+
print("Failed to decode FieldSection: \(error)")
|
|
7928
|
+
params["description"] = "Hosted payment checkout"
|
|
7929
|
+
}
|
|
7930
|
+
} else {
|
|
7931
|
+
// Fallback if billingInfoData is missing
|
|
7932
|
+
params["description"] = "Hosted payment checkout"
|
|
7933
|
+
}
|
|
7934
|
+
|
|
7051
7935
|
// Add these if recurring is enabled
|
|
7052
7936
|
if let req = request, req.is_recurring == true {
|
|
7053
7937
|
if let recurringType = req.recurringStartDateType, recurringType == .custom {
|
|
@@ -7119,30 +8003,19 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
7119
8003
|
paymentDoneVC.chargeData = responseObject
|
|
7120
8004
|
paymentDoneVC.easyPayDelegate = self.easyPayDelegate
|
|
7121
8005
|
paymentDoneVC.amount = self.amount
|
|
7122
|
-
// Pass
|
|
7123
|
-
if let
|
|
7124
|
-
let
|
|
8006
|
+
// Pass billing info and additional info if available
|
|
8007
|
+
if let billingInfoData = self.request.billingInfoData,
|
|
8008
|
+
let fieldSection = try? JSONDecoder().decode(FieldSection.self, from: billingInfoData) {
|
|
7125
8009
|
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
"city": billingInfoDict["city"] ?? "",
|
|
7131
|
-
"address": billingInfoDict["address"] ?? "",
|
|
7132
|
-
"state": billingInfoDict["state"] ?? ""
|
|
7133
|
-
]
|
|
7134
|
-
paymentDoneVC.billingInfo = cleanBillingInfo
|
|
8010
|
+
paymentDoneVC.billingInfoData = fieldSection.billing
|
|
8011
|
+
var billingDict: [String: Any] = [:]
|
|
8012
|
+
fieldSection.billing.forEach { billingDict[$0.name] = $0.value }
|
|
8013
|
+
paymentDoneVC.billingInfo = billingDict
|
|
7135
8014
|
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
"phone_number": additional["phone_number"] ?? "",
|
|
7141
|
-
"name": additional["name"] ?? "",
|
|
7142
|
-
"country_code": additional["country_code"] ?? ""
|
|
7143
|
-
]
|
|
7144
|
-
paymentDoneVC.additionalInfo = cleanAdditionalInfo
|
|
7145
|
-
}
|
|
8015
|
+
paymentDoneVC.additionalInfoData = fieldSection.additional
|
|
8016
|
+
var additionalDict: [String: Any] = [:]
|
|
8017
|
+
fieldSection.additional.forEach { additionalDict[$0.name] = $0.value }
|
|
8018
|
+
paymentDoneVC.additionalInfo = additionalDict
|
|
7146
8019
|
}
|
|
7147
8020
|
self.navigationController?.pushViewController(paymentDoneVC, animated: true)
|
|
7148
8021
|
}
|
|
@@ -8354,6 +9227,15 @@ extension PaymentInfoVC: UITextFieldDelegate {
|
|
|
8354
9227
|
viewTxtFieldConfirmNewAccountView.layer.borderColor = UIColor._1757D9.withAlphaComponent(1).cgColor
|
|
8355
9228
|
}
|
|
8356
9229
|
}
|
|
9230
|
+
else if textField == txtFieldEmailGrailPayView.textField {
|
|
9231
|
+
if let primaryBtnFontColor = UserStoreSingleton.shared.primary_btn_bg_col,
|
|
9232
|
+
let uiColor = UIColor(hex: primaryBtnFontColor) {
|
|
9233
|
+
viewTxtFieldEmailGrailPayView.layer.borderColor = uiColor.cgColor
|
|
9234
|
+
} else {
|
|
9235
|
+
viewTxtFieldEmailGrailPayView.layer.borderColor = UIColor._1757D9.withAlphaComponent(1).cgColor
|
|
9236
|
+
}
|
|
9237
|
+
}
|
|
9238
|
+
|
|
8357
9239
|
}
|
|
8358
9240
|
|
|
8359
9241
|
func textFieldDidEndEditing(_ textField: UITextField) {
|
|
@@ -8561,6 +9443,14 @@ extension PaymentInfoVC: UITextFieldDelegate {
|
|
|
8561
9443
|
viewTxtFieldConfirmNewAccountView.layer.borderColor = UIColor.systemGray.cgColor
|
|
8562
9444
|
}
|
|
8563
9445
|
}
|
|
9446
|
+
else if textField == txtFieldEmailGrailPayView.textField {
|
|
9447
|
+
if let bodyBackgroundColor = UserStoreSingleton.shared.secondary_font_col,
|
|
9448
|
+
let borderColor = UIColor(hex: bodyBackgroundColor) {
|
|
9449
|
+
viewTxtFieldEmailGrailPayView.layer.borderColor = borderColor.cgColor
|
|
9450
|
+
} else {
|
|
9451
|
+
viewTxtFieldEmailGrailPayView.layer.borderColor = UIColor.systemGray.cgColor
|
|
9452
|
+
}
|
|
9453
|
+
}
|
|
8564
9454
|
}
|
|
8565
9455
|
|
|
8566
9456
|
}
|