@jimrising/easymerchantsdk-react-native 2.7.7 → 2.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/build.gradle
CHANGED
|
@@ -94,7 +94,7 @@ dependencies {
|
|
|
94
94
|
implementation 'com.google.android.material:material:1.13.0'
|
|
95
95
|
|
|
96
96
|
// Third-party libs
|
|
97
|
-
implementation 'com.app:paysdk:
|
|
97
|
+
implementation 'com.app:paysdk:2.0.1'
|
|
98
98
|
implementation 'com.hbb20:ccp:2.7.3'
|
|
99
99
|
implementation 'com.github.bumptech.glide:glide:5.0.4'
|
|
100
100
|
implementation 'com.github.androidmads:QRGenerator:1.0.5'
|
|
@@ -2559,73 +2559,26 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2559
2559
|
}
|
|
2560
2560
|
|
|
2561
2561
|
private func updateShowSavedCardsVisibility() {
|
|
2562
|
-
|
|
2562
|
+
// Show the "Show saved cards/accounts" button whenever the OTP view is not visible,
|
|
2563
|
+
// so the user can always re-open saved options after closing OTP or email views.
|
|
2564
|
+
let shouldShow = OTPView.isHidden
|
|
2563
2565
|
viewBtnShowSavedCards.isHidden = !shouldShow
|
|
2564
2566
|
viewBtnShowSavedCardHeight.constant = shouldShow ? 50 : 0
|
|
2565
2567
|
viewBtnShowSavedCardTopCon.constant = shouldShow ? 16 : 0
|
|
2566
2568
|
}
|
|
2567
2569
|
|
|
2568
|
-
// @IBAction func actionBtnShowSavedCards(_ sender: UIButton) {
|
|
2569
|
-
// if UserStoreSingleton.shared.customerToken == nil {
|
|
2570
|
-
// emailView.isHidden = false
|
|
2571
|
-
// OTPView.isHidden = true
|
|
2572
|
-
// updateShowSavedCardsVisibility()
|
|
2573
|
-
// }
|
|
2574
|
-
// else {
|
|
2575
|
-
// // UserStoreSingleton.shared.isLoggedIn = true
|
|
2576
|
-
//
|
|
2577
|
-
// emailView.isHidden = true
|
|
2578
|
-
// OTPView.isHidden = true
|
|
2579
|
-
//
|
|
2580
|
-
// if self.selectedPaymentMethod == "Card" {
|
|
2581
|
-
// if UserStoreSingleton.shared.customerId == nil {
|
|
2582
|
-
// self.OTPView.isHidden = true
|
|
2583
|
-
// self.viewCardFields.isHidden = false
|
|
2584
|
-
// self.viewSingleSavedCard.isHidden = true
|
|
2585
|
-
// self.viewBtnShowSavedCards.isHidden = true
|
|
2586
|
-
// self.viewBtnShowSavedCardHeight.constant = 0
|
|
2587
|
-
// self.viewBtnShowSavedCardTopCon.constant = 0
|
|
2588
|
-
// self.viewChangeCard.isHidden = true
|
|
2589
|
-
// self.viewUpdateCard.isHidden = true
|
|
2590
|
-
// self.viewAddNewCard.isHidden = true
|
|
2591
|
-
// } else {
|
|
2592
|
-
// self.getShowCardsApi()
|
|
2593
|
-
// self.OTPView.isHidden = true
|
|
2594
|
-
// self.viewCardFields.isHidden = true
|
|
2595
|
-
// self.viewSingleSavedCard.isHidden = false
|
|
2596
|
-
// self.viewBtnShowSavedCards.isHidden = true
|
|
2597
|
-
// self.viewBtnShowSavedCardHeight.constant = 0
|
|
2598
|
-
// self.viewBtnShowSavedCardTopCon.constant = 0
|
|
2599
|
-
// self.viewChangeCard.isHidden = true
|
|
2600
|
-
// self.viewUpdateCard.isHidden = true
|
|
2601
|
-
// self.viewAddNewCard.isHidden = true
|
|
2602
|
-
//
|
|
2603
|
-
// self.viewTxtFieldCVVSingleCard.isHidden = true
|
|
2604
|
-
// self.btnPayNowSingleCard.isHidden = true
|
|
2605
|
-
// self.btnNext.isHidden = true
|
|
2606
|
-
// self.btnNextHeight.constant = 0
|
|
2607
|
-
// self.btnNextTopCon.constant = 8
|
|
2608
|
-
// }
|
|
2609
|
-
//
|
|
2610
|
-
// self.txtFieldSelectPlanSingleSavedCard.isHidden = true
|
|
2611
|
-
// self.txtFieldSelectDateSingleSavedCard.isHidden = true
|
|
2612
|
-
//
|
|
2613
|
-
// self.txtFieldSelectPlanSingleSavedBankView.isHidden = true
|
|
2614
|
-
// self.txtFieldSelectDateSingleSavedBankView.isHidden = true
|
|
2615
|
-
// } else if self.selectedPaymentMethod == "Bank" {
|
|
2616
|
-
// self.getShowBankAccountsApi()
|
|
2617
|
-
// }
|
|
2618
|
-
// }
|
|
2619
|
-
// }
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
2570
|
@IBAction func actionBtnShowSavedCards(_ sender: UIButton) {
|
|
2623
|
-
|
|
2571
|
+
// Mirror MobileCheckout iOS: require both customerToken and customerId to treat as a verified saved customer.
|
|
2572
|
+
if UserStoreSingleton.shared.customerToken == nil || UserStoreSingleton.shared.customerId == nil {
|
|
2573
|
+
// No verified saved customer yet – show email view so user can request OTP
|
|
2574
|
+
isSavedViewVisible = false
|
|
2624
2575
|
emailView.isHidden = false
|
|
2625
2576
|
OTPView.isHidden = true
|
|
2577
|
+
viewSingleSavedCard.isHidden = true
|
|
2578
|
+
viewSingleSavedAccount.isHidden = true
|
|
2626
2579
|
updateShowSavedCardsVisibility()
|
|
2627
|
-
}
|
|
2628
|
-
|
|
2580
|
+
} else {
|
|
2581
|
+
// Verified saved customer exists – show saved cards/accounts UI
|
|
2629
2582
|
isSavedViewVisible = true
|
|
2630
2583
|
|
|
2631
2584
|
emailView.isHidden = true
|
|
@@ -2636,21 +2589,15 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2636
2589
|
self.OTPView.isHidden = true
|
|
2637
2590
|
self.viewCardFields.isHidden = false
|
|
2638
2591
|
self.viewSingleSavedCard.isHidden = true
|
|
2639
|
-
// self.viewBtnShowSavedCards.isHidden = true
|
|
2640
|
-
// self.viewBtnShowSavedCardHeight.constant = 0
|
|
2641
|
-
// self.viewBtnShowSavedCardTopCon.constant = 0
|
|
2642
2592
|
self.viewChangeCard.isHidden = true
|
|
2643
2593
|
self.viewUpdateCard.isHidden = true
|
|
2644
2594
|
self.viewAddNewCard.isHidden = true
|
|
2645
2595
|
} else {
|
|
2646
|
-
//
|
|
2596
|
+
// Only show saved cards when button tapped
|
|
2647
2597
|
self.getShowCardsApi()
|
|
2648
2598
|
self.OTPView.isHidden = true
|
|
2649
2599
|
self.viewCardFields.isHidden = true
|
|
2650
2600
|
self.viewSingleSavedCard.isHidden = false
|
|
2651
|
-
// self.viewBtnShowSavedCards.isHidden = true
|
|
2652
|
-
// self.viewBtnShowSavedCardHeight.constant = 0
|
|
2653
|
-
// self.viewBtnShowSavedCardTopCon.constant = 0
|
|
2654
2601
|
self.viewChangeCard.isHidden = true
|
|
2655
2602
|
self.viewUpdateCard.isHidden = true
|
|
2656
2603
|
self.viewAddNewCard.isHidden = true
|
|
@@ -2668,7 +2615,7 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2668
2615
|
self.txtFieldSelectPlanSingleSavedBankView.isHidden = true
|
|
2669
2616
|
self.txtFieldSelectDateSingleSavedBankView.isHidden = true
|
|
2670
2617
|
} else if self.selectedPaymentMethod == "Bank" {
|
|
2671
|
-
//
|
|
2618
|
+
// Only show saved banks when button tapped
|
|
2672
2619
|
self.getShowBankAccountsApi()
|
|
2673
2620
|
self.viewBankFields.isHidden = true
|
|
2674
2621
|
self.viewSingleSavedAccount.isHidden = false
|
|
@@ -2779,8 +2726,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2779
2726
|
if cvvText.isEmpty {
|
|
2780
2727
|
self.showAlert(title: "Missing CVV", message: "Please enter the CVV to proceed.")
|
|
2781
2728
|
return
|
|
2782
|
-
} else if cvvText.count < 3
|
|
2783
|
-
|
|
2729
|
+
} else if cvvText.count < 3 || cvvText.count > 4 ||
|
|
2730
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: cvvText)) {
|
|
2731
|
+
self.showAlert(title: "Invalid CVV", message: "CVV must be 3 or 4 digits.")
|
|
2784
2732
|
return
|
|
2785
2733
|
}
|
|
2786
2734
|
|
|
@@ -2866,8 +2814,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
2866
2814
|
if cvvText.isEmpty {
|
|
2867
2815
|
self.showAlert(title: "Missing CVV", message: "Please enter the CVV to proceed.")
|
|
2868
2816
|
return
|
|
2869
|
-
} else if cvvText.count < 3
|
|
2870
|
-
|
|
2817
|
+
} else if cvvText.count < 3 || cvvText.count > 4 ||
|
|
2818
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: cvvText)) {
|
|
2819
|
+
self.showAlert(title: "Invalid CVV", message: "CVV must be 3 or 4 digits.")
|
|
2871
2820
|
return
|
|
2872
2821
|
}
|
|
2873
2822
|
|
|
@@ -5127,8 +5076,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
5127
5076
|
if cardNumber.isEmpty {
|
|
5128
5077
|
self.showAlert(title: "Missing Information", message: "Card Number is required.")
|
|
5129
5078
|
return
|
|
5130
|
-
} else if sanitizedCardNumber.count
|
|
5131
|
-
|
|
5079
|
+
} else if sanitizedCardNumber.count < 12 || sanitizedCardNumber.count > 19 ||
|
|
5080
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: sanitizedCardNumber)) {
|
|
5081
|
+
self.showAlert(title: "Invalid Card Number", message: "Card Number must be 12 to 19 digits.")
|
|
5132
5082
|
return
|
|
5133
5083
|
} else if expiryDate.isEmpty {
|
|
5134
5084
|
self.showAlert(title: "Missing Information", message: "Card Expiry Date is required.")
|
|
@@ -5184,8 +5134,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
5184
5134
|
if cvv.isEmpty {
|
|
5185
5135
|
self.showAlert(title: "Missing Information", message: "Card CVV Number is required.")
|
|
5186
5136
|
return
|
|
5187
|
-
} else if cvv.count < 3
|
|
5188
|
-
|
|
5137
|
+
} else if cvv.count < 3 || cvv.count > 4 ||
|
|
5138
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: cvv)) {
|
|
5139
|
+
self.showAlert(title: "Invalid CVV", message: "CVV must be 3 or 4 digits.")
|
|
5189
5140
|
return
|
|
5190
5141
|
} else if cardName.isEmpty {
|
|
5191
5142
|
self.showAlert(title: "Missing Information", message: "Card Name is required.")
|
|
@@ -5303,12 +5254,24 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
5303
5254
|
else if self.txtFieldAccountType.text?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true {
|
|
5304
5255
|
self.showAlert(title: "Missing Information", message: "Bank account type is required.")
|
|
5305
5256
|
return
|
|
5306
|
-
} else if self.txtFieldAccountNumber.text?.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
5307
|
-
|
|
5257
|
+
} else if let accountNumber = self.txtFieldAccountNumber.text?.trimmingCharacters(in: .whitespacesAndNewlines),
|
|
5258
|
+
(accountNumber.isEmpty || accountNumber.count < 4 || accountNumber.count > 17 ||
|
|
5259
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: accountNumber))) {
|
|
5260
|
+
if accountNumber.isEmpty {
|
|
5261
|
+
self.showAlert(title: "Missing Information", message: "Bank account number is required.")
|
|
5262
|
+
} else {
|
|
5263
|
+
self.showAlert(title: "Invalid Account Number", message: "Account number must be 4 to 17 digits.")
|
|
5264
|
+
}
|
|
5308
5265
|
return
|
|
5309
5266
|
}
|
|
5310
|
-
else if self.txtFieldConfirmBankAccount.text?.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
5311
|
-
|
|
5267
|
+
else if let confirmAccountNumber = self.txtFieldConfirmBankAccount.text?.trimmingCharacters(in: .whitespacesAndNewlines),
|
|
5268
|
+
(confirmAccountNumber.isEmpty || confirmAccountNumber.count < 4 || confirmAccountNumber.count > 17 ||
|
|
5269
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: confirmAccountNumber))) {
|
|
5270
|
+
if confirmAccountNumber.isEmpty {
|
|
5271
|
+
self.showAlert(title: "Missing Information", message: "Please confirm your bank account number.")
|
|
5272
|
+
} else {
|
|
5273
|
+
self.showAlert(title: "Invalid Account Number", message: "Confirm account number must be 4 to 17 digits.")
|
|
5274
|
+
}
|
|
5312
5275
|
return
|
|
5313
5276
|
}
|
|
5314
5277
|
else if self.txtFieldAccountNumber.text?.trimmingCharacters(in: .whitespacesAndNewlines) != self.txtFieldConfirmBankAccount.text?.trimmingCharacters(in: .whitespacesAndNewlines) {
|
|
@@ -5437,8 +5400,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
5437
5400
|
if cardNumber.isEmpty {
|
|
5438
5401
|
self.showAlert(title: "Missing Information", message: "Card Number is required.")
|
|
5439
5402
|
return
|
|
5440
|
-
} else if sanitizedCardNumber.count
|
|
5441
|
-
|
|
5403
|
+
} else if sanitizedCardNumber.count < 12 || sanitizedCardNumber.count > 19 ||
|
|
5404
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: sanitizedCardNumber)) {
|
|
5405
|
+
self.showAlert(title: "Invalid Card Number", message: "Card Number must be 12 to 19 digits.")
|
|
5442
5406
|
return
|
|
5443
5407
|
} else if expiryDate.isEmpty {
|
|
5444
5408
|
self.showAlert(title: "Missing Information", message: "Card Expiry Date is required.")
|
|
@@ -5494,8 +5458,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
5494
5458
|
if cvv.isEmpty {
|
|
5495
5459
|
self.showAlert(title: "Missing Information", message: "Card CVV Number is required.")
|
|
5496
5460
|
return
|
|
5497
|
-
} else if cvv.count < 3
|
|
5498
|
-
|
|
5461
|
+
} else if cvv.count < 3 || cvv.count > 4 ||
|
|
5462
|
+
!CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: cvv)) {
|
|
5463
|
+
self.showAlert(title: "Invalid CVV", message: "CVV must be 3 or 4 digits.")
|
|
5499
5464
|
return
|
|
5500
5465
|
} else if cardName.isEmpty {
|
|
5501
5466
|
self.showAlert(title: "Missing Information", message: "Card Name is required.")
|
|
@@ -6083,6 +6048,18 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
|
|
|
6083
6048
|
self.showAlert(title: "Invalid Routing Number", message: "Routing number is not correct. It must be exactly 9 digits.")
|
|
6084
6049
|
return
|
|
6085
6050
|
}
|
|
6051
|
+
|
|
6052
|
+
// Account number must be 4 to 17 digits and numeric
|
|
6053
|
+
if accountNumber.count < 4 || accountNumber.count > 17 || !CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: accountNumber)) {
|
|
6054
|
+
self.showAlert(title: "Invalid Account Number", message: "Account number must be 4 to 17 digits.")
|
|
6055
|
+
return
|
|
6056
|
+
}
|
|
6057
|
+
|
|
6058
|
+
// Confirm account number must be 4 to 17 digits and numeric
|
|
6059
|
+
if confirmAccountNumber.count < 4 || confirmAccountNumber.count > 17 || !CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: confirmAccountNumber)) {
|
|
6060
|
+
self.showAlert(title: "Invalid Account Number", message: "Confirm account number must be 4 to 17 digits.")
|
|
6061
|
+
return
|
|
6062
|
+
}
|
|
6086
6063
|
|
|
6087
6064
|
// Check if account number and confirmation match
|
|
6088
6065
|
if accountNumber != confirmAccountNumber {
|
|
@@ -12399,12 +12376,18 @@ extension PaymentInfoVC: UITextFieldDelegate {
|
|
|
12399
12376
|
textField.text = formatCardNumber(modifiedText)
|
|
12400
12377
|
return false
|
|
12401
12378
|
}
|
|
12402
|
-
|
|
12403
|
-
|
|
12404
|
-
|
|
12379
|
+
|
|
12380
|
+
// Only allow digits (including paste); formatting inserts spaces itself
|
|
12381
|
+
let cleanedInput = string.replacingOccurrences(of: " ", with: "")
|
|
12382
|
+
if !CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: cleanedInput)) {
|
|
12405
12383
|
return false
|
|
12406
12384
|
}
|
|
12407
|
-
|
|
12385
|
+
|
|
12386
|
+
let text = (textField.text ?? "") + cleanedInput
|
|
12387
|
+
if text.filter({ $0.isNumber }).count > 19 {
|
|
12388
|
+
return false
|
|
12389
|
+
}
|
|
12390
|
+
|
|
12408
12391
|
textField.text = formatCardNumber(text)
|
|
12409
12392
|
if let lastCharacter = text.last, lastCharacter == " " {
|
|
12410
12393
|
textField.text = String(text.dropLast())
|
|
@@ -12418,6 +12401,9 @@ extension PaymentInfoVC: UITextFieldDelegate {
|
|
|
12418
12401
|
let maxLength = 4
|
|
12419
12402
|
let currentString = (textField.text ?? "") as NSString
|
|
12420
12403
|
let newString = currentString.replacingCharacters(in: range, with: string)
|
|
12404
|
+
if !CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: string)) && !string.isEmpty {
|
|
12405
|
+
return false
|
|
12406
|
+
}
|
|
12421
12407
|
return newString.count <= maxLength
|
|
12422
12408
|
}
|
|
12423
12409
|
|
|
@@ -12521,6 +12507,15 @@ extension PaymentInfoVC: UITextFieldDelegate {
|
|
|
12521
12507
|
|
|
12522
12508
|
return allowedCharacters.isSuperset(of: characterSet) && newLength <= 9
|
|
12523
12509
|
}
|
|
12510
|
+
|
|
12511
|
+
else if textField == txtFieldAccountNumber || textField == txtFieldConfirmBankAccount ||
|
|
12512
|
+
textField == txtFieldAccountNumberNewAccountView || textField == txtFieldConfirmAccountNewAccountView {
|
|
12513
|
+
let allowedCharacters = CharacterSet.decimalDigits
|
|
12514
|
+
let characterSet = CharacterSet(charactersIn: string)
|
|
12515
|
+
let currentText = textField.text ?? ""
|
|
12516
|
+
let newLength = (currentText as NSString).replacingCharacters(in: range, with: string).count
|
|
12517
|
+
return allowedCharacters.isSuperset(of: characterSet) && newLength <= 17
|
|
12518
|
+
}
|
|
12524
12519
|
|
|
12525
12520
|
return true
|
|
12526
12521
|
}
|