@jimrising/easymerchantsdk-react-native 1.0.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.
Files changed (188) hide show
  1. package/.idea/caches/deviceStreaming.xml +340 -0
  2. package/.idea/em-MobileCheckoutSDK-ReactNative.iml +9 -0
  3. package/.idea/misc.xml +5 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/README.md +230 -0
  7. package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/results.bin +1 -0
  8. package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
  9. package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  10. package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  11. package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
  12. package/android/build/.transforms/27d3a0c22098810ca42038b1b8102417/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  13. package/android/build/.transforms/41cd2635778c1bb5c18af2c46eb9196e/results.bin +1 -0
  14. package/android/build/.transforms/41cd2635778c1bb5c18af2c46eb9196e/transformed/classes/classes_dex/classes.dex +0 -0
  15. package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/results.bin +1 -0
  16. package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
  17. package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  18. package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  19. package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
  20. package/android/build/.transforms/6b36622787f586c4b6e3df98c5efa11c/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  21. package/android/build/.transforms/7eb7ceaa43c9e8323ac65b4f785987b6/results.bin +1 -0
  22. package/android/build/.transforms/7eb7ceaa43c9e8323ac65b4f785987b6/transformed/classes/classes_dex/classes.dex +0 -0
  23. package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/results.bin +1 -0
  24. package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/BuildConfig.dex +0 -0
  25. package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule$1.dex +0 -0
  26. package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkModule.dex +0 -0
  27. package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/reactlibrary/RNEasymerchantsdkPackage.dex +0 -0
  28. package/android/build/.transforms/a8b93af4be449a0e2cca4bd6ddb6685e/transformed/bundleLibRuntimeToDirDebug/desugar_graph.bin +0 -0
  29. package/android/build/.transforms/f1a160720415bc76d8d6c6734c5acf3e/results.bin +1 -0
  30. package/android/build/.transforms/f1a160720415bc76d8d6c6734c5acf3e/transformed/classes/classes_dex/classes.dex +0 -0
  31. package/android/build/generated/source/buildConfig/debug/com/reactlibrary/BuildConfig.java +10 -0
  32. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/AndroidManifest.xml +7 -0
  33. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/processDebugManifest/aapt/output-metadata.json +18 -0
  34. package/android/build/intermediates/aar_metadata/debug/writeDebugAarMetadata/aar-metadata.properties +6 -0
  35. package/android/build/intermediates/annotation_processor_list/debug/javaPreCompileDebug/annotationProcessors.json +1 -0
  36. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  37. package/android/build/intermediates/compile_r_class_jar/debug/generateDebugRFile/R.jar +0 -0
  38. package/android/build/intermediates/compile_symbol_list/debug/generateDebugRFile/R.txt +0 -0
  39. package/android/build/intermediates/incremental/debug/packageDebugResources/compile-file-map.properties +1 -0
  40. package/android/build/intermediates/incremental/debug/packageDebugResources/merger.xml +2 -0
  41. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +2 -0
  42. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +2 -0
  43. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +2 -0
  44. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/BuildConfig.class +0 -0
  45. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  46. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  47. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/reactlibrary/RNEasymerchantsdkPackage.class +0 -0
  48. package/android/build/intermediates/local_only_symbol_list/debug/parseDebugLocalResources/R-def.txt +2 -0
  49. package/android/build/intermediates/manifest_merge_blame_file/debug/processDebugManifest/manifest-merger-blame-debug-report.txt +7 -0
  50. package/android/build/intermediates/merged_manifest/debug/processDebugManifest/AndroidManifest.xml +7 -0
  51. package/android/build/intermediates/navigation_json/debug/extractDeepLinksDebug/navigation.json +1 -0
  52. package/android/build/intermediates/nested_resources_validation_report/debug/generateDebugResources/nestedResourcesValidationReport.txt +1 -0
  53. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/BuildConfig.class +0 -0
  54. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule$1.class +0 -0
  55. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkModule.class +0 -0
  56. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/reactlibrary/RNEasymerchantsdkPackage.class +0 -0
  57. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  58. package/android/build/intermediates/symbol_list_with_package_name/debug/generateDebugRFile/package-aware-r.txt +1 -0
  59. package/android/build/outputs/logs/manifest-merger-debug-report.txt +17 -0
  60. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule$1.class.uniqueId2 +0 -0
  61. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkModule.class.uniqueId1 +0 -0
  62. package/android/build/tmp/compileDebugJavaWithJavac/compileTransaction/stash-dir/RNEasymerchantsdkPackage.class.uniqueId0 +0 -0
  63. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  64. package/android/build.gradle +55 -0
  65. package/android/src/main/AndroidManifest.xml +5 -0
  66. package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkModule.java +72 -0
  67. package/android/src/main/java/com/reactlibrary/RNEasymerchantsdkPackage.java +28 -0
  68. package/index.js +5 -0
  69. package/ios/Bundle/EasyPayBundle.swift +22 -0
  70. package/ios/Classes/EasyMerchantSdk.h +4 -0
  71. package/ios/Classes/EasyMerchantSdk.m +43 -0
  72. package/ios/Classes/EasyMerchantSdk.swift +124 -0
  73. package/ios/Classes/EasyPayViewController.swift +90 -0
  74. package/ios/CustomComponents/CheckboxButton.swift +20 -0
  75. package/ios/CustomComponents/FilledButton.swift +17 -0
  76. package/ios/CustomComponents/OutlineButton.swift +26 -0
  77. package/ios/CustomComponents/TextFieldStackView.swift +96 -0
  78. package/ios/EnvironmentConfig.swift +63 -0
  79. package/ios/Example/Assets.xcassets/AccentColor.colorset/Contents.json +11 -0
  80. package/ios/Example/Assets.xcassets/AppIcon.appiconset/Contents.json +13 -0
  81. package/ios/Example/Assets.xcassets/Contents.json +6 -0
  82. package/ios/Example/Base.lproj/LaunchScreen.storyboard +25 -0
  83. package/ios/Example/Base.lproj/Main.storyboard +65 -0
  84. package/ios/Example/SceneDelegate.swift +52 -0
  85. package/ios/Example/ViewController.swift +84 -0
  86. package/ios/Extensions/UIColor.swift +22 -0
  87. package/ios/Extensions/UIFont.swift +80 -0
  88. package/ios/Extensions/UIViewController+Extension.swift +42 -0
  89. package/ios/Models/AdditionalInfo.swift +16 -0
  90. package/ios/Models/BankAccountModel.swift +23 -0
  91. package/ios/Models/BillingInfo.swift +16 -0
  92. package/ios/Models/CardModel.swift +19 -0
  93. package/ios/Models/Country.swift +19 -0
  94. package/ios/Models/PaymentInfo.swift +46 -0
  95. package/ios/Models/Request.swift +245 -0
  96. package/ios/Models/Result.swift +69 -0
  97. package/ios/Pods/UserDefaults/UserStoreSingleton.swift +200 -0
  98. package/ios/Pods/ViewControllers/AdditionalInfoVC.swift +1073 -0
  99. package/ios/Pods/ViewControllers/BaseVC.swift +117 -0
  100. package/ios/Pods/ViewControllers/BillingInfoVC/BillingInfoVC.swift +616 -0
  101. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CityListTVC.swift +19 -0
  102. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/CountryListTVC.swift +19 -0
  103. package/ios/Pods/ViewControllers/BillingInfoVC/Cells/StateListTVC.swift +19 -0
  104. package/ios/Pods/ViewControllers/CountryListVC.swift +367 -0
  105. package/ios/Pods/ViewControllers/EmailVerificationVC.swift +192 -0
  106. package/ios/Pods/ViewControllers/OTPVerificationVC.swift +1009 -0
  107. package/ios/Pods/ViewControllers/PaymentDoneVC.swift +94 -0
  108. package/ios/Pods/ViewControllers/PaymentErrorVC.swift +43 -0
  109. package/ios/Pods/ViewControllers/PaymentInformation/AccountTypeTVC.swift +19 -0
  110. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInfoVC.swift +4269 -0
  111. package/ios/Pods/ViewControllers/PaymentInformation/PaymentInformationCVC.swift +20 -0
  112. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.swift +37 -0
  113. package/ios/Pods/ViewControllers/PaymentInformation/SavedAccountsTVC/SavedAccountTVC.xib +163 -0
  114. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.swift +40 -0
  115. package/ios/Pods/ViewControllers/PaymentInformation/SavedCardsTVC/SavedCardsTVC.xib +184 -0
  116. package/ios/Pods/ViewControllers/TermAndConditionsVC.swift +21 -0
  117. package/ios/Resources/Assets.xcassets/Card/Amex.imageset/206682_american_express_method_card_payment_icon.svg +1 -0
  118. package/ios/Resources/Assets.xcassets/Card/Amex.imageset/Contents.json +12 -0
  119. package/ios/Resources/Assets.xcassets/Card/Contents.json +6 -0
  120. package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/472318_card_club_diners_dinner_payment_icon.svg +1 -0
  121. package/ios/Resources/Assets.xcassets/Card/DinersClub.imageset/Contents.json +12 -0
  122. package/ios/Resources/Assets.xcassets/Card/Discover.imageset/206686_network_payment_discover_card_method_icon.svg +1 -0
  123. package/ios/Resources/Assets.xcassets/Card/Discover.imageset/Contents.json +12 -0
  124. package/ios/Resources/Assets.xcassets/Card/JCB.imageset/358102_card_jcb_payment_icon.svg +1 -0
  125. package/ios/Resources/Assets.xcassets/Card/JCB.imageset/Contents.json +12 -0
  126. package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/206680_master_method_card_payment_icon.svg +1 -0
  127. package/ios/Resources/Assets.xcassets/Card/MasterCard.imageset/Contents.json +12 -0
  128. package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/1468976_card_payment_unionpay_icon.svg +1 -0
  129. package/ios/Resources/Assets.xcassets/Card/UnionPay.imageset/Contents.json +12 -0
  130. package/ios/Resources/Assets.xcassets/Card/Visa.imageset/206684_visa_method_card_payment_icon.svg +1 -0
  131. package/ios/Resources/Assets.xcassets/Card/Visa.imageset/Contents.json +12 -0
  132. package/ios/Resources/Assets.xcassets/Card/maestro.imageset/Contents.json +12 -0
  133. package/ios/Resources/Assets.xcassets/Card/maestro.imageset/maestro.svg +1 -0
  134. package/ios/Resources/Assets.xcassets/Card/paypal.imageset/206675_paypal_method_payment_icon.svg +1 -0
  135. package/ios/Resources/Assets.xcassets/Card/paypal.imageset/Contents.json +12 -0
  136. package/ios/Resources/Assets.xcassets/Card/rupay.imageset/Contents.json +12 -0
  137. package/ios/Resources/Assets.xcassets/Card/rupay.imageset/rupay.svg +1 -0
  138. package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/4635000_card_credit_digital_money_icon.svg +1 -0
  139. package/ios/Resources/Assets.xcassets/Card/unknown_card.imageset/Contents.json +12 -0
  140. package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/Contents.json +12 -0
  141. package/ios/Resources/Assets.xcassets/Card/worldpay.imageset/worldpay.svg +1 -0
  142. package/ios/Resources/Assets.xcassets/Contents.json +6 -0
  143. package/ios/Resources/Assets.xcassets/Ellipsis.imageset/Contents.json +23 -0
  144. package/ios/Resources/Assets.xcassets/Ellipsis.imageset/icons8-menu-30.png +0 -0
  145. package/ios/Resources/Assets.xcassets/Ellipsis.imageset/icons8-menu-60.png +0 -0
  146. package/ios/Resources/Assets.xcassets/Ellipsis.imageset/icons8-menu-90.png +0 -0
  147. package/ios/Resources/Assets.xcassets/Rotate.imageset/Contents.json +23 -0
  148. package/ios/Resources/Assets.xcassets/Rotate.imageset/refresh-cw-2.png +0 -0
  149. package/ios/Resources/Assets.xcassets/Rotate.imageset/refresh-cw-3.png +0 -0
  150. package/ios/Resources/Assets.xcassets/Rotate.imageset/refresh-cw.png +0 -0
  151. package/ios/Resources/Assets.xcassets/amexCvc.imageset/Contents.json +22 -0
  152. package/ios/Resources/Assets.xcassets/amexCvc.imageset/Group-1.png +0 -0
  153. package/ios/Resources/Assets.xcassets/amexCvc.imageset/Group.png +0 -0
  154. package/ios/Resources/Assets.xcassets/check.imageset/Contents.json +23 -0
  155. package/ios/Resources/Assets.xcassets/check.imageset/check-circle-4.png +0 -0
  156. package/ios/Resources/Assets.xcassets/check.imageset/check-circle-5.png +0 -0
  157. package/ios/Resources/Assets.xcassets/check.imageset/check-circle-6.png +0 -0
  158. package/ios/Resources/Assets.xcassets/chip.imageset/Contents.json +21 -0
  159. package/ios/Resources/Assets.xcassets/chip.imageset/chip.png +0 -0
  160. package/ios/Resources/Assets.xcassets/loaderImage.imageset/Contents.json +23 -0
  161. package/ios/Resources/Assets.xcassets/loaderImage.imageset/check-circle-2.png +0 -0
  162. package/ios/Resources/Assets.xcassets/loaderImage.imageset/check-circle-3.png +0 -0
  163. package/ios/Resources/Assets.xcassets/loaderImage.imageset/check-circle.png +0 -0
  164. package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/Contents.json +23 -0
  165. package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/payment_done_icon 1.png +0 -0
  166. package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/payment_done_icon 2.png +0 -0
  167. package/ios/Resources/Assets.xcassets/payment_done_icon.imageset/payment_done_icon.png +0 -0
  168. package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/Contents.json +23 -0
  169. package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/payment_error_icon 1.png +0 -0
  170. package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/payment_error_icon 2.png +0 -0
  171. package/ios/Resources/Assets.xcassets/payment_error_icon.imageset/payment_error_icon.png +0 -0
  172. package/ios/Resources/Assets.xcassets/wallet.imageset/Contents.json +23 -0
  173. package/ios/Resources/Assets.xcassets/wallet.imageset/icons8-wallet-24(@1/303/227).png +0 -0
  174. package/ios/Resources/Assets.xcassets/wallet.imageset/icons8-wallet-48(@2/303/227).png +0 -0
  175. package/ios/Resources/Assets.xcassets/wallet.imageset/icons8-wallet-72(@3/303/227).png +0 -0
  176. package/ios/Resources/Colors.xcassets/00000008.colorset/Contents.json +20 -0
  177. package/ios/Resources/Colors.xcassets/00000016.colorset/Contents.json +20 -0
  178. package/ios/Resources/Colors.xcassets/00000038.colorset/Contents.json +20 -0
  179. package/ios/Resources/Colors.xcassets/00000060.colorset/Contents.json +20 -0
  180. package/ios/Resources/Colors.xcassets/1757D9.colorset/Contents.json +20 -0
  181. package/ios/Resources/Colors.xcassets/Contents.json +6 -0
  182. package/ios/Resources/Colors.xcassets/E93939.colorset/Contents.json +20 -0
  183. package/ios/Resources/PrivacyInfo.xcprivacy +10 -0
  184. package/ios/ThirdParty/Keyboad Handling/KeyboardObserver.swift +74 -0
  185. package/ios/easymerchantsdk.podspec +80 -0
  186. package/ios/easymerchantsdk.storyboard +5885 -0
  187. package/package.json +27 -0
  188. package/src/index.js +44 -0
@@ -0,0 +1,616 @@
1
+ //
2
+ // BillingInfoVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 12/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ @available(iOS 16.0, *)
11
+
12
+ protocol BillingInfoVCDelegate: AnyObject {
13
+ func didPassTextBack(_ text: String)
14
+ }
15
+
16
+ class BillingInfoVC: BaseVC {
17
+
18
+ @IBOutlet weak var viewBillingInfo: UIView!
19
+ @IBOutlet weak var btnPrevious: UIButton!
20
+ @IBOutlet weak var viewCountryList: UIView!
21
+ @IBOutlet weak var tblViewCountryList: UITableView!
22
+ @IBOutlet weak var txtFieldAddress: UITextField!
23
+ @IBOutlet weak var txtFieldCountry: UITextField!
24
+ @IBOutlet weak var viewStateList: UIView!
25
+ @IBOutlet weak var tblViewStateList: UITableView!
26
+ @IBOutlet weak var txtFieldState: UITextField!
27
+ @IBOutlet weak var viewCityList: UIView!
28
+ @IBOutlet weak var tblViewCityList: UITableView!
29
+ @IBOutlet weak var txtFieldCity: UITextField!
30
+ @IBOutlet weak var txtFieldPostalCode: UITextField!
31
+
32
+ @IBOutlet weak var buttonBottomConstraint: NSLayoutConstraint!
33
+
34
+ // Variable to store the auth token
35
+ var authToken: String?
36
+
37
+ var countryList: [[String: Any]] = []
38
+ var stateList: [[String: Any]] = []
39
+ var cityList: [[String: Any]] = []
40
+
41
+ var billingInfoData: [String: Any]?
42
+
43
+ var cardNumber: String?
44
+ var expiryDate: String?
45
+ var cvv: String?
46
+ var nameOnCard: String?
47
+
48
+ //Banking Params
49
+ var accountName: String?
50
+ var routingNumber: String?
51
+ var accountType: String?
52
+ var accountNumber: String?
53
+
54
+ var selectedPaymentMethod: String?
55
+
56
+ private let keyboardObserver = KeyboardObserver()
57
+
58
+ var isSavedForFuture: Bool = false
59
+ var isSavedNewCard: Bool = false
60
+
61
+ private var request: Request!
62
+ var selectedCard: CardModel?
63
+ var amount: Int?
64
+ var cvvText: String?
65
+
66
+ var isFrom = String()
67
+
68
+ //From Regular Saved Bank Accounts
69
+ var customerID: String?
70
+ var accountID: String?
71
+
72
+ var isSavedNewAccount: Bool?
73
+
74
+ weak var delegate: BillingInfoVCDelegate?
75
+
76
+ override func viewDidLoad() {
77
+ super.viewDidLoad()
78
+
79
+ viewBillingInfo.layer.borderColor = UIColor.systemGray.cgColor
80
+ viewBillingInfo.layer.borderWidth = 1
81
+ viewBillingInfo.layer.cornerRadius = 8
82
+
83
+ btnPrevious.layer.borderColor = UIColor.systemBlue.cgColor
84
+ btnPrevious.layer.borderWidth = 1
85
+ btnPrevious.layer.cornerRadius = 8
86
+
87
+ setupShadowForListViews()
88
+
89
+ tblViewCountryList.delegate = self
90
+ tblViewCountryList.dataSource = self
91
+ viewCountryList.isHidden = true
92
+
93
+ tblViewStateList.delegate = self
94
+ tblViewStateList.dataSource = self
95
+ viewStateList.isHidden = true
96
+
97
+ tblViewCityList.delegate = self
98
+ tblViewCityList.dataSource = self
99
+ viewCityList.isHidden = true
100
+
101
+ txtFieldCity.delegate = self
102
+ txtFieldState.delegate = self
103
+ txtFieldAddress.delegate = self
104
+ txtFieldCountry.delegate = self
105
+ txtFieldPostalCode.delegate = self
106
+
107
+ getTokenApi()
108
+
109
+ // Add tap gesture to hide the views and dismiss the keyboard
110
+ let tapGesture = UITapGestureRecognizer(target: self, action: #selector(didTapOutside))
111
+ tapGesture.cancelsTouchesInView = false
112
+ self.view.addGestureRecognizer(tapGesture)
113
+
114
+ // Print data for verification
115
+ if let billingInfoData = billingInfoData {
116
+ print("Billing Info Data: \(billingInfoData)")
117
+
118
+ if let address = billingInfoData["address"] as? String {
119
+ txtFieldAddress.text = address
120
+ }
121
+
122
+ if let country = billingInfoData["country"] as? String {
123
+ txtFieldCountry.text = country
124
+ }
125
+
126
+ if let state = billingInfoData["state"] as? String {
127
+ txtFieldState.text = state
128
+ }
129
+
130
+ if let city = billingInfoData["city"] as? String {
131
+ txtFieldCity.text = city
132
+ }
133
+
134
+ if let postalCode = billingInfoData["postal_code"] as? String {
135
+ txtFieldPostalCode.text = postalCode
136
+ }
137
+ }
138
+
139
+ print(accountName ?? "")
140
+ print(routingNumber ?? "")
141
+ print(accountType ?? "")
142
+ print(accountNumber ?? "")
143
+ print(billingInfoData ?? "")
144
+ print(selectedPaymentMethod ?? "")
145
+ print(isSavedForFuture)
146
+ }
147
+
148
+ override func viewWillAppear(_ animated: Bool) {
149
+ super.viewWillAppear(animated)
150
+ keyboardObserver.animateChanges({ [self] height in
151
+ let newConstant = CGFloat.maximum(height - self.view.safeAreaInsets.bottom + 8, 8)
152
+ buttonBottomConstraint.constant = newConstant
153
+ self.view.setNeedsLayout()
154
+ self.view.layoutIfNeeded()
155
+ })
156
+ }
157
+
158
+ override func viewWillDisappear(_ animated: Bool) {
159
+ super.viewWillDisappear(animated)
160
+ keyboardObserver.invalidate()
161
+ }
162
+
163
+ @objc func didTapOutside() {
164
+ // Dismiss the keyboard
165
+ self.view.endEditing(true)
166
+
167
+ // Hide the country list view if it is visible
168
+ if !viewCountryList.isHidden {
169
+ viewCountryList.isHidden = true
170
+ }
171
+
172
+ // Hide the state list view if it is visible
173
+ if !viewStateList.isHidden {
174
+ viewStateList.isHidden = true
175
+ }
176
+
177
+ // Hide the city list view if it is visible
178
+ if !viewCityList.isHidden {
179
+ viewCityList.isHidden = true
180
+ }
181
+ }
182
+
183
+ func setupShadowForListViews() {
184
+ // Ensure the view does not clip its content or shadows
185
+ viewCountryList.clipsToBounds = false
186
+ // Apply shadow properties
187
+ viewCountryList.layer.shadowColor = UIColor.black.cgColor
188
+ viewCountryList.layer.shadowOpacity = 0.3
189
+ viewCountryList.layer.shadowOffset = CGSize(width: 0, height: 2)
190
+ viewCountryList.layer.shadowRadius = 4
191
+ // Optionally, you might want to set a corner radius to the view as well
192
+ viewCountryList.layer.cornerRadius = 8
193
+ tblViewCountryList.layer.cornerRadius = 8
194
+
195
+ // Ensure the view does not clip its content or shadows
196
+ viewStateList.clipsToBounds = false
197
+ // Apply shadow properties
198
+ viewStateList.layer.shadowColor = UIColor.black.cgColor
199
+ viewStateList.layer.shadowOpacity = 0.3
200
+ viewStateList.layer.shadowOffset = CGSize(width: 0, height: 2)
201
+ viewStateList.layer.shadowRadius = 4
202
+ // Optionally, you might want to set a corner radius to the view as well
203
+ viewStateList.layer.cornerRadius = 8
204
+ tblViewStateList.layer.cornerRadius = 8
205
+
206
+ // Ensure the view does not clip its content or shadows
207
+ viewCityList.clipsToBounds = false
208
+ // Apply shadow properties
209
+ viewCityList.layer.shadowColor = UIColor.black.cgColor
210
+ viewCityList.layer.shadowOpacity = 0.3
211
+ viewCityList.layer.shadowOffset = CGSize(width: 0, height: 2)
212
+ viewCityList.layer.shadowRadius = 4
213
+ // Optionally, you might want to set a corner radius to the view as well
214
+ viewCityList.layer.cornerRadius = 8
215
+ tblViewCityList.layer.cornerRadius = 8
216
+ }
217
+
218
+ //MARK: Get Auth Token
219
+ func getTokenApi() {
220
+ showLoadingIndicator()
221
+ let session = URLSession.shared
222
+ let serviceURL = URL(string: "https://www.universal-tutorial.com/api/getaccesstoken")!
223
+
224
+ var request = URLRequest(url: serviceURL)
225
+ request.httpMethod = "GET"
226
+
227
+ // Add the headers
228
+ request.addValue("nL1j-qXjd2cH3N4ZZ7SeL5TCI2mKhXdxFYh52DjahJyrSxAmQXeDJQADwkRO0fZSy84", forHTTPHeaderField: "api-token")
229
+ request.addValue("bright.developer7@gmail.com", forHTTPHeaderField: "user-email")
230
+
231
+ let task = session.dataTask(with: request) { (serviceData, serviceResponse, error) in
232
+
233
+ if error == nil {
234
+ if let httpResponse = serviceResponse as? HTTPURLResponse, httpResponse.statusCode == 200 {
235
+ if let data = serviceData {
236
+ do {
237
+ self.hideLoadingIndicator()
238
+ if let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [String: Any],
239
+ let authToken = jsonData["auth_token"] as? String {
240
+ // Save the auth token to the variable
241
+ self.authToken = authToken
242
+ print("Auth Token: \(authToken)")
243
+ self.getCountryListApi()
244
+ } else {
245
+ self.hideLoadingIndicator()
246
+ print("Error: Unable to parse JSON or find auth_token")
247
+ }
248
+ } catch {
249
+ self.hideLoadingIndicator()
250
+ print("Error parsing JSON: \(error.localizedDescription)")
251
+ }
252
+ }
253
+ } else {
254
+ self.hideLoadingIndicator()
255
+ print("Error: HTTP Status Code \(String(describing: (serviceResponse as? HTTPURLResponse)?.statusCode))")
256
+ }
257
+ } else {
258
+ self.hideLoadingIndicator()
259
+ print("Error: \(error?.localizedDescription ?? "Unknown error")")
260
+ }
261
+ }
262
+ task.resume()
263
+ }
264
+
265
+ //MARK: Get Country List
266
+ func getCountryListApi() {
267
+ guard let authToken = authToken else {
268
+ print("Auth token is missing")
269
+ return
270
+ }
271
+
272
+ let session = URLSession.shared
273
+ let serviceURL = URL(string: "https://www.universal-tutorial.com/api/countries")!
274
+
275
+ var request = URLRequest(url: serviceURL)
276
+ request.httpMethod = "GET"
277
+
278
+ request.addValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization")
279
+
280
+ let task = session.dataTask(with: request) { (serviceData, serviceResponse, error) in
281
+
282
+ if error == nil {
283
+ if let httpResponse = serviceResponse as? HTTPURLResponse, httpResponse.statusCode == 200 {
284
+ if let data = serviceData {
285
+ do {
286
+ if let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String: Any]] {
287
+ self.countryList = jsonData
288
+ DispatchQueue.main.async {
289
+ self.tblViewCountryList.reloadData()
290
+ }
291
+ } else {
292
+ self.hideLoadingIndicator()
293
+ print("Error: Unable to parse JSON or find country data")
294
+ }
295
+ } catch {
296
+ self.hideLoadingIndicator()
297
+ print("Error parsing JSON: \(error.localizedDescription)")
298
+ }
299
+ }
300
+ } else {
301
+ self.hideLoadingIndicator()
302
+ print("Error: HTTP Status Code \(String(describing: (serviceResponse as? HTTPURLResponse)?.statusCode))")
303
+ }
304
+ } else {
305
+ self.hideLoadingIndicator()
306
+ print("Error: \(error?.localizedDescription ?? "Unknown error")")
307
+ }
308
+ }
309
+ task.resume()
310
+ }
311
+
312
+ //MARK: Get State List
313
+ func getStateListApi(for country: String) {
314
+ guard let authToken = authToken else {
315
+ print("Auth token is missing")
316
+ return
317
+ }
318
+
319
+ let session = URLSession.shared
320
+ let serviceURLString = "https://www.universal-tutorial.com/api/states/\(country.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!)"
321
+
322
+ guard let serviceURL = URL(string: serviceURLString) else {
323
+ print("Error: Invalid URL")
324
+ return
325
+ }
326
+
327
+ var request = URLRequest(url: serviceURL)
328
+ request.httpMethod = "GET"
329
+ request.addValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization")
330
+
331
+ let task = session.dataTask(with: request) { (serviceData, serviceResponse, error) in
332
+
333
+ if error == nil {
334
+ if let httpResponse = serviceResponse as? HTTPURLResponse, httpResponse.statusCode == 200 {
335
+ if let data = serviceData {
336
+ do {
337
+ if let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String: Any]] {
338
+ self.stateList = jsonData
339
+
340
+ // Automatically select the first state
341
+ if let firstState = self.stateList.first?["state_name"] as? String {
342
+ DispatchQueue.main.async {
343
+ self.txtFieldState.text = firstState
344
+ // Fetch cities for the first state
345
+ self.getCityListListApi(for: firstState)
346
+ }
347
+ }
348
+
349
+ DispatchQueue.main.async {
350
+ self.tblViewStateList.reloadData()
351
+ }
352
+ } else {
353
+ self.hideLoadingIndicator()
354
+ print("Error: Unable to parse JSON or find state data")
355
+ }
356
+ } catch {
357
+ self.hideLoadingIndicator()
358
+ print("Error parsing JSON: \(error.localizedDescription)")
359
+ }
360
+ }
361
+ } else {
362
+ self.hideLoadingIndicator()
363
+ print("Error: HTTP Status Code \(String(describing: (serviceResponse as? HTTPURLResponse)?.statusCode))")
364
+ }
365
+ } else {
366
+ self.hideLoadingIndicator()
367
+ print("Error: \(error?.localizedDescription ?? "Unknown error")")
368
+ }
369
+ }
370
+ task.resume()
371
+ }
372
+
373
+ //MARK: Get City List
374
+ func getCityListListApi(for state: String) {
375
+ guard let authToken = authToken else {
376
+ print("Auth token is missing")
377
+ return
378
+ }
379
+
380
+ let session = URLSession.shared
381
+ let serviceURLString = "https://www.universal-tutorial.com/api/cities/\(state.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed)!)"
382
+
383
+ guard let serviceURL = URL(string: serviceURLString) else {
384
+ print("Error: Invalid URL")
385
+ return
386
+ }
387
+
388
+ var request = URLRequest(url: serviceURL)
389
+ request.httpMethod = "GET"
390
+ request.addValue("Bearer \(authToken)", forHTTPHeaderField: "Authorization")
391
+
392
+ let task = session.dataTask(with: request) { (serviceData, serviceResponse, error) in
393
+
394
+ if error == nil {
395
+ if let httpResponse = serviceResponse as? HTTPURLResponse, httpResponse.statusCode == 200 {
396
+ if let data = serviceData {
397
+ do {
398
+ if let jsonData = try JSONSerialization.jsonObject(with: data, options: .mutableContainers) as? [[String: Any]] {
399
+ self.cityList = jsonData
400
+
401
+ DispatchQueue.main.async {
402
+ if self.cityList.isEmpty {
403
+ self.txtFieldCity.text = "" // Clear the city field if no cities are available
404
+ } else {
405
+ // Automatically select the first city if available
406
+ if let firstCity = self.cityList.first?["city_name"] as? String {
407
+ self.txtFieldCity.text = firstCity
408
+ }
409
+ }
410
+ self.tblViewCityList.reloadData()
411
+ }
412
+ } else {
413
+ self.hideLoadingIndicator()
414
+ print("Error: Unable to parse JSON or find city data")
415
+ }
416
+ } catch {
417
+ self.hideLoadingIndicator()
418
+ print("Error parsing JSON: \(error.localizedDescription)")
419
+ }
420
+ }
421
+ } else {
422
+ self.hideLoadingIndicator()
423
+ print("Error: HTTP Status Code \(String(describing: (serviceResponse as? HTTPURLResponse)?.statusCode))")
424
+ }
425
+ } else {
426
+ self.hideLoadingIndicator()
427
+ print("Error: \(error?.localizedDescription ?? "Unknown error")")
428
+ }
429
+ }
430
+ task.resume()
431
+ }
432
+
433
+ func updateBillingInfoData() {
434
+ billingInfoData?["address"] = txtFieldAddress.text
435
+ billingInfoData?["country"] = txtFieldCountry.text
436
+ billingInfoData?["state"] = txtFieldState.text
437
+ billingInfoData?["city"] = txtFieldCity.text
438
+ billingInfoData?["postal_code"] = txtFieldPostalCode.text
439
+ }
440
+
441
+ @IBAction func actionBtnSelectCountry(_ sender: UIButton) {
442
+ UIView.animate(withDuration: 0.3) {
443
+ self.viewCountryList.isHidden.toggle()
444
+ }
445
+ }
446
+
447
+ @IBAction func actionBtnSelectState(_ sender: UIButton) {
448
+ UIView.animate(withDuration: 0.3) {
449
+ self.viewStateList.isHidden.toggle()
450
+ }
451
+ }
452
+
453
+ @IBAction func actionBtnSelectCity(_ sender: UIButton) {
454
+ UIView.animate(withDuration: 0.3) {
455
+ self.viewCityList.isHidden.toggle()
456
+ }
457
+ }
458
+
459
+ @IBAction func actionBtnPrevious(_ sender: UIButton) {
460
+ // Pass the text back to the previous screen
461
+ delegate?.didPassTextBack("NewAccount")
462
+ self.navigationController?.popViewController(animated: true)
463
+ }
464
+
465
+ @IBAction func actionBtnNext(_ sender: UIButton) {
466
+ let vc = EasyPaySdk.instantiateViewController(withIdentifier: "AdditionalInfoVC") as! AdditionalInfoVC
467
+ // Set properties on AdditionalInfoVC
468
+ vc.cardNumber = cardNumber
469
+ vc.expiryDate = expiryDate
470
+ vc.cvv = cvv
471
+ vc.nameOnCard = nameOnCard
472
+ updateBillingInfoData()
473
+ vc.billingInfoData = billingInfoData
474
+ // Pass the selected payment method
475
+ vc.selectedPaymentMethod = selectedPaymentMethod
476
+ vc.isSavedForFuture = isSavedForFuture
477
+
478
+ //Banking Case
479
+ vc.accountName = accountName
480
+ vc.routingNumber = routingNumber
481
+ vc.accountType = accountType
482
+ vc.accountNumber = accountNumber
483
+
484
+ vc.customerID = customerID
485
+ vc.accountID = accountID
486
+ vc.isFrom = isFrom
487
+
488
+ vc.isSavedNewAccount = isSavedNewAccount
489
+ vc.amount = amount
490
+
491
+ if isFrom == "SavedCards" {
492
+ vc.isFrom = "SavedCards"
493
+ vc.selectedCard = selectedCard // Passing the selected card data
494
+ vc.cvvText = cvvText // Passing the CVV text
495
+ vc.amount = amount
496
+ }
497
+
498
+ if isFrom == "AddNewCard" {
499
+ vc.isFrom = "AddNewCard"
500
+ vc.amount = amount
501
+ vc.isSavedNewCard = isSavedNewCard
502
+ }
503
+
504
+ self.navigationController?.pushViewController(vc, animated: true)
505
+ }
506
+
507
+ }
508
+
509
+ @available(iOS 16.0, *)
510
+ extension BillingInfoVC: UITableViewDelegate, UITableViewDataSource {
511
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
512
+ if tableView == tblViewCountryList {
513
+ return countryList.count
514
+ }
515
+ else if tableView == tblViewStateList {
516
+ return stateList.count
517
+ }
518
+ else if tableView == tblViewCityList {
519
+ return cityList.count
520
+ }
521
+ else {
522
+ return 0
523
+ }
524
+ }
525
+
526
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
527
+ if tableView == tblViewCountryList {
528
+ let cell = tableView.dequeueReusableCell(withIdentifier: "CountryListTVC") as! CountryListTVC
529
+ let country = countryList[indexPath.row]
530
+ cell.lblCountryName.text = country["country_name"] as? String
531
+ return cell
532
+ } else if tableView == tblViewStateList {
533
+ let cell = tableView.dequeueReusableCell(withIdentifier: "StateListTVC") as! StateListTVC
534
+ let state = stateList[indexPath.row]
535
+ cell.lblStateName.text = state["state_name"] as? String
536
+ return cell
537
+ } else if tableView == tblViewCityList {
538
+ let cell = tableView.dequeueReusableCell(withIdentifier: "CityListTVC") as! CityListTVC
539
+ let city = cityList[indexPath.row]
540
+ cell.lblCityName.text = city["city_name"] as? String
541
+ return cell
542
+ } else {
543
+ return UITableViewCell()
544
+ }
545
+ }
546
+
547
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
548
+ if tableView == tblViewCountryList {
549
+ let selectedCountry = countryList[indexPath.row]["country_name"] as? String
550
+ txtFieldCountry.text = selectedCountry
551
+ viewCountryList.isHidden = true
552
+
553
+ // Fetch states for the selected country
554
+ if let country = selectedCountry {
555
+ getStateListApi(for: country)
556
+ }
557
+ } else if tableView == tblViewStateList {
558
+ let selectedState = stateList[indexPath.row]["state_name"] as? String
559
+ txtFieldState.text = selectedState
560
+ viewStateList.isHidden = true
561
+
562
+ // Fetch cities for the selected state
563
+ if let state = selectedState {
564
+ getCityListListApi(for: state)
565
+ }
566
+ } else if tableView == tblViewCityList {
567
+ let selectedCity = cityList[indexPath.row]["city_name"] as? String
568
+ txtFieldCity.text = selectedCity
569
+ viewCityList.isHidden = true
570
+ }
571
+
572
+ updateBillingInfoData()
573
+ }
574
+
575
+
576
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
577
+ return 50
578
+ }
579
+
580
+ }
581
+
582
+ @available(iOS 16.0, *)
583
+ extension BillingInfoVC: UITextFieldDelegate {
584
+ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
585
+ textField.resignFirstResponder() // Dismiss the keyboard
586
+ return true
587
+ }
588
+
589
+ // Update billingInfoData when user finishes editing a field
590
+ func textFieldDidEndEditing(_ textField: UITextField) {
591
+ switch textField {
592
+ case txtFieldAddress:
593
+ billingInfoData?["address"] = textField.text
594
+ case txtFieldCountry:
595
+ billingInfoData?["country"] = textField.text
596
+ case txtFieldState:
597
+ billingInfoData?["state"] = textField.text
598
+ case txtFieldCity:
599
+ billingInfoData?["city"] = textField.text
600
+ case txtFieldPostalCode:
601
+ billingInfoData?["postal_code"] = textField.text
602
+ default:
603
+ break
604
+ }
605
+ }
606
+ }
607
+
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
@@ -0,0 +1,19 @@
1
+ //
2
+ // CityListTVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 12/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class CityListTVC: UITableViewCell {
11
+
12
+ @IBOutlet weak var lblCityName: UILabel!
13
+
14
+ override func awakeFromNib() {
15
+ super.awakeFromNib()
16
+
17
+ }
18
+
19
+ }
@@ -0,0 +1,19 @@
1
+ //
2
+ // CountryListTVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 12/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class CountryListTVC: UITableViewCell {
11
+
12
+ @IBOutlet weak var lblCountryName: UILabel!
13
+
14
+ override func awakeFromNib() {
15
+ super.awakeFromNib()
16
+
17
+ }
18
+
19
+ }
@@ -0,0 +1,19 @@
1
+ //
2
+ // StateListTVC.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 12/08/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ class StateListTVC: UITableViewCell {
11
+
12
+ @IBOutlet weak var lblStateName: UILabel!
13
+
14
+ override func awakeFromNib() {
15
+ super.awakeFromNib()
16
+
17
+ }
18
+
19
+ }