@jimrising/easymerchantsdk-react-native 2.7.8 → 2.8.0

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.
Binary file
@@ -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:2.0.0'
97
+ implementation 'com.app:paysdk:2.0.2'
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'
@@ -2726,8 +2726,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
2726
2726
  if cvvText.isEmpty {
2727
2727
  self.showAlert(title: "Missing CVV", message: "Please enter the CVV to proceed.")
2728
2728
  return
2729
- } else if cvvText.count < 3 {
2730
- self.showAlert(title: "Invalid CVV", message: "CVV must be at least 3 digits.")
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.")
2731
2732
  return
2732
2733
  }
2733
2734
 
@@ -2813,8 +2814,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
2813
2814
  if cvvText.isEmpty {
2814
2815
  self.showAlert(title: "Missing CVV", message: "Please enter the CVV to proceed.")
2815
2816
  return
2816
- } else if cvvText.count < 3 {
2817
- self.showAlert(title: "Invalid CVV", message: "CVV must be at least 3 digits.")
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.")
2818
2820
  return
2819
2821
  }
2820
2822
 
@@ -5074,8 +5076,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5074
5076
  if cardNumber.isEmpty {
5075
5077
  self.showAlert(title: "Missing Information", message: "Card Number is required.")
5076
5078
  return
5077
- } else if sanitizedCardNumber.count != 16 {
5078
- self.showAlert(title: "Invalid Card Number", message: "Card Number must be 16 digits.")
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.")
5079
5082
  return
5080
5083
  } else if expiryDate.isEmpty {
5081
5084
  self.showAlert(title: "Missing Information", message: "Card Expiry Date is required.")
@@ -5131,8 +5134,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5131
5134
  if cvv.isEmpty {
5132
5135
  self.showAlert(title: "Missing Information", message: "Card CVV Number is required.")
5133
5136
  return
5134
- } else if cvv.count < 3 {
5135
- self.showAlert(title: "Invalid CVV", message: "CVV must be at least 3 digits.")
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.")
5136
5140
  return
5137
5141
  } else if cardName.isEmpty {
5138
5142
  self.showAlert(title: "Missing Information", message: "Card Name is required.")
@@ -5250,12 +5254,24 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5250
5254
  else if self.txtFieldAccountType.text?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true {
5251
5255
  self.showAlert(title: "Missing Information", message: "Bank account type is required.")
5252
5256
  return
5253
- } else if self.txtFieldAccountNumber.text?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true {
5254
- self.showAlert(title: "Missing Information", message: "Bank account number is required.")
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
+ }
5255
5265
  return
5256
5266
  }
5257
- else if self.txtFieldConfirmBankAccount.text?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == true {
5258
- self.showAlert(title: "Missing Information", message: "Please confirm your bank account number.")
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
+ }
5259
5275
  return
5260
5276
  }
5261
5277
  else if self.txtFieldAccountNumber.text?.trimmingCharacters(in: .whitespacesAndNewlines) != self.txtFieldConfirmBankAccount.text?.trimmingCharacters(in: .whitespacesAndNewlines) {
@@ -5384,8 +5400,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5384
5400
  if cardNumber.isEmpty {
5385
5401
  self.showAlert(title: "Missing Information", message: "Card Number is required.")
5386
5402
  return
5387
- } else if sanitizedCardNumber.count != 16 {
5388
- self.showAlert(title: "Invalid Card Number", message: "Card Number must be 16 digits.")
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.")
5389
5406
  return
5390
5407
  } else if expiryDate.isEmpty {
5391
5408
  self.showAlert(title: "Missing Information", message: "Card Expiry Date is required.")
@@ -5441,8 +5458,9 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
5441
5458
  if cvv.isEmpty {
5442
5459
  self.showAlert(title: "Missing Information", message: "Card CVV Number is required.")
5443
5460
  return
5444
- } else if cvv.count < 3 {
5445
- self.showAlert(title: "Invalid CVV", message: "CVV must be at least 3 digits.")
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.")
5446
5464
  return
5447
5465
  } else if cardName.isEmpty {
5448
5466
  self.showAlert(title: "Missing Information", message: "Card Name is required.")
@@ -6030,6 +6048,18 @@ class PaymentInfoVC: BaseVC, BillingInfoVCDelegate {
6030
6048
  self.showAlert(title: "Invalid Routing Number", message: "Routing number is not correct. It must be exactly 9 digits.")
6031
6049
  return
6032
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
+ }
6033
6063
 
6034
6064
  // Check if account number and confirmation match
6035
6065
  if accountNumber != confirmAccountNumber {
@@ -12346,12 +12376,18 @@ extension PaymentInfoVC: UITextFieldDelegate {
12346
12376
  textField.text = formatCardNumber(modifiedText)
12347
12377
  return false
12348
12378
  }
12349
-
12350
- let text = (textField.text ?? "") + string
12351
- if text.filter({ $0.isNumber }).count > 16 {
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)) {
12352
12383
  return false
12353
12384
  }
12354
-
12385
+
12386
+ let text = (textField.text ?? "") + cleanedInput
12387
+ if text.filter({ $0.isNumber }).count > 19 {
12388
+ return false
12389
+ }
12390
+
12355
12391
  textField.text = formatCardNumber(text)
12356
12392
  if let lastCharacter = text.last, lastCharacter == " " {
12357
12393
  textField.text = String(text.dropLast())
@@ -12365,6 +12401,9 @@ extension PaymentInfoVC: UITextFieldDelegate {
12365
12401
  let maxLength = 4
12366
12402
  let currentString = (textField.text ?? "") as NSString
12367
12403
  let newString = currentString.replacingCharacters(in: range, with: string)
12404
+ if !CharacterSet.decimalDigits.isSuperset(of: CharacterSet(charactersIn: string)) && !string.isEmpty {
12405
+ return false
12406
+ }
12368
12407
  return newString.count <= maxLength
12369
12408
  }
12370
12409
 
@@ -12468,6 +12507,15 @@ extension PaymentInfoVC: UITextFieldDelegate {
12468
12507
 
12469
12508
  return allowedCharacters.isSuperset(of: characterSet) && newLength <= 9
12470
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
+ }
12471
12519
 
12472
12520
  return true
12473
12521
  }
@@ -1,6 +1,6 @@
1
1
  Pod::Spec.new do |s|
2
2
  s.name = 'easymerchantsdk'
3
- s.version = '2.7.8'
3
+ s.version = '2.8.0'
4
4
  s.summary = 'A React Native SDK for Easy Merchant.'
5
5
  s.description = <<-DESC
6
6
  A React Native SDK to enable Easy Merchant functionality in mobile applications.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jimrising/easymerchantsdk-react-native",
3
- "version": "2.7.8",
3
+ "version": "2.8.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {