react-native-payengine 1.0.6 → 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 (300) 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/fileHashes/resourceHashesCache.bin → 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/gradle.xml +2 -3
  14. package/android/.idea/kotlinc.xml +6 -0
  15. package/android/.idea/migrations.xml +10 -0
  16. package/android/.idea/misc.xml +1 -1
  17. package/android/build.gradle +24 -3
  18. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  19. package/android/paymentsdk-debug.aar +0 -0
  20. package/android/paymentsdk-release.aar +0 -0
  21. package/android/src/main/java/com/reactnativepayengine/PayengineModule.java +1 -5
  22. package/android/src/main/java/com/reactnativepayengine/PayenginePackage.java +7 -33
  23. package/android/src/main/java/com/reactnativepayengine/util/MetricsUtil.kt +44 -0
  24. package/android/src/main/java/com/reactnativepayengine/v2/RNPEFraudAnalyticsApplication.java +55 -0
  25. package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +71 -0
  26. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +8 -0
  27. package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEField.kt +17 -0
  28. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +103 -0
  29. package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNPEBankAccountView.kt +77 -0
  30. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardView.kt +77 -0
  31. package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +103 -0
  32. package/ios/PayEngineSDK.xcframework/Info.plist +44 -0
  33. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Frameworks/libKountDataCollector.a +0 -0
  34. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +25 -0
  35. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +106 -0
  36. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +82 -0
  37. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +622 -0
  38. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK.h +20 -0
  39. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +33 -0
  40. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +27 -0
  41. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
  42. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +15143 -0
  43. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +326 -0
  44. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +326 -0
  45. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  46. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +326 -0
  47. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +326 -0
  48. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/module.modulemap +11 -0
  49. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
  50. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
  51. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  52. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/browserInfo.html +136 -0
  53. package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/perform3ds.html +467 -0
  54. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Frameworks/libKountDataCollector.a +0 -0
  55. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +25 -0
  56. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +106 -0
  57. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +82 -0
  58. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +1240 -0
  59. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK.h +20 -0
  60. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +33 -0
  61. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +27 -0
  62. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
  63. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +15143 -0
  64. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +326 -0
  65. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +326 -0
  66. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  67. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +326 -0
  68. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +326 -0
  69. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +15143 -0
  70. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +326 -0
  71. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +326 -0
  72. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  73. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +326 -0
  74. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +326 -0
  75. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/module.modulemap +11 -0
  76. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
  77. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
  78. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
  79. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/browserInfo.html +136 -0
  80. package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/perform3ds.html +467 -0
  81. package/ios/Payengine.xcodeproj/project.pbxproj +14 -4
  82. package/ios/Payengine.xcodeproj/project.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  83. package/ios/Payengine.xcworkspace/contents.xcworkspacedata +7 -0
  84. package/ios/Payengine.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  85. package/ios/Sources/Classes/ApplePay/RNPEApplePayButton.swift +111 -0
  86. package/ios/Sources/Classes/ApplePay/RNPEApplePayPaymentRequest.swift +43 -0
  87. package/ios/Sources/Classes/RNPEError.swift +12 -0
  88. package/ios/Sources/Classes/RNPEEventEmitter.swift +29 -0
  89. package/ios/Sources/Classes/RNPEUtils.swift +30 -0
  90. package/ios/Sources/Classes/RNPayEngineNative.swift +87 -0
  91. package/ios/Sources/Classes/SecureFields/RNPEBankAccountView.swift +130 -0
  92. package/ios/Sources/Classes/SecureFields/RNPECreditCardView.swift +129 -0
  93. package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +15 -0
  94. package/ios/Sources/Classes/SecureFields/RNPEField.swift +26 -0
  95. package/ios/Sources/Payengine.m +73 -0
  96. package/ios/Sources/Payengine.swift +13 -0
  97. package/lib/commonjs/components/PayEngine.js +2 -123
  98. package/lib/commonjs/components/PayEngine.js.map +1 -1
  99. package/lib/commonjs/components/{SecureFields/VGS/ExpDateField.js → v2/ApplePay/PEApplePayButton.js} +38 -13
  100. package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
  101. package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js +29 -0
  102. package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js.map +1 -0
  103. package/lib/commonjs/components/v2/PayEngineNative.js +34 -0
  104. package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -0
  105. package/lib/commonjs/components/{SecureFields/VGS/TextField.js → v2/PayEngineProvider.js} +28 -12
  106. package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -0
  107. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +89 -0
  108. package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -0
  109. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +90 -0
  110. package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -0
  111. package/lib/commonjs/components/v2/SecureFields/IPEField.js +6 -0
  112. package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -0
  113. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js +6 -0
  114. package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -0
  115. package/lib/commonjs/components/v2/SecureFields/PECard.js +6 -0
  116. package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -0
  117. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +18 -0
  118. package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -0
  119. package/lib/commonjs/index.js +54 -18
  120. package/lib/commonjs/index.js.map +1 -1
  121. package/lib/commonjs/interfaces/index.js +0 -4
  122. package/lib/commonjs/interfaces/index.js.map +1 -1
  123. package/lib/commonjs/utils/index.js +10 -38
  124. package/lib/commonjs/utils/index.js.map +1 -1
  125. package/lib/module/components/PayEngine.js +3 -118
  126. package/lib/module/components/PayEngine.js.map +1 -1
  127. package/lib/module/components/v2/ApplePay/PEApplePayButton.js +37 -0
  128. package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
  129. package/lib/module/components/v2/ApplePay/PEPaymentRequest.js +20 -0
  130. package/lib/module/components/v2/ApplePay/PEPaymentRequest.js.map +1 -0
  131. package/lib/module/components/v2/PayEngineNative.js +23 -0
  132. package/lib/module/components/v2/PayEngineNative.js.map +1 -0
  133. package/lib/module/components/v2/PayEngineProvider.js +30 -0
  134. package/lib/module/components/v2/PayEngineProvider.js.map +1 -0
  135. package/lib/module/components/v2/SecureFields/BankAccountView.js +75 -0
  136. package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -0
  137. package/lib/module/components/v2/SecureFields/CreditCardView.js +76 -0
  138. package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -0
  139. package/lib/module/components/v2/SecureFields/IPEField.js +2 -0
  140. package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -0
  141. package/lib/module/components/v2/SecureFields/PEBankAccount.js +2 -0
  142. package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -0
  143. package/lib/module/components/v2/SecureFields/PECard.js +2 -0
  144. package/lib/module/components/v2/SecureFields/PECard.js.map +1 -0
  145. package/lib/module/components/v2/SecureFields/PEKeyboardType.js +11 -0
  146. package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -0
  147. package/lib/module/index.js +14 -6
  148. package/lib/module/index.js.map +1 -1
  149. package/lib/module/interfaces/index.js +1 -1
  150. package/lib/module/interfaces/index.js.map +1 -1
  151. package/lib/module/utils/index.js +6 -37
  152. package/lib/module/utils/index.js.map +1 -1
  153. package/lib/typescript/components/PayEngine.d.ts +1 -14
  154. package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +12 -0
  155. package/lib/typescript/components/v2/ApplePay/PEPaymentRequest.d.ts +12 -0
  156. package/lib/typescript/components/v2/PayEngineNative.d.ts +5 -0
  157. package/lib/typescript/components/v2/PayEngineProvider.d.ts +8 -0
  158. package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +14 -0
  159. package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +14 -0
  160. package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +10 -0
  161. package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +11 -0
  162. package/lib/typescript/components/v2/SecureFields/PECard.d.ts +13 -0
  163. package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +7 -0
  164. package/lib/typescript/index.d.ts +12 -6
  165. package/lib/typescript/interfaces/index.d.ts +0 -27
  166. package/lib/typescript/utils/index.d.ts +3 -36
  167. package/package.json +12 -7
  168. package/react-native-payengine.podspec +2 -2
  169. package/src/components/PayEngine.tsx +5 -118
  170. package/src/components/v2/ApplePay/PEApplePayButton.tsx +70 -0
  171. package/src/components/v2/ApplePay/PEPaymentRequest.ts +18 -0
  172. package/src/components/v2/PayEngineNative.tsx +20 -0
  173. package/src/components/v2/PayEngineProvider.tsx +30 -0
  174. package/src/components/v2/SecureFields/BankAccountView.tsx +95 -0
  175. package/src/components/v2/SecureFields/CreditCardView.tsx +96 -0
  176. package/src/components/v2/SecureFields/IPEField.ts +12 -0
  177. package/src/components/v2/SecureFields/PEBankAccount.ts +12 -0
  178. package/src/components/v2/SecureFields/PECard.ts +14 -0
  179. package/src/components/v2/SecureFields/PEKeyboardType.ts +8 -0
  180. package/src/index.tsx +47 -22
  181. package/src/interfaces/index.ts +0 -32
  182. package/src/utils/index.ts +8 -36
  183. package/android/.gradle/5.6.4/executionHistory/executionHistory.bin +0 -0
  184. package/android/.gradle/5.6.4/executionHistory/executionHistory.lock +0 -0
  185. package/android/.gradle/5.6.4/fileContent/fileContent.lock +0 -0
  186. package/android/.gradle/5.6.4/fileHashes/fileHashes.bin +0 -0
  187. package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
  188. package/android/.gradle/5.6.4/javaCompile/classAnalysis.bin +0 -0
  189. package/android/.gradle/5.6.4/javaCompile/jarAnalysis.bin +0 -0
  190. package/android/.gradle/5.6.4/javaCompile/javaCompile.lock +0 -0
  191. package/android/.gradle/5.6.4/javaCompile/taskHistory.bin +0 -0
  192. package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectModule.java +0 -153
  193. package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectOnCreateViewInstanceListener.java +0 -6
  194. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCVCField.java +0 -67
  195. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCardHolderNameField.java +0 -53
  196. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCardNumberField.java +0 -57
  197. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSExpDateField.java +0 -54
  198. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSTextField.java +0 -57
  199. package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSZipCodeField.java +0 -62
  200. package/android/src/main/java/com/reactnativepayengine/util/ResourceUtil.java +0 -14
  201. package/ios/Payengine.m +0 -72
  202. package/ios/Payengine.swift +0 -720
  203. package/lib/commonjs/components/ApplePay/PayEngineApplePay.js +0 -71
  204. package/lib/commonjs/components/ApplePay/PayEngineApplePay.js.map +0 -1
  205. package/lib/commonjs/components/ApplePay/index.js +0 -46
  206. package/lib/commonjs/components/ApplePay/index.js.map +0 -1
  207. package/lib/commonjs/components/ApplePay/interfaces.js +0 -2
  208. package/lib/commonjs/components/ApplePay/interfaces.js.map +0 -1
  209. package/lib/commonjs/components/CreditCardForm/index.js +0 -76
  210. package/lib/commonjs/components/CreditCardForm/index.js.map +0 -1
  211. package/lib/commonjs/components/GooglePay/PayEngineGooglePay.js +0 -65
  212. package/lib/commonjs/components/GooglePay/PayEngineGooglePay.js.map +0 -1
  213. package/lib/commonjs/components/GooglePay/index.js +0 -40
  214. package/lib/commonjs/components/GooglePay/index.js.map +0 -1
  215. package/lib/commonjs/components/GooglePay/interfaces.js +0 -2
  216. package/lib/commonjs/components/GooglePay/interfaces.js.map +0 -1
  217. package/lib/commonjs/components/Legacy/CreditCardFormLegacy.js +0 -323
  218. package/lib/commonjs/components/Legacy/CreditCardFormLegacy.js.map +0 -1
  219. package/lib/commonjs/components/SecureFields/VGS/CVCField.js +0 -26
  220. package/lib/commonjs/components/SecureFields/VGS/CVCField.js.map +0 -1
  221. package/lib/commonjs/components/SecureFields/VGS/CardHolderNameField.js +0 -26
  222. package/lib/commonjs/components/SecureFields/VGS/CardHolderNameField.js.map +0 -1
  223. package/lib/commonjs/components/SecureFields/VGS/CardNumberField.js +0 -26
  224. package/lib/commonjs/components/SecureFields/VGS/CardNumberField.js.map +0 -1
  225. package/lib/commonjs/components/SecureFields/VGS/CollectManager.js +0 -60
  226. package/lib/commonjs/components/SecureFields/VGS/CollectManager.js.map +0 -1
  227. package/lib/commonjs/components/SecureFields/VGS/ExpDateField.js.map +0 -1
  228. package/lib/commonjs/components/SecureFields/VGS/TextField.js.map +0 -1
  229. package/lib/commonjs/components/SecureFields/VGS/ZipCodeField.js +0 -26
  230. package/lib/commonjs/components/SecureFields/VGS/ZipCodeField.js.map +0 -1
  231. package/lib/commonjs/components/SecureFields/index.js +0 -34
  232. package/lib/commonjs/components/SecureFields/index.js.map +0 -1
  233. package/lib/module/components/ApplePay/PayEngineApplePay.js +0 -58
  234. package/lib/module/components/ApplePay/PayEngineApplePay.js.map +0 -1
  235. package/lib/module/components/ApplePay/index.js +0 -35
  236. package/lib/module/components/ApplePay/index.js.map +0 -1
  237. package/lib/module/components/ApplePay/interfaces.js +0 -2
  238. package/lib/module/components/ApplePay/interfaces.js.map +0 -1
  239. package/lib/module/components/CreditCardForm/index.js +0 -60
  240. package/lib/module/components/CreditCardForm/index.js.map +0 -1
  241. package/lib/module/components/GooglePay/PayEngineGooglePay.js +0 -52
  242. package/lib/module/components/GooglePay/PayEngineGooglePay.js.map +0 -1
  243. package/lib/module/components/GooglePay/index.js +0 -29
  244. package/lib/module/components/GooglePay/index.js.map +0 -1
  245. package/lib/module/components/GooglePay/interfaces.js +0 -2
  246. package/lib/module/components/GooglePay/interfaces.js.map +0 -1
  247. package/lib/module/components/Legacy/CreditCardFormLegacy.js +0 -302
  248. package/lib/module/components/Legacy/CreditCardFormLegacy.js.map +0 -1
  249. package/lib/module/components/SecureFields/VGS/CVCField.js +0 -14
  250. package/lib/module/components/SecureFields/VGS/CVCField.js.map +0 -1
  251. package/lib/module/components/SecureFields/VGS/CardHolderNameField.js +0 -14
  252. package/lib/module/components/SecureFields/VGS/CardHolderNameField.js.map +0 -1
  253. package/lib/module/components/SecureFields/VGS/CardNumberField.js +0 -14
  254. package/lib/module/components/SecureFields/VGS/CardNumberField.js.map +0 -1
  255. package/lib/module/components/SecureFields/VGS/CollectManager.js +0 -45
  256. package/lib/module/components/SecureFields/VGS/CollectManager.js.map +0 -1
  257. package/lib/module/components/SecureFields/VGS/ExpDateField.js +0 -14
  258. package/lib/module/components/SecureFields/VGS/ExpDateField.js.map +0 -1
  259. package/lib/module/components/SecureFields/VGS/TextField.js +0 -17
  260. package/lib/module/components/SecureFields/VGS/TextField.js.map +0 -1
  261. package/lib/module/components/SecureFields/VGS/ZipCodeField.js +0 -14
  262. package/lib/module/components/SecureFields/VGS/ZipCodeField.js.map +0 -1
  263. package/lib/module/components/SecureFields/index.js +0 -17
  264. package/lib/module/components/SecureFields/index.js.map +0 -1
  265. package/lib/typescript/components/ApplePay/PayEngineApplePay.d.ts +0 -12
  266. package/lib/typescript/components/ApplePay/index.d.ts +0 -7
  267. package/lib/typescript/components/ApplePay/interfaces.d.ts +0 -20
  268. package/lib/typescript/components/CreditCardForm/index.d.ts +0 -3
  269. package/lib/typescript/components/GooglePay/PayEngineGooglePay.d.ts +0 -10
  270. package/lib/typescript/components/GooglePay/index.d.ts +0 -7
  271. package/lib/typescript/components/GooglePay/interfaces.d.ts +0 -38
  272. package/lib/typescript/components/Legacy/CreditCardFormLegacy.d.ts +0 -4
  273. package/lib/typescript/components/SecureFields/VGS/CVCField.d.ts +0 -10
  274. package/lib/typescript/components/SecureFields/VGS/CardHolderNameField.d.ts +0 -10
  275. package/lib/typescript/components/SecureFields/VGS/CardNumberField.d.ts +0 -10
  276. package/lib/typescript/components/SecureFields/VGS/CollectManager.d.ts +0 -12
  277. package/lib/typescript/components/SecureFields/VGS/ExpDateField.d.ts +0 -10
  278. package/lib/typescript/components/SecureFields/VGS/TextField.d.ts +0 -14
  279. package/lib/typescript/components/SecureFields/VGS/ZipCodeField.d.ts +0 -10
  280. package/lib/typescript/components/SecureFields/index.d.ts +0 -16
  281. package/src/components/ApplePay/PayEngineApplePay.ts +0 -61
  282. package/src/components/ApplePay/index.ts +0 -32
  283. package/src/components/ApplePay/interfaces.ts +0 -25
  284. package/src/components/CreditCardForm/index.tsx +0 -43
  285. package/src/components/GooglePay/PayEngineGooglePay.ts +0 -48
  286. package/src/components/GooglePay/index.ts +0 -39
  287. package/src/components/GooglePay/interfaces.ts +0 -42
  288. package/src/components/Legacy/CreditCardFormLegacy.tsx +0 -292
  289. package/src/components/SecureFields/VGS/CVCField.tsx +0 -21
  290. package/src/components/SecureFields/VGS/CardHolderNameField.tsx +0 -21
  291. package/src/components/SecureFields/VGS/CardNumberField.tsx +0 -21
  292. package/src/components/SecureFields/VGS/CollectManager.tsx +0 -74
  293. package/src/components/SecureFields/VGS/ExpDateField.tsx +0 -21
  294. package/src/components/SecureFields/VGS/TextField.tsx +0 -27
  295. package/src/components/SecureFields/VGS/ZipCodeField.tsx +0 -21
  296. package/src/components/SecureFields/index.ts +0 -17
  297. /package/android/.gradle/{5.6.4 → 6.1.1}/fileChanges/last-build.bin +0 -0
  298. /package/android/.gradle/{5.6.4 → 6.1.1}/gc.properties +0 -0
  299. /package/android/{vgscollect-1.7.2-debug.aar → securefields-1.7.2-debug.aar} +0 -0
  300. /package/ios/{Payengine-Bridging-Header.h → Sources/Payengine-Bridging-Header.h} +0 -0
@@ -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
+ }
@@ -0,0 +1,129 @@
1
+ //
2
+ // CreditCardView.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 RNPECreditCardView: UIView {
12
+ var view: ICardNumberView?
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?.createSecureView(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
+ func submit(_ merchantId: String, additionalData: NSDictionary) {
61
+ guard let view = self.view else {
62
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["error": "View is not ready"])
63
+ return
64
+ }
65
+ DispatchQueue.main.async {
66
+ view.createCard(merchantId: merchantId, additionalData: additionalData as! [String : Any]) { result in
67
+ switch result {
68
+ case .success(let card):
69
+ debugPrint("Card created \(card)")
70
+ if let json = try? JSONEncoder().encode(card) {
71
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["card": String(decoding: json, as: UTF8.self)])
72
+ } else {
73
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["error": "Unable to encode card object"])
74
+ }
75
+ case .failure(let error):
76
+ RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["error": error.localizedDescription])
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ func hideKeyboard() {
83
+ view?.hideKeyboard()
84
+ }
85
+
86
+ func showKeyboard() {
87
+ view?.showKeyboard()
88
+ }
89
+ }
90
+
91
+ @objc(RNPECreditCardView)
92
+ class RNPECreditCardViewManager: RCTViewManager {
93
+
94
+ @objc override static func requiresMainQueueSetup() -> Bool {
95
+ return true
96
+ }
97
+
98
+ override func view() -> UIView! {
99
+ return RNPECreditCardView()
100
+ }
101
+
102
+ override func constantsToExport() -> [AnyHashable : Any]! {
103
+ return [:]
104
+ }
105
+
106
+ @objc(submit:merchantId:additionalData:)
107
+ func submit(_ node: NSNumber, merchantId: String, additionalData: NSDictionary) {
108
+ DispatchQueue.main.async {
109
+ let component = self.bridge.uiManager.view(forReactTag: node) as! RNPECreditCardView
110
+ component.submit(merchantId, additionalData: additionalData)
111
+ }
112
+ }
113
+
114
+ @objc
115
+ func hideKeyboard(_ node: NSNumber) {
116
+ DispatchQueue.main.async {
117
+ let component = self.bridge.uiManager.view(forReactTag: node) as! RNPECreditCardView
118
+ component.hideKeyboard()
119
+ }
120
+ }
121
+
122
+ @objc
123
+ func showKeyboard(_ node: NSNumber) {
124
+ DispatchQueue.main.async {
125
+ let component = self.bridge.uiManager.view(forReactTag: node) as! RNPECreditCardView
126
+ component.showKeyboard()
127
+ }
128
+ }
129
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // Events.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 11/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ class RNPEEvents {
11
+ static let EVENT_SIZE_CHANGES = "onSizeChanges"
12
+ static let EVENT_BANK_ACCOUNT_RESPOND = "onBankAccountRespond"
13
+ static let EVENT_CARD_RESPOND = "onCardRespond"
14
+ static let EVENT_READY = "onReady"
15
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // PayEngineField.swift
3
+ // react-native-payengine
4
+ //
5
+ // Created by Tri Nguyen on 5/9/2024.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ public struct RNPEField: Codable {
11
+ var name: String
12
+ var type: String
13
+ var placeholder: String
14
+ var keyboardType: String
15
+ var isRequired: Bool
16
+ var pattern: String?
17
+
18
+ init(name: String, type: String, placeholder: String, keyboardType: String, isRequired: Bool, pattern: String?) {
19
+ self.name = name
20
+ self.type = type
21
+ self.placeholder = placeholder
22
+ self.keyboardType = keyboardType
23
+ self.isRequired = isRequired
24
+ self.pattern = pattern
25
+ }
26
+ }
@@ -0,0 +1,73 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <Foundation/Foundation.h>
3
+ #import <React/RCTViewManager.h>
4
+ #import <React/RCTEventEmitter.h>
5
+ #import <React/RCTUIManager.h>
6
+
7
+ @interface RCT_EXTERN_MODULE(RNPayEngineNative, NSObject)
8
+
9
+ RCT_EXTERN_METHOD(setConfig: (NSString *)publicKey baseURL:(NSString *)baseURL)
10
+
11
+ RCT_EXTERN_METHOD(createFraudMonitorSession:(NSString *)merchantId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
12
+
13
+ RCT_EXTERN_METHOD(getBrowserInfo:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
14
+
15
+ RCT_EXTERN_METHOD(isApplePaySupported:(NSString *)merchantId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
16
+
17
+ + (BOOL)requiresMainQueueSetup
18
+ {
19
+ return NO;
20
+ }
21
+ @end
22
+
23
+ @interface RCT_EXTERN_MODULE(RNPECreditCardView, RCTViewManager)
24
+
25
+ RCT_EXTERN_METHOD(submit:(nonnull NSNumber*)reactTag merchantId:(NSString *)merchantId additionalData:(NSDictionary *)additionalData)
26
+
27
+ RCT_EXTERN_METHOD(showKeyboard:(nonnull NSNumber*)reactTag)
28
+ RCT_EXTERN_METHOD(hideKeyboard:(nonnull NSNumber*)reactTag)
29
+
30
+ RCT_EXPORT_VIEW_PROPERTY(additionalFields, NSString)
31
+
32
+
33
+ @end
34
+
35
+ @interface RCT_EXTERN_MODULE(RNPEBankAccountView, RCTViewManager)
36
+
37
+ RCT_EXTERN_METHOD(submit:(nonnull NSNumber*)reactTag merchantId:(NSString *)merchantId additionalData:(NSDictionary *)additionalData)
38
+
39
+ RCT_EXTERN_METHOD(showKeyboard:(nonnull NSNumber*)reactTag)
40
+ RCT_EXTERN_METHOD(hideKeyboard:(nonnull NSNumber*)reactTag)
41
+
42
+ RCT_EXPORT_VIEW_PROPERTY(additionalFields, NSString)
43
+
44
+ @end
45
+
46
+ @interface RCT_EXTERN_MODULE(RNPEApplePayButtonManager, RCTViewManager)
47
+
48
+ RCT_EXPORT_VIEW_PROPERTY(paymentRequest, NSString)
49
+ RCT_EXPORT_VIEW_PROPERTY(onPmSheetDidDismiss, RCTBubblingEventBlock)
50
+ RCT_EXPORT_VIEW_PROPERTY(onPmTokenDidReturn, RCTBubblingEventBlock)
51
+ RCT_EXPORT_VIEW_PROPERTY(onPmTokenNotAvailable, RCTBubblingEventBlock)
52
+ RCT_EXPORT_VIEW_PROPERTY(onPmError, RCTBubblingEventBlock)
53
+
54
+ @end
55
+
56
+ @interface RCT_EXTERN_MODULE(RNPEEventEmitter, RCTEventEmitter)
57
+
58
+ RCT_EXTERN_METHOD(supportedEvents)
59
+
60
+ @end
61
+
62
+
63
+ /// old stuffs
64
+ @interface RCT_EXTERN_MODULE(Payengine, NSObject)
65
+ RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
66
+ withResolver:(RCTPromiseResolveBlock)resolve
67
+ withRejecter:(RCTPromiseRejectBlock)reject)
68
+
69
+ + (BOOL)requiresMainQueueSetup
70
+ {
71
+ return NO;
72
+ }
73
+ @end