react-native-payengine 1.0.5 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +193 -111
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/{5.6.4 → 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/compiler.xml +1 -1
- package/android/.idea/gradle.xml +2 -2
- 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 +42 -6
- 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/legacy/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativepayengine/GooglePayModule.java +196 -0
- package/android/src/main/java/com/reactnativepayengine/PayengineModule.java +1 -5
- package/android/src/main/java/com/reactnativepayengine/PayenginePackage.java +8 -33
- package/android/src/main/java/com/reactnativepayengine/util/MetricsUtil.kt +44 -0
- package/android/src/main/java/com/reactnativepayengine/util/PaymentsUtil.java +113 -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 +30 -9
- package/ios/Payengine.xcodeproj/project.xcworkspace/xcuserdata/tringuyen.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Payengine.xcodeproj/xcuserdata/tringuyen.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +4 -4
- 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/CardHolderNameField.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 +73 -8
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/index.js +2 -0
- package/lib/commonjs/interfaces/index.js.map +1 -0
- package/lib/commonjs/utils/index.js +29 -45
- 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 +15 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/index.js +2 -0
- package/lib/module/interfaces/index.js.map +1 -0
- package/lib/module/utils/index.js +20 -45
- 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 +13 -3
- package/lib/typescript/interfaces/index.d.ts +6 -0
- package/lib/typescript/utils/index.d.ts +7 -41
- package/package.json +17 -11
- package/react-native-payengine.podspec +3 -3
- package/src/components/LoadingIndicator.tsx +28 -0
- package/src/components/PayEngine.tsx +8 -0
- 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 +62 -0
- package/src/interfaces/index.ts +6 -0
- package/src/utils/index.ts +79 -0
- package/android/.gradle/5.6.4/fileHashes/fileHashes.lock +0 -0
- package/android/src/main/java/com/reactnativepayengine/collect/VGSCollectModule.java +0 -148
- 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 -55
- package/ios/Payengine.swift +0 -637
- 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.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 -65
- package/lib/commonjs/components/SecureFields/VGS/CollectManager.js.map +0 -1
- package/lib/commonjs/components/SecureFields/VGS/ExpDateField.js +0 -26
- 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/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 -50
- 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/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/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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
package com.reactnativepayengine;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.content.Intent;
|
|
5
|
+
import android.util.Log;
|
|
6
|
+
|
|
7
|
+
import com.facebook.react.bridge.ActivityEventListener;
|
|
8
|
+
import com.facebook.react.bridge.BaseActivityEventListener;
|
|
9
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
11
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
12
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
13
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
14
|
+
import com.facebook.react.bridge.Promise;
|
|
15
|
+
|
|
16
|
+
import com.google.android.gms.wallet.PaymentsClient;
|
|
17
|
+
import com.google.android.gms.wallet.WalletConstants;
|
|
18
|
+
import com.google.android.gms.wallet.IsReadyToPayRequest;
|
|
19
|
+
import com.google.android.gms.wallet.AutoResolveHelper;
|
|
20
|
+
import com.google.android.gms.wallet.PaymentData;
|
|
21
|
+
import com.google.android.gms.wallet.PaymentDataRequest;
|
|
22
|
+
import com.google.android.gms.common.api.Status;
|
|
23
|
+
import com.google.android.gms.tasks.OnCompleteListener;
|
|
24
|
+
import com.google.android.gms.tasks.Task;
|
|
25
|
+
import com.reactnativepayengine.util.PaymentsUtil;
|
|
26
|
+
|
|
27
|
+
import androidx.annotation.NonNull;
|
|
28
|
+
|
|
29
|
+
import java.util.HashMap;
|
|
30
|
+
import java.util.Map;
|
|
31
|
+
|
|
32
|
+
import org.json.JSONException;
|
|
33
|
+
import org.json.JSONObject;
|
|
34
|
+
|
|
35
|
+
public class GooglePayModule extends ReactContextBaseJavaModule {
|
|
36
|
+
|
|
37
|
+
private static final String TAG = "ReactNative";
|
|
38
|
+
|
|
39
|
+
private static final String ENVIRONMENT_PRODUCTION_KEY = "ENVIRONMENT_PRODUCTION";
|
|
40
|
+
|
|
41
|
+
private static final String ENVIRONMENT_TEST_KEY = "ENVIRONMENT_TEST";
|
|
42
|
+
|
|
43
|
+
private final ReactApplicationContext reactContext;
|
|
44
|
+
|
|
45
|
+
private PaymentsClient mPaymentsClient;
|
|
46
|
+
|
|
47
|
+
private Promise requestPaymentPromise = null;
|
|
48
|
+
|
|
49
|
+
private static final int LOAD_PAYMENT_DATA_REQUEST_CODE = 991;
|
|
50
|
+
|
|
51
|
+
private final ActivityEventListener activityEventListener = new BaseActivityEventListener() {
|
|
52
|
+
@Override
|
|
53
|
+
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
|
|
54
|
+
switch (requestCode) {
|
|
55
|
+
// value passed in AutoResolveHelper
|
|
56
|
+
case LOAD_PAYMENT_DATA_REQUEST_CODE:
|
|
57
|
+
switch (resultCode) {
|
|
58
|
+
case Activity.RESULT_OK:
|
|
59
|
+
PaymentData paymentData = PaymentData.getFromIntent(data);
|
|
60
|
+
handlePaymentSuccess(paymentData);
|
|
61
|
+
break;
|
|
62
|
+
case Activity.RESULT_CANCELED:
|
|
63
|
+
requestPaymentPromise.reject("PAYMENT_RESULT_CANCELED", "Payment has been canceled");
|
|
64
|
+
break;
|
|
65
|
+
case AutoResolveHelper.RESULT_ERROR:
|
|
66
|
+
Status status = AutoResolveHelper.getStatusFromIntent(data);
|
|
67
|
+
int statusCode = status.getStatusCode();
|
|
68
|
+
String errorMessage = String.format("loadPaymentData failed. Error code: %d", statusCode);
|
|
69
|
+
Log.w(TAG, "[GooglePay] " + errorMessage);
|
|
70
|
+
requestPaymentPromise.reject("PAYMENT_RESULT_ERROR", errorMessage);
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
// Do nothing.
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
public GooglePayModule(ReactApplicationContext reactContext) {
|
|
81
|
+
super(reactContext);
|
|
82
|
+
this.reactContext = reactContext;
|
|
83
|
+
reactContext.addActivityEventListener(activityEventListener);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
@Override
|
|
87
|
+
public Map<String, Object> getConstants() {
|
|
88
|
+
final Map<String, Object> constants = new HashMap<>();
|
|
89
|
+
constants.put(ENVIRONMENT_PRODUCTION_KEY, WalletConstants.ENVIRONMENT_PRODUCTION);
|
|
90
|
+
constants.put(ENVIRONMENT_TEST_KEY, WalletConstants.ENVIRONMENT_TEST);
|
|
91
|
+
return constants;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@ReactMethod
|
|
95
|
+
public void setEnvironment(int environment) {
|
|
96
|
+
final Activity activity = getCurrentActivity();
|
|
97
|
+
if (activity == null) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
mPaymentsClient = PaymentsUtil.createPaymentsClient(environment, activity);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@ReactMethod
|
|
104
|
+
public void isReadyToPay(ReadableArray allowedCardNetworks, ReadableArray allowedCardAuthMethods, final Promise promise) {
|
|
105
|
+
final Activity activity = getCurrentActivity();
|
|
106
|
+
if (activity == null) {
|
|
107
|
+
Log.w(TAG, "[GooglePay] activity is null");
|
|
108
|
+
promise.resolve(false);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
final JSONObject isReadyToPayJson = PaymentsUtil.getIsReadyToPayRequest(allowedCardNetworks.toArrayList(), allowedCardAuthMethods.toArrayList());
|
|
112
|
+
if (isReadyToPayJson == null) {
|
|
113
|
+
Log.w(TAG, "[GooglePay] isReadyToPayJson == null");
|
|
114
|
+
promise.resolve(false);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
IsReadyToPayRequest request = IsReadyToPayRequest.fromJson(isReadyToPayJson.toString());
|
|
118
|
+
if (request == null) {
|
|
119
|
+
Log.w(TAG, "[GooglePay] IsReadyToPayRequest == null");
|
|
120
|
+
promise.resolve(false);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// The call to isReadyToPay is asynchronous and returns a Task. We need to provide an
|
|
125
|
+
// OnCompleteListener to be triggered when the result of the call is known.
|
|
126
|
+
Task<Boolean> task = mPaymentsClient.isReadyToPay(request);
|
|
127
|
+
task.addOnCompleteListener(activity,
|
|
128
|
+
new OnCompleteListener<Boolean>() {
|
|
129
|
+
@Override
|
|
130
|
+
public void onComplete(@NonNull Task<Boolean> task) {
|
|
131
|
+
if (task.isSuccessful()) {
|
|
132
|
+
if (task.getResult()) {
|
|
133
|
+
promise.resolve(true);
|
|
134
|
+
} else {
|
|
135
|
+
Log.w(TAG, "[GooglePay] Not available");
|
|
136
|
+
promise.resolve(false);
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
Log.w(TAG, "[GooglePay] isReadyToPay failed. May add com.google.android.gms.wallet.api.enabled to your manifest?");
|
|
140
|
+
promise.resolve(false);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@ReactMethod
|
|
147
|
+
public void requestPayment(ReadableMap requestData, final Promise promise) {
|
|
148
|
+
final Activity activity = getCurrentActivity();
|
|
149
|
+
if (activity == null) {
|
|
150
|
+
Log.w(TAG, "[GooglePay] activity is null");
|
|
151
|
+
promise.reject("NO_ACTIVITY", "activity is null");
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
JSONObject paymentDataRequestJson = PaymentsUtil.getPaymentDataRequest(requestData);
|
|
155
|
+
if (paymentDataRequestJson == null) {
|
|
156
|
+
promise.reject("PAYMENT_DATA_REQUEST_JSON", "paymentDataRequestJson is null");
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.requestPaymentPromise = promise;
|
|
161
|
+
|
|
162
|
+
PaymentDataRequest request = PaymentDataRequest.fromJson(paymentDataRequestJson.toString());
|
|
163
|
+
if (request != null) {
|
|
164
|
+
AutoResolveHelper.resolveTask(mPaymentsClient.loadPaymentData(request), activity, LOAD_PAYMENT_DATA_REQUEST_CODE);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private void handlePaymentSuccess(PaymentData paymentData) {
|
|
169
|
+
String paymentInformation = paymentData.toJson();
|
|
170
|
+
|
|
171
|
+
// Token will be null if PaymentDataRequest was not constructed using fromJson(String).
|
|
172
|
+
if (paymentInformation == null) {
|
|
173
|
+
requestPaymentPromise.reject("NULL_PAYMENT_INFORMATION", "paymentInformation is null");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
JSONObject paymentMethodData;
|
|
177
|
+
|
|
178
|
+
try {
|
|
179
|
+
paymentMethodData = new JSONObject(paymentInformation).getJSONObject("paymentMethodData");
|
|
180
|
+
// If the gateway is set to "example", no payment information is returned - instead, the
|
|
181
|
+
// token will only consist of "examplePaymentMethodToken".
|
|
182
|
+
|
|
183
|
+
// Logging token string.
|
|
184
|
+
String token = paymentMethodData.getJSONObject("tokenizationData").getString("token");
|
|
185
|
+
requestPaymentPromise.resolve(token);
|
|
186
|
+
} catch (JSONException e) {
|
|
187
|
+
Log.e(TAG, "[GooglePay] handlePaymentSuccess error: " + e.toString());
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@Override
|
|
193
|
+
public String getName() {
|
|
194
|
+
return "GooglePay";
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -22,12 +22,8 @@ public class PayengineModule extends ReactContextBaseJavaModule {
|
|
|
22
22
|
return NAME;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
// Example method
|
|
27
|
-
// See https://reactnative.dev/docs/native-modules-android
|
|
28
25
|
@ReactMethod
|
|
29
26
|
public void multiply(double a, double b, Promise promise) {
|
|
30
|
-
|
|
27
|
+
promise.resolve(a * b);
|
|
31
28
|
}
|
|
32
|
-
|
|
33
29
|
}
|
|
@@ -6,40 +6,23 @@ import com.facebook.react.ReactPackage;
|
|
|
6
6
|
import com.facebook.react.bridge.NativeModule;
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
8
|
import com.facebook.react.uimanager.ViewManager;
|
|
9
|
-
import com.reactnativepayengine.
|
|
10
|
-
import com.reactnativepayengine.
|
|
11
|
-
import com.reactnativepayengine.
|
|
12
|
-
import com.reactnativepayengine.collect.fields.VGSCardHolderNameField;
|
|
13
|
-
import com.reactnativepayengine.collect.fields.VGSCardNumberField;
|
|
14
|
-
import com.reactnativepayengine.collect.fields.VGSExpDateField;
|
|
15
|
-
import com.reactnativepayengine.collect.fields.VGSTextField;
|
|
16
|
-
import com.reactnativepayengine.collect.fields.VGSZipCodeField;
|
|
17
|
-
import com.verygoodsecurity.vgscollect.view.InputFieldView;
|
|
9
|
+
import com.reactnativepayengine.v2.RNPayEngineNative;
|
|
10
|
+
import com.reactnativepayengine.v2.securefields.bankaccount.RNPEBankAccountViewManager;
|
|
11
|
+
import com.reactnativepayengine.v2.securefields.creditcard.RNPECreditCardViewManager;
|
|
18
12
|
|
|
19
13
|
import java.util.ArrayList;
|
|
20
14
|
import java.util.List;
|
|
21
15
|
|
|
22
|
-
public class PayenginePackage implements ReactPackage
|
|
23
|
-
|
|
24
|
-
private VGSCollectModule module;
|
|
25
|
-
|
|
26
|
-
public VGSCollectOnCreateViewInstanceListener getListener() {
|
|
27
|
-
return this;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public VGSCollectModule getVGSCollectModule() {
|
|
31
|
-
return module;
|
|
32
|
-
}
|
|
33
|
-
|
|
16
|
+
public class PayenginePackage implements ReactPackage {
|
|
34
17
|
|
|
35
18
|
@NonNull
|
|
36
19
|
@Override
|
|
37
20
|
public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
|
|
38
|
-
module = new VGSCollectModule(reactContext);
|
|
39
21
|
|
|
40
22
|
List<NativeModule> modules = new ArrayList<>();
|
|
23
|
+
modules.add(new RNPayEngineNative(reactContext));
|
|
41
24
|
modules.add(new PayengineModule(reactContext));
|
|
42
|
-
modules.add(
|
|
25
|
+
modules.add(new GooglePayModule(reactContext));
|
|
43
26
|
|
|
44
27
|
return modules;
|
|
45
28
|
}
|
|
@@ -48,17 +31,9 @@ public class PayenginePackage implements ReactPackage, VGSCollectOnCreateViewIns
|
|
|
48
31
|
@Override
|
|
49
32
|
public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
|
|
50
33
|
List<ViewManager> views = new ArrayList<>();
|
|
51
|
-
views.add(new
|
|
52
|
-
views.add(new
|
|
53
|
-
views.add(new VGSCardHolderNameField(this, reactContext));
|
|
54
|
-
views.add(new VGSCVCField(this, reactContext));
|
|
55
|
-
views.add(new VGSZipCodeField(this, reactContext));
|
|
56
|
-
views.add(new VGSTextField(this, reactContext));
|
|
34
|
+
views.add(new RNPECreditCardViewManager(reactContext));
|
|
35
|
+
views.add(new RNPEBankAccountViewManager(reactContext));
|
|
57
36
|
return views;
|
|
58
37
|
}
|
|
59
38
|
|
|
60
|
-
@Override
|
|
61
|
-
public void onCreateViewInstance(InputFieldView inputFieldView) {
|
|
62
|
-
module.bindView(inputFieldView);
|
|
63
|
-
}
|
|
64
39
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.reactnativepayengine.util
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.content.res.Resources
|
|
5
|
+
import android.util.DisplayMetrics
|
|
6
|
+
|
|
7
|
+
object MetricsUtil {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* This method converts dp unit to equivalent pixels, depending on device density.
|
|
11
|
+
* @param dp A value in dp (density independent pixels) unit. Which we need to convert into pixels
|
|
12
|
+
* @param context Context to get resources and device specific display metrics. If you don't have
|
|
13
|
+
* access to Context, just pass null.
|
|
14
|
+
* @return A float value to represent px equivalent to dp depending on device density
|
|
15
|
+
*/
|
|
16
|
+
fun convertDpToPixel(dp: Float, context: Context?): Float {
|
|
17
|
+
return if (context != null) {
|
|
18
|
+
val resources = context.resources
|
|
19
|
+
val metrics = resources.displayMetrics
|
|
20
|
+
dp * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
|
|
21
|
+
} else {
|
|
22
|
+
val metrics = Resources.getSystem().displayMetrics
|
|
23
|
+
dp * (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This method converts device specific pixels to density independent pixels.
|
|
29
|
+
* @param px A value in px (pixels) unit. Which we need to convert into db
|
|
30
|
+
* @param context Context to get resources and device specific display metrics. If you don't have
|
|
31
|
+
* access to Context, just pass null.
|
|
32
|
+
* @return A float value to represent dp equivalent to px value
|
|
33
|
+
*/
|
|
34
|
+
fun convertPixelsToDp(px: Float, context: Context?): Float {
|
|
35
|
+
return if (context != null) {
|
|
36
|
+
val resources = context.resources
|
|
37
|
+
val metrics = resources.displayMetrics
|
|
38
|
+
px / (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
|
|
39
|
+
} else {
|
|
40
|
+
val metrics = Resources.getSystem().displayMetrics
|
|
41
|
+
px / (metrics.densityDpi.toFloat() / DisplayMetrics.DENSITY_DEFAULT)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
package com.reactnativepayengine.util;
|
|
2
|
+
import android.app.Activity;
|
|
3
|
+
|
|
4
|
+
import com.google.android.gms.wallet.PaymentsClient;
|
|
5
|
+
import com.google.android.gms.wallet.Wallet;
|
|
6
|
+
|
|
7
|
+
import org.json.JSONArray;
|
|
8
|
+
import org.json.JSONException;
|
|
9
|
+
import org.json.JSONObject;
|
|
10
|
+
|
|
11
|
+
import java.util.ArrayList;
|
|
12
|
+
|
|
13
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
14
|
+
|
|
15
|
+
public class PaymentsUtil {
|
|
16
|
+
|
|
17
|
+
private PaymentsUtil() {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private static JSONObject getBaseRequest() throws JSONException {
|
|
21
|
+
return new JSONObject().put("apiVersion", 2).put("apiVersionMinor", 0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
private static JSONObject getBaseCardPaymentMethod(ArrayList allowedCardNetworks, ArrayList allowedCardAuthMethods) throws JSONException {
|
|
25
|
+
JSONObject cardPaymentMethod = new JSONObject();
|
|
26
|
+
cardPaymentMethod.put("type", "CARD");
|
|
27
|
+
|
|
28
|
+
JSONObject parameters = new JSONObject();
|
|
29
|
+
parameters.put("allowedAuthMethods", new JSONArray(allowedCardAuthMethods));
|
|
30
|
+
parameters.put("allowedCardNetworks", new JSONArray(allowedCardNetworks));
|
|
31
|
+
|
|
32
|
+
cardPaymentMethod.put("parameters", parameters);
|
|
33
|
+
|
|
34
|
+
return cardPaymentMethod;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public static PaymentsClient createPaymentsClient(int environment, Activity activity) {
|
|
38
|
+
Wallet.WalletOptions walletOptions = new Wallet.WalletOptions.Builder().setEnvironment(environment).build();
|
|
39
|
+
return Wallet.getPaymentsClient(activity, walletOptions);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public static JSONObject getIsReadyToPayRequest(ArrayList allowedCardNetworks, ArrayList allowedCardAuthMethods) {
|
|
43
|
+
try {
|
|
44
|
+
JSONObject isReadyToPayRequest = getBaseRequest();
|
|
45
|
+
JSONArray allowedPaymentMethods = new JSONArray().put(getBaseCardPaymentMethod(allowedCardNetworks, allowedCardAuthMethods));
|
|
46
|
+
isReadyToPayRequest.put("allowedPaymentMethods", allowedPaymentMethods);
|
|
47
|
+
return isReadyToPayRequest;
|
|
48
|
+
} catch (JSONException e) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private static JSONObject getTransactionInfo(ReadableMap transaction) throws JSONException {
|
|
54
|
+
JSONObject transactionInfo = new JSONObject();
|
|
55
|
+
transactionInfo.put("totalPrice", transaction.getString("totalPrice"));
|
|
56
|
+
transactionInfo.put("totalPriceStatus", transaction.getString("totalPriceStatus"));
|
|
57
|
+
transactionInfo.put("currencyCode", transaction.getString("currencyCode"));
|
|
58
|
+
|
|
59
|
+
return transactionInfo;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private static JSONObject getMerchantInfo(String merchantName) throws JSONException {
|
|
63
|
+
return new JSONObject().put("merchantName", merchantName);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private static JSONObject getTokenizationSpecification(final ReadableMap tokenizationSpecification) throws JSONException {
|
|
67
|
+
return new JSONObject() {{
|
|
68
|
+
put("type", tokenizationSpecification.getString("type"));
|
|
69
|
+
put("parameters", new JSONObject() {
|
|
70
|
+
{
|
|
71
|
+
if (tokenizationSpecification.hasKey("gateway")) {
|
|
72
|
+
put("gateway", tokenizationSpecification.getString("gateway"));
|
|
73
|
+
}
|
|
74
|
+
if (tokenizationSpecification.hasKey("gatewayMerchantId")) {
|
|
75
|
+
put("gatewayMerchantId", tokenizationSpecification.getString("gatewayMerchantId"));
|
|
76
|
+
}
|
|
77
|
+
if (tokenizationSpecification.hasKey("publicKey")) {
|
|
78
|
+
put("protocolVersion", "ECv2");
|
|
79
|
+
put("publicKey", tokenizationSpecification.getString("publicKey"));
|
|
80
|
+
}
|
|
81
|
+
if (tokenizationSpecification.hasKey("stripe")) {
|
|
82
|
+
final ReadableMap stripe = tokenizationSpecification.getMap("stripe");
|
|
83
|
+
put("stripe:publishableKey", stripe.getString("publishableKey"));
|
|
84
|
+
put("stripe:version", stripe.getString("version"));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private static JSONObject getCardPaymentMethod(ReadableMap cardPaymentMethodData) throws JSONException {
|
|
92
|
+
ArrayList allowedCardNetworks = cardPaymentMethodData.getArray("allowedCardNetworks").toArrayList();
|
|
93
|
+
ArrayList allowedCardAuthMethods = cardPaymentMethodData.getArray("allowedCardAuthMethods").toArrayList();
|
|
94
|
+
JSONObject cardPaymentMethod = getBaseCardPaymentMethod(allowedCardNetworks, allowedCardAuthMethods);
|
|
95
|
+
cardPaymentMethod.put("tokenizationSpecification", getTokenizationSpecification(cardPaymentMethodData.getMap("tokenizationSpecification")));
|
|
96
|
+
|
|
97
|
+
return cardPaymentMethod;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public static JSONObject getPaymentDataRequest(ReadableMap requestData) {
|
|
101
|
+
try {
|
|
102
|
+
JSONObject paymentDataRequest = PaymentsUtil.getBaseRequest();
|
|
103
|
+
paymentDataRequest.put(
|
|
104
|
+
"allowedPaymentMethods", new JSONArray().put(PaymentsUtil.getCardPaymentMethod(requestData.getMap("cardPaymentMethod"))));
|
|
105
|
+
paymentDataRequest.put("transactionInfo", PaymentsUtil.getTransactionInfo(requestData.getMap("transaction")));
|
|
106
|
+
paymentDataRequest.put("merchantInfo", PaymentsUtil.getMerchantInfo(requestData.getString("merchantName")));
|
|
107
|
+
|
|
108
|
+
return paymentDataRequest;
|
|
109
|
+
} catch (JSONException e) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
package com.reactnativepayengine.v2;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.app.Application;
|
|
5
|
+
import android.os.Bundle;
|
|
6
|
+
|
|
7
|
+
import androidx.annotation.NonNull;
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
|
|
10
|
+
import com.kount.api.analytics.AnalyticsApplication;
|
|
11
|
+
import com.kount.api.analytics.enums.EventEnums;
|
|
12
|
+
|
|
13
|
+
public class RNPEFraudAnalyticsApplication extends Application implements Application.ActivityLifecycleCallbacks {
|
|
14
|
+
@Override
|
|
15
|
+
public void onCreate() {
|
|
16
|
+
AnalyticsApplication.init();
|
|
17
|
+
registerActivityLifecycleCallbacks(this);
|
|
18
|
+
super.onCreate();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@Override
|
|
22
|
+
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle savedInstanceState) {
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@Override
|
|
27
|
+
public void onActivityStarted(@NonNull Activity activity) {
|
|
28
|
+
AnalyticsApplication.registerKountEvents(EventEnums.EVENT_STARTED, activity);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Override
|
|
32
|
+
public void onActivityResumed(@NonNull Activity activity) {
|
|
33
|
+
AnalyticsApplication.registerKountEvents(EventEnums.EVENT_RESUMED, activity);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@Override
|
|
37
|
+
public void onActivityPaused(@NonNull Activity activity) {
|
|
38
|
+
AnalyticsApplication.registerKountEvents(EventEnums.EVENT_PAUSED, activity);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@Override
|
|
42
|
+
public void onActivityStopped(@NonNull Activity activity) {
|
|
43
|
+
AnalyticsApplication.registerKountEvents(EventEnums.EVENT_STOPPED, activity);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@Override
|
|
47
|
+
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle outState) {
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Override
|
|
52
|
+
public void onActivityDestroyed(@NonNull Activity activity) {
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
package com.reactnativepayengine.v2
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import com.facebook.react.bridge.Promise
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
8
|
+
import com.facebook.react.bridge.ReactMethod
|
|
9
|
+
import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
|
|
10
|
+
import com.payengine.paymentsdk.PayEngine
|
|
11
|
+
import com.payengine.paymentsdk.models.PEConfig
|
|
12
|
+
import kotlin.concurrent.thread
|
|
13
|
+
|
|
14
|
+
class RNPayEngineNative: ReactContextBaseJavaModule {
|
|
15
|
+
|
|
16
|
+
constructor(context: ReactApplicationContext): super(context) {
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
override fun getName(): String {
|
|
21
|
+
return "RNPayEngineNative"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@ReactMethod
|
|
25
|
+
fun setConfig(publicKey: String, baseURL: String?) {
|
|
26
|
+
Log.d("PayEngine", "setConfig is called $publicKey $baseURL")
|
|
27
|
+
val config = PEConfig(publicKey, baseURL)
|
|
28
|
+
instance = PayEngine(config)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@ReactMethod
|
|
32
|
+
fun createFraudMonitorSession(merchantId: String, promise: Promise) {
|
|
33
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
34
|
+
if (currentActivity == null) {
|
|
35
|
+
promise.reject("NO_ACTIVITY", "No activity found")
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
val sessionId = instance?.createFraudMonitorSession(currentActivity, merchantId) { sessionId ->
|
|
41
|
+
if (sessionId != null) {
|
|
42
|
+
promise.resolve(sessionId)
|
|
43
|
+
} else {
|
|
44
|
+
promise.reject("NO_SESSION", "No session found")
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@ReactMethod
|
|
50
|
+
fun getBrowserInfo(promise: Promise) {
|
|
51
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
52
|
+
if (currentActivity == null) {
|
|
53
|
+
promise.reject("NO_ACTIVITY", "No activity found")
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
runOnUiThread {
|
|
58
|
+
instance?.getBrowserInfo(currentActivity) { browserInfo ->
|
|
59
|
+
if (browserInfo != null) {
|
|
60
|
+
promise.resolve(browserInfo)
|
|
61
|
+
} else {
|
|
62
|
+
promise.reject("NO_BROWSER_INFO", "No browser info found")
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
companion object {
|
|
69
|
+
var instance: PayEngine? = null
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
package com.reactnativepayengine.v2.securefields
|
|
2
|
+
|
|
3
|
+
import com.payengine.paymentsdk.models.PEField
|
|
4
|
+
import com.payengine.paymentsdk.models.PEKeyboardType
|
|
5
|
+
|
|
6
|
+
data class RNPEField(val name: String, val type: String, val placeholder: String, val keyboardType: String, val isRequired: Boolean, val pattern: String?) {
|
|
7
|
+
|
|
8
|
+
fun toNative(): PEField {
|
|
9
|
+
val nativeKeyboardType = when (keyboardType) {
|
|
10
|
+
"number" -> PEKeyboardType.NUMBER
|
|
11
|
+
"alphabet" -> PEKeyboardType.ALPHABET
|
|
12
|
+
"phone" -> PEKeyboardType.PHONE
|
|
13
|
+
else -> PEKeyboardType.NORMAL
|
|
14
|
+
}
|
|
15
|
+
return PEField(name, type, placeholder, isRequired, nativeKeyboardType, pattern)
|
|
16
|
+
}
|
|
17
|
+
}
|