@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,23 @@
1
+ //
2
+ // BankAccountModel.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 23/08/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ struct BankAccountModel : Codable {
11
+ let status : Bool?
12
+ let message : String?
13
+ let accounts : [Accounts]?
14
+ let total_rows : Int?
15
+ }
16
+
17
+ struct Accounts : Codable {
18
+ let customer_id : String?
19
+ let account_id : String?
20
+ let account_number_last_4 : String?
21
+ let account_type : String?
22
+ let created_by : String?
23
+ }
@@ -0,0 +1,16 @@
1
+ //
2
+ // BillingInfo.swift
3
+ // EasyPay
4
+ //
5
+ // Created by iftekhar on 14/07/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ struct BillingInfo {
11
+ let address: String
12
+ let country: String
13
+ let state: String
14
+ let city: String
15
+ let postalCode: String
16
+ }
@@ -0,0 +1,19 @@
1
+ //
2
+ // CardModel.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 22/08/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ struct CardModel {
11
+ let cardBrandName: String
12
+ let cardId: String
13
+ let cardType: String
14
+ let ccLast4: String
15
+ let ccValidThru: String
16
+ let customerId: String
17
+ let isDefault: Bool
18
+ }
19
+
@@ -0,0 +1,19 @@
1
+ //
2
+ // Country.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 26/11/24.
6
+ //
7
+
8
+ import Foundation
9
+ import UIKit
10
+
11
+ class Country {
12
+ var countryCode: String?
13
+ var name: String?
14
+ var currencyCode: String?
15
+ var currencySymbol: String?
16
+ var extensionCode: String?
17
+ var flag: String?
18
+ }
19
+
@@ -0,0 +1,46 @@
1
+ //
2
+ // PaymentInfo.swift
3
+ // EasyPay
4
+ //
5
+ // Created by iftekhar on 14/07/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ @objc
11
+ protocol PaymentInfo: AnyObject {
12
+
13
+ }
14
+
15
+ class CardInfo: PaymentInfo {
16
+ let number: String
17
+ let expiry: String
18
+ let cvv: String
19
+ let name: String
20
+ let saveForFuture: Bool
21
+
22
+ init(number: String, expiry: String, cvv: String, name: String, saveForFuture: Bool) {
23
+ self.number = number
24
+ self.expiry = expiry
25
+ self.cvv = cvv
26
+ self.name = name
27
+ self.saveForFuture = saveForFuture
28
+ }
29
+ }
30
+
31
+ class BankInfo: PaymentInfo {
32
+ let name: String
33
+ let routing: String
34
+ let type: String
35
+ let number: String
36
+ let saveForFuture: Bool
37
+
38
+ init(name: String, routing: String, type: String, number: String, saveForFuture: Bool) {
39
+ self.name = name
40
+ self.routing = routing
41
+ self.type = type
42
+ self.number = number
43
+ self.saveForFuture = saveForFuture
44
+ }
45
+ }
46
+
@@ -0,0 +1,245 @@
1
+ //
2
+ // Request.swift
3
+ // EasyPay
4
+ //
5
+ // Created by iftekhar on 13/07/24.
6
+ //
7
+
8
+ import UIKit
9
+
10
+ @objc
11
+ public final class Request: NSObject {
12
+ public let amount: Double
13
+ public let billingInfoData: Data?
14
+
15
+ public init(amount: Double, billingInfoData: Data? = nil) {
16
+ self.amount = amount
17
+ self.billingInfoData = billingInfoData
18
+
19
+ super.init()
20
+
21
+ // Call the payment intent API
22
+ self.paymentIntentApi { success in
23
+ if success {
24
+ print("Payment Intent API call succeeded")
25
+ // Save the amount in UserStoreSingleton
26
+ UserStoreSingleton.shared.price = String(self.amount)
27
+ print("Saved amount: \(UserStoreSingleton.shared.price ?? "No amount")")
28
+ }
29
+ }
30
+
31
+ }
32
+
33
+ //MARK: - Payment Intent Api
34
+ func paymentIntentApi(completion: @escaping (Bool) -> Void) {
35
+ // Start loader when API call starts
36
+
37
+ guard let serviceURL = URL(string: EnvironmentConfig.baseURL + EnvironmentConfig.Endpoints.paymentIntent.path()) else {
38
+ print("Invalid URL")
39
+ completion(false)
40
+ return
41
+ }
42
+
43
+ var request = URLRequest(url: serviceURL)
44
+ request.httpMethod = "POST"
45
+ request.addValue("application/json", forHTTPHeaderField: "Content-Type")
46
+ request.addValue(EnvironmentConfig.apiKey ?? "", forHTTPHeaderField: "X-Api-Key")
47
+ request.addValue(EnvironmentConfig.apiSecret ?? "", forHTTPHeaderField: "X-Api-Secret")
48
+
49
+ let params: [String: Any] = [
50
+ "amount": amount,
51
+ ]
52
+
53
+ do {
54
+ request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
55
+ } catch {
56
+ print("Error creating JSON data: \(error)")
57
+ completion(false)
58
+ return
59
+ }
60
+
61
+ let task = URLSession.shared.dataTask(with: request) { data, response, error in
62
+ DispatchQueue.main.async {
63
+ // Stop loader when response is received
64
+ }
65
+
66
+ guard let httpResponse = response as? HTTPURLResponse, error == nil else {
67
+ print("Error: \(error?.localizedDescription ?? "Unknown error")")
68
+ completion(false)
69
+ return
70
+ }
71
+
72
+ if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
73
+ if let data = data {
74
+ do {
75
+ if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
76
+ print("Response Data: \(responseObject)")
77
+
78
+ // Save tokens
79
+ if let clientToken = responseObject["client_token"] as? String {
80
+ UserStoreSingleton.shared.clientToken = clientToken
81
+ print("Client Token successfully saved: \(UserStoreSingleton.shared.clientToken ?? "None")")
82
+ }
83
+
84
+ if let paymentIntent = responseObject["payment_intent"] as? String {
85
+ UserStoreSingleton.shared.paymentIntent = paymentIntent
86
+ }
87
+
88
+ self.hostedCheckoutsApi { success in
89
+ completion(success)
90
+ }
91
+ } else {
92
+ print("Invalid JSON format")
93
+ completion(false)
94
+ }
95
+ } catch {
96
+ print("Error parsing JSON: \(error)")
97
+ completion(false)
98
+ }
99
+ } else {
100
+ print("No data received")
101
+ completion(false)
102
+ }
103
+ } else {
104
+ print("HTTP Status Code: \(httpResponse.statusCode)")
105
+ completion(false)
106
+ }
107
+ }
108
+ task.resume()
109
+ }
110
+
111
+ // MARK: - Hosted Checkout API
112
+ func hostedCheckoutsApi(completion: @escaping (Bool) -> Void) {
113
+
114
+ // Build the URL using EnvironmentConfig
115
+ guard let baseURL = URL(string: EnvironmentConfig.baseURL) else {
116
+ print("Invalid base URL")
117
+ completion(false)
118
+ return
119
+ }
120
+
121
+ let endpointPath = EnvironmentConfig.Endpoints.hostedCheckouts.path()
122
+ let serviceURL = baseURL.appendingPathComponent(endpointPath)
123
+
124
+ var request = URLRequest(url: serviceURL)
125
+ request.httpMethod = "POST"
126
+ request.addValue("application/json", forHTTPHeaderField: "Content-Type")
127
+ request.addValue(UserStoreSingleton.shared.clientToken ?? "", forHTTPHeaderField: "clientToken")
128
+
129
+ let params: [String: Any] = [
130
+ "amount": amount,
131
+ ]
132
+
133
+ do {
134
+ request.httpBody = try JSONSerialization.data(withJSONObject: params, options: .prettyPrinted)
135
+ } catch {
136
+ print("Error creating JSON data: \(error)")
137
+ completion(false)
138
+ return
139
+ }
140
+
141
+ let task = URLSession.shared.dataTask(with: request) { data, response, error in
142
+
143
+ guard let httpResponse = response as? HTTPURLResponse, error == nil else {
144
+ print("Error: \(error?.localizedDescription ?? "Unknown error")")
145
+ completion(false)
146
+ return
147
+ }
148
+
149
+ if httpResponse.statusCode == 200 || httpResponse.statusCode == 201 {
150
+ if let data = data {
151
+ do {
152
+ if let responseObject = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any],
153
+ let dataObject = responseObject["data"] as? [String: Any] {
154
+ print(dataObject)
155
+
156
+ // Save merchant details
157
+ if let merchantEmail = dataObject["merchant_email"] as? String {
158
+ UserStoreSingleton.shared.merchantEmail = merchantEmail
159
+ print("Saved merchantEmail: \(merchantEmail)")
160
+ }
161
+
162
+ if let merchantName = dataObject["merchant_name"] as? String {
163
+ UserStoreSingleton.shared.merchantName = merchantName
164
+ print("Saved merchantName: \(merchantName)")
165
+ }
166
+
167
+ // Save payment methods (crypto payment account)
168
+ if let paymentMethods = dataObject["payment_methods"] as? [String: Any],
169
+ let cryptoSection = paymentMethods["crypto"] as? [String: Any],
170
+ let paymentAccount = cryptoSection["payment_account"] as? String {
171
+ UserStoreSingleton.shared.paymentAccount = paymentAccount
172
+ print("Saved paymentAccount (Crypto): \(paymentAccount)")
173
+ }
174
+
175
+ // Save appearance settings
176
+ if let appearanceSettings = dataObject["apperance_settings"] as? [String: Any] {
177
+ if let bodyBgCol = appearanceSettings["body_bg_col"] as? String {
178
+ UserStoreSingleton.shared.body_bg_col = bodyBgCol
179
+ print("Saved bodyBgCol: \(bodyBgCol)")
180
+ }
181
+ if let borderRadious = appearanceSettings["border_radious"] as? String {
182
+ UserStoreSingleton.shared.border_radious = borderRadious
183
+ print("Saved borderRadious: \(borderRadious)")
184
+ }
185
+ if let containerBgCol = appearanceSettings["container_bg_col"] as? String {
186
+ UserStoreSingleton.shared.container_bg_col = containerBgCol
187
+ print("Saved containerBgCol: \(containerBgCol)")
188
+ }
189
+ if let primaryBtnBgCol = appearanceSettings["primary_btn_bg_col"] as? String {
190
+ UserStoreSingleton.shared.primary_btn_bg_col = primaryBtnBgCol
191
+ print("Saved primaryBtnBgCol: \(primaryBtnBgCol)")
192
+ }
193
+ if let primaryBtnFontCol = appearanceSettings["primary_btn_font_col"] as? String {
194
+ UserStoreSingleton.shared.primary_btn_font_col = primaryBtnFontCol
195
+ print("Saved primaryBtnFontCol: \(primaryBtnFontCol)")
196
+ }
197
+ if let primaryBtnHoverCol = appearanceSettings["primary_btn_hover_col"] as? String {
198
+ UserStoreSingleton.shared.primary_btn_hover_col = primaryBtnHoverCol
199
+ print("Saved primaryBtnHoverCol: \(primaryBtnHoverCol)")
200
+ }
201
+ if let primaryFontCol = appearanceSettings["primary_font_col"] as? String {
202
+ UserStoreSingleton.shared.primary_font_col = primaryFontCol
203
+ print("Saved primaryFontCol: \(primaryFontCol)")
204
+ }
205
+ if let secondaryBtnBgCol = appearanceSettings["secondary_btn_bg_col"] as? String {
206
+ UserStoreSingleton.shared.secondary_btn_bg_col = secondaryBtnBgCol
207
+ print("Saved secondaryBtnBgCol: \(secondaryBtnBgCol)")
208
+ }
209
+ if let secondaryBtnFontCol = appearanceSettings["secondary_btn_font_col"] as? String {
210
+ UserStoreSingleton.shared.secondary_font_col = secondaryBtnFontCol
211
+ print("Saved secondaryBtnFontCol: \(secondaryBtnFontCol)")
212
+ }
213
+ if let secondaryBtnHoverCol = appearanceSettings["secondary_btn_hover_col"] as? String {
214
+ UserStoreSingleton.shared.secondary_btn_hover_col = secondaryBtnHoverCol
215
+ print("Saved secondaryBtnHoverCol: \(secondaryBtnHoverCol)")
216
+ }
217
+ if let secondaryFontCol = appearanceSettings["secondary_font_col"] as? String {
218
+ UserStoreSingleton.shared.secondary_font_col = secondaryFontCol
219
+ print("Saved secondaryFontCol: \(secondaryFontCol)")
220
+ }
221
+ }
222
+
223
+ completion(true)
224
+
225
+ } else {
226
+ print("Invalid JSON format or 'data' key is missing")
227
+ completion(false)
228
+ }
229
+ } catch {
230
+ print("Error parsing JSON: \(error)")
231
+ completion(false)
232
+ }
233
+ } else {
234
+ print("No data received")
235
+ completion(false)
236
+ }
237
+ } else {
238
+ print("HTTP Status Code: \(httpResponse.statusCode)")
239
+ completion(false)
240
+ }
241
+ }
242
+ task.resume()
243
+ }
244
+
245
+ }
@@ -0,0 +1,69 @@
1
+ //
2
+ // Result.swift
3
+ // EasyPay
4
+ //
5
+ // Created by iftekhar on 14/07/24.
6
+ //
7
+
8
+ //import UIKit
9
+ //
10
+ //@objc
11
+ //public enum ResultType: Int {
12
+ // case cancelled
13
+ // case success
14
+ // case error
15
+ //}
16
+ //
17
+ //@objc
18
+ //public final class Result: NSObject {
19
+ //
20
+ // @objc public let type: ResultType
21
+ //
22
+ // @objc public let error: NSError?
23
+ //
24
+ // internal init(error: NSError) {
25
+ // type = .error
26
+ // self.error = error
27
+ // super.init()
28
+ // }
29
+ //
30
+ // internal init(type: ResultType) {
31
+ // self.type = type
32
+ // self.error = nil
33
+ // super.init()
34
+ // }
35
+ //}
36
+
37
+ import UIKit
38
+
39
+ @objc
40
+ public enum ResultType: Int {
41
+ case cancelled
42
+ case success
43
+ case error
44
+ }
45
+
46
+ @objc
47
+ public final class Result: NSObject {
48
+
49
+ @objc public let type: ResultType
50
+ @objc public let error: NSError?
51
+ @objc public let chargeData: [String: Any]?
52
+
53
+ // Initializer for error type result
54
+ internal init(error: NSError) {
55
+ self.type = .error
56
+ self.error = error
57
+ self.chargeData = nil
58
+ super.init()
59
+ }
60
+
61
+ // Initializer for other result types with optional charge data
62
+ internal init(type: ResultType, chargeData: [String: Any]? = nil) {
63
+ self.type = type
64
+ self.error = nil
65
+ self.chargeData = chargeData
66
+ super.init()
67
+ }
68
+ }
69
+
@@ -0,0 +1,200 @@
1
+ //
2
+ // UserStoreSingleton.swift
3
+ // EasyPay
4
+ //
5
+ // Created by Mony's Mac on 13/08/24.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ import Foundation
11
+ import UIKit
12
+
13
+
14
+ class UserStoreSingleton: NSObject {
15
+
16
+ static let shared = UserStoreSingleton()
17
+
18
+ private override init() {}
19
+
20
+ var clientToken : String? {
21
+ get {
22
+ return (UserDefaults().object(forKey: "client_token") as? String)
23
+ } set {
24
+ UserDefaults.standard.setValue(newValue, forKey: "client_token")
25
+ }
26
+ }
27
+
28
+ var paymentIntent : String? {
29
+ get {
30
+ return (UserDefaults().object(forKey: "payment_intent") as? String)
31
+ } set {
32
+ UserDefaults.standard.setValue(newValue, forKey: "payment_intent")
33
+ }
34
+ }
35
+
36
+ var merchantEmail : String? {
37
+ get {
38
+ return (UserDefaults().object(forKey: "merchant_email") as? String)
39
+ } set {
40
+ UserDefaults.standard.setValue(newValue, forKey: "merchant_email")
41
+ }
42
+ }
43
+
44
+ var merchantName : String? {
45
+ get {
46
+ return (UserDefaults().object(forKey: "merchant_name") as? String)
47
+ } set {
48
+ UserDefaults.standard.setValue(newValue, forKey: "merchant_name")
49
+ }
50
+ }
51
+
52
+ var paymentAccount : String? {
53
+ get {
54
+ return (UserDefaults().object(forKey: "payment_account") as? String)
55
+ } set {
56
+ UserDefaults.standard.setValue(newValue, forKey: "payment_account")
57
+ }
58
+ }
59
+
60
+ var price : String? {
61
+ get {
62
+ return (UserDefaults().object(forKey: "price") as? String)
63
+ } set {
64
+ UserDefaults.standard.setValue(newValue, forKey: "price")
65
+ }
66
+ }
67
+
68
+ var isLoggedIn : Bool? {
69
+ get {
70
+ return (UserDefaults().object(forKey: "isLoggedIn") as? Bool)
71
+ } set {
72
+ UserDefaults.standard.setValue(newValue, forKey: "isLoggedIn")
73
+ }
74
+ }
75
+
76
+ var customerId: String? {
77
+ get {
78
+ return UserDefaults.standard.string(forKey: "customer_id")
79
+ }
80
+ set {
81
+ UserDefaults.standard.set(newValue, forKey: "customer_id")
82
+ }
83
+ }
84
+
85
+ var customerToken: String? {
86
+ get {
87
+ return UserDefaults.standard.string(forKey: "customer_token")
88
+ }
89
+ set {
90
+ UserDefaults.standard.set(newValue, forKey: "customer_token")
91
+ }
92
+ }
93
+
94
+ var verificationEmail: String? {
95
+ get {
96
+ return UserDefaults.standard.string(forKey: "verificationEmail")
97
+ }
98
+ set {
99
+ UserDefaults.standard.set(newValue, forKey: "verificationEmail")
100
+ }
101
+ }
102
+
103
+ //apperance_settings
104
+ var body_bg_col : String? {
105
+ get {
106
+ return (UserDefaults().object(forKey: "body_bg_col") as? String)
107
+ } set {
108
+ UserDefaults.standard.setValue(newValue, forKey: "body_bg_col")
109
+ }
110
+ }
111
+
112
+ var border_radious : String? {
113
+ get {
114
+ return (UserDefaults().object(forKey: "border_radious") as? String)
115
+ } set {
116
+ UserDefaults.standard.setValue(newValue, forKey: "border_radious")
117
+ }
118
+ }
119
+
120
+ var container_bg_col : String? {
121
+ get {
122
+ return (UserDefaults().object(forKey: "container_bg_col") as? String)
123
+ } set {
124
+ UserDefaults.standard.setValue(newValue, forKey: "container_bg_col")
125
+ }
126
+ }
127
+
128
+ var primary_btn_bg_col : String? {
129
+ get {
130
+ return (UserDefaults().object(forKey: "primary_btn_bg_col") as? String)
131
+ } set {
132
+ UserDefaults.standard.setValue(newValue, forKey: "primary_btn_bg_col")
133
+ }
134
+ }
135
+
136
+ var primary_btn_font_col : String? {
137
+ get {
138
+ return (UserDefaults().object(forKey: "primary_btn_font_col") as? String)
139
+ } set {
140
+ UserDefaults.standard.setValue(newValue, forKey: "primary_btn_font_col")
141
+ }
142
+ }
143
+
144
+ var primary_btn_hover_col : String? {
145
+ get {
146
+ return (UserDefaults().object(forKey: "primary_btn_hover_col") as? String)
147
+ } set {
148
+ UserDefaults.standard.setValue(newValue, forKey: "primary_btn_hover_col")
149
+ }
150
+ }
151
+
152
+ var primary_font_col : String? {
153
+ get {
154
+ return (UserDefaults().object(forKey: "primary_font_col") as? String)
155
+ } set {
156
+ UserDefaults.standard.setValue(newValue, forKey: "primary_font_col")
157
+ }
158
+ }
159
+
160
+ var secondary_btn_bg_col : String? {
161
+ get {
162
+ return (UserDefaults().object(forKey: "secondary_btn_bg_col") as? String)
163
+ } set {
164
+ UserDefaults.standard.setValue(newValue, forKey: "secondary_btn_bg_col")
165
+ }
166
+ }
167
+
168
+ var secondary_btn_font_col : String? {
169
+ get {
170
+ return (UserDefaults().object(forKey: "secondary_btn_font_col") as? String)
171
+ } set {
172
+ UserDefaults.standard.setValue(newValue, forKey: "secondary_btn_font_col")
173
+ }
174
+ }
175
+
176
+ var secondary_btn_hover_col : String? {
177
+ get {
178
+ return (UserDefaults().object(forKey: "secondary_btn_hover_col") as? String)
179
+ } set {
180
+ UserDefaults.standard.setValue(newValue, forKey: "secondary_btn_hover_col")
181
+ }
182
+ }
183
+
184
+ var secondary_font_col : String? {
185
+ get {
186
+ return (UserDefaults().object(forKey: "secondary_font_col") as? String)
187
+ } set {
188
+ UserDefaults.standard.setValue(newValue, forKey: "secondary_font_col")
189
+ }
190
+ }
191
+
192
+ // Method to clear user data from UserDefaults
193
+ func clearUserData() {
194
+ UserDefaults.standard.removeObject(forKey: "customer_id")
195
+ UserDefaults.standard.removeObject(forKey: "verificationEmail")
196
+ UserDefaults.standard.removeObject(forKey: "customer_token")
197
+ UserDefaults.standard.synchronize() // Optional, but can help ensure the changes are applied immediately
198
+ }
199
+
200
+ }