@jimrising/easymerchantsdk-react-native 2.3.4 → 2.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/android/build/.transforms/20e1216b87bd06eaab3c9e5c68d4267a/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  3. package/android/build/.transforms/e9a664a11ce12edf79cd87b1e07aa243/transformed/classes/classes_dex/classes.dex +0 -0
  4. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -1
  5. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  6. package/android/build.gradle +1 -1
  7. package/ios/ApiManager/APIRequest.swift +1 -4
  8. package/ios/Bundle/EasyPayBundle.swift +1 -1
  9. package/ios/Classes/EasyMerchantSdk.m +2 -2
  10. package/ios/Classes/EasyMerchantSdk.swift +3 -3
  11. package/ios/CustomComponents/PlanSelector.swift +1 -1
  12. package/ios/Example/Base.lproj/Main.storyboard +183 -22
  13. package/ios/Example/ViewController.swift +208 -182
  14. package/ios/Helper/GrailPayHelper.swift +0 -1
  15. package/ios/Models/Request.swift +96 -71
  16. package/ios/Models/SDKResult.swift +32 -25
  17. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +59 -60
  18. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +360 -150
  19. package/ios/Pods/ViewControllers/BaseVC.swift +2 -1
  20. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +401 -196
  21. package/ios/Pods/ViewControllers/Clean Runner_2025-07-23T14-58-05.txt +13 -0
  22. package/ios/Pods/ViewControllers/EmailVerificationVC.swift +0 -7
  23. package/ios/Pods/ViewControllers/GrailPayVC.swift +11 -3
  24. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +252 -105
  25. package/ios/Pods/ViewControllers/PaymentDoneVC.swift +20 -5
  26. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +2 -2
  27. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +804 -347
  28. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +0 -1
  29. package/ios/Pods/ViewControllers/PaymentStatusWebViewVC.swift +1 -1
  30. package/ios/Pods/ViewControllers/ThreeDSecurePaymentDoneVC.swift +68 -66
  31. package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/Contents.json +3 -0
  32. package/ios/easymerchantsdk.podspec +1 -1
  33. package/package.json +1 -1
  34. package/ios/CustomComponents/CheckboxButton.swift +0 -66
  35. package/ios/Models/AdditionalInfo.swift +0 -53
  36. package/ios/Models/BillingInfo.swift +0 -60
  37. package/ios/Pods/ViewControllers/CustomOverlay.swift +0 -199
  38. package/ios/Resources/Assets.xcassets/Card/Amex.imageset/206682_american_express_method_card_payment_icon.svg +0 -1
  39. package/ios/Resources/Assets.xcassets/Card/Amex.imageset/Contents.json +0 -12
  40. package/ios/Resources/Assets.xcassets/Card/Contents.json +0 -6
  41. package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/472318_card_club_diners_dinner_payment_icon.svg +0 -1
  42. package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/Contents.json +0 -12
  43. package/ios/Resources/Assets.xcassets/Card/Discover.imageset/206686_network_payment_discover_card_method_icon.svg +0 -1
  44. package/ios/Resources/Assets.xcassets/Card/Discover.imageset/Contents.json +0 -12
  45. package/ios/Resources/Assets.xcassets/Card/JCB.imageset/358102_card_jcb_payment_icon.svg +0 -1
  46. package/ios/Resources/Assets.xcassets/Card/JCB.imageset/Contents.json +0 -12
  47. package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/206680_master_method_card_payment_icon.svg +0 -1
  48. package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/Contents.json +0 -12
  49. package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/1468976_card_payment_unionpay_icon.svg +0 -1
  50. package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/Contents.json +0 -12
  51. package/ios/Resources/Assets.xcassets/Card/Visa.imageset/206684_visa_method_card_payment_icon.svg +0 -1
  52. package/ios/Resources/Assets.xcassets/Card/Visa.imageset/Contents.json +0 -12
  53. package/ios/Resources/Assets.xcassets/Card/maestro.imageset/Contents.json +0 -12
  54. package/ios/Resources/Assets.xcassets/Card/maestro.imageset/maestro.svg +0 -1
  55. package/ios/Resources/Assets.xcassets/Card/paypal.imageset/206675_paypal_method_payment_icon.svg +0 -1
  56. package/ios/Resources/Assets.xcassets/Card/paypal.imageset/Contents.json +0 -12
  57. package/ios/Resources/Assets.xcassets/Card/rupay.imageset/Contents.json +0 -12
  58. package/ios/Resources/Assets.xcassets/Card/rupay.imageset/rupay.svg +0 -1
  59. package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/4635000_card_credit_digital_money_icon.svg +0 -1
  60. package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/Contents.json +0 -12
  61. package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/Contents.json +0 -12
  62. package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/worldpay.svg +0 -1
@@ -1040,26 +1040,47 @@ class BillingInfoVC: BaseVC {
1040
1040
  params["zip"] = billingInfoDict["postal_code"] as? String ?? ""
1041
1041
  }
1042
1042
 
1043
+ // Add these if recurring is enabled
1044
+ // if let req = request, req.is_recurring == true {
1045
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
1046
+ // // Only send start_date if type is .custom and field is not empty
1047
+ // if let startDateText = startDate, !startDateText.isEmpty {
1048
+ // let inputFormatter = DateFormatter()
1049
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
1050
+ //
1051
+ // let outputFormatter = DateFormatter()
1052
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
1053
+ //
1054
+ // if let date = inputFormatter.date(from: startDateText) {
1055
+ // let apiFormattedDate = outputFormatter.string(from: date)
1056
+ // params["start_date"] = apiFormattedDate
1057
+ // } else {
1058
+ // print("Invalid date format in startDateText")
1059
+ // }
1060
+ // }
1061
+ // }
1062
+ //
1063
+ // params["interval"] = chosenPlan?.lowercased()
1064
+ // }
1065
+
1043
1066
  // Add these if recurring is enabled
1044
1067
  if let req = request, req.is_recurring == true {
1045
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
1046
- // Only send start_date if type is .custom and field is not empty
1047
- if let startDateText = startDate, !startDateText.isEmpty {
1048
- let inputFormatter = DateFormatter()
1049
- inputFormatter.dateFormat = "dd/MM/yyyy"
1050
-
1051
- let outputFormatter = DateFormatter()
1052
- outputFormatter.dateFormat = "MM/dd/yyyy"
1053
-
1054
- if let date = inputFormatter.date(from: startDateText) {
1055
- let apiFormattedDate = outputFormatter.string(from: date)
1056
- params["start_date"] = apiFormattedDate
1057
- } else {
1058
- print("Invalid date format in startDateText")
1059
- }
1068
+ if let startDateText = startDate, !startDateText.isEmpty {
1069
+ let inputFormatter = DateFormatter()
1070
+ inputFormatter.dateFormat = "dd/MM/yyyy"
1071
+
1072
+ let outputFormatter = DateFormatter()
1073
+ outputFormatter.dateFormat = "MM/dd/yyyy"
1074
+
1075
+ if let date = inputFormatter.date(from: startDateText) {
1076
+ let apiFormattedDate = outputFormatter.string(from: date)
1077
+ params["start_date"] = apiFormattedDate
1078
+ } else {
1079
+ print("Invalid date format in startDateText")
1060
1080
  }
1061
1081
  }
1062
1082
 
1083
+ // interval is still required
1063
1084
  params["interval"] = chosenPlan?.lowercased()
1064
1085
  }
1065
1086
 
@@ -1068,6 +1089,11 @@ class BillingInfoVC: BaseVC {
1068
1089
  params["metadata"] = metadata
1069
1090
  }
1070
1091
 
1092
+ // ✅ Include metadata only if it has at least 1 key-value pair
1093
+ if let metadata = request?.metadata, !metadata.isEmpty {
1094
+ params["metadata"] = metadata
1095
+ }
1096
+
1071
1097
  // ✅ Only for logged-in users
1072
1098
  if UserStoreSingleton.shared.isLoggedIn == true {
1073
1099
  let emailText = userEmail
@@ -1213,13 +1239,6 @@ class BillingInfoVC: BaseVC {
1213
1239
  print("Setting clientToken header: \(token ?? "None")")
1214
1240
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
1215
1241
 
1216
- // Add API headers
1217
- if let apiKey = EnvironmentConfig.apiKey,
1218
- let apiSecret = EnvironmentConfig.apiSecret {
1219
- uRLRequest.addValue(apiKey, forHTTPHeaderField: "x-api-key")
1220
- uRLRequest.addValue(apiSecret, forHTTPHeaderField: "x-api-secret")
1221
- }
1222
-
1223
1242
  var params: [String: Any] = [
1224
1243
  "name": nameOnCard ?? "",
1225
1244
  "email": userEmail ?? "",
@@ -1275,26 +1294,47 @@ class BillingInfoVC: BaseVC {
1275
1294
  params["description"] = "Hosted payment checkout"
1276
1295
  }
1277
1296
 
1297
+ // Add these if recurring is enabled
1298
+ // if let req = request, req.is_recurring == true {
1299
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
1300
+ // // Only send start_date if type is .custom and field is not empty
1301
+ // if let startDateText = startDate, !startDateText.isEmpty {
1302
+ // let inputFormatter = DateFormatter()
1303
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
1304
+ //
1305
+ // let outputFormatter = DateFormatter()
1306
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
1307
+ //
1308
+ // if let date = inputFormatter.date(from: startDateText) {
1309
+ // let apiFormattedDate = outputFormatter.string(from: date)
1310
+ // params["start_date"] = apiFormattedDate
1311
+ // } else {
1312
+ // print("Invalid date format in startDateText")
1313
+ // }
1314
+ // }
1315
+ // }
1316
+ //
1317
+ // params["interval"] = chosenPlan?.lowercased()
1318
+ // }
1319
+
1278
1320
  // Add these if recurring is enabled
1279
1321
  if let req = request, req.is_recurring == true {
1280
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
1281
- // Only send start_date if type is .custom and field is not empty
1282
- if let startDateText = startDate, !startDateText.isEmpty {
1283
- let inputFormatter = DateFormatter()
1284
- inputFormatter.dateFormat = "dd/MM/yyyy"
1285
-
1286
- let outputFormatter = DateFormatter()
1287
- outputFormatter.dateFormat = "MM/dd/yyyy"
1288
-
1289
- if let date = inputFormatter.date(from: startDateText) {
1290
- let apiFormattedDate = outputFormatter.string(from: date)
1291
- params["start_date"] = apiFormattedDate
1292
- } else {
1293
- print("Invalid date format in startDateText")
1294
- }
1322
+ if let startDateText = startDate, !startDateText.isEmpty {
1323
+ let inputFormatter = DateFormatter()
1324
+ inputFormatter.dateFormat = "dd/MM/yyyy"
1325
+
1326
+ let outputFormatter = DateFormatter()
1327
+ outputFormatter.dateFormat = "MM/dd/yyyy"
1328
+
1329
+ if let date = inputFormatter.date(from: startDateText) {
1330
+ let apiFormattedDate = outputFormatter.string(from: date)
1331
+ params["start_date"] = apiFormattedDate
1332
+ } else {
1333
+ print("Invalid date format in startDateText")
1295
1334
  }
1296
1335
  }
1297
1336
 
1337
+ // interval is still required
1298
1338
  params["interval"] = chosenPlan?.lowercased()
1299
1339
  }
1300
1340
 
@@ -1418,13 +1458,6 @@ class BillingInfoVC: BaseVC {
1418
1458
  print("Setting clientToken header: \(token ?? "None")")
1419
1459
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
1420
1460
 
1421
- // Add API headers
1422
- if let apiKey = EnvironmentConfig.apiKey,
1423
- let apiSecret = EnvironmentConfig.apiSecret {
1424
- uRLRequest.addValue(apiKey, forHTTPHeaderField: "x-api-key")
1425
- uRLRequest.addValue(apiSecret, forHTTPHeaderField: "x-api-secret")
1426
- }
1427
-
1428
1461
  var params: [String: Any] = [
1429
1462
  "name": nameOnCard ?? "",
1430
1463
  "email": userEmail ?? "",
@@ -1461,26 +1494,47 @@ class BillingInfoVC: BaseVC {
1461
1494
  params["zip"] = billingInfoDict["postal_code"] as? String ?? ""
1462
1495
  }
1463
1496
 
1497
+ // Add these if recurring is enabled
1498
+ // if let req = request, req.is_recurring == true {
1499
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
1500
+ // // Only send start_date if type is .custom and field is not empty
1501
+ // if let startDateText = startDate, !startDateText.isEmpty {
1502
+ // let inputFormatter = DateFormatter()
1503
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
1504
+ //
1505
+ // let outputFormatter = DateFormatter()
1506
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
1507
+ //
1508
+ // if let date = inputFormatter.date(from: startDateText) {
1509
+ // let apiFormattedDate = outputFormatter.string(from: date)
1510
+ // params["start_date"] = apiFormattedDate
1511
+ // } else {
1512
+ // print("Invalid date format in startDateText")
1513
+ // }
1514
+ // }
1515
+ // }
1516
+ //
1517
+ // params["interval"] = chosenPlan?.lowercased()
1518
+ // }
1519
+
1464
1520
  // Add these if recurring is enabled
1465
1521
  if let req = request, req.is_recurring == true {
1466
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
1467
- // Only send start_date if type is .custom and field is not empty
1468
- if let startDateText = startDate, !startDateText.isEmpty {
1469
- let inputFormatter = DateFormatter()
1470
- inputFormatter.dateFormat = "dd/MM/yyyy"
1471
-
1472
- let outputFormatter = DateFormatter()
1473
- outputFormatter.dateFormat = "MM/dd/yyyy"
1474
-
1475
- if let date = inputFormatter.date(from: startDateText) {
1476
- let apiFormattedDate = outputFormatter.string(from: date)
1477
- params["start_date"] = apiFormattedDate
1478
- } else {
1479
- print("Invalid date format in startDateText")
1480
- }
1522
+ if let startDateText = startDate, !startDateText.isEmpty {
1523
+ let inputFormatter = DateFormatter()
1524
+ inputFormatter.dateFormat = "dd/MM/yyyy"
1525
+
1526
+ let outputFormatter = DateFormatter()
1527
+ outputFormatter.dateFormat = "MM/dd/yyyy"
1528
+
1529
+ if let date = inputFormatter.date(from: startDateText) {
1530
+ let apiFormattedDate = outputFormatter.string(from: date)
1531
+ params["start_date"] = apiFormattedDate
1532
+ } else {
1533
+ print("Invalid date format in startDateText")
1481
1534
  }
1482
1535
  }
1483
1536
 
1537
+ // interval is still required
1484
1538
  params["interval"] = chosenPlan?.lowercased()
1485
1539
  }
1486
1540
 
@@ -1643,26 +1697,47 @@ class BillingInfoVC: BaseVC {
1643
1697
  params["description"] = "Hosted payment checkout"
1644
1698
  }
1645
1699
 
1700
+ // Add these if recurring is enabled
1701
+ // if let req = request, req.is_recurring == true {
1702
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
1703
+ // // Only send start_date if type is .custom and field is not empty
1704
+ // if let startDateText = startDate, !startDateText.isEmpty {
1705
+ // let inputFormatter = DateFormatter()
1706
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
1707
+ //
1708
+ // let outputFormatter = DateFormatter()
1709
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
1710
+ //
1711
+ // if let date = inputFormatter.date(from: startDateText) {
1712
+ // let apiFormattedDate = outputFormatter.string(from: date)
1713
+ // params["start_date"] = apiFormattedDate
1714
+ // } else {
1715
+ // print("Invalid date format in startDateText")
1716
+ // }
1717
+ // }
1718
+ // }
1719
+ //
1720
+ // params["interval"] = chosenPlan?.lowercased()
1721
+ // }
1722
+
1646
1723
  // Add these if recurring is enabled
1647
1724
  if let req = request, req.is_recurring == true {
1648
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
1649
- // Only send start_date if type is .custom and field is not empty
1650
- if let startDateText = startDate, !startDateText.isEmpty {
1651
- let inputFormatter = DateFormatter()
1652
- inputFormatter.dateFormat = "dd/MM/yyyy"
1653
-
1654
- let outputFormatter = DateFormatter()
1655
- outputFormatter.dateFormat = "MM/dd/yyyy"
1656
-
1657
- if let date = inputFormatter.date(from: startDateText) {
1658
- let apiFormattedDate = outputFormatter.string(from: date)
1659
- params["start_date"] = apiFormattedDate
1660
- } else {
1661
- print("Invalid date format in startDateText")
1662
- }
1725
+ if let startDateText = startDate, !startDateText.isEmpty {
1726
+ let inputFormatter = DateFormatter()
1727
+ inputFormatter.dateFormat = "dd/MM/yyyy"
1728
+
1729
+ let outputFormatter = DateFormatter()
1730
+ outputFormatter.dateFormat = "MM/dd/yyyy"
1731
+
1732
+ if let date = inputFormatter.date(from: startDateText) {
1733
+ let apiFormattedDate = outputFormatter.string(from: date)
1734
+ params["start_date"] = apiFormattedDate
1735
+ } else {
1736
+ print("Invalid date format in startDateText")
1663
1737
  }
1664
1738
  }
1665
1739
 
1740
+ // interval is still required
1666
1741
  params["interval"] = chosenPlan?.lowercased()
1667
1742
  }
1668
1743
 
@@ -1851,26 +1926,47 @@ class BillingInfoVC: BaseVC {
1851
1926
  params["description"] = "Hosted payment checkout"
1852
1927
  }
1853
1928
 
1929
+ // Add these if recurring is enabled
1930
+ // if let req = request, req.is_recurring == true {
1931
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
1932
+ // // Only send start_date if type is .custom and field is not empty
1933
+ // if let startDateText = startDate, !startDateText.isEmpty {
1934
+ // let inputFormatter = DateFormatter()
1935
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
1936
+ //
1937
+ // let outputFormatter = DateFormatter()
1938
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
1939
+ //
1940
+ // if let date = inputFormatter.date(from: startDateText) {
1941
+ // let apiFormattedDate = outputFormatter.string(from: date)
1942
+ // params["start_date"] = apiFormattedDate
1943
+ // } else {
1944
+ // print("Invalid date format in startDateText")
1945
+ // }
1946
+ // }
1947
+ // }
1948
+ //
1949
+ // params["interval"] = chosenPlan?.lowercased()
1950
+ // }
1951
+
1854
1952
  // Add these if recurring is enabled
1855
1953
  if let req = request, req.is_recurring == true {
1856
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
1857
- // Only send start_date if type is .custom and field is not empty
1858
- if let startDateText = startDate, !startDateText.isEmpty {
1859
- let inputFormatter = DateFormatter()
1860
- inputFormatter.dateFormat = "dd/MM/yyyy"
1861
-
1862
- let outputFormatter = DateFormatter()
1863
- outputFormatter.dateFormat = "MM/dd/yyyy"
1864
-
1865
- if let date = inputFormatter.date(from: startDateText) {
1866
- let apiFormattedDate = outputFormatter.string(from: date)
1867
- params["start_date"] = apiFormattedDate
1868
- } else {
1869
- print("Invalid date format in startDateText")
1870
- }
1954
+ if let startDateText = startDate, !startDateText.isEmpty {
1955
+ let inputFormatter = DateFormatter()
1956
+ inputFormatter.dateFormat = "dd/MM/yyyy"
1957
+
1958
+ let outputFormatter = DateFormatter()
1959
+ outputFormatter.dateFormat = "MM/dd/yyyy"
1960
+
1961
+ if let date = inputFormatter.date(from: startDateText) {
1962
+ let apiFormattedDate = outputFormatter.string(from: date)
1963
+ params["start_date"] = apiFormattedDate
1964
+ } else {
1965
+ print("Invalid date format in startDateText")
1871
1966
  }
1872
1967
  }
1873
1968
 
1969
+ // interval is still required
1874
1970
  params["interval"] = chosenPlan?.lowercased()
1875
1971
  }
1876
1972
 
@@ -2032,26 +2128,47 @@ class BillingInfoVC: BaseVC {
2032
2128
  params["description"] = "Hosted payment checkout"
2033
2129
  }
2034
2130
 
2131
+ // Add these if recurring is enabled
2132
+ // if let req = request, req.is_recurring == true {
2133
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
2134
+ // // Only send start_date if type is .custom and field is not empty
2135
+ // if let startDateText = startDate, !startDateText.isEmpty {
2136
+ // let inputFormatter = DateFormatter()
2137
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
2138
+ //
2139
+ // let outputFormatter = DateFormatter()
2140
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
2141
+ //
2142
+ // if let date = inputFormatter.date(from: startDateText) {
2143
+ // let apiFormattedDate = outputFormatter.string(from: date)
2144
+ // params["start_date"] = apiFormattedDate
2145
+ // } else {
2146
+ // print("Invalid date format in startDateText")
2147
+ // }
2148
+ // }
2149
+ // }
2150
+ //
2151
+ // params["interval"] = chosenPlan?.lowercased()
2152
+ // }
2153
+
2035
2154
  // Add these if recurring is enabled
2036
2155
  if let req = request, req.is_recurring == true {
2037
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
2038
- // Only send start_date if type is .custom and field is not empty
2039
- if let startDateText = startDate, !startDateText.isEmpty {
2040
- let inputFormatter = DateFormatter()
2041
- inputFormatter.dateFormat = "dd/MM/yyyy"
2042
-
2043
- let outputFormatter = DateFormatter()
2044
- outputFormatter.dateFormat = "MM/dd/yyyy"
2045
-
2046
- if let date = inputFormatter.date(from: startDateText) {
2047
- let apiFormattedDate = outputFormatter.string(from: date)
2048
- params["start_date"] = apiFormattedDate
2049
- } else {
2050
- print("Invalid date format in startDateText")
2051
- }
2156
+ if let startDateText = startDate, !startDateText.isEmpty {
2157
+ let inputFormatter = DateFormatter()
2158
+ inputFormatter.dateFormat = "dd/MM/yyyy"
2159
+
2160
+ let outputFormatter = DateFormatter()
2161
+ outputFormatter.dateFormat = "MM/dd/yyyy"
2162
+
2163
+ if let date = inputFormatter.date(from: startDateText) {
2164
+ let apiFormattedDate = outputFormatter.string(from: date)
2165
+ params["start_date"] = apiFormattedDate
2166
+ } else {
2167
+ print("Invalid date format in startDateText")
2052
2168
  }
2053
2169
  }
2054
2170
 
2171
+ // interval is still required
2055
2172
  params["interval"] = chosenPlan?.lowercased()
2056
2173
  }
2057
2174
 
@@ -2182,7 +2299,6 @@ class BillingInfoVC: BaseVC {
2182
2299
  "routing_number": routingNumber ?? "",
2183
2300
  "account_number": accountNumber ?? "",
2184
2301
  "payment_mode": "auth_and_capture",
2185
- "payment_intent": UserStoreSingleton.shared.paymentIntent ?? "",
2186
2302
  "levelIndicator": 1,
2187
2303
  ]
2188
2304
 
@@ -2207,26 +2323,47 @@ class BillingInfoVC: BaseVC {
2207
2323
  params["description"] = "Hosted payment checkout"
2208
2324
  }
2209
2325
 
2326
+ // Add these if recurring is enabled
2327
+ // if let req = request, req.is_recurring == true {
2328
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
2329
+ // // Only send start_date if type is .custom and field is not empty
2330
+ // if let startDateText = startDate, !startDateText.isEmpty {
2331
+ // let inputFormatter = DateFormatter()
2332
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
2333
+ //
2334
+ // let outputFormatter = DateFormatter()
2335
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
2336
+ //
2337
+ // if let date = inputFormatter.date(from: startDateText) {
2338
+ // let apiFormattedDate = outputFormatter.string(from: date)
2339
+ // params["start_date"] = apiFormattedDate
2340
+ // } else {
2341
+ // print("Invalid date format in startDateText")
2342
+ // }
2343
+ // }
2344
+ // }
2345
+ //
2346
+ // params["interval"] = chosenPlan?.lowercased()
2347
+ // }
2348
+
2210
2349
  // Add these if recurring is enabled
2211
2350
  if let req = request, req.is_recurring == true {
2212
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
2213
- // Only send start_date if type is .custom and field is not empty
2214
- if let startDateText = startDate, !startDateText.isEmpty {
2215
- let inputFormatter = DateFormatter()
2216
- inputFormatter.dateFormat = "dd/MM/yyyy"
2217
-
2218
- let outputFormatter = DateFormatter()
2219
- outputFormatter.dateFormat = "MM/dd/yyyy"
2220
-
2221
- if let date = inputFormatter.date(from: startDateText) {
2222
- let apiFormattedDate = outputFormatter.string(from: date)
2223
- params["start_date"] = apiFormattedDate
2224
- } else {
2225
- print("Invalid date format in startDateText")
2226
- }
2351
+ if let startDateText = startDate, !startDateText.isEmpty {
2352
+ let inputFormatter = DateFormatter()
2353
+ inputFormatter.dateFormat = "dd/MM/yyyy"
2354
+
2355
+ let outputFormatter = DateFormatter()
2356
+ outputFormatter.dateFormat = "MM/dd/yyyy"
2357
+
2358
+ if let date = inputFormatter.date(from: startDateText) {
2359
+ let apiFormattedDate = outputFormatter.string(from: date)
2360
+ params["start_date"] = apiFormattedDate
2361
+ } else {
2362
+ print("Invalid date format in startDateText")
2227
2363
  }
2228
2364
  }
2229
2365
 
2366
+ // interval is still required
2230
2367
  params["interval"] = chosenPlan?.lowercased()
2231
2368
  }
2232
2369
 
@@ -2359,7 +2496,6 @@ class BillingInfoVC: BaseVC {
2359
2496
  "routing_number": routingNumber ?? "",
2360
2497
  "account_number": accountNumber ?? "",
2361
2498
  "payment_mode": "auth_and_capture",
2362
- "payment_intent": UserStoreSingleton.shared.paymentIntent ?? "",
2363
2499
  "levelIndicator": 1,
2364
2500
  "save_account": 1,
2365
2501
  "payment_method": "ach"
@@ -2392,26 +2528,47 @@ class BillingInfoVC: BaseVC {
2392
2528
  params["description"] = "Hosted payment checkout"
2393
2529
  }
2394
2530
 
2531
+ // Add these if recurring is enabled
2532
+ // if let req = request, req.is_recurring == true {
2533
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
2534
+ // // Only send start_date if type is .custom and field is not empty
2535
+ // if let startDateText = startDate, !startDateText.isEmpty {
2536
+ // let inputFormatter = DateFormatter()
2537
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
2538
+ //
2539
+ // let outputFormatter = DateFormatter()
2540
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
2541
+ //
2542
+ // if let date = inputFormatter.date(from: startDateText) {
2543
+ // let apiFormattedDate = outputFormatter.string(from: date)
2544
+ // params["start_date"] = apiFormattedDate
2545
+ // } else {
2546
+ // print("Invalid date format in startDateText")
2547
+ // }
2548
+ // }
2549
+ // }
2550
+ //
2551
+ // params["interval"] = chosenPlan?.lowercased()
2552
+ // }
2553
+
2395
2554
  // Add these if recurring is enabled
2396
2555
  if let req = request, req.is_recurring == true {
2397
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
2398
- // Only send start_date if type is .custom and field is not empty
2399
- if let startDateText = startDate, !startDateText.isEmpty {
2400
- let inputFormatter = DateFormatter()
2401
- inputFormatter.dateFormat = "dd/MM/yyyy"
2402
-
2403
- let outputFormatter = DateFormatter()
2404
- outputFormatter.dateFormat = "MM/dd/yyyy"
2405
-
2406
- if let date = inputFormatter.date(from: startDateText) {
2407
- let apiFormattedDate = outputFormatter.string(from: date)
2408
- params["start_date"] = apiFormattedDate
2409
- } else {
2410
- print("Invalid date format in startDateText")
2411
- }
2556
+ if let startDateText = startDate, !startDateText.isEmpty {
2557
+ let inputFormatter = DateFormatter()
2558
+ inputFormatter.dateFormat = "dd/MM/yyyy"
2559
+
2560
+ let outputFormatter = DateFormatter()
2561
+ outputFormatter.dateFormat = "MM/dd/yyyy"
2562
+
2563
+ if let date = inputFormatter.date(from: startDateText) {
2564
+ let apiFormattedDate = outputFormatter.string(from: date)
2565
+ params["start_date"] = apiFormattedDate
2566
+ } else {
2567
+ print("Invalid date format in startDateText")
2412
2568
  }
2413
2569
  }
2414
2570
 
2571
+ // interval is still required
2415
2572
  params["interval"] = chosenPlan?.lowercased()
2416
2573
  }
2417
2574
 
@@ -2543,7 +2700,6 @@ class BillingInfoVC: BaseVC {
2543
2700
  "routing_number": routingNumber ?? "",
2544
2701
  "account_number": accountNumber ?? "",
2545
2702
  "payment_mode": "auth_and_capture",
2546
- "payment_intent": UserStoreSingleton.shared.paymentIntent ?? "",
2547
2703
  "levelIndicator": 1,
2548
2704
  "save_account": 1,
2549
2705
  "payment_method": "ach"
@@ -2580,26 +2736,47 @@ class BillingInfoVC: BaseVC {
2580
2736
  params["description"] = "Hosted payment checkout"
2581
2737
  }
2582
2738
 
2739
+ // Add these if recurring is enabled
2740
+ // if let req = request, req.is_recurring == true {
2741
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
2742
+ // // Only send start_date if type is .custom and field is not empty
2743
+ // if let startDateText = startDate, !startDateText.isEmpty {
2744
+ // let inputFormatter = DateFormatter()
2745
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
2746
+ //
2747
+ // let outputFormatter = DateFormatter()
2748
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
2749
+ //
2750
+ // if let date = inputFormatter.date(from: startDateText) {
2751
+ // let apiFormattedDate = outputFormatter.string(from: date)
2752
+ // params["start_date"] = apiFormattedDate
2753
+ // } else {
2754
+ // print("Invalid date format in startDateText")
2755
+ // }
2756
+ // }
2757
+ // }
2758
+ //
2759
+ // params["interval"] = chosenPlan?.lowercased()
2760
+ // }
2761
+
2583
2762
  // Add these if recurring is enabled
2584
2763
  if let req = request, req.is_recurring == true {
2585
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
2586
- // Only send start_date if type is .custom and field is not empty
2587
- if let startDateText = startDate, !startDateText.isEmpty {
2588
- let inputFormatter = DateFormatter()
2589
- inputFormatter.dateFormat = "dd/MM/yyyy"
2590
-
2591
- let outputFormatter = DateFormatter()
2592
- outputFormatter.dateFormat = "MM/dd/yyyy"
2593
-
2594
- if let date = inputFormatter.date(from: startDateText) {
2595
- let apiFormattedDate = outputFormatter.string(from: date)
2596
- params["start_date"] = apiFormattedDate
2597
- } else {
2598
- print("Invalid date format in startDateText")
2599
- }
2764
+ if let startDateText = startDate, !startDateText.isEmpty {
2765
+ let inputFormatter = DateFormatter()
2766
+ inputFormatter.dateFormat = "dd/MM/yyyy"
2767
+
2768
+ let outputFormatter = DateFormatter()
2769
+ outputFormatter.dateFormat = "MM/dd/yyyy"
2770
+
2771
+ if let date = inputFormatter.date(from: startDateText) {
2772
+ let apiFormattedDate = outputFormatter.string(from: date)
2773
+ params["start_date"] = apiFormattedDate
2774
+ } else {
2775
+ print("Invalid date format in startDateText")
2600
2776
  }
2601
2777
  }
2602
2778
 
2779
+ // interval is still required
2603
2780
  params["interval"] = chosenPlan?.lowercased()
2604
2781
  }
2605
2782
 
@@ -2720,13 +2897,6 @@ class BillingInfoVC: BaseVC {
2720
2897
  print("Setting clientToken header: \(token ?? "None")")
2721
2898
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
2722
2899
 
2723
- if let apiKey = EnvironmentConfig.apiKey {
2724
- uRLRequest.addValue(apiKey, forHTTPHeaderField: "X-Api-Key")
2725
- }
2726
- if let apiSecret = EnvironmentConfig.apiSecret {
2727
- uRLRequest.addValue(apiSecret, forHTTPHeaderField: "X-Api-Secret")
2728
- }
2729
-
2730
2900
  var params: [String: Any] = [
2731
2901
  "account_id": self.grailPayAccountID ?? "",
2732
2902
  "account_type": self.selectedGrailPayAccountType ?? "",
@@ -2776,26 +2946,47 @@ class BillingInfoVC: BaseVC {
2776
2946
  params["description"] = "Hosted payment checkout"
2777
2947
  }
2778
2948
 
2949
+ // Add these if recurring is enabled
2950
+ // if let req = request, req.is_recurring == true {
2951
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
2952
+ // // Only send start_date if type is .custom and field is not empty
2953
+ // if let startDateText = startDate, !startDateText.isEmpty {
2954
+ // let inputFormatter = DateFormatter()
2955
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
2956
+ //
2957
+ // let outputFormatter = DateFormatter()
2958
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
2959
+ //
2960
+ // if let date = inputFormatter.date(from: startDateText) {
2961
+ // let apiFormattedDate = outputFormatter.string(from: date)
2962
+ // params["start_date"] = apiFormattedDate
2963
+ // } else {
2964
+ // print("Invalid date format in startDateText")
2965
+ // }
2966
+ // }
2967
+ // }
2968
+ //
2969
+ // params["interval"] = chosenPlan?.lowercased()
2970
+ // }
2971
+
2779
2972
  // Add these if recurring is enabled
2780
2973
  if let req = request, req.is_recurring == true {
2781
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
2782
- // Only send start_date if type is .custom and field is not empty
2783
- if let startDateText = startDate, !startDateText.isEmpty {
2784
- let inputFormatter = DateFormatter()
2785
- inputFormatter.dateFormat = "dd/MM/yyyy"
2786
-
2787
- let outputFormatter = DateFormatter()
2788
- outputFormatter.dateFormat = "MM/dd/yyyy"
2789
-
2790
- if let date = inputFormatter.date(from: startDateText) {
2791
- let apiFormattedDate = outputFormatter.string(from: date)
2792
- params["start_date"] = apiFormattedDate
2793
- } else {
2794
- print("Invalid date format in startDateText")
2795
- }
2974
+ if let startDateText = startDate, !startDateText.isEmpty {
2975
+ let inputFormatter = DateFormatter()
2976
+ inputFormatter.dateFormat = "dd/MM/yyyy"
2977
+
2978
+ let outputFormatter = DateFormatter()
2979
+ outputFormatter.dateFormat = "MM/dd/yyyy"
2980
+
2981
+ if let date = inputFormatter.date(from: startDateText) {
2982
+ let apiFormattedDate = outputFormatter.string(from: date)
2983
+ params["start_date"] = apiFormattedDate
2984
+ } else {
2985
+ print("Invalid date format in startDateText")
2796
2986
  }
2797
2987
  }
2798
2988
 
2989
+ // interval is still required
2799
2990
  params["interval"] = chosenPlan?.lowercased()
2800
2991
  }
2801
2992
 
@@ -2916,13 +3107,6 @@ class BillingInfoVC: BaseVC {
2916
3107
  print("Setting clientToken header: \(token ?? "None")")
2917
3108
  uRLRequest.addValue(token ?? "", forHTTPHeaderField: "Client-Token")
2918
3109
 
2919
- if let apiKey = EnvironmentConfig.apiKey {
2920
- uRLRequest.addValue(apiKey, forHTTPHeaderField: "X-Api-Key")
2921
- }
2922
- if let apiSecret = EnvironmentConfig.apiSecret {
2923
- uRLRequest.addValue(apiSecret, forHTTPHeaderField: "X-Api-Secret")
2924
- }
2925
-
2926
3110
  let emailPrefix = userEmail?.components(separatedBy: "@").first ?? ""
2927
3111
 
2928
3112
  var params: [String: Any] = [
@@ -3001,26 +3185,47 @@ class BillingInfoVC: BaseVC {
3001
3185
  }
3002
3186
  params["description"] = descriptionValue
3003
3187
 
3188
+ // Add these if recurring is enabled
3189
+ // if let req = request, req.is_recurring == true {
3190
+ // if let recurringType = req.recurringStartDateType, recurringType == .custom {
3191
+ // // Only send start_date if type is .custom and field is not empty
3192
+ // if let startDateText = startDate, !startDateText.isEmpty {
3193
+ // let inputFormatter = DateFormatter()
3194
+ // inputFormatter.dateFormat = "dd/MM/yyyy"
3195
+ //
3196
+ // let outputFormatter = DateFormatter()
3197
+ // outputFormatter.dateFormat = "MM/dd/yyyy"
3198
+ //
3199
+ // if let date = inputFormatter.date(from: startDateText) {
3200
+ // let apiFormattedDate = outputFormatter.string(from: date)
3201
+ // params["start_date"] = apiFormattedDate
3202
+ // } else {
3203
+ // print("Invalid date format in startDateText")
3204
+ // }
3205
+ // }
3206
+ // }
3207
+ //
3208
+ // params["interval"] = chosenPlan?.lowercased()
3209
+ // }
3210
+
3004
3211
  // Add these if recurring is enabled
3005
3212
  if let req = request, req.is_recurring == true {
3006
- if let recurringType = req.recurringStartDateType, recurringType == .custom {
3007
- // Only send start_date if type is .custom and field is not empty
3008
- if let startDateText = startDate, !startDateText.isEmpty {
3009
- let inputFormatter = DateFormatter()
3010
- inputFormatter.dateFormat = "dd/MM/yyyy"
3011
-
3012
- let outputFormatter = DateFormatter()
3013
- outputFormatter.dateFormat = "MM/dd/yyyy"
3014
-
3015
- if let date = inputFormatter.date(from: startDateText) {
3016
- let apiFormattedDate = outputFormatter.string(from: date)
3017
- params["start_date"] = apiFormattedDate
3018
- } else {
3019
- print("Invalid date format in startDateText")
3020
- }
3213
+ if let startDateText = startDate, !startDateText.isEmpty {
3214
+ let inputFormatter = DateFormatter()
3215
+ inputFormatter.dateFormat = "dd/MM/yyyy"
3216
+
3217
+ let outputFormatter = DateFormatter()
3218
+ outputFormatter.dateFormat = "MM/dd/yyyy"
3219
+
3220
+ if let date = inputFormatter.date(from: startDateText) {
3221
+ let apiFormattedDate = outputFormatter.string(from: date)
3222
+ params["start_date"] = apiFormattedDate
3223
+ } else {
3224
+ print("Invalid date format in startDateText")
3021
3225
  }
3022
3226
  }
3023
3227
 
3228
+ // interval is still required
3024
3229
  params["interval"] = chosenPlan?.lowercased()
3025
3230
  }
3026
3231