react-native-payengine 1.0.5 → 2.0.2

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 (242) hide show
  1. package/README.md +193 -111
  2. package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
  3. package/android/.gradle/{5.6.4 → 6.1.1}/fileHashes/fileHashes.bin +0 -0
  4. package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
  5. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  6. package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
  7. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  8. package/android/.gradle/checksums/checksums.lock +0 -0
  9. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  10. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  11. package/android/.gradle/config.properties +2 -0
  12. package/android/.idea/caches/deviceStreaming.xml +318 -0
  13. package/android/.idea/compiler.xml +1 -1
  14. package/android/.idea/gradle.xml +2 -2
  15. package/android/.idea/kotlinc.xml +6 -0
  16. package/android/.idea/migrations.xml +10 -0
  17. package/android/.idea/misc.xml +1 -1
  18. package/android/build.gradle +42 -6
  19. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  20. package/android/paymentsdk-debug.aar +0 -0
  21. package/android/paymentsdk-release.aar +0 -0
  22. package/android/src/legacy/AndroidManifest.xml +4 -0
  23. package/android/src/main/java/com/reactnativepayengine/GooglePayModule.java +196 -0
  24. package/android/src/main/java/com/reactnativepayengine/PayengineModule.java +1 -5
  25. package/android/src/main/java/com/reactnativepayengine/PayenginePackage.java +8 -33
  26. package/android/src/main/java/com/reactnativepayengine/util/MetricsUtil.kt +44 -0
  27. package/android/src/main/java/com/reactnativepayengine/util/PaymentsUtil.java +113 -0
  28. package/android/src/main/java/com/reactnativepayengine/v2/RNPEFraudAnalyticsApplication.java +55 -0
  29. package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +71 -0
  30. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +8 -0
  31. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEField.kt +17 -0
  32. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +103 -0
  33. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNPEBankAccountView.kt +77 -0
  34. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardView.kt +77 -0
  35. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +103 -0
  36. package/ios/PayEngineSDK.xcframework/Info.plist +44 -0
  37. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Frameworks/libKountDataCollector.a +0 -0
  38. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +25 -0
  39. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +106 -0
  40. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +82 -0
  41. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +622 -0
  42. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK.h +20 -0
  43. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +33 -0
  44. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +27 -0
  45. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
  46. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +15143 -0
  47. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +326 -0
  48. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +326 -0
  49. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  50. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +326 -0
  51. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +326 -0
  52. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/module.modulemap +11 -0
  53. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
  54. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
  55. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  56. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/browserInfo.html +136 -0
  57. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/perform3ds.html +467 -0
  58. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Frameworks/libKountDataCollector.a +0 -0
  59. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +25 -0
  60. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +106 -0
  61. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +82 -0
  62. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +1240 -0
  63. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK.h +20 -0
  64. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +33 -0
  65. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +27 -0
  66. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
  67. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +15143 -0
  68. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +326 -0
  69. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +326 -0
  70. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  71. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +326 -0
  72. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +326 -0
  73. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +15143 -0
  74. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +326 -0
  75. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +326 -0
  76. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  77. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +326 -0
  78. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +326 -0
  79. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/module.modulemap +11 -0
  80. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
  81. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
  82. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  83. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/browserInfo.html +136 -0
  84. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/perform3ds.html +467 -0
  85. package/ios/Payengine.xcodeproj/project.pbxproj +30 -9
  86. package/ios/Payengine.xcodeproj/project.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  87. package/ios/Payengine.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +4 -4
  88. package/ios/Payengine.xcworkspace/contents.xcworkspacedata +7 -0
  89. package/ios/Payengine.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  90. package/ios/Sources/Classes/ApplePay/RNPEApplePayButton.swift +111 -0
  91. package/ios/Sources/Classes/ApplePay/RNPEApplePayPaymentRequest.swift +43 -0
  92. package/ios/Sources/Classes/RNPEError.swift +12 -0
  93. package/ios/Sources/Classes/RNPEEventEmitter.swift +29 -0
  94. package/ios/Sources/Classes/RNPEUtils.swift +30 -0
  95. package/ios/Sources/Classes/RNPayEngineNative.swift +87 -0
  96. package/ios/Sources/Classes/SecureFields/RNPEBankAccountView.swift +130 -0
  97. package/ios/Sources/Classes/SecureFields/RNPECreditCardView.swift +129 -0
  98. package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +15 -0
  99. package/ios/Sources/Classes/SecureFields/RNPEField.swift +26 -0
  100. package/ios/Sources/Payengine.m +73 -0
  101. package/ios/Sources/Payengine.swift +13 -0
  102. package/lib/commonjs/components/PayEngine.js +2 -123
  103. package/lib/commonjs/components/PayEngine.js.map +1 -1
  104. package/lib/commonjs/components/{SecureFields/VGS/CardHolderNameField.js → v2/ApplePay/PEApplePayButton.js} +38 -13
  105. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
  106. package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js +29 -0
  107. package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js.map +1 -0
  108. package/lib/commonjs/components/v2/PayEngineNative.js +34 -0
  109. package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -0
  110. package/lib/commonjs/components/{SecureFields/VGS/TextField.js → v2/PayEngineProvider.js} +28 -12
  111. package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -0
  112. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +89 -0
  113. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -0
  114. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +90 -0
  115. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -0
  116. package/lib/commonjs/components/v2/SecureFields/IPEField.js +6 -0
  117. package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -0
  118. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js +6 -0
  119. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -0
  120. package/lib/commonjs/components/v2/SecureFields/PECard.js +6 -0
  121. package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -0
  122. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +18 -0
  123. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -0
  124. package/lib/commonjs/index.js +73 -8
  125. package/lib/commonjs/index.js.map +1 -1
  126. package/lib/commonjs/interfaces/index.js +2 -0
  127. package/lib/commonjs/interfaces/index.js.map +1 -0
  128. package/lib/commonjs/utils/index.js +29 -45
  129. package/lib/commonjs/utils/index.js.map +1 -1
  130. package/lib/module/components/PayEngine.js +3 -118
  131. package/lib/module/components/PayEngine.js.map +1 -1
  132. package/lib/module/components/v2/ApplePay/PEApplePayButton.js +37 -0
  133. package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
  134. package/lib/module/components/v2/ApplePay/PEPaymentRequest.js +20 -0
  135. package/lib/module/components/v2/ApplePay/PEPaymentRequest.js.map +1 -0
  136. package/lib/module/components/v2/PayEngineNative.js +23 -0
  137. package/lib/module/components/v2/PayEngineNative.js.map +1 -0
  138. package/lib/module/components/v2/PayEngineProvider.js +30 -0
  139. package/lib/module/components/v2/PayEngineProvider.js.map +1 -0
  140. package/lib/module/components/v2/SecureFields/BankAccountView.js +75 -0
  141. package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -0
  142. package/lib/module/components/v2/SecureFields/CreditCardView.js +76 -0
  143. package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -0
  144. package/lib/module/components/v2/SecureFields/IPEField.js +2 -0
  145. package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -0
  146. package/lib/module/components/v2/SecureFields/PEBankAccount.js +2 -0
  147. package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -0
  148. package/lib/module/components/v2/SecureFields/PECard.js +2 -0
  149. package/lib/module/components/v2/SecureFields/PECard.js.map +1 -0
  150. package/lib/module/components/v2/SecureFields/PEKeyboardType.js +11 -0
  151. package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -0
  152. package/lib/module/index.js +15 -6
  153. package/lib/module/index.js.map +1 -1
  154. package/lib/module/interfaces/index.js +2 -0
  155. package/lib/module/interfaces/index.js.map +1 -0
  156. package/lib/module/utils/index.js +20 -45
  157. package/lib/module/utils/index.js.map +1 -1
  158. package/lib/typescript/components/PayEngine.d.ts +1 -14
  159. package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +12 -0
  160. package/lib/typescript/components/v2/ApplePay/PEPaymentRequest.d.ts +12 -0
  161. package/lib/typescript/components/v2/PayEngineNative.d.ts +5 -0
  162. package/lib/typescript/components/v2/PayEngineProvider.d.ts +8 -0
  163. package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +14 -0
  164. package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +14 -0
  165. package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +10 -0
  166. package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +11 -0
  167. package/lib/typescript/components/v2/SecureFields/PECard.d.ts +13 -0
  168. package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +7 -0
  169. package/lib/typescript/index.d.ts +13 -3
  170. package/lib/typescript/interfaces/index.d.ts +6 -0
  171. package/lib/typescript/utils/index.d.ts +7 -41
  172. package/package.json +17 -11
  173. package/react-native-payengine.podspec +3 -3
  174. package/src/components/LoadingIndicator.tsx +28 -0
  175. package/src/components/PayEngine.tsx +8 -0
  176. package/src/components/v2/ApplePay/PEApplePayButton.tsx +70 -0
  177. package/src/components/v2/ApplePay/PEPaymentRequest.ts +18 -0
  178. package/src/components/v2/PayEngineNative.tsx +20 -0
  179. package/src/components/v2/PayEngineProvider.tsx +30 -0
  180. package/src/components/v2/SecureFields/BankAccountView.tsx +95 -0
  181. package/src/components/v2/SecureFields/CreditCardView.tsx +96 -0
  182. package/src/components/v2/SecureFields/IPEField.ts +12 -0
  183. package/src/components/v2/SecureFields/PEBankAccount.ts +12 -0
  184. package/src/components/v2/SecureFields/PECard.ts +14 -0
  185. package/src/components/v2/SecureFields/PEKeyboardType.ts +8 -0
  186. package/src/index.tsx +62 -0
  187. package/src/interfaces/index.ts +6 -0
  188. package/src/utils/index.ts +79 -0
  189. package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
  190. package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectModule.java +0 -148
  191. package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectOnCreateViewInstanceListener.java +0 -6
  192. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCVCField.java +0 -67
  193. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCardHolderNameField.java +0 -53
  194. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCardNumberField.java +0 -57
  195. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSExpDateField.java +0 -54
  196. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSTextField.java +0 -57
  197. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSZipCodeField.java +0 -62
  198. package/android/src/main/java/com/reactnativepayengine/util/ResourceUtil.java +0 -14
  199. package/ios/Payengine.m +0 -55
  200. package/ios/Payengine.swift +0 -637
  201. package/lib/commonjs/components/SecureFields/VGS/CVCField.js +0 -26
  202. package/lib/commonjs/components/SecureFields/VGS/CVCField.js.map +0 -1
  203. package/lib/commonjs/components/SecureFields/VGS/CardHolderNameField.js.map +0 -1
  204. package/lib/commonjs/components/SecureFields/VGS/CardNumberField.js +0 -26
  205. package/lib/commonjs/components/SecureFields/VGS/CardNumberField.js.map +0 -1
  206. package/lib/commonjs/components/SecureFields/VGS/CollectManager.js +0 -65
  207. package/lib/commonjs/components/SecureFields/VGS/CollectManager.js.map +0 -1
  208. package/lib/commonjs/components/SecureFields/VGS/ExpDateField.js +0 -26
  209. package/lib/commonjs/components/SecureFields/VGS/ExpDateField.js.map +0 -1
  210. package/lib/commonjs/components/SecureFields/VGS/TextField.js.map +0 -1
  211. package/lib/commonjs/components/SecureFields/VGS/ZipCodeField.js +0 -26
  212. package/lib/commonjs/components/SecureFields/VGS/ZipCodeField.js.map +0 -1
  213. package/lib/commonjs/components/SecureFields/index.js +0 -34
  214. package/lib/commonjs/components/SecureFields/index.js.map +0 -1
  215. package/lib/module/components/SecureFields/VGS/CVCField.js +0 -14
  216. package/lib/module/components/SecureFields/VGS/CVCField.js.map +0 -1
  217. package/lib/module/components/SecureFields/VGS/CardHolderNameField.js +0 -14
  218. package/lib/module/components/SecureFields/VGS/CardHolderNameField.js.map +0 -1
  219. package/lib/module/components/SecureFields/VGS/CardNumberField.js +0 -14
  220. package/lib/module/components/SecureFields/VGS/CardNumberField.js.map +0 -1
  221. package/lib/module/components/SecureFields/VGS/CollectManager.js +0 -50
  222. package/lib/module/components/SecureFields/VGS/CollectManager.js.map +0 -1
  223. package/lib/module/components/SecureFields/VGS/ExpDateField.js +0 -14
  224. package/lib/module/components/SecureFields/VGS/ExpDateField.js.map +0 -1
  225. package/lib/module/components/SecureFields/VGS/TextField.js +0 -17
  226. package/lib/module/components/SecureFields/VGS/TextField.js.map +0 -1
  227. package/lib/module/components/SecureFields/VGS/ZipCodeField.js +0 -14
  228. package/lib/module/components/SecureFields/VGS/ZipCodeField.js.map +0 -1
  229. package/lib/module/components/SecureFields/index.js +0 -17
  230. package/lib/module/components/SecureFields/index.js.map +0 -1
  231. package/lib/typescript/components/SecureFields/VGS/CVCField.d.ts +0 -10
  232. package/lib/typescript/components/SecureFields/VGS/CardHolderNameField.d.ts +0 -10
  233. package/lib/typescript/components/SecureFields/VGS/CardNumberField.d.ts +0 -10
  234. package/lib/typescript/components/SecureFields/VGS/CollectManager.d.ts +0 -12
  235. package/lib/typescript/components/SecureFields/VGS/ExpDateField.d.ts +0 -10
  236. package/lib/typescript/components/SecureFields/VGS/TextField.d.ts +0 -14
  237. package/lib/typescript/components/SecureFields/VGS/ZipCodeField.d.ts +0 -10
  238. package/lib/typescript/components/SecureFields/index.d.ts +0 -16
  239. /package/android/.gradle/{5.6.4 → 6.1.1}/fileChanges/last-build.bin +0 -0
  240. /package/android/.gradle/{5.6.4 → 6.1.1}/gc.properties +0 -0
  241. /package/android/{vgscollect-1.7.2-debug.aar → securefields-1.7.2-debug.aar} +0 -0
  242. /package/ios/{Payengine-Bridging-Header.h → Sources/Payengine-Bridging-Header.h} +0 -0
@@ -3,11 +3,12 @@
3
3
  archiveVersion = 1;
4
4
  classes = {
5
5
  };
6
- objectVersion = 52;
6
+ objectVersion = 54;
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
10
10
  F45965C128D879900039BFB1 /* VGSCollectSDK in Frameworks */ = {isa = PBXBuildFile; productRef = F45965C028D879900039BFB1 /* VGSCollectSDK */; };
11
+ F490697528EDB75300FB544D /* Payengine.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* Payengine.m */; };
11
12
  F4FF95D7245B92E800C19C63 /* Payengine.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* Payengine.swift */; };
12
13
  /* End PBXBuildFile section */
13
14
 
@@ -26,6 +27,7 @@
26
27
  /* Begin PBXFileReference section */
27
28
  134814201AA4EA6300B7C361 /* libPayengine.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPayengine.a; sourceTree = BUILT_PRODUCTS_DIR; };
28
29
  B3E7B5891CC2AC0600A0062D /* Payengine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Payengine.m; sourceTree = "<group>"; };
30
+ F4778C722C8AAD2800E4448A /* Classes */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Classes; sourceTree = "<group>"; };
29
31
  F4FF95D5245B92E700C19C63 /* Payengine-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Payengine-Bridging-Header.h"; sourceTree = "<group>"; };
30
32
  F4FF95D6245B92E800C19C63 /* Payengine.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Payengine.swift; sourceTree = "<group>"; };
31
33
  /* End PBXFileReference section */
@@ -51,13 +53,22 @@
51
53
  sourceTree = "<group>";
52
54
  };
53
55
  58B511D21A9E6C8500147676 = {
56
+ isa = PBXGroup;
57
+ children = (
58
+ F42472392C8C2808001E949F /* Sources */,
59
+ 134814211AA4EA7D00B7C361 /* Products */,
60
+ );
61
+ sourceTree = "<group>";
62
+ };
63
+ F42472392C8C2808001E949F /* Sources */ = {
54
64
  isa = PBXGroup;
55
65
  children = (
56
66
  F4FF95D6245B92E800C19C63 /* Payengine.swift */,
57
67
  B3E7B5891CC2AC0600A0062D /* Payengine.m */,
58
68
  F4FF95D5245B92E700C19C63 /* Payengine-Bridging-Header.h */,
59
- 134814211AA4EA7D00B7C361 /* Products */,
69
+ F4778C722C8AAD2800E4448A /* Classes */,
60
70
  );
71
+ path = Sources;
61
72
  sourceTree = "<group>";
62
73
  };
63
74
  /* End PBXGroup section */
@@ -89,7 +100,7 @@
89
100
  58B511D31A9E6C8500147676 /* Project object */ = {
90
101
  isa = PBXProject;
91
102
  attributes = {
92
- LastUpgradeCheck = 0920;
103
+ LastUpgradeCheck = 1320;
93
104
  ORGANIZATIONNAME = Facebook;
94
105
  TargetAttributes = {
95
106
  58B511DA1A9E6C8500147676 = {
@@ -99,11 +110,11 @@
99
110
  };
100
111
  buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "Payengine" */;
101
112
  compatibilityVersion = "Xcode 3.2";
102
- developmentRegion = English;
113
+ developmentRegion = en;
103
114
  hasScannedForEncodings = 0;
104
115
  knownRegions = (
105
- English,
106
116
  en,
117
+ Base,
107
118
  );
108
119
  mainGroup = 58B511D21A9E6C8500147676;
109
120
  packageReferences = (
@@ -124,6 +135,7 @@
124
135
  isa = PBXSourcesBuildPhase;
125
136
  buildActionMask = 2147483647;
126
137
  files = (
138
+ F490697528EDB75300FB544D /* Payengine.m in Sources */,
127
139
  F4FF95D7245B92E800C19C63 /* Payengine.swift in Sources */,
128
140
  );
129
141
  runOnlyForDeploymentPostprocessing = 0;
@@ -135,6 +147,7 @@
135
147
  isa = XCBuildConfiguration;
136
148
  buildSettings = {
137
149
  ALWAYS_SEARCH_USER_PATHS = NO;
150
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
138
151
  CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
139
152
  CLANG_CXX_LIBRARY = "libc++";
140
153
  CLANG_ENABLE_MODULES = YES;
@@ -143,14 +156,17 @@
143
156
  CLANG_WARN_BOOL_CONVERSION = YES;
144
157
  CLANG_WARN_COMMA = YES;
145
158
  CLANG_WARN_CONSTANT_CONVERSION = YES;
159
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
146
160
  CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
147
161
  CLANG_WARN_EMPTY_BODY = YES;
148
162
  CLANG_WARN_ENUM_CONVERSION = YES;
149
163
  CLANG_WARN_INFINITE_RECURSION = YES;
150
164
  CLANG_WARN_INT_CONVERSION = YES;
151
165
  CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
166
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
152
167
  CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
153
168
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
169
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
154
170
  CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
155
171
  CLANG_WARN_STRICT_PROTOTYPES = YES;
156
172
  CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -175,7 +191,7 @@
175
191
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
176
192
  GCC_WARN_UNUSED_FUNCTION = YES;
177
193
  GCC_WARN_UNUSED_VARIABLE = YES;
178
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
194
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
179
195
  MTL_ENABLE_DEBUG_INFO = YES;
180
196
  ONLY_ACTIVE_ARCH = YES;
181
197
  SDKROOT = iphoneos;
@@ -186,6 +202,7 @@
186
202
  isa = XCBuildConfiguration;
187
203
  buildSettings = {
188
204
  ALWAYS_SEARCH_USER_PATHS = NO;
205
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
189
206
  CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
190
207
  CLANG_CXX_LIBRARY = "libc++";
191
208
  CLANG_ENABLE_MODULES = YES;
@@ -194,14 +211,17 @@
194
211
  CLANG_WARN_BOOL_CONVERSION = YES;
195
212
  CLANG_WARN_COMMA = YES;
196
213
  CLANG_WARN_CONSTANT_CONVERSION = YES;
214
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
197
215
  CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
198
216
  CLANG_WARN_EMPTY_BODY = YES;
199
217
  CLANG_WARN_ENUM_CONVERSION = YES;
200
218
  CLANG_WARN_INFINITE_RECURSION = YES;
201
219
  CLANG_WARN_INT_CONVERSION = YES;
202
220
  CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
221
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
203
222
  CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
204
223
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
224
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
205
225
  CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
206
226
  CLANG_WARN_STRICT_PROTOTYPES = YES;
207
227
  CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -219,9 +239,10 @@
219
239
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
220
240
  GCC_WARN_UNUSED_FUNCTION = YES;
221
241
  GCC_WARN_UNUSED_VARIABLE = YES;
222
- IPHONEOS_DEPLOYMENT_TARGET = 8.0;
242
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
223
243
  MTL_ENABLE_DEBUG_INFO = NO;
224
244
  SDKROOT = iphoneos;
245
+ SWIFT_COMPILATION_MODE = wholemodule;
225
246
  VALIDATE_PRODUCT = YES;
226
247
  };
227
248
  name = Release;
@@ -239,7 +260,7 @@
239
260
  OTHER_LDFLAGS = "-ObjC";
240
261
  PRODUCT_NAME = Payengine;
241
262
  SKIP_INSTALL = YES;
242
- SWIFT_OBJC_BRIDGING_HEADER = "Payengine-Bridging-Header.h";
263
+ SWIFT_OBJC_BRIDGING_HEADER = "Sources/Payengine-Bridging-Header.h";
243
264
  SWIFT_OPTIMIZATION_LEVEL = "-Onone";
244
265
  SWIFT_VERSION = 5.0;
245
266
  };
@@ -258,7 +279,7 @@
258
279
  OTHER_LDFLAGS = "-ObjC";
259
280
  PRODUCT_NAME = Payengine;
260
281
  SKIP_INSTALL = YES;
261
- SWIFT_OBJC_BRIDGING_HEADER = "Payengine-Bridging-Header.h";
282
+ SWIFT_OBJC_BRIDGING_HEADER = "Sources/Payengine-Bridging-Header.h";
262
283
  SWIFT_VERSION = 5.0;
263
284
  };
264
285
  name = Release;
@@ -14,10 +14,10 @@
14
14
  filePath = "Payengine.swift"
15
15
  startingColumnNumber = "9223372036854775807"
16
16
  endingColumnNumber = "9223372036854775807"
17
- startingLineNumber = "207"
18
- endingLineNumber = "207"
19
- landmarkName = "unknown"
20
- landmarkType = "0">
17
+ startingLineNumber = "282"
18
+ endingLineNumber = "282"
19
+ landmarkName = "VGSCardNumberFieldManager"
20
+ landmarkType = "3">
21
21
  </BreakpointContent>
22
22
  </BreakpointProxy>
23
23
  </Breakpoints>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "group:Payengine.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,111 @@
1
+ //
2
+ // RNPEApplePayButton.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 6/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+ import PayEngineSDK
10
+
11
+ @objc(RNPEApplePayButton)
12
+ class RNPEApplePayButton: UIView {
13
+
14
+ @objc var onPmSheetDidDismiss: RCTBubblingEventBlock?
15
+ @objc var onPmTokenDidReturn: RCTBubblingEventBlock?
16
+ @objc var onPmError: RCTBubblingEventBlock?
17
+
18
+ private var _button: UIButton?
19
+
20
+ override init(frame: CGRect) {
21
+ super.init(frame: frame)
22
+ }
23
+
24
+ required init?(coder: NSCoder) {
25
+ super.init(coder: coder)
26
+ }
27
+
28
+ override func layoutSubviews() {
29
+ self._button?.frame = self.bounds
30
+ }
31
+
32
+
33
+ @objc var paymentRequest: String? = "" {
34
+ didSet {
35
+ setupView()
36
+ }
37
+ }
38
+
39
+ private func setupView() {
40
+ guard let paymentRequest = self.paymentRequest else {
41
+ debugPrint("Unable to render apple pay button: Missing payment request")
42
+ return
43
+ }
44
+
45
+ if let paymentRequest: RNPEApplePayPaymentRequest = try? JSONDecoder().decode(RNPEApplePayPaymentRequest.self, from: paymentRequest.data(using: .utf8)!) {
46
+ let pePaymentRequest = paymentRequest.toNative()
47
+ if let applepay = RNPayEngineNative.applePayInstance {
48
+ applepay.delegate = self
49
+ DispatchQueue.main.async {
50
+ if let button = applepay.setupApplePayButton(for: pePaymentRequest, type: .checkout) {
51
+ self._button = button
52
+ self._button!.layer.masksToBounds = true
53
+ self.addSubview(self._button!)
54
+ }
55
+ }
56
+ }
57
+ } else {
58
+ debugPrint("Invalid payment request. Please try again")
59
+ }
60
+ }
61
+
62
+ }
63
+
64
+ extension RNPEApplePayButton: PEApplePayDelegate {
65
+
66
+ func paymentError(error: Error) {
67
+ debugPrint("payment error \(error)")
68
+ if self.onPmError != nil {
69
+ self.onPmError!(["error": error.localizedDescription])
70
+ }
71
+ }
72
+
73
+ func paymentSheetDidMDismiss() {
74
+ if self.onPmSheetDidDismiss != nil {
75
+ self.onPmSheetDidDismiss!(["token": "null"])
76
+ }
77
+ }
78
+
79
+ func paymentTokenDidReturn(token: String, completion: @escaping (PayEngineSDK.PEApplePayResult) -> Void) {
80
+ debugPrint("Token returned \(token)")
81
+ if self.onPmTokenDidReturn != nil {
82
+ self.onPmTokenDidReturn!(["token": token])
83
+ }
84
+ completion(.success)
85
+ }
86
+
87
+ func paymentTokenNotAvailable() {
88
+ debugPrint("paymentTokenNotAvailable")
89
+ if self.onPmError != nil {
90
+ self.onPmError!(["error": "Payment token not available"])
91
+ }
92
+ }
93
+
94
+
95
+ }
96
+
97
+
98
+ @objc(RNPEApplePayButtonManager)
99
+ class RNPEApplePayButtonManager: RCTViewManager {
100
+
101
+ var _view = RNPEApplePayButton()
102
+
103
+ @objc override static func requiresMainQueueSetup() -> Bool {
104
+ return true
105
+ }
106
+
107
+ override func view() -> UIView! {
108
+ return _view
109
+ }
110
+
111
+ }
@@ -0,0 +1,43 @@
1
+ //
2
+ // RNPEApplePayPaymentRequest.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 6/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+ import PassKit
10
+ import PayEngineSDK
11
+
12
+ public struct RNPEApplePayPaymentRequest: Codable {
13
+ var paymentAmount: Double
14
+ var currencyCode: String = "USD"
15
+ var paymentItems: [RNPEApplePayPaymentSummaryItem]
16
+
17
+ init(paymentAmount: Double, currencyCode: String, paymentItems: [RNPEApplePayPaymentSummaryItem]) {
18
+ self.paymentAmount = paymentAmount
19
+ self.currencyCode = currencyCode
20
+ self.paymentItems = paymentItems
21
+ }
22
+
23
+ func toNative() -> ApplePayPaymentRequest {
24
+ let request = ApplePayPaymentRequest()
25
+ request.build(paymentItems: self.paymentItems.map { $0.toNative() }, paymentAmount: self.paymentAmount, currencyCode: self.currencyCode)
26
+ return request
27
+ }
28
+ }
29
+
30
+ public struct RNPEApplePayPaymentSummaryItem: Codable {
31
+ var amount: Double
32
+ var label: String
33
+
34
+ init(amount: Double, label: String) {
35
+ self.amount = amount
36
+ self.label = label
37
+ }
38
+
39
+ func toNative() -> PKPaymentSummaryItem {
40
+ return PKPaymentSummaryItem(label: self.label, amount: NSDecimalNumber(value: self.amount))
41
+ }
42
+ }
43
+
@@ -0,0 +1,12 @@
1
+ //
2
+ // PEError.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 5/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ enum RNPEError: Error {
11
+ case common(String)
12
+ }
@@ -0,0 +1,29 @@
1
+ //
2
+ // PEEventEmitter.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 5/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+ import React
10
+
11
+ @objc(RNPEEventEmitter)
12
+ open class RNPEEventEmitter:RCTEventEmitter{
13
+
14
+ public static var emitter: RNPEEventEmitter! // global variable
15
+
16
+ // constructor
17
+ override init(){
18
+ super.init()
19
+ RNPEEventEmitter.emitter = self
20
+ }
21
+
22
+ open override func supportedEvents() -> [String] {
23
+ ["onReady", "onSizeChanges", "onCardRespond", "onBankAccountRespond"]
24
+ }
25
+
26
+ @objc public override static func requiresMainQueueSetup() -> Bool {
27
+ return true
28
+ }
29
+ }
@@ -0,0 +1,30 @@
1
+ //
2
+ // Utils.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 5/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+ import PayEngineSDK
10
+ import React
11
+ import SwiftUI
12
+ class RNPEUtils {
13
+
14
+ public static func createSecureFieldsAuthHeader(publicKey: String) -> String {
15
+ return #"Signature key="\#(publicKey)",algorithm="hmac-sha256",identifier="secure-fields",signature="""#
16
+ }
17
+
18
+ public static func mapKeyboardType(keyboardType: String) -> PEKeyboardType {
19
+ switch (keyboardType) {
20
+ case "number":
21
+ return .number
22
+ case "alphabet":
23
+ return .alphabet
24
+ case "phone":
25
+ return .phone
26
+ default:
27
+ return .normal
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,87 @@
1
+ //
2
+ // PayEngineNative.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 5/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+ import PayEngineSDK
10
+
11
+ @objc(RNPayEngineNative)
12
+ class RNPayEngineNative: NSObject {
13
+ static var instance: PayEngine?
14
+
15
+ static var applePayInstance: PEApplePay?
16
+
17
+ @objc(setConfig:baseURL:)
18
+ func setConfig(_ publicKey: String, baseURL: String?) {
19
+ let config = PEConfig(publicKey: publicKey, baseURL: baseURL)
20
+ RNPayEngineNative.instance = PayEngine(config: config)
21
+ }
22
+
23
+ func getInstance() throws -> PayEngine {
24
+ guard let instance = RNPayEngineNative.instance else {
25
+ throw RNPEError.common("Configuration is not set")
26
+ }
27
+
28
+ return instance
29
+ }
30
+
31
+ @objc(createFraudMonitorSession:resolver:rejecter:)
32
+ func createFraudMonitorSession(merchantId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
33
+ do {
34
+ let payengine = try self.getInstance()
35
+ payengine.createFraudMonitorSession(merchantId) { fraudResult in
36
+ switch fraudResult {
37
+ case .success(let sessionId):
38
+ return resolve(sessionId)
39
+ case .failure(let error):
40
+ return reject("error", "Unable to obtain session ID", error)
41
+ }
42
+ }
43
+ } catch {
44
+ return reject("error", error.localizedDescription, error)
45
+ }
46
+ }
47
+
48
+ @objc(getBrowserInfo:rejecter:)
49
+ func getBrowserInfo(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
50
+ DispatchQueue.main.async {
51
+ do {
52
+ // get current root view from react native
53
+ if let rootView = UIApplication.shared.keyWindow?.rootViewController?.view {
54
+ let payengine = try self.getInstance()
55
+ payengine.getBrowserInfo(view: rootView) { browserInfo in
56
+ return resolve(browserInfo)
57
+ }
58
+ } else {
59
+ return reject("error", "Unable to find current root view", nil)
60
+ }
61
+ } catch {
62
+ return reject("error", error.localizedDescription, error)
63
+ }
64
+ }
65
+ }
66
+
67
+ @objc(isApplePaySupported:resolver:rejecter:)
68
+ func isApplePaySupported(merchantId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
69
+ do {
70
+ let payengine = try self.getInstance()
71
+ payengine.setupApplePay(merchantId: merchantId) { result in
72
+ switch result {
73
+ case .success(let applepay):
74
+ RNPayEngineNative.applePayInstance = applepay
75
+ return resolve(true)
76
+ case .failure(let error):
77
+ return reject("error", error.localizedDescription, error)
78
+ }
79
+ }
80
+ } catch {
81
+ return reject("error", error.localizedDescription, error)
82
+ }
83
+ }
84
+ }
85
+
86
+
87
+
@@ -0,0 +1,130 @@
1
+ //
2
+ // BankAccountView.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 6/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+ import PayEngineSDK
10
+
11
+ class RNPEBankAccountView: UIView {
12
+ var view: IBankAccountView?
13
+
14
+ override init(frame: CGRect) {
15
+ super.init(frame: frame)
16
+ }
17
+
18
+ required init?(coder: NSCoder) {
19
+ super.init(coder: coder)
20
+ }
21
+
22
+ @objc var additionalFields: String = "" {
23
+ didSet {
24
+ setupView()
25
+ }
26
+ }
27
+
28
+ private func setupView() {
29
+ // debugPrint("PayEngine instance \(String(describing: PayEngineNative.instance))")
30
+ // let zipField = PEField(name: "address_zip", type: "text", placeholder: "Zip code", isRequired: true, keyboardType: .alphabet, pattern: #"^(?:\d{5}(?:-\d{4})?|[ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d)$"#)
31
+
32
+ var customFields: [PEField] = []
33
+ if let fields: [RNPEField] = try? JSONDecoder().decode([RNPEField].self, from: additionalFields.data(using: .utf8)!) {
34
+ if (fields.count > 0) {
35
+ for i in 0...fields.count - 1 {
36
+ let f = fields[i]
37
+ let field = PEField(name: f.name, type: f.type, placeholder: f.placeholder, isRequired: f.isRequired, keyboardType: RNPEUtils.mapKeyboardType(keyboardType: f.keyboardType), pattern: f.pattern)
38
+ customFields.append(field)
39
+ }
40
+ }
41
+ } else {
42
+ debugPrint("Could not parse additional fields \(additionalFields)")
43
+ }
44
+ RNPayEngineNative.instance?.createBankAccountView(additionalFields: customFields) { [unowned self] result in
45
+ switch result {
46
+ case .success(let view):
47
+ self.view = view
48
+ self.view!.detectSizeChanges { size in
49
+ // self.frame.size = size
50
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_SIZE_CHANGES, body: ["width": size.width, "height": size.height])
51
+ debugPrint("Could not parse additional fields \(self.additionalFields)")
52
+ }
53
+ self.addSubview(self.view!)
54
+ case .failure(let error):
55
+ debugPrint("Error: \(error)")
56
+ }
57
+ }
58
+ }
59
+
60
+
61
+ func submit(_ merchantId: String, additionalData: NSDictionary) {
62
+ guard let view = self.view else {
63
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["error": "View is not ready"])
64
+ return
65
+ }
66
+ DispatchQueue.main.async {
67
+ view.createBankAccount(merchantId: merchantId, additionalData: additionalData as! [String : Any]) { result in
68
+ switch result {
69
+ case .success(let bankAccount):
70
+ debugPrint("Bank account created \(bankAccount)")
71
+ if let json = try? JSONEncoder().encode(bankAccount) {
72
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["bankAccount": String(decoding: json, as: UTF8.self)])
73
+ } else {
74
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["error": "Unable to encode bank account object"])
75
+ }
76
+ case .failure(let error):
77
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["error": error.localizedDescription])
78
+ }
79
+ }
80
+ }
81
+ }
82
+
83
+ func hideKeyboard() {
84
+ view?.hideKeyboard()
85
+ }
86
+
87
+ func showKeyboard() {
88
+ view?.showKeyboard()
89
+ }
90
+ }
91
+
92
+ @objc(RNPEBankAccountView)
93
+ class RNPEBankAccountViewManager: RCTViewManager {
94
+
95
+ @objc override static func requiresMainQueueSetup() -> Bool {
96
+ return true
97
+ }
98
+
99
+ override func view() -> UIView! {
100
+ return RNPEBankAccountView()
101
+ }
102
+
103
+ override func constantsToExport() -> [AnyHashable : Any]! {
104
+ return [:]
105
+ }
106
+
107
+ @objc(submit:merchantId:additionalData:)
108
+ func submit(_ node: NSNumber, merchantId: String, additionalData: NSDictionary) {
109
+ DispatchQueue.main.async {
110
+ let component = self.bridge.uiManager.view(forReactTag: node) as! RNPEBankAccountView
111
+ component.submit(merchantId, additionalData: additionalData)
112
+ }
113
+ }
114
+
115
+ @objc
116
+ func hideKeyboard(_ node: NSNumber) {
117
+ DispatchQueue.main.async {
118
+ let component = self.bridge.uiManager.view(forReactTag: node) as! RNPEBankAccountView
119
+ component.hideKeyboard()
120
+ }
121
+ }
122
+
123
+ @objc
124
+ func showKeyboard(_ node: NSNumber) {
125
+ DispatchQueue.main.async {
126
+ let component = self.bridge.uiManager.view(forReactTag: node) as! RNPEBankAccountView
127
+ component.showKeyboard()
128
+ }
129
+ }
130
+ }