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.
- package/README.md +193 -111
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/{5.6.4/fileHashes/resourceHashesCache.bin → 6.1.1/fileHashes/fileHashes.bin} +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -2
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/config.properties +2 -0
- package/android/.idea/caches/deviceStreaming.xml +318 -0
- package/android/.idea/gradle.xml +2 -3
- package/android/.idea/kotlinc.xml +6 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +1 -1
- package/android/build.gradle +24 -3
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/paymentsdk-debug.aar +0 -0
- package/android/paymentsdk-release.aar +0 -0
- package/android/src/main/java/com/reactnativepayengine/PayengineModule.java +1 -5
- package/android/src/main/java/com/reactnativepayengine/PayenginePackage.java +7 -33
- package/android/src/main/java/com/reactnativepayengine/util/MetricsUtil.kt +44 -0
- package/android/src/main/java/com/reactnativepayengine/v2/RNPEFraudAnalyticsApplication.java +55 -0
- package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +71 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +8 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEField.kt +17 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +103 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNPEBankAccountView.kt +77 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardView.kt +77 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +103 -0
- package/ios/PayEngineSDK.xcframework/Info.plist +44 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Frameworks/libKountDataCollector.a +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +25 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +106 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +82 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +622 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK.h +20 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +33 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +27 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.abi.json +15143 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/module.modulemap +11 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/browserInfo.html +136 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/perform3ds.html +467 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Frameworks/libKountDataCollector.a +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +25 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +106 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +82 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +1240 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK.h +20 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +33 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +27 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.abi.json +15143 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +15143 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +326 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/module.modulemap +11 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Assets.car +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/VGSCollectSDK_VGSCollectSDK.bundle/Info.plist +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/browserInfo.html +136 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/perform3ds.html +467 -0
- package/ios/Payengine.xcodeproj/project.pbxproj +14 -4
- package/ios/Payengine.xcodeproj/project.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Payengine.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Payengine.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Sources/Classes/ApplePay/RNPEApplePayButton.swift +111 -0
- package/ios/Sources/Classes/ApplePay/RNPEApplePayPaymentRequest.swift +43 -0
- package/ios/Sources/Classes/RNPEError.swift +12 -0
- package/ios/Sources/Classes/RNPEEventEmitter.swift +29 -0
- package/ios/Sources/Classes/RNPEUtils.swift +30 -0
- package/ios/Sources/Classes/RNPayEngineNative.swift +87 -0
- package/ios/Sources/Classes/SecureFields/RNPEBankAccountView.swift +130 -0
- package/ios/Sources/Classes/SecureFields/RNPECreditCardView.swift +129 -0
- package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +15 -0
- package/ios/Sources/Classes/SecureFields/RNPEField.swift +26 -0
- package/ios/Sources/Payengine.m +73 -0
- package/ios/Sources/Payengine.swift +13 -0
- package/lib/commonjs/components/PayEngine.js +2 -123
- package/lib/commonjs/components/PayEngine.js.map +1 -1
- package/lib/commonjs/components/{SecureFields/VGS/ExpDateField.js → v2/ApplePay/PEApplePayButton.js} +38 -13
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
- package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js +29 -0
- package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js.map +1 -0
- package/lib/commonjs/components/v2/PayEngineNative.js +34 -0
- package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -0
- package/lib/commonjs/components/{SecureFields/VGS/TextField.js → v2/PayEngineProvider.js} +28 -12
- package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -0
- package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +89 -0
- package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -0
- package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +90 -0
- package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -0
- package/lib/commonjs/components/v2/SecureFields/IPEField.js +6 -0
- package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -0
- package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js +6 -0
- package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -0
- package/lib/commonjs/components/v2/SecureFields/PECard.js +6 -0
- package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -0
- package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +18 -0
- package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -0
- package/lib/commonjs/index.js +54 -18
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/index.js +0 -4
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +10 -38
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/PayEngine.js +3 -118
- package/lib/module/components/PayEngine.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js +37 -0
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
- package/lib/module/components/v2/ApplePay/PEPaymentRequest.js +20 -0
- package/lib/module/components/v2/ApplePay/PEPaymentRequest.js.map +1 -0
- package/lib/module/components/v2/PayEngineNative.js +23 -0
- package/lib/module/components/v2/PayEngineNative.js.map +1 -0
- package/lib/module/components/v2/PayEngineProvider.js +30 -0
- package/lib/module/components/v2/PayEngineProvider.js.map +1 -0
- package/lib/module/components/v2/SecureFields/BankAccountView.js +75 -0
- package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -0
- package/lib/module/components/v2/SecureFields/CreditCardView.js +76 -0
- package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -0
- package/lib/module/components/v2/SecureFields/IPEField.js +2 -0
- package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -0
- package/lib/module/components/v2/SecureFields/PEBankAccount.js +2 -0
- package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -0
- package/lib/module/components/v2/SecureFields/PECard.js +2 -0
- package/lib/module/components/v2/SecureFields/PECard.js.map +1 -0
- package/lib/module/components/v2/SecureFields/PEKeyboardType.js +11 -0
- package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -0
- package/lib/module/index.js +14 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/index.js +1 -1
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/module/utils/index.js +6 -37
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/components/PayEngine.d.ts +1 -14
- package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +12 -0
- package/lib/typescript/components/v2/ApplePay/PEPaymentRequest.d.ts +12 -0
- package/lib/typescript/components/v2/PayEngineNative.d.ts +5 -0
- package/lib/typescript/components/v2/PayEngineProvider.d.ts +8 -0
- package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +14 -0
- package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +14 -0
- package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +10 -0
- package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +11 -0
- package/lib/typescript/components/v2/SecureFields/PECard.d.ts +13 -0
- package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +7 -0
- package/lib/typescript/index.d.ts +12 -6
- package/lib/typescript/interfaces/index.d.ts +0 -27
- package/lib/typescript/utils/index.d.ts +3 -36
- package/package.json +12 -7
- package/react-native-payengine.podspec +2 -2
- package/src/components/PayEngine.tsx +5 -118
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +70 -0
- package/src/components/v2/ApplePay/PEPaymentRequest.ts +18 -0
- package/src/components/v2/PayEngineNative.tsx +20 -0
- package/src/components/v2/PayEngineProvider.tsx +30 -0
- package/src/components/v2/SecureFields/BankAccountView.tsx +95 -0
- package/src/components/v2/SecureFields/CreditCardView.tsx +96 -0
- package/src/components/v2/SecureFields/IPEField.ts +12 -0
- package/src/components/v2/SecureFields/PEBankAccount.ts +12 -0
- package/src/components/v2/SecureFields/PECard.ts +14 -0
- package/src/components/v2/SecureFields/PEKeyboardType.ts +8 -0
- package/src/index.tsx +47 -22
- package/src/interfaces/index.ts +0 -32
- package/src/utils/index.ts +8 -36
- package/android/.gradle/5.6.4/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/5.6.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/5.6.4/fileContent/fileContent.lock +0 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/5.6.4/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/5.6.4/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/5.6.4/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/5.6.4/javaCompile/taskHistory.bin +0 -0
- package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectModule.java +0 -153
- package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectOnCreateViewInstanceListener.java +0 -6
- package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCVCField.java +0 -67
- package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCardHolderNameField.java +0 -53
- package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSCardNumberField.java +0 -57
- package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSExpDateField.java +0 -54
- package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSTextField.java +0 -57
- package/android/src/main/java/com/reactnativepayengine/collect/fields/VGSZipCodeField.java +0 -62
- package/android/src/main/java/com/reactnativepayengine/util/ResourceUtil.java +0 -14
- package/ios/Payengine.m +0 -72
- package/ios/Payengine.swift +0 -720
- package/lib/commonjs/components/ApplePay/PayEngineApplePay.js +0 -71
- package/lib/commonjs/components/ApplePay/PayEngineApplePay.js.map +0 -1
- package/lib/commonjs/components/ApplePay/index.js +0 -46
- package/lib/commonjs/components/ApplePay/index.js.map +0 -1
- package/lib/commonjs/components/ApplePay/interfaces.js +0 -2
- package/lib/commonjs/components/ApplePay/interfaces.js.map +0 -1
- package/lib/commonjs/components/CreditCardForm/index.js +0 -76
- package/lib/commonjs/components/CreditCardForm/index.js.map +0 -1
- package/lib/commonjs/components/GooglePay/PayEngineGooglePay.js +0 -65
- package/lib/commonjs/components/GooglePay/PayEngineGooglePay.js.map +0 -1
- package/lib/commonjs/components/GooglePay/index.js +0 -40
- package/lib/commonjs/components/GooglePay/index.js.map +0 -1
- package/lib/commonjs/components/GooglePay/interfaces.js +0 -2
- package/lib/commonjs/components/GooglePay/interfaces.js.map +0 -1
- package/lib/commonjs/components/Legacy/CreditCardFormLegacy.js +0 -323
- package/lib/commonjs/components/Legacy/CreditCardFormLegacy.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/CVCField.js +0 -26
- package/lib/commonjs/components/SecureFields/VGS/CVCField.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/CardHolderNameField.js +0 -26
- package/lib/commonjs/components/SecureFields/VGS/CardHolderNameField.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/CardNumberField.js +0 -26
- package/lib/commonjs/components/SecureFields/VGS/CardNumberField.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/CollectManager.js +0 -60
- package/lib/commonjs/components/SecureFields/VGS/CollectManager.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/ExpDateField.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/TextField.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/ZipCodeField.js +0 -26
- package/lib/commonjs/components/SecureFields/VGS/ZipCodeField.js.map +0 -1
- package/lib/commonjs/components/SecureFields/index.js +0 -34
- package/lib/commonjs/components/SecureFields/index.js.map +0 -1
- package/lib/module/components/ApplePay/PayEngineApplePay.js +0 -58
- package/lib/module/components/ApplePay/PayEngineApplePay.js.map +0 -1
- package/lib/module/components/ApplePay/index.js +0 -35
- package/lib/module/components/ApplePay/index.js.map +0 -1
- package/lib/module/components/ApplePay/interfaces.js +0 -2
- package/lib/module/components/ApplePay/interfaces.js.map +0 -1
- package/lib/module/components/CreditCardForm/index.js +0 -60
- package/lib/module/components/CreditCardForm/index.js.map +0 -1
- package/lib/module/components/GooglePay/PayEngineGooglePay.js +0 -52
- package/lib/module/components/GooglePay/PayEngineGooglePay.js.map +0 -1
- package/lib/module/components/GooglePay/index.js +0 -29
- package/lib/module/components/GooglePay/index.js.map +0 -1
- package/lib/module/components/GooglePay/interfaces.js +0 -2
- package/lib/module/components/GooglePay/interfaces.js.map +0 -1
- package/lib/module/components/Legacy/CreditCardFormLegacy.js +0 -302
- package/lib/module/components/Legacy/CreditCardFormLegacy.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/CVCField.js +0 -14
- package/lib/module/components/SecureFields/VGS/CVCField.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/CardHolderNameField.js +0 -14
- package/lib/module/components/SecureFields/VGS/CardHolderNameField.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/CardNumberField.js +0 -14
- package/lib/module/components/SecureFields/VGS/CardNumberField.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/CollectManager.js +0 -45
- package/lib/module/components/SecureFields/VGS/CollectManager.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/ExpDateField.js +0 -14
- package/lib/module/components/SecureFields/VGS/ExpDateField.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/TextField.js +0 -17
- package/lib/module/components/SecureFields/VGS/TextField.js.map +0 -1
- package/lib/module/components/SecureFields/VGS/ZipCodeField.js +0 -14
- package/lib/module/components/SecureFields/VGS/ZipCodeField.js.map +0 -1
- package/lib/module/components/SecureFields/index.js +0 -17
- package/lib/module/components/SecureFields/index.js.map +0 -1
- package/lib/typescript/components/ApplePay/PayEngineApplePay.d.ts +0 -12
- package/lib/typescript/components/ApplePay/index.d.ts +0 -7
- package/lib/typescript/components/ApplePay/interfaces.d.ts +0 -20
- package/lib/typescript/components/CreditCardForm/index.d.ts +0 -3
- package/lib/typescript/components/GooglePay/PayEngineGooglePay.d.ts +0 -10
- package/lib/typescript/components/GooglePay/index.d.ts +0 -7
- package/lib/typescript/components/GooglePay/interfaces.d.ts +0 -38
- package/lib/typescript/components/Legacy/CreditCardFormLegacy.d.ts +0 -4
- package/lib/typescript/components/SecureFields/VGS/CVCField.d.ts +0 -10
- package/lib/typescript/components/SecureFields/VGS/CardHolderNameField.d.ts +0 -10
- package/lib/typescript/components/SecureFields/VGS/CardNumberField.d.ts +0 -10
- package/lib/typescript/components/SecureFields/VGS/CollectManager.d.ts +0 -12
- package/lib/typescript/components/SecureFields/VGS/ExpDateField.d.ts +0 -10
- package/lib/typescript/components/SecureFields/VGS/TextField.d.ts +0 -14
- package/lib/typescript/components/SecureFields/VGS/ZipCodeField.d.ts +0 -10
- package/lib/typescript/components/SecureFields/index.d.ts +0 -16
- package/src/components/ApplePay/PayEngineApplePay.ts +0 -61
- package/src/components/ApplePay/index.ts +0 -32
- package/src/components/ApplePay/interfaces.ts +0 -25
- package/src/components/CreditCardForm/index.tsx +0 -43
- package/src/components/GooglePay/PayEngineGooglePay.ts +0 -48
- package/src/components/GooglePay/index.ts +0 -39
- package/src/components/GooglePay/interfaces.ts +0 -42
- package/src/components/Legacy/CreditCardFormLegacy.tsx +0 -292
- package/src/components/SecureFields/VGS/CVCField.tsx +0 -21
- package/src/components/SecureFields/VGS/CardHolderNameField.tsx +0 -21
- package/src/components/SecureFields/VGS/CardNumberField.tsx +0 -21
- package/src/components/SecureFields/VGS/CollectManager.tsx +0 -74
- package/src/components/SecureFields/VGS/ExpDateField.tsx +0 -21
- package/src/components/SecureFields/VGS/TextField.tsx +0 -27
- package/src/components/SecureFields/VGS/ZipCodeField.tsx +0 -21
- package/src/components/SecureFields/index.ts +0 -17
- /package/android/.gradle/{5.6.4 → 6.1.1}/fileChanges/last-build.bin +0 -0
- /package/android/.gradle/{5.6.4 → 6.1.1}/gc.properties +0 -0
- /package/android/{vgscollect-1.7.2-debug.aar → securefields-1.7.2-debug.aar} +0 -0
- /package/ios/{Payengine-Bridging-Header.h → Sources/Payengine-Bridging-Header.h} +0 -0
|
@@ -1,121 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { WebView } from 'react-native-webview';
|
|
4
|
-
import { getScriptURL, debuggingScript } from '../utils';
|
|
5
|
-
import LoadingIndicator from './LoadingIndicator';
|
|
6
|
-
import type { IPayEngineConfig } from '../interfaces/index';
|
|
2
|
+
import { Text } from 'react-native';
|
|
7
3
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
merchantId?: string
|
|
12
|
-
hash?: string
|
|
13
|
-
events: {
|
|
14
|
-
[key: string]: (eventData: any) => void
|
|
15
|
-
}
|
|
16
|
-
style?: StyleProp<ViewStyle>
|
|
17
|
-
[key: string]: any
|
|
18
|
-
}
|
|
4
|
+
const PayEngine = () => {
|
|
5
|
+
return <Text>Obsolete. Please check out the package readme</Text>;
|
|
6
|
+
};
|
|
19
7
|
|
|
20
|
-
|
|
21
|
-
const allowedProps = Object.keys(props).filter(x => !['config', 'events', 'style'].includes(x))
|
|
22
|
-
return `<pay-engine id="component"
|
|
23
|
-
style="z-index: 100"
|
|
24
|
-
${allowedProps.map((propName: string) => `${propName}="${props[propName]}"`).join(' ')}
|
|
25
|
-
></pay-engine>`
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const generateHTML = (scriptURL: string, props: IProps) => {
|
|
29
|
-
return `<!DOCTYPE html>
|
|
30
|
-
<html>
|
|
31
|
-
<head>
|
|
32
|
-
<title>PayEngine Elements</title>
|
|
33
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
34
|
-
<script src="${scriptURL}" async defer type="text/javascript"></script>
|
|
35
|
-
</head>
|
|
36
|
-
<body>
|
|
37
|
-
${getHtmlTag(props)}
|
|
38
|
-
<script>
|
|
39
|
-
setInterval(function() {
|
|
40
|
-
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
41
|
-
type: 'PayEngine-height',
|
|
42
|
-
height: document.body.scrollHeight
|
|
43
|
-
}))
|
|
44
|
-
}, 500);
|
|
45
|
-
</script>
|
|
46
|
-
</body>
|
|
47
|
-
</html>`
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const PayEngine = (props: IProps) => {
|
|
51
|
-
|
|
52
|
-
const [scriptURL] = React.useState(getScriptURL(props.config))
|
|
53
|
-
const [height, setHeight] = React.useState(30)
|
|
54
|
-
|
|
55
|
-
const html = generateHTML(scriptURL, props)
|
|
56
|
-
|
|
57
|
-
const onMessage = (payload: any) => {
|
|
58
|
-
const isDebug = props.config.logLevel! > 0
|
|
59
|
-
let dataPayload;
|
|
60
|
-
try {
|
|
61
|
-
dataPayload = JSON.parse(payload.nativeEvent.data);
|
|
62
|
-
} catch (e) { }
|
|
63
|
-
|
|
64
|
-
if (dataPayload) {
|
|
65
|
-
switch (dataPayload.type) {
|
|
66
|
-
case 'Console':
|
|
67
|
-
if (isDebug) {
|
|
68
|
-
console.info(`[Console] ${JSON.stringify(dataPayload.data)}`);
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
case 'PayEngine':
|
|
72
|
-
const { type, detail } = dataPayload.event
|
|
73
|
-
if (props.events?.[type]) {
|
|
74
|
-
props.events?.[type]?.(detail)
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
case 'PayEngine-height':
|
|
78
|
-
setHeight(dataPayload.height)
|
|
79
|
-
break;
|
|
80
|
-
default:
|
|
81
|
-
if (isDebug) {
|
|
82
|
-
console.log(dataPayload)
|
|
83
|
-
}
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
return <View style={[{ flex: 1, height: height }, props.style]}>
|
|
90
|
-
<View style={styles.yellowBox}>
|
|
91
|
-
<Text>Script URL: {scriptURL}</Text>
|
|
92
|
-
</View>
|
|
93
|
-
<View style={styles.yellowBox}>
|
|
94
|
-
<Text>{getHtmlTag(props)}</Text>
|
|
95
|
-
</View>
|
|
96
|
-
<WebView
|
|
97
|
-
originWhitelist={['*']}
|
|
98
|
-
source={{ html: html, baseUrl: '' }}
|
|
99
|
-
// source={{ uri: 'https://google.com' }}
|
|
100
|
-
applicationNameForUserAgent={`PayEngine-RN/${Platform.OS}`}
|
|
101
|
-
injectedJavaScript={debuggingScript}
|
|
102
|
-
renderLoading={LoadingIndicator}
|
|
103
|
-
startInLoadingState={true}
|
|
104
|
-
onMessage={onMessage}
|
|
105
|
-
/>
|
|
106
|
-
</View>
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const styles = StyleSheet.create({
|
|
110
|
-
yellowBox: {
|
|
111
|
-
marginVertical: 5,
|
|
112
|
-
marginHorizontal: 10,
|
|
113
|
-
padding: 10,
|
|
114
|
-
backgroundColor: 'yellow',
|
|
115
|
-
borderWidth: 1,
|
|
116
|
-
borderColor: 'yellow'
|
|
117
|
-
}
|
|
118
|
-
})
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
export default PayEngine
|
|
8
|
+
export default PayEngine;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { requireNativeComponent, ViewProps } from 'react-native';
|
|
4
|
+
import type { PEPaymentRequest } from './PEPaymentRequest';
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
const RNPEApplePayButton = requireNativeComponent<NativePECreditCardViewProps>('RNPEApplePayButton');
|
|
8
|
+
|
|
9
|
+
type NativePEApplePayEvent = {
|
|
10
|
+
nativeEvent: {
|
|
11
|
+
error?: string;
|
|
12
|
+
token?: string
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
interface NativePECreditCardViewProps extends ViewProps {
|
|
17
|
+
paymentRequest: string;
|
|
18
|
+
onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;
|
|
19
|
+
onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;
|
|
20
|
+
onPmError: (event: NativePEApplePayEvent) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface PEApplePayButtonProps extends ViewProps {
|
|
24
|
+
paymentRequest: PEPaymentRequest;
|
|
25
|
+
onTokenDidReturn?: (token: string) => void;
|
|
26
|
+
onPaymentSheetDismissed?: () => void;
|
|
27
|
+
onPaymentFailed?: (error: Error) => void;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PEApplePayButtonMethods {
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export const PEApplePayButton = React.forwardRef<
|
|
36
|
+
PEApplePayButtonMethods,
|
|
37
|
+
PEApplePayButtonProps
|
|
38
|
+
>((props, ref) => {
|
|
39
|
+
|
|
40
|
+
React.useImperativeHandle(ref, () => ({
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const pmError = (event: NativePEApplePayEvent) => {
|
|
44
|
+
if (props.onPaymentFailed) {
|
|
45
|
+
props.onPaymentFailed(new Error(event.nativeEvent.error));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const pmTokenDidReturn = (event: NativePEApplePayEvent) => {
|
|
50
|
+
if (props.onTokenDidReturn) {
|
|
51
|
+
props.onTokenDidReturn(event.nativeEvent.token!);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const pmSheetDidDismiss = () => {
|
|
56
|
+
if (props.onPaymentSheetDismissed) {
|
|
57
|
+
props.onPaymentSheetDismissed();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<RNPEApplePayButton
|
|
63
|
+
style={{ height: 32, width: '100%', ...(props.style as object) }}
|
|
64
|
+
paymentRequest={JSON.stringify(props.paymentRequest)}
|
|
65
|
+
onPmError={pmError}
|
|
66
|
+
onPmTokenDidReturn={pmTokenDidReturn}
|
|
67
|
+
onPmSheetDidDismiss={pmSheetDidDismiss}
|
|
68
|
+
/>
|
|
69
|
+
);
|
|
70
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
export class PEPaymentRequest {
|
|
3
|
+
paymentAmount: number;
|
|
4
|
+
currencyCode: 'USD' | 'CAD';
|
|
5
|
+
paymentItems: {
|
|
6
|
+
amount: number;
|
|
7
|
+
label: string;
|
|
8
|
+
}[]
|
|
9
|
+
|
|
10
|
+
constructor(paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {
|
|
11
|
+
amount: number;
|
|
12
|
+
label: string;
|
|
13
|
+
}[] = []) {
|
|
14
|
+
this.paymentAmount = paymentAmount;
|
|
15
|
+
this.currencyCode = currencyCode;
|
|
16
|
+
this.paymentItems = paymentItems;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { NativeModules, Platform } from "react-native";
|
|
2
|
+
|
|
3
|
+
const { RNPayEngineNative } = NativeModules;
|
|
4
|
+
|
|
5
|
+
export default class PayEngineNative {
|
|
6
|
+
static async createFraudMonitorSession(merchantId: string) {
|
|
7
|
+
return RNPayEngineNative.createFraudMonitorSession(merchantId);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static async getBrowserInfo() {
|
|
11
|
+
return RNPayEngineNative.getBrowserInfo();
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static async isPlatformPaySupported(merchantId: string) {
|
|
15
|
+
if (Platform.OS === 'ios') {
|
|
16
|
+
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { createContext } from "react";
|
|
2
|
+
import type { IPayEngineConfig } from "../../interfaces";
|
|
3
|
+
import { ActivityIndicator, NativeModules } from "react-native";
|
|
4
|
+
|
|
5
|
+
const { RNPayEngineNative } = NativeModules;
|
|
6
|
+
|
|
7
|
+
const PayEngineContext = createContext<IPayEngineConfig | undefined>(undefined);
|
|
8
|
+
|
|
9
|
+
const PayEngineProvider = ({ config, children }: { config: IPayEngineConfig, children: React.ReactNode }) => {
|
|
10
|
+
const [loading, setLoading] = React.useState(true);
|
|
11
|
+
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
RNPayEngineNative.setConfig(config.publicKey, config.scriptURL)
|
|
15
|
+
setLoading(false);
|
|
16
|
+
}, [config]);
|
|
17
|
+
|
|
18
|
+
if (!config) {
|
|
19
|
+
throw new Error('PayEngineProvider: config is required');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return <PayEngineContext.Provider value={config}>
|
|
23
|
+
{loading ? <ActivityIndicator /> : children}
|
|
24
|
+
</PayEngineContext.Provider>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
PayEngineContext,
|
|
29
|
+
PayEngineProvider
|
|
30
|
+
};
|
|
@@ -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
|
+
});
|
package/src/index.tsx
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
-
import PayEngine from './components/PayEngine'
|
|
1
|
+
import PayEngine from './components/PayEngine';
|
|
2
2
|
import { NativeModules, Platform } from 'react-native';
|
|
3
|
-
import { SecureFields } from './components/SecureFields/index';
|
|
4
|
-
import { CreditCardForm } from './components/CreditCardForm/index';
|
|
5
|
-
import CreditCardFormLegacy from './components/Legacy/CreditCardFormLegacy';
|
|
6
3
|
import type { IPayEngineConfig } from './interfaces/index';
|
|
7
|
-
import {
|
|
8
|
-
|
|
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';
|
|
9
21
|
|
|
10
22
|
const LINKING_ERROR =
|
|
11
23
|
`The package 'react-native-payengine' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -13,25 +25,38 @@ const LINKING_ERROR =
|
|
|
13
25
|
'- You rebuilt the app after installing the package\n' +
|
|
14
26
|
'- You are not using Expo managed workflow\n';
|
|
15
27
|
|
|
16
|
-
const PayEngineStatic = NativeModules.Payengine
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
const PayEngineStatic = NativeModules.Payengine
|
|
29
|
+
? NativeModules.Payengine
|
|
30
|
+
: new Proxy(
|
|
31
|
+
{},
|
|
32
|
+
{
|
|
33
|
+
get() {
|
|
34
|
+
throw new Error(LINKING_ERROR);
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
);
|
|
25
38
|
|
|
26
39
|
export {
|
|
27
40
|
PayEngineStatic,
|
|
28
41
|
PayEngine,
|
|
29
|
-
SecureFields,
|
|
30
|
-
CreditCardForm,
|
|
31
|
-
CreditCardFormLegacy,
|
|
32
42
|
IPayEngineConfig,
|
|
33
|
-
PayEngineGooglePay,
|
|
34
|
-
PayEngineApplePay
|
|
35
|
-
}
|
|
36
|
-
|
|
37
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
|
+
};
|
package/src/interfaces/index.ts
CHANGED
|
@@ -1,38 +1,6 @@
|
|
|
1
|
-
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
-
import type { GooglePayRequestData } from '../components/GooglePay/interfaces';
|
|
3
|
-
|
|
4
1
|
export interface IPayEngineConfig {
|
|
5
2
|
publicKey: string;
|
|
6
3
|
version?: string;
|
|
7
4
|
scriptURL?: string;
|
|
8
5
|
logLevel?: number;
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
export interface CreditCardFormProps {
|
|
12
|
-
style?: StyleProp<ViewStyle>;
|
|
13
|
-
merchantId?: string;
|
|
14
|
-
showZipCode?: boolean;
|
|
15
|
-
config: IPayEngineConfig;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface CreditCardFormMethods {
|
|
19
|
-
createCard: (merchantId?: string) => Promise<any>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface MobilePaymentConfig {
|
|
23
|
-
base_url: string;
|
|
24
|
-
country: string;
|
|
25
|
-
currency: string;
|
|
26
|
-
gateway: string; // nmi | converge
|
|
27
|
-
google_pay: GooglePayRequestData;
|
|
28
|
-
apple_pay: {
|
|
29
|
-
merchantName: string;
|
|
30
|
-
supportedCardNetworks: string[];
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface PaymentRequest {
|
|
35
|
-
amount: number;
|
|
36
|
-
currencyCode?: string;
|
|
37
|
-
countryCode?: string;
|
|
38
|
-
}
|
package/src/utils/index.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import type { IPayEngineConfig } from '../interfaces/index';
|
|
3
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
|
+
|
|
4
12
|
export const getHttpHeaders = (config: IPayEngineConfig) => {
|
|
5
13
|
return {
|
|
6
14
|
Authorization: `Signature key="${config.publicKey}",algorithm="hmac-sha256",identifier="secure-fields",signature=""`,
|
|
@@ -44,42 +52,6 @@ export function getScriptURL(config: IPayEngineConfig) {
|
|
|
44
52
|
return scriptURL;
|
|
45
53
|
}
|
|
46
54
|
|
|
47
|
-
/**
|
|
48
|
-
* <script>
|
|
49
|
-
console.log("AAAAAAAA")
|
|
50
|
-
var component = document.getElementById("component");
|
|
51
|
-
var onEvent = function(event) {
|
|
52
|
-
console.log({ event })
|
|
53
|
-
}
|
|
54
|
-
console.log('component')
|
|
55
|
-
component.addEventListener('stepChange', function(e) {
|
|
56
|
-
console.log('step change')
|
|
57
|
-
})
|
|
58
|
-
function addEventListenerAll(target, listener, ...otherArguments) {
|
|
59
|
-
|
|
60
|
-
// install listeners for all natively triggered events
|
|
61
|
-
for (const key in target) {
|
|
62
|
-
if (/^on/.test(key)) {
|
|
63
|
-
const eventType = key.substr(2);
|
|
64
|
-
target.addEventListener(eventType, listener, ...otherArguments);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// dynamically install listeners for all manually triggered events, just-in-time before they're dispatched ;D
|
|
69
|
-
const dispatchEvent_original = EventTarget.prototype.dispatchEvent;
|
|
70
|
-
function dispatchEvent(event) {
|
|
71
|
-
console.log('event test', event.type)
|
|
72
|
-
target.addEventListener(event.type, listener, ...otherArguments); // multiple identical listeners are automatically discarded
|
|
73
|
-
dispatchEvent_original.apply(this, arguments);
|
|
74
|
-
}
|
|
75
|
-
EventTarget.prototype.dispatchEvent = dispatchEvent;
|
|
76
|
-
if (EventTarget.prototype.dispatchEvent !== dispatchEvent) throw new Error('Browser is smarter than you think');
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// addEventListenerAll(component, onEvent);
|
|
81
|
-
</script>
|
|
82
|
-
*/
|
|
83
55
|
export const debuggingScript = `
|
|
84
56
|
const consoleLog = (type, ...log) => window.ReactNativeWebView.postMessage(JSON.stringify({'type': 'Console', 'data': {'type': type, 'log': log}}));
|
|
85
57
|
console = {
|