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
@@ -0,0 +1,95 @@
1
+
2
+ import * as React from 'react';
3
+ import { requireNativeComponent, NativeModules, NativeEventEmitter, ViewProps, findNodeHandle, UIManager, ActivityIndicator, Platform } from 'react-native';
4
+ import type IPEField from './IPEField';
5
+ import type PEBankAccount from './PEBankAccount';
6
+
7
+ const { RNPEEventEmitter } = NativeModules;
8
+
9
+ interface NativePEBankAccountViewProps extends ViewProps {
10
+ additionalFields: string;
11
+ }
12
+
13
+ const COMPONENT_NAME = 'RNPEBankAccountView'
14
+ const RNPEBankAccountView = requireNativeComponent<NativePEBankAccountViewProps>(COMPONENT_NAME);
15
+ // @ts-ignore
16
+ const RNPEBankAccountViewManager = UIManager[COMPONENT_NAME]
17
+
18
+ const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
19
+
20
+ export interface PEBankAccountViewProps {
21
+ additionalFields?: IPEField[];
22
+ }
23
+
24
+ export interface PEBankAccountViewMethods {
25
+ submit: (merchantId: string, additionalData: { [key: string]: string }) => Promise<PEBankAccount>;
26
+ showKeyboard: () => void;
27
+ hideKeyboard: () => void;
28
+ }
29
+
30
+ export const PEBankAccountView = React.forwardRef<
31
+ PEBankAccountViewMethods,
32
+ PEBankAccountViewProps
33
+ >((props, ref) => {
34
+ const formRef = React.useRef<any>();
35
+ const [height, setHeight] = React.useState(0);
36
+
37
+ React.useImperativeHandle(ref, () => ({
38
+ submit: async (merchantId: string, additionalData: any = {}) => {
39
+ return new Promise((resolve, reject) => {
40
+ if (height === 0) {
41
+ return reject(new Error('Form is not ready'))
42
+ }
43
+
44
+ const listener = peEventEmitter.addListener('onBankAccountRespond', args => {
45
+ listener.remove()
46
+
47
+ const { error, bankAccount: json } = args;
48
+ if (error) {
49
+ reject(new Error(error))
50
+ } else {
51
+ const bankAccount = JSON.parse(json) as PEBankAccount;
52
+ resolve(bankAccount)
53
+ }
54
+ });
55
+
56
+ callNativeMethod("submit", [merchantId, additionalData],)
57
+ });
58
+ },
59
+ showKeyboard: () => {
60
+ callNativeMethod("showKeyboard")
61
+ },
62
+ hideKeyboard: () => {
63
+ callNativeMethod("hideKeyboard")
64
+ }
65
+ }));
66
+
67
+ const callNativeMethod = React.useCallback((methodName: string, params: any[] = []) => {
68
+ const viewId = findNodeHandle(formRef.current);
69
+ let commandId = RNPEBankAccountViewManager.Commands[methodName].toString()
70
+ if (Platform.OS === 'ios') {
71
+ commandId = Number(commandId)
72
+ }
73
+ UIManager.dispatchViewManagerCommand(
74
+ viewId,
75
+ commandId,
76
+ params,
77
+ );
78
+ }, [formRef.current])
79
+
80
+
81
+ React.useEffect(() => {
82
+ const eventListener = peEventEmitter.addListener('onSizeChanges', args => {
83
+ const { width: _, height: frameHeight } = args;
84
+ setHeight(frameHeight);
85
+ });
86
+ return () => eventListener.remove();
87
+ }, []);
88
+
89
+ return (
90
+ <>
91
+ {height === 0 && <ActivityIndicator />}
92
+ <RNPEBankAccountView ref={formRef} additionalFields={JSON.stringify(props.additionalFields ?? [])} style={{ height: height }} />
93
+ </>
94
+ );
95
+ });
@@ -0,0 +1,96 @@
1
+
2
+ import * as React from 'react';
3
+ import { requireNativeComponent, NativeModules, NativeEventEmitter, ViewProps, Platform, findNodeHandle, UIManager, ActivityIndicator } from 'react-native';
4
+ import type IPEField from './IPEField';
5
+ import type PECard from './PECard';
6
+
7
+ const { RNPEEventEmitter } = NativeModules;
8
+
9
+ interface NativePECreditCardViewProps extends ViewProps {
10
+ additionalFields: string;
11
+ }
12
+
13
+ const COMPONENT_NAME = 'RNPECreditCardView'
14
+ const RNPECreditCardView = requireNativeComponent<NativePECreditCardViewProps>(COMPONENT_NAME);
15
+ // @ts-ignore
16
+ const RNPECreditCardViewManager = UIManager[COMPONENT_NAME]
17
+ const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
18
+
19
+ export interface PECreditCardViewProps {
20
+ additionalFields?: IPEField[];
21
+ }
22
+
23
+ export interface PECreditCardViewMethods {
24
+ submit: (merchantId: string, additionalData: { [key: string]: string }) => Promise<PECard>;
25
+ showKeyboard: () => void;
26
+ hideKeyboard: () => void;
27
+ }
28
+
29
+ export const PECreditCardView = React.forwardRef<
30
+ PECreditCardViewMethods,
31
+ PECreditCardViewProps
32
+ >((props, ref) => {
33
+ const formRef = React.useRef<any>();
34
+ const [height, setHeight] = React.useState(0);
35
+
36
+ React.useImperativeHandle(ref, () => ({
37
+ submit: async (merchantId: string, additionalData: any = {}) => {
38
+ return new Promise((resolve, reject) => {
39
+ if (height === 0) {
40
+ return reject(new Error('Form is not ready'))
41
+ }
42
+
43
+ const listener = peEventEmitter.addListener('onCardRespond', args => {
44
+ listener.remove()
45
+
46
+ const { error, card: json } = args;
47
+ if (error) {
48
+ reject(new Error(error))
49
+ } else {
50
+ const card = JSON.parse(json) as PECard;
51
+ resolve(card)
52
+ }
53
+ });
54
+
55
+ callNativeMethod("submit", [merchantId, additionalData])
56
+ });
57
+ },
58
+ showKeyboard: () => {
59
+ callNativeMethod("showKeyboard")
60
+ },
61
+ hideKeyboard: () => {
62
+ callNativeMethod("hideKeyboard")
63
+ }
64
+ }));
65
+
66
+ const callNativeMethod = React.useCallback((methodName: string, params: any[] = []) => {
67
+ console.log("callNativeMethod", methodName, params)
68
+ const viewId = findNodeHandle(formRef.current);
69
+ let commandId = RNPECreditCardViewManager.Commands[methodName].toString()
70
+ if (Platform.OS === 'ios') {
71
+ commandId = Number(commandId)
72
+ }
73
+ UIManager.dispatchViewManagerCommand(
74
+ viewId,
75
+ commandId,
76
+ params,
77
+ );
78
+ }, [formRef.current])
79
+
80
+ React.useEffect(() => {
81
+ const eventListener = peEventEmitter.addListener('onSizeChanges', args => {
82
+ const { width: _, height: frameHeight } = args;
83
+ setHeight(frameHeight);
84
+ });
85
+
86
+ return () => eventListener.remove();
87
+ }, []);
88
+
89
+
90
+ return (
91
+ <>
92
+ {height === 0 && <ActivityIndicator />}
93
+ <RNPECreditCardView ref={formRef} additionalFields={JSON.stringify(props.additionalFields ?? [])} style={{ height: height }} />
94
+ </>
95
+ );
96
+ });
@@ -0,0 +1,12 @@
1
+ import type PEKeyboardType from "./PEKeyboardType";
2
+
3
+ interface IPEField {
4
+ name: string;
5
+ type: string;
6
+ placeholder: string;
7
+ keyboardType: PEKeyboardType;
8
+ isRequired: boolean;
9
+ pattern?: string;
10
+ }
11
+
12
+ export default IPEField;
@@ -0,0 +1,12 @@
1
+ interface PEBankAccount {
2
+ id: string;
3
+ token: string;
4
+ account_data: {
5
+ first_name: string;
6
+ last_name: string;
7
+ routing_number: string;
8
+ last_4: string;
9
+ };
10
+ }
11
+
12
+ export default PEBankAccount;
@@ -0,0 +1,14 @@
1
+ interface PECard {
2
+ token: string;
3
+ card_data: {
4
+ id: string;
5
+ brand: string;
6
+ last_4: string;
7
+ exp_year: string;
8
+ exp_month: string;
9
+ name: string;
10
+ address_zip?: string;
11
+ };
12
+ }
13
+
14
+ export default PECard;
@@ -0,0 +1,8 @@
1
+ enum PEKeyboardType {
2
+ alphabet = 'alphabet',
3
+ number = 'number',
4
+ phone = 'phone',
5
+ normal = 'normal',
6
+ }
7
+
8
+ export default PEKeyboardType;
package/src/index.tsx ADDED
@@ -0,0 +1,62 @@
1
+ import PayEngine from './components/PayEngine';
2
+ import { NativeModules, Platform } from 'react-native';
3
+ import type { IPayEngineConfig } from './interfaces/index';
4
+ import {
5
+ PECreditCardView,
6
+ PECreditCardViewMethods,
7
+ } from './components/v2/SecureFields/CreditCardView';
8
+ import {
9
+ PEBankAccountView,
10
+ PEBankAccountViewMethods,
11
+ } from './components/v2/SecureFields/BankAccountView';
12
+ import type IPEField from './components/v2/SecureFields/IPEField';
13
+ import type PECard from './components/v2/SecureFields/PECard';
14
+ import type PEBankAccount from './components/v2/SecureFields/PEBankAccount';
15
+ import { PayEngineProvider } from './components/v2/PayEngineProvider';
16
+ import PayEngineNative from './components/v2/PayEngineNative';
17
+ import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
18
+ import { PEPaymentRequest } from './components/v2/ApplePay/PEPaymentRequest';
19
+ import * as PayEngineUtils from './utils/index';
20
+ import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
21
+
22
+ const LINKING_ERROR =
23
+ `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \n\n` +
24
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
25
+ '- You rebuilt the app after installing the package\n' +
26
+ '- You are not using Expo managed workflow\n';
27
+
28
+ const PayEngineStatic = NativeModules.Payengine
29
+ ? NativeModules.Payengine
30
+ : new Proxy(
31
+ {},
32
+ {
33
+ get() {
34
+ throw new Error(LINKING_ERROR);
35
+ },
36
+ }
37
+ );
38
+
39
+ export {
40
+ PayEngineStatic,
41
+ PayEngine,
42
+ IPayEngineConfig,
43
+
44
+ // v2 starting here
45
+ PayEngineUtils,
46
+ PayEngineProvider,
47
+ PayEngineNative,
48
+ // securefields
49
+ PEKeyboardType,
50
+ IPEField,
51
+ // credit card
52
+ PECreditCardView,
53
+ PECreditCardViewMethods,
54
+ PECard,
55
+ // bank account
56
+ PEBankAccountView,
57
+ PEBankAccountViewMethods,
58
+ PEBankAccount,
59
+ // Apple Pay
60
+ PEApplePayButton,
61
+ PEPaymentRequest,
62
+ };
@@ -0,0 +1,6 @@
1
+ export interface IPayEngineConfig {
2
+ publicKey: string;
3
+ version?: string;
4
+ scriptURL?: string;
5
+ logLevel?: number;
6
+ }
@@ -0,0 +1,79 @@
1
+ import axios from 'axios';
2
+ import type { IPayEngineConfig } from '../interfaces/index';
3
+
4
+ export class PEDeprecationError extends Error {
5
+ constructor() {
6
+ super(
7
+ 'This method is obsolete and can not be used anymore. Please check out the package README'
8
+ );
9
+ }
10
+ }
11
+
12
+ export const getHttpHeaders = (config: IPayEngineConfig) => {
13
+ return {
14
+ Authorization: `Signature key="${config.publicKey}",algorithm="hmac-sha256",identifier="secure-fields",signature=""`,
15
+ };
16
+ };
17
+
18
+ export const getBaseURL = (config: IPayEngineConfig) => {
19
+ let baseUrl = config.publicKey.includes('_prod_')
20
+ ? 'https://console.payengine.co'
21
+ : 'https://console.payengine.dev';
22
+
23
+ if (config.scriptURL) {
24
+ baseUrl = config.scriptURL.replace(/^((\w+:)?\/\/[^\/]+\/?).*$/, '$1');
25
+ }
26
+ return baseUrl;
27
+ };
28
+
29
+ export const createHttpClient = (config: IPayEngineConfig) => {
30
+ return axios.create({
31
+ baseURL: getBaseURL(config),
32
+ headers: getHttpHeaders(config),
33
+ });
34
+ };
35
+
36
+ export function getScriptURL(config: IPayEngineConfig) {
37
+ if (!config.publicKey) {
38
+ throw new Error('PayEngine Public Key is missing');
39
+ }
40
+ let scriptURL = '';
41
+ const logLevelStr = config.logLevel ? `&loglevel=${config.logLevel}` : '';
42
+ if (config.scriptURL) {
43
+ scriptURL = `${config.scriptURL}?key=${config.publicKey}${logLevelStr}`;
44
+ } else {
45
+ const baseURL = config.publicKey.includes('_prod_')
46
+ ? 'https://console.payengine.co'
47
+ : 'https://console.payengine.dev';
48
+ const version = config.version ?? '1.0.0';
49
+ scriptURL = `${baseURL}/js/${version}/embed.js?key=${config.publicKey}${logLevelStr}`;
50
+ }
51
+
52
+ return scriptURL;
53
+ }
54
+
55
+ export const debuggingScript = `
56
+ const consoleLog = (type, ...log) => window.ReactNativeWebView.postMessage(JSON.stringify({'type': 'Console', 'data': {'type': type, 'log': log}}));
57
+ console = {
58
+ log: (...log) => consoleLog('log', ...log),
59
+ debug: (...log) => consoleLog('debug', ...log),
60
+ info: (...log) => consoleLog('info', ...log),
61
+ warn: (...log) => consoleLog('warn', ...log),
62
+ error: (...log) => consoleLog('error', ...log),
63
+ verbose: (...log) => consoleLog('verbose', ...log),
64
+ };
65
+
66
+ const dispatchEvent_original = EventTarget.prototype.dispatchEvent;
67
+ function dispatchEvent(event) {
68
+ if (event.type && !event.type.startsWith('react')) {
69
+ ReactNativeWebView.postMessage(JSON.stringify({
70
+ type: 'PayEngine',
71
+ event: {
72
+ type: event.type,
73
+ detail: event.detail
74
+ }
75
+ }))
76
+ }
77
+ }
78
+ EventTarget.prototype.dispatchEvent = dispatchEvent;
79
+ `;
@@ -1,148 +0,0 @@
1
- package com.reactnativepayengine.collect;
2
-
3
- import android.app.Activity;
4
- import android.content.Intent;
5
- import android.util.Log;
6
-
7
- import androidx.annotation.NonNull;
8
-
9
- import com.facebook.react.bridge.Promise;
10
- import com.facebook.react.bridge.ReactApplicationContext;
11
- import com.facebook.react.bridge.ReactContextBaseJavaModule;
12
- import com.facebook.react.bridge.ReactMethod;
13
- import com.facebook.react.modules.core.DeviceEventManagerModule;
14
- import com.reactnativepayengine.util.JSONObjectUtil;
15
- import com.verygoodsecurity.vgscollect.VGSCollectLogger;
16
- import com.verygoodsecurity.vgscollect.core.Environment;
17
- import com.verygoodsecurity.vgscollect.core.HTTPMethod;
18
- import com.verygoodsecurity.vgscollect.core.VGSCollect;
19
- import com.verygoodsecurity.vgscollect.core.model.network.VGSRequest;
20
- import com.verygoodsecurity.vgscollect.core.model.network.VGSResponse;
21
- import com.verygoodsecurity.vgscollect.core.model.state.FieldState;
22
- import com.verygoodsecurity.vgscollect.view.InputFieldView;
23
-
24
- import org.json.JSONException;
25
- import org.json.JSONObject;
26
-
27
- import java.util.HashMap;
28
- import java.util.List;
29
- import java.util.Optional;
30
-
31
- public class VGSCollectModule extends ReactContextBaseJavaModule {
32
-
33
- private static ReactApplicationContext reactContext;
34
-
35
- private VGSCollect collect;
36
-
37
- public VGSCollectModule(ReactApplicationContext c) {
38
- super(c);
39
- reactContext = c;
40
- }
41
-
42
- @Override
43
- public void initialize() {
44
- super.initialize();
45
- // Activity activity = reactContext.getCurrentActivity();
46
- // collect = new VGSCollect.Builder(activity, "")
47
- // .create();
48
- }
49
-
50
- @NonNull
51
- @Override
52
- public String getName() {
53
- return "VGSCollectManager";
54
- }
55
-
56
- @ReactMethod
57
- public void setConfiguration(String vaultId, String environment, String cname, double vgsSatellitePort) {
58
- Log.e("test", "Create event called with name: " + vaultId + " and location: " + environment + " cname: " + cname);
59
-
60
- VGSCollectLogger.INSTANCE.setLogLevel(VGSCollectLogger.Level.DEBUG);
61
-
62
- Activity activity = reactContext.getCurrentActivity();
63
- collect = new VGSCollect.Builder(activity, vaultId)
64
- .setEnvironment(environment)
65
- // .setHostname(cname)
66
- // .setPort((int) Math.round(vgsSatellitePort))
67
- .create();
68
-
69
- }
70
-
71
- @ReactMethod
72
- public void createCard(String merchantId, Promise promise) {
73
- this.submit("/api/cards", merchantId, promise);
74
- }
75
-
76
- @ReactMethod
77
- public void createBankAccount(String merchantId, Promise promise) {
78
- this.submit("/api/bank-accounts", merchantId, promise);
79
- }
80
-
81
- private void submit(String path, String merchantId, Promise promise) {
82
- HashMap<String, Object> customData = new HashMap<>();
83
- customData.put("pci_vault_provider", "vgs");
84
- if (merchantId != null && !merchantId.isEmpty()) {
85
- customData.put("merchant_id", merchantId);
86
- }
87
-
88
- HashMap<String, String> headers = new HashMap<>();
89
- headers.put("CUSTOM-HEADER", "custom-header");
90
-
91
- List<FieldState> states = collect.getAllStates();
92
-
93
- for (int i = 0; i < states.size(); i++) {
94
- FieldState state = states.get(i);
95
-
96
- if (!state.isValid()) {
97
- String message = new StringBuilder("Field ")
98
- .append(state.getFieldName())
99
- .append(" is not valid.")
100
- .toString();
101
- promise.reject("validation_error", message);
102
- return;
103
- }
104
- if (state instanceof FieldState.CardNumberState) {
105
- FieldState.CardNumberState cardState = (FieldState.CardNumberState) state;
106
- customData.put("last_4", cardState.getNumber());
107
- customData.put("bin", cardState.getBin());
108
- customData.put("brand", cardState.getCardBrand());
109
- }
110
- }
111
-
112
- VGSRequest request = new VGSRequest.VGSRequestBuilder()
113
- .setMethod(HTTPMethod.POST)
114
- .setPath(path)
115
- .setCustomHeader(headers)
116
- .setCustomData(customData)
117
- .build();
118
-
119
- VGSResponse response = collect.submit(request);
120
- Log.e("test", "response " + response.getBody());
121
- if (response instanceof VGSResponse.SuccessResponse) {
122
- VGSResponse.SuccessResponse result = (VGSResponse.SuccessResponse) response;
123
- try {
124
- JSONObject jsonObj = new JSONObject(result.getBody());
125
- promise.resolve(JSONObjectUtil.convertJsonToMap(jsonObj.getJSONObject("data")));
126
- return;
127
- } catch (JSONException e) {
128
- e.printStackTrace();
129
- promise.reject("invalid_response", "We got success response but unable to parse it");
130
- }
131
- } else if (response instanceof VGSResponse.ErrorResponse) {
132
- VGSResponse.ErrorResponse error = (VGSResponse.ErrorResponse) response;
133
- promise.reject(String.valueOf(error.getErrorCode()), error.getLocalizeMessage());
134
- }
135
-
136
- }
137
-
138
- public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
139
- if (collect != null) {
140
- collect.onActivityResult(requestCode, resultCode, data);
141
- }
142
- }
143
-
144
- public void bindView(InputFieldView inputFieldView) {
145
- Log.e("test", "collect bindView " + inputFieldView.getFieldName() + " - Collect " + collect.getAllStates());
146
- collect.bindView(inputFieldView);
147
- }
148
- }
@@ -1,6 +0,0 @@
1
- package com.reactnativepayengine.collect;
2
- import com.verygoodsecurity.vgscollect.view.InputFieldView;
3
-
4
- public interface VGSCollectOnCreateViewInstanceListener {
5
- void onCreateViewInstance(InputFieldView inputFieldView);
6
- }
@@ -1,67 +0,0 @@
1
- package com.reactnativepayengine.collect.fields;
2
-
3
- import android.graphics.Rect;
4
- import android.graphics.drawable.Drawable;
5
-
6
- import androidx.annotation.NonNull;
7
- import androidx.annotation.Nullable;
8
-
9
- import com.facebook.react.bridge.ReactApplicationContext;
10
- import com.facebook.react.uimanager.SimpleViewManager;
11
- import com.facebook.react.uimanager.ThemedReactContext;
12
- import com.facebook.react.uimanager.annotations.ReactProp;
13
- import com.reactnativepayengine.collect.VGSCollectOnCreateViewInstanceListener;
14
- import com.verygoodsecurity.vgscollect.view.card.CardType;
15
- import com.verygoodsecurity.vgscollect.view.cvc.CVCIconAdapter;
16
- import com.verygoodsecurity.vgscollect.widget.CardVerificationCodeEditText;
17
- import com.verygoodsecurity.vgscollect.widget.VGSCardNumberEditText;
18
- import com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout;
19
-
20
- import org.jetbrains.annotations.NotNull;
21
-
22
- public class VGSCVCField extends SimpleViewManager<VGSTextInputLayout> {
23
- private final VGSCollectOnCreateViewInstanceListener listener;
24
-
25
- private CardVerificationCodeEditText editText;
26
- private VGSTextInputLayout vgsTextInputLayout;
27
-
28
- ReactApplicationContext mCallerContext;
29
-
30
- public VGSCVCField(VGSCollectOnCreateViewInstanceListener listener, ReactApplicationContext reactContext) {
31
- this.listener = listener;
32
- mCallerContext = reactContext;
33
- }
34
-
35
- @Override
36
- public String getName() {
37
- return "VGSCVCField";
38
- }
39
-
40
- @NonNull
41
- @Override
42
- protected VGSTextInputLayout createViewInstance(@NonNull ThemedReactContext reactContext) {
43
- vgsTextInputLayout = new VGSTextInputLayout(reactContext);
44
- vgsTextInputLayout.setHint("CVC");
45
- editText = new CardVerificationCodeEditText(reactContext);
46
- editText.setIsRequired(true);
47
- editText.setFieldName("card_cvc");
48
- CVCIconAdapter adapter = new CVCIconAdapter(reactContext) {
49
- @Override
50
- protected Drawable getIcon(@NotNull CardType cardType, @Nullable String cardBrand, int cvcLength, @NotNull Rect r) {
51
- return super.getIcon(cardType, cardBrand, cvcLength, r);
52
- }
53
- };
54
- editText.setPreviewIconAdapter(adapter);
55
- editText.setPadding(10, 0, 10, 0);
56
-
57
- vgsTextInputLayout.addView(editText);
58
-
59
- this.listener.onCreateViewInstance(editText);
60
- return vgsTextInputLayout;
61
- }
62
-
63
- @ReactProp(name = "placeholder")
64
- public void setPlaceholder(VGSTextInputLayout view, @Nullable String placeholder) {
65
- vgsTextInputLayout.setHint(placeholder);
66
- }
67
- }
@@ -1,53 +0,0 @@
1
- package com.reactnativepayengine.collect.fields;
2
-
3
- import androidx.annotation.NonNull;
4
- import androidx.annotation.Nullable;
5
-
6
- import com.facebook.react.bridge.ReactApplicationContext;
7
- import com.facebook.react.uimanager.SimpleViewManager;
8
- import com.facebook.react.uimanager.ThemedReactContext;
9
- import com.facebook.react.uimanager.annotations.ReactProp;
10
- import com.reactnativepayengine.collect.VGSCollectOnCreateViewInstanceListener;
11
- import com.verygoodsecurity.vgscollect.widget.ExpirationDateEditText;
12
- import com.verygoodsecurity.vgscollect.widget.PersonNameEditText;
13
- import com.verygoodsecurity.vgscollect.widget.VGSTextInputLayout;
14
-
15
- public class VGSCardHolderNameField extends SimpleViewManager<VGSTextInputLayout> {
16
- private final VGSCollectOnCreateViewInstanceListener listener;
17
-
18
- private PersonNameEditText editText;
19
- private VGSTextInputLayout vgsTextInputLayout;
20
-
21
- ReactApplicationContext mCallerContext;
22
-
23
- public VGSCardHolderNameField(VGSCollectOnCreateViewInstanceListener listener, ReactApplicationContext reactContext) {
24
- this.listener = listener;
25
- mCallerContext = reactContext;
26
- }
27
-
28
- @Override
29
- public String getName() {
30
- return "VGSCardHolderNameField";
31
- }
32
-
33
- @NonNull
34
- @Override
35
- protected VGSTextInputLayout createViewInstance(@NonNull ThemedReactContext reactContext) {
36
- vgsTextInputLayout = new VGSTextInputLayout(reactContext);
37
- vgsTextInputLayout.setHint("Card holder name");
38
- editText = new PersonNameEditText(reactContext);
39
- editText.setIsRequired(true);
40
- editText.setFieldName("card_holder");
41
- editText.setPadding(10, 0, 10, 0);
42
-
43
- vgsTextInputLayout.addView(editText);
44
-
45
- this.listener.onCreateViewInstance(editText);
46
- return vgsTextInputLayout;
47
- }
48
-
49
- @ReactProp(name = "placeholder")
50
- public void setPlaceholder(VGSTextInputLayout view, @Nullable String placeholder) {
51
- vgsTextInputLayout.setHint(placeholder);
52
- }
53
- }