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
@@ -1,720 +0,0 @@
1
- import VGSCollectSDK
2
- import UIKit
3
- import PassKit
4
-
5
- let borderColor = UIColor.gray
6
- let errorBorderColor = UIColor.red
7
-
8
- var publicKey = ""
9
- var vgsCollect = VGSCollect(id: "vauiltId", environment: .sandbox)
10
-
11
- func hexStringFromData(data: Data?) -> String? {
12
- // Returns hexadecimal string of NSData. Empty string if data is empty.
13
- return data?.map { String(format: "%02lx", $0) }.joined()
14
- }
15
-
16
- @objc(Payengine)
17
- class Payengine: NSObject {
18
-
19
- @objc(multiply:withB:withResolver:withRejecter:)
20
- func multiply(a: Float, b: Float, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
21
- resolve(a*b)
22
- }
23
- }
24
-
25
-
26
- @objc(ApplePay)
27
- class ApplePay: UIViewController {
28
- private var rootViewController: UIViewController = UIApplication.shared.keyWindow!.rootViewController!
29
- private var request: PKPaymentRequest = PKPaymentRequest()
30
- private var resolve: RCTPromiseResolveBlock?
31
- private var paymentNetworks: [PKPaymentNetwork]?
32
-
33
-
34
- @objc(invokeApplePay:details:)
35
- private func invokeApplePay(method: NSDictionary, details: NSDictionary) -> Void {
36
- self.paymentNetworks = method["supportedNetworks"] as? [PKPaymentNetwork]
37
- guard PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: paymentNetworks!) else {
38
- print("Can not make payment")
39
- return
40
- }
41
- let total = details["total"] as! NSDictionary
42
- let paymentItem = PKPaymentSummaryItem.init(label: total["label"] as! String, amount: NSDecimalNumber(value: total["amount"] as! Double))
43
- request.currencyCode = method["currencyCode"] as! String
44
- request.countryCode = method["countryCode"] as! String
45
- request.merchantIdentifier = method["merchantIdentifier"] as! String
46
- request.merchantCapabilities = PKMerchantCapability.capability3DS
47
- request.supportedNetworks = self.paymentNetworks!
48
- request.paymentSummaryItems = [paymentItem]
49
- }
50
-
51
- @objc(initApplePay:withRejecter:)
52
- func initApplePay(resolve: @escaping RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
53
- guard PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: paymentNetworks!) else {
54
- print("Can not make payment")
55
- return
56
- }
57
- self.resolve = resolve
58
- if let controller = PKPaymentAuthorizationViewController(paymentRequest: request) {
59
- controller.delegate = self
60
- DispatchQueue.main.async {
61
- self.rootViewController.present(controller, animated: true, completion: nil)
62
- }
63
- }
64
- }
65
-
66
- @objc(canMakePayments:withRejecter:)
67
- func canMakePayments(resolve: RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
68
- if PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: paymentNetworks!) {
69
- resolve(true)
70
- } else {
71
- resolve(false)
72
- }
73
- }
74
- }
75
-
76
- extension ApplePay: PKPaymentAuthorizationViewControllerDelegate {
77
- func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) {
78
- controller.dismiss(animated: true, completion: nil)
79
- }
80
-
81
- func paymentAuthorizationViewController(_ controller: PKPaymentAuthorizationViewController, didAuthorizePayment payment: PKPayment, completion: @escaping (PKPaymentAuthorizationStatus) -> Void) {
82
-
83
- let hexStringData = hexStringFromData(data: payment.token.paymentData)
84
-
85
- let token = String(decoding: payment.token.paymentData, as: UTF8.self)
86
- if token != nil {
87
- self.resolve!(hexStringData)
88
- completion(.success)
89
- } else {
90
- self.resolve!("COULD_NOT_FIND_TOKEN")
91
- completion(.failure)
92
- }
93
- }
94
- }
95
-
96
-
97
-
98
- @objc(VGSCollectManager)
99
- class VGSCollectManager: NSObject {
100
-
101
- override init() {
102
- super.init()
103
-
104
- // Enable loggers only for debug!
105
- VGSCollectLogger.shared.configuration.level = .info
106
- VGSCollectLogger.shared.configuration.isNetworkDebugEnabled = true
107
- // *You can stop all VGS Show loggers in app:
108
- // VGSCollectLogger.shared.disableAllLoggers()
109
- vgsCollect.textFields.forEach { (textField) in
110
- textField.delegate = self
111
- }
112
- }
113
-
114
- @objc
115
- static func requiresMainQueueSetup() -> Bool {
116
- return true
117
- }
118
-
119
- @objc(setConfiguration:vaultId:environment:hostname:satellitePort:)
120
- func setConfiguration(_ pKey: String, vaultId: String, environment: String, hostname: String, satellitePort: Int) -> Void {
121
- publicKey = pKey
122
- vgsCollect = VGSCollect(id: vaultId, environment: environment)
123
- // , hostname: hostname, satellitePort: satellitePort
124
- }
125
-
126
- @objc(createCard:resolver:rejecter:)
127
- func createCard(_ merchantId: String?, resolve: @escaping RCTResponseSenderBlock, reject: @escaping RCTPromiseRejectBlock) {
128
- return submitData(merchantId, path: "/api/cards", resolve: resolve, reject: reject)
129
- }
130
-
131
- @objc(createBankAccount:resolver:rejecter:)
132
- func createBankAccount(_ merchantId: String?, resolve: @escaping RCTResponseSenderBlock, reject: @escaping RCTPromiseRejectBlock) {
133
- return submitData(merchantId, path: "/api/bank-accounts", resolve: resolve, reject: reject)
134
- }
135
-
136
- private func submitData(_ merchantId: String?, path: String, resolve: @escaping RCTResponseSenderBlock, reject: @escaping RCTPromiseRejectBlock) {
137
- // add extra data to submit
138
- var extraData = [String: Any]()
139
- if (merchantId != nil) {
140
- extraData["merchant_id"] = merchantId
141
- }
142
- extraData["pci_vault_provider"] = "vgs"
143
-
144
-
145
- //All UI changes should be done on main thread.
146
- DispatchQueue.main.async { [weak self] in
147
- vgsCollect.textFields.forEach { (textfield) in
148
- /// Check textField state before submit
149
- if !textfield.state.isValid {
150
- /// if state is not valid, set border color as red
151
- textfield.borderColor = errorBorderColor
152
- } else {
153
- textfield.borderColor = borderColor
154
- }
155
- /// hide keyboard(if field was active)
156
- textfield.resignFirstResponder()
157
-
158
- if let cardState = textfield.state as? CardState {
159
- extraData["bin"] = cardState.bin
160
- extraData["last_4"] = cardState.last4
161
- extraData["brand"] = cardState.cardBrand.stringValue
162
- }
163
- }
164
-
165
- vgsCollect.customHeaders = [
166
- "Authorization": "Signature key=\"\(publicKey)\",algorithm=\"hmac-sha256\",identifier=\"secure-fields\",signature=\"\""
167
- ]
168
- // Send data to your Vault
169
- vgsCollect.sendData(path: path, extraData: extraData) { (response) in
170
-
171
- switch response {
172
- case .success(_, let data, _):
173
- var jsonText = ""
174
- if let data = data, let jsonData = try? JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] {
175
- return resolve([jsonData["data"]!])
176
- }
177
- case .failure(let code, _, _, let error):
178
- var errorText = ""
179
- print("Submit request error: \(code), \(String(describing: error))")
180
- switch code {
181
- case 400..<499:
182
- // Wrong request. This also can happend when your Routs not setup yet or your <vaultId> is wrong
183
- errorText = "Wrong Request Error: \(code)"
184
- return reject("http_error", errorText, error)
185
- case VGSErrorType.inputDataIsNotValid.rawValue:
186
- if let error = error as? VGSError {
187
- errorText = "Input data is not valid. Details:\n \(error)"
188
- }
189
- return reject("input_error", errorText, error)
190
- default:
191
- errorText = "Something went wrong. Code: \(code)"
192
- return reject("unexpected_error", errorText, error)
193
- }
194
- }
195
- }
196
- }
197
- }
198
- }
199
-
200
- /// VGSTextFieldDelegate -handle VGSTextField changes
201
- extension VGSCollectManager: VGSTextFieldDelegate {
202
- func vgsTextFieldDidBeginEditing(_ textField: VGSTextField) {
203
- /// Reset border color to default if the field was not valid on sendData(_:) request
204
- textField.borderColor = borderColor
205
- }
206
-
207
- func vgsTextFieldDidChange(_ textField: VGSTextField) {
208
- print(textField.state.description)
209
- }
210
- }
211
-
212
- class CustomCardNumberField: UIView {
213
-
214
- var field: VGSCardTextField!
215
-
216
- @objc var placeholder: NSString = "Card number" {
217
- didSet {
218
- _placeholder = String(describing: placeholder)
219
- }
220
- }
221
-
222
- var _placeholder: String = "Card number" {
223
- didSet {
224
- field.placeholder = String(describing: _placeholder)
225
- }
226
- }
227
-
228
- @objc var name: NSString = "card_number" {
229
- didSet {
230
- _name = String(describing: name)
231
- }
232
- }
233
-
234
- var _name: String = "card_number" {
235
- didSet {
236
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
237
- config.type = FieldType.cardNumber
238
- config.isRequiredValidOnly = true
239
-
240
- field.configuration = config
241
- }
242
- }
243
-
244
- override init(frame: CGRect) {
245
- super.init(frame: frame)
246
- setupView()
247
- }
248
-
249
- required init?(coder aDecoder: NSCoder) {
250
- super.init(coder: aDecoder)
251
- setupView()
252
- }
253
-
254
-
255
- private func setupView() {
256
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
257
- config.type = FieldType.cardNumber
258
- config.isRequiredValidOnly = true
259
-
260
- field = VGSCardTextField()
261
- field.translatesAutoresizingMaskIntoConstraints = false
262
- field.placeholder = String(describing: _placeholder)
263
- field.padding = .init(top: 8, left: 8, bottom: 8, right: 8)
264
- field.configuration = config
265
- self.addSubview(field)
266
- self.bringSubviewToFront(field)
267
- field.bounds = self.bounds
268
- NSLayoutConstraint.activate([
269
- field.topAnchor.constraint(equalTo: self.topAnchor),
270
- field.bottomAnchor.constraint(equalTo: self.bottomAnchor),
271
- field.leadingAnchor.constraint(equalTo: self.leadingAnchor),
272
- field.trailingAnchor.constraint(equalTo: self.trailingAnchor)
273
- ])
274
-
275
- }
276
-
277
- }
278
-
279
-
280
- @objc(VGSCardNumberFieldManager)
281
- class VGSCardNumberFieldManager: RCTViewManager {
282
-
283
- @objc override static func requiresMainQueueSetup() -> Bool {
284
- return true
285
- }
286
-
287
- override func view() -> UIView! {
288
- return CustomCardNumberField()
289
- }
290
- }
291
-
292
- class CustomExpDateField: UIView {
293
-
294
- var field: VGSExpDateTextField!
295
-
296
- @objc var placeholder: NSString = "Exp date" {
297
- didSet {
298
- _placeholder = String(describing: placeholder)
299
- }
300
- }
301
-
302
- var _placeholder: String = "Exp date" {
303
- didSet {
304
- field.placeholder = String(describing: _placeholder)
305
- }
306
- }
307
-
308
- @objc var name: NSString = "card_exp" {
309
- didSet {
310
- _name = String(describing: name)
311
- }
312
- }
313
-
314
- var _name: String = "card_exp" {
315
- didSet {
316
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
317
- config.type = FieldType.expDate
318
- config.isRequiredValidOnly = true
319
-
320
- field.configuration = config
321
- }
322
- }
323
-
324
- override init(frame: CGRect) {
325
- super.init(frame: frame)
326
- setupView()
327
- }
328
-
329
- required init?(coder aDecoder: NSCoder) {
330
- super.init(coder: aDecoder)
331
- setupView()
332
- }
333
-
334
-
335
-
336
- private func setupView() {
337
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
338
- config.type = FieldType.expDate
339
- config.isRequiredValidOnly = true
340
-
341
- field = VGSExpDateTextField()
342
- field.translatesAutoresizingMaskIntoConstraints = false
343
- field.placeholder = String(describing: _placeholder)
344
- field.padding = .init(top: 8, left: 8, bottom: 8, right: 8)
345
- field.configuration = config
346
- field.monthPickerFormat = .longSymbols
347
- self.addSubview(field)
348
- self.bringSubviewToFront(field)
349
- field.bounds = self.bounds
350
- NSLayoutConstraint.activate([
351
- field.topAnchor.constraint(equalTo: self.topAnchor),
352
- field.bottomAnchor.constraint(equalTo: self.bottomAnchor),
353
- field.leadingAnchor.constraint(equalTo: self.leadingAnchor),
354
- field.trailingAnchor.constraint(equalTo: self.trailingAnchor)
355
- ])
356
-
357
- }
358
-
359
- }
360
-
361
- @objc(VGSExpDateFieldManager)
362
- class VGSExpDateFieldManager: RCTViewManager {
363
-
364
- @objc override static func requiresMainQueueSetup() -> Bool {
365
- return true
366
- }
367
-
368
- override func view() -> UIView! {
369
- return CustomExpDateField()
370
- }
371
- }
372
-
373
- class CustomCVCField: UIView {
374
-
375
- var field: VGSCVCTextField!
376
-
377
- @objc var placeholder: NSString = "CVC" {
378
- didSet {
379
- _placeholder = String(describing: placeholder)
380
- }
381
- }
382
-
383
- var _placeholder: String = "CVC" {
384
- didSet {
385
- field.placeholder = String(describing: _placeholder)
386
- }
387
- }
388
-
389
- @objc var name: NSString = "card_cvc" {
390
- didSet {
391
- _name = String(describing: name)
392
- }
393
- }
394
-
395
- var _name: String = "card_cvc" {
396
- didSet {
397
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
398
- config.type = FieldType.cvc
399
- config.isRequiredValidOnly = true
400
-
401
- field.configuration = config
402
- }
403
- }
404
-
405
- override init(frame: CGRect) {
406
- super.init(frame: frame)
407
- setupView()
408
- }
409
-
410
- required init?(coder aDecoder: NSCoder) {
411
- super.init(coder: aDecoder)
412
- setupView()
413
- }
414
-
415
-
416
-
417
- private func setupView() {
418
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
419
- config.type = FieldType.cvc
420
- config.isRequiredValidOnly = true
421
-
422
- field = VGSCVCTextField()
423
- field.translatesAutoresizingMaskIntoConstraints = false
424
- field.placeholder = String(describing: _placeholder)
425
- field.padding = .init(top: 8, left: 8, bottom: 8, right: 8)
426
- field.configuration = config
427
- self.addSubview(field)
428
- self.bringSubviewToFront(field)
429
- field.bounds = self.bounds
430
- NSLayoutConstraint.activate([
431
- field.topAnchor.constraint(equalTo: self.topAnchor),
432
- field.bottomAnchor.constraint(equalTo: self.bottomAnchor),
433
- field.leadingAnchor.constraint(equalTo: self.leadingAnchor),
434
- field.trailingAnchor.constraint(equalTo: self.trailingAnchor)
435
- ])
436
-
437
- }
438
-
439
- }
440
-
441
- @objc(VGSCVCFieldManager)
442
- class VGSCVCFieldManager: RCTViewManager {
443
-
444
- @objc override static func requiresMainQueueSetup() -> Bool {
445
- return true
446
- }
447
-
448
- override func view() -> UIView! {
449
- return CustomCVCField()
450
- }
451
- }
452
-
453
- class CustomCardHolderNameField: UIView {
454
-
455
- var field: VGSTextField!
456
-
457
- @objc var placeholder: NSString = "Card holder name" {
458
- didSet {
459
- _placeholder = String(describing: placeholder)
460
- }
461
- }
462
-
463
- var _placeholder: String = "Card holder name" {
464
- didSet {
465
- field.placeholder = String(describing: _placeholder)
466
- }
467
- }
468
-
469
- @objc var name: NSString = "card_holder" {
470
- didSet {
471
- _name = String(describing: name)
472
- }
473
- }
474
-
475
- var _name: String = "card_holder" {
476
- didSet {
477
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
478
- config.type = FieldType.cardHolderName
479
- config.isRequiredValidOnly = true
480
-
481
- field.configuration = config
482
- }
483
- }
484
-
485
- override init(frame: CGRect) {
486
- super.init(frame: frame)
487
- setupView()
488
- }
489
-
490
- required init?(coder aDecoder: NSCoder) {
491
- super.init(coder: aDecoder)
492
- setupView()
493
- }
494
-
495
- private func setupView() {
496
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
497
- config.type = FieldType.cardHolderName
498
- config.isRequiredValidOnly = true
499
-
500
- field = VGSTextField()
501
- field.translatesAutoresizingMaskIntoConstraints = false
502
- field.autocapitalizationType = UITextAutocapitalizationType.allCharacters
503
- field.placeholder = String(describing: _placeholder)
504
- field.padding = .init(top: 8, left: 8, bottom: 8, right: 8)
505
- field.configuration = config
506
- self.addSubview(field)
507
- self.bringSubviewToFront(field)
508
- field.bounds = self.bounds
509
- NSLayoutConstraint.activate([
510
- field.topAnchor.constraint(equalTo: self.topAnchor),
511
- field.bottomAnchor.constraint(equalTo: self.bottomAnchor),
512
- field.leadingAnchor.constraint(equalTo: self.leadingAnchor),
513
- field.trailingAnchor.constraint(equalTo: self.trailingAnchor)
514
- ])
515
-
516
- }
517
-
518
- }
519
-
520
- @objc(VGSCardHolderNameFieldManager)
521
- class VGSCardHolderNameFieldManager: RCTViewManager {
522
-
523
- @objc override static func requiresMainQueueSetup() -> Bool {
524
- return true
525
- }
526
-
527
- override func view() -> UIView! {
528
- return CustomCardHolderNameField()
529
- }
530
- }
531
-
532
- class CustomZipCodeField: UIView {
533
-
534
- var field: VGSTextField!
535
-
536
- @objc var placeholder: NSString = "Zip code" {
537
- didSet {
538
- _placeholder = String(describing: placeholder)
539
- }
540
- }
541
-
542
- var _placeholder: String = "Zip code" {
543
- didSet {
544
- field.placeholder = String(describing: _placeholder)
545
- }
546
- }
547
-
548
- @objc var name: NSString = "address_zip" {
549
- didSet {
550
- _name = String(describing: name)
551
- }
552
- }
553
-
554
- var _name: String = "address_zip" {
555
- didSet {
556
- self.reloadConfig()
557
- }
558
- }
559
-
560
- override init(frame: CGRect) {
561
- super.init(frame: frame)
562
- setupView()
563
- }
564
-
565
- required init?(coder aDecoder: NSCoder) {
566
- super.init(coder: aDecoder)
567
- setupView()
568
- }
569
-
570
- private func setupView() {
571
- field = VGSTextField()
572
- field.translatesAutoresizingMaskIntoConstraints = false
573
- field.placeholder = String(describing: _placeholder)
574
- field.padding = .init(top: 8, left: 8, bottom: 8, right: 8)
575
- self.reloadConfig()
576
-
577
- self.addSubview(field)
578
- self.bringSubviewToFront(field)
579
- field.bounds = self.bounds
580
- NSLayoutConstraint.activate([
581
- field.topAnchor.constraint(equalTo: self.topAnchor),
582
- field.bottomAnchor.constraint(equalTo: self.bottomAnchor),
583
- field.leadingAnchor.constraint(equalTo: self.leadingAnchor),
584
- field.trailingAnchor.constraint(equalTo: self.trailingAnchor)
585
- ])
586
-
587
- }
588
-
589
- private func reloadConfig() {
590
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
591
- config.type = FieldType.cardHolderName
592
- config.isRequiredValidOnly = true
593
- config.validationRules = VGSValidationRuleSet(rules: [
594
- VGSValidationRuleLength(min: 5, max: 7, error: "WRONG_LENGTH"),
595
- VGSValidationRulePattern.init(pattern: "^(\\d{5}(-\\d{4})?|[a-z]\\d[a-z][- ]*\\d[a-z]\\d)$" , error: "PATTERN FAILED")
596
- ])
597
- field.configuration = config
598
- }
599
-
600
- }
601
-
602
- @objc(VGSZipCodeFieldManager)
603
- class VGSZipCodeFieldManager: RCTViewManager {
604
-
605
- @objc override static func requiresMainQueueSetup() -> Bool {
606
- return true
607
- }
608
-
609
- override func view() -> UIView! {
610
- return CustomZipCodeField()
611
- }
612
- }
613
-
614
- class CustomTextField: UIView {
615
-
616
- var field: VGSTextField!
617
-
618
- @objc var placeholder: NSString = "" {
619
- didSet {
620
- _placeholder = String(describing: placeholder)
621
- }
622
- }
623
-
624
- var _placeholder: String = "" {
625
- didSet {
626
- field.placeholder = String(describing: _placeholder)
627
- }
628
- }
629
-
630
- @objc var name: NSString = "" {
631
- didSet {
632
- _name = String(describing: name)
633
- }
634
- }
635
-
636
- var _name: String = "" {
637
- didSet {
638
- self.reloadConfig()
639
- }
640
- }
641
-
642
- @objc var pattern: NSString = "" {
643
- didSet {
644
- _pattern = String(describing: pattern)
645
- }
646
- }
647
-
648
- var _pattern: String = "" {
649
- didSet {
650
- self.reloadConfig()
651
- }
652
- }
653
-
654
- @objc var maxlength: NSNumber = 0 {
655
- didSet {
656
- _maxlength = Int(exactly: maxlength)!
657
- }
658
- }
659
-
660
- var _maxlength: Int = 0 {
661
- didSet {
662
- self.reloadConfig()
663
- }
664
- }
665
-
666
- override init(frame: CGRect) {
667
- super.init(frame: frame)
668
- setupView()
669
- }
670
-
671
- required init?(coder aDecoder: NSCoder) {
672
- super.init(coder: aDecoder)
673
- setupView()
674
- }
675
-
676
- private func setupView() {
677
- field = VGSTextField()
678
- field.translatesAutoresizingMaskIntoConstraints = false
679
- field.placeholder = String(describing: _placeholder)
680
- field.padding = .init(top: 8, left: 8, bottom: 8, right: 8)
681
-
682
- self.reloadConfig()
683
-
684
- self.addSubview(field)
685
- self.bringSubviewToFront(field)
686
- field.bounds = self.bounds
687
- NSLayoutConstraint.activate([
688
- field.topAnchor.constraint(equalTo: self.topAnchor),
689
- field.bottomAnchor.constraint(equalTo: self.bottomAnchor),
690
- field.leadingAnchor.constraint(equalTo: self.leadingAnchor),
691
- field.trailingAnchor.constraint(equalTo: self.trailingAnchor)
692
- ])
693
-
694
- }
695
-
696
- private func reloadConfig() {
697
- let config = VGSConfiguration(collector: vgsCollect, fieldName: _name)
698
- config.type = FieldType.none
699
- if _pattern.isEmpty == false {
700
- config.formatPattern = _pattern
701
- }
702
- if _maxlength > 0 {
703
- config.maxInputLength = _maxlength
704
- }
705
- field.configuration = config
706
- }
707
-
708
- }
709
-
710
- @objc(VGSTextFieldManager)
711
- class VGSTextFieldManager: RCTViewManager {
712
-
713
- @objc override static func requiresMainQueueSetup() -> Bool {
714
- return true
715
- }
716
-
717
- override func view() -> UIView! {
718
- return CustomTextField()
719
- }
720
- }