react-native-payengine 1.0.6 → 2.0.4
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 +269 -110
- 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 +329 -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 +25 -4
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/payment-sdk-debug-1.0.2.aar +0 -0
- package/android/payment-sdk-release-1.0.2.aar +0 -0
- package/android/src/main/java/com/reactnativepayengine/PayengineModule.java +1 -5
- package/android/src/main/java/com/reactnativepayengine/PayenginePackage.java +9 -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 +73 -0
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButton.kt +105 -0
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButtonManager.kt +56 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +11 -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/v2/ApplePay/PEApplePayButton.js +55 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +70 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -0
- package/lib/commonjs/components/v2/PEPaymentRequest.js +32 -0
- package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -0
- package/lib/commonjs/components/v2/PayEngineNative.js +36 -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 +62 -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 +41 -0
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +56 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -0
- package/lib/module/components/v2/PEPaymentRequest.js +23 -0
- package/lib/module/components/v2/PEPaymentRequest.js.map +1 -0
- package/lib/module/components/v2/PayEngineNative.js +25 -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 +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/GooglePay/PEGooglePayButton.d.ts +12 -0
- package/lib/typescript/components/v2/PEPaymentRequest.d.ts +13 -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 -6
- package/lib/typescript/interfaces/index.d.ts +0 -27
- package/lib/typescript/utils/index.d.ts +3 -36
- package/package.json +11 -6
- package/react-native-payengine.podspec +2 -2
- package/src/components/PayEngine.tsx +5 -118
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +74 -0
- package/src/components/v2/GooglePay/PEGooglePayButton.tsx +73 -0
- package/src/components/v2/PEPaymentRequest.ts +20 -0
- package/src/components/v2/PayEngineNative.tsx +22 -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 +49 -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 +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/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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNPEApplePayButton.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 6/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PayEngineSDK
|
|
10
|
+
|
|
11
|
+
@objc(RNPEApplePayButton)
|
|
12
|
+
class RNPEApplePayButton: UIView {
|
|
13
|
+
|
|
14
|
+
@objc var onPmSheetDidDismiss: RCTBubblingEventBlock?
|
|
15
|
+
@objc var onPmTokenDidReturn: RCTBubblingEventBlock?
|
|
16
|
+
@objc var onPmError: RCTBubblingEventBlock?
|
|
17
|
+
|
|
18
|
+
private var _button: UIButton?
|
|
19
|
+
|
|
20
|
+
override init(frame: CGRect) {
|
|
21
|
+
super.init(frame: frame)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
required init?(coder: NSCoder) {
|
|
25
|
+
super.init(coder: coder)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
override func layoutSubviews() {
|
|
29
|
+
self._button?.frame = self.bounds
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@objc var paymentRequest: String? = "" {
|
|
34
|
+
didSet {
|
|
35
|
+
setupView()
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private func setupView() {
|
|
40
|
+
guard let paymentRequest = self.paymentRequest else {
|
|
41
|
+
debugPrint("Unable to render apple pay button: Missing payment request")
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if let paymentRequest: RNPEApplePayPaymentRequest = try? JSONDecoder().decode(RNPEApplePayPaymentRequest.self, from: paymentRequest.data(using: .utf8)!) {
|
|
46
|
+
let pePaymentRequest = paymentRequest.toNative()
|
|
47
|
+
if let applepay = RNPayEngineNative.applePayInstance {
|
|
48
|
+
applepay.delegate = self
|
|
49
|
+
DispatchQueue.main.async {
|
|
50
|
+
if let button = applepay.setupApplePayButton(for: pePaymentRequest, type: .checkout) {
|
|
51
|
+
self._button = button
|
|
52
|
+
self._button!.layer.masksToBounds = true
|
|
53
|
+
self.addSubview(self._button!)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
debugPrint("Invalid payment request. Please try again")
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
extension RNPEApplePayButton: PEApplePayDelegate {
|
|
65
|
+
|
|
66
|
+
func paymentError(error: Error) {
|
|
67
|
+
debugPrint("payment error \(error)")
|
|
68
|
+
if self.onPmError != nil {
|
|
69
|
+
self.onPmError!(["error": error.localizedDescription])
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
func paymentSheetDidMDismiss() {
|
|
74
|
+
if self.onPmSheetDidDismiss != nil {
|
|
75
|
+
self.onPmSheetDidDismiss!(["token": "null"])
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
func paymentTokenDidReturn(token: String, completion: @escaping (PayEngineSDK.PEApplePayResult) -> Void) {
|
|
80
|
+
debugPrint("Token returned \(token)")
|
|
81
|
+
if self.onPmTokenDidReturn != nil {
|
|
82
|
+
self.onPmTokenDidReturn!(["token": token])
|
|
83
|
+
}
|
|
84
|
+
completion(.success)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
func paymentTokenNotAvailable() {
|
|
88
|
+
debugPrint("paymentTokenNotAvailable")
|
|
89
|
+
if self.onPmError != nil {
|
|
90
|
+
self.onPmError!(["error": "Payment token not available"])
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@objc(RNPEApplePayButtonManager)
|
|
99
|
+
class RNPEApplePayButtonManager: RCTViewManager {
|
|
100
|
+
|
|
101
|
+
var _view = RNPEApplePayButton()
|
|
102
|
+
|
|
103
|
+
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
104
|
+
return true
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
override func view() -> UIView! {
|
|
108
|
+
return _view
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RNPEApplePayPaymentRequest.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 6/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PassKit
|
|
10
|
+
import PayEngineSDK
|
|
11
|
+
|
|
12
|
+
public struct RNPEApplePayPaymentRequest: Codable {
|
|
13
|
+
var paymentAmount: Double
|
|
14
|
+
var currencyCode: String = "USD"
|
|
15
|
+
var paymentItems: [RNPEApplePayPaymentSummaryItem]
|
|
16
|
+
|
|
17
|
+
init(paymentAmount: Double, currencyCode: String, paymentItems: [RNPEApplePayPaymentSummaryItem]) {
|
|
18
|
+
self.paymentAmount = paymentAmount
|
|
19
|
+
self.currencyCode = currencyCode
|
|
20
|
+
self.paymentItems = paymentItems
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func toNative() -> ApplePayPaymentRequest {
|
|
24
|
+
let request = ApplePayPaymentRequest()
|
|
25
|
+
request.build(paymentItems: self.paymentItems.map { $0.toNative() }, paymentAmount: self.paymentAmount, currencyCode: self.currencyCode)
|
|
26
|
+
return request
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public struct RNPEApplePayPaymentSummaryItem: Codable {
|
|
31
|
+
var amount: Double
|
|
32
|
+
var label: String
|
|
33
|
+
|
|
34
|
+
init(amount: Double, label: String) {
|
|
35
|
+
self.amount = amount
|
|
36
|
+
self.label = label
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
func toNative() -> PKPaymentSummaryItem {
|
|
40
|
+
return PKPaymentSummaryItem(label: self.label, amount: NSDecimalNumber(value: self.amount))
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PEEventEmitter.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 5/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import React
|
|
10
|
+
|
|
11
|
+
@objc(RNPEEventEmitter)
|
|
12
|
+
open class RNPEEventEmitter:RCTEventEmitter{
|
|
13
|
+
|
|
14
|
+
public static var emitter: RNPEEventEmitter! // global variable
|
|
15
|
+
|
|
16
|
+
// constructor
|
|
17
|
+
override init(){
|
|
18
|
+
super.init()
|
|
19
|
+
RNPEEventEmitter.emitter = self
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
open override func supportedEvents() -> [String] {
|
|
23
|
+
["onReady", "onSizeChanges", "onCardRespond", "onBankAccountRespond"]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@objc public override static func requiresMainQueueSetup() -> Bool {
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Utils.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 5/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PayEngineSDK
|
|
10
|
+
import React
|
|
11
|
+
import SwiftUI
|
|
12
|
+
class RNPEUtils {
|
|
13
|
+
|
|
14
|
+
public static func createSecureFieldsAuthHeader(publicKey: String) -> String {
|
|
15
|
+
return #"Signature key="\#(publicKey)",algorithm="hmac-sha256",identifier="secure-fields",signature="""#
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public static func mapKeyboardType(keyboardType: String) -> PEKeyboardType {
|
|
19
|
+
switch (keyboardType) {
|
|
20
|
+
case "number":
|
|
21
|
+
return .number
|
|
22
|
+
case "alphabet":
|
|
23
|
+
return .alphabet
|
|
24
|
+
case "phone":
|
|
25
|
+
return .phone
|
|
26
|
+
default:
|
|
27
|
+
return .normal
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PayEngineNative.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 5/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PayEngineSDK
|
|
10
|
+
|
|
11
|
+
@objc(RNPayEngineNative)
|
|
12
|
+
class RNPayEngineNative: NSObject {
|
|
13
|
+
static var instance: PayEngine?
|
|
14
|
+
|
|
15
|
+
static var applePayInstance: PEApplePay?
|
|
16
|
+
|
|
17
|
+
@objc(setConfig:baseURL:)
|
|
18
|
+
func setConfig(_ publicKey: String, baseURL: String?) {
|
|
19
|
+
let config = PEConfig(publicKey: publicKey, baseURL: baseURL)
|
|
20
|
+
RNPayEngineNative.instance = PayEngine(config: config)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
func getInstance() throws -> PayEngine {
|
|
24
|
+
guard let instance = RNPayEngineNative.instance else {
|
|
25
|
+
throw RNPEError.common("Configuration is not set")
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return instance
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@objc(createFraudMonitorSession:resolver:rejecter:)
|
|
32
|
+
func createFraudMonitorSession(merchantId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
33
|
+
do {
|
|
34
|
+
let payengine = try self.getInstance()
|
|
35
|
+
payengine.createFraudMonitorSession(merchantId) { fraudResult in
|
|
36
|
+
switch fraudResult {
|
|
37
|
+
case .success(let sessionId):
|
|
38
|
+
return resolve(sessionId)
|
|
39
|
+
case .failure(let error):
|
|
40
|
+
return reject("error", "Unable to obtain session ID", error)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
} catch {
|
|
44
|
+
return reject("error", error.localizedDescription, error)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@objc(getBrowserInfo:rejecter:)
|
|
49
|
+
func getBrowserInfo(resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
50
|
+
DispatchQueue.main.async {
|
|
51
|
+
do {
|
|
52
|
+
// get current root view from react native
|
|
53
|
+
if let rootView = UIApplication.shared.keyWindow?.rootViewController?.view {
|
|
54
|
+
let payengine = try self.getInstance()
|
|
55
|
+
payengine.getBrowserInfo(view: rootView) { browserInfo in
|
|
56
|
+
return resolve(browserInfo)
|
|
57
|
+
}
|
|
58
|
+
} else {
|
|
59
|
+
return reject("error", "Unable to find current root view", nil)
|
|
60
|
+
}
|
|
61
|
+
} catch {
|
|
62
|
+
return reject("error", error.localizedDescription, error)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@objc(isApplePaySupported:resolver:rejecter:)
|
|
68
|
+
func isApplePaySupported(merchantId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
69
|
+
do {
|
|
70
|
+
let payengine = try self.getInstance()
|
|
71
|
+
payengine.setupApplePay(merchantId: merchantId) { result in
|
|
72
|
+
switch result {
|
|
73
|
+
case .success(let applepay):
|
|
74
|
+
RNPayEngineNative.applePayInstance = applepay
|
|
75
|
+
return resolve(true)
|
|
76
|
+
case .failure(let error):
|
|
77
|
+
return reject("error", error.localizedDescription, error)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
} catch {
|
|
81
|
+
return reject("error", error.localizedDescription, error)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
//
|
|
2
|
+
// BankAccountView.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 6/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PayEngineSDK
|
|
10
|
+
|
|
11
|
+
class RNPEBankAccountView: UIView {
|
|
12
|
+
var view: IBankAccountView?
|
|
13
|
+
|
|
14
|
+
override init(frame: CGRect) {
|
|
15
|
+
super.init(frame: frame)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
required init?(coder: NSCoder) {
|
|
19
|
+
super.init(coder: coder)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc var additionalFields: String = "" {
|
|
23
|
+
didSet {
|
|
24
|
+
setupView()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private func setupView() {
|
|
29
|
+
// debugPrint("PayEngine instance \(String(describing: PayEngineNative.instance))")
|
|
30
|
+
// let zipField = PEField(name: "address_zip", type: "text", placeholder: "Zip code", isRequired: true, keyboardType: .alphabet, pattern: #"^(?:\d{5}(?:-\d{4})?|[ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d)$"#)
|
|
31
|
+
|
|
32
|
+
var customFields: [PEField] = []
|
|
33
|
+
if let fields: [RNPEField] = try? JSONDecoder().decode([RNPEField].self, from: additionalFields.data(using: .utf8)!) {
|
|
34
|
+
if (fields.count > 0) {
|
|
35
|
+
for i in 0...fields.count - 1 {
|
|
36
|
+
let f = fields[i]
|
|
37
|
+
let field = PEField(name: f.name, type: f.type, placeholder: f.placeholder, isRequired: f.isRequired, keyboardType: RNPEUtils.mapKeyboardType(keyboardType: f.keyboardType), pattern: f.pattern)
|
|
38
|
+
customFields.append(field)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
debugPrint("Could not parse additional fields \(additionalFields)")
|
|
43
|
+
}
|
|
44
|
+
RNPayEngineNative.instance?.createBankAccountView(additionalFields: customFields) { [unowned self] result in
|
|
45
|
+
switch result {
|
|
46
|
+
case .success(let view):
|
|
47
|
+
self.view = view
|
|
48
|
+
self.view!.detectSizeChanges { size in
|
|
49
|
+
// self.frame.size = size
|
|
50
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_SIZE_CHANGES, body: ["width": size.width, "height": size.height])
|
|
51
|
+
debugPrint("Could not parse additional fields \(self.additionalFields)")
|
|
52
|
+
}
|
|
53
|
+
self.addSubview(self.view!)
|
|
54
|
+
case .failure(let error):
|
|
55
|
+
debugPrint("Error: \(error)")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
func submit(_ merchantId: String, additionalData: NSDictionary) {
|
|
62
|
+
guard let view = self.view else {
|
|
63
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["error": "View is not ready"])
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
DispatchQueue.main.async {
|
|
67
|
+
view.createBankAccount(merchantId: merchantId, additionalData: additionalData as! [String : Any]) { result in
|
|
68
|
+
switch result {
|
|
69
|
+
case .success(let bankAccount):
|
|
70
|
+
debugPrint("Bank account created \(bankAccount)")
|
|
71
|
+
if let json = try? JSONEncoder().encode(bankAccount) {
|
|
72
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["bankAccount": String(decoding: json, as: UTF8.self)])
|
|
73
|
+
} else {
|
|
74
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["error": "Unable to encode bank account object"])
|
|
75
|
+
}
|
|
76
|
+
case .failure(let error):
|
|
77
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_BANK_ACCOUNT_RESPOND, body: ["error": error.localizedDescription])
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
func hideKeyboard() {
|
|
84
|
+
view?.hideKeyboard()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
func showKeyboard() {
|
|
88
|
+
view?.showKeyboard()
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@objc(RNPEBankAccountView)
|
|
93
|
+
class RNPEBankAccountViewManager: RCTViewManager {
|
|
94
|
+
|
|
95
|
+
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
96
|
+
return true
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
override func view() -> UIView! {
|
|
100
|
+
return RNPEBankAccountView()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
override func constantsToExport() -> [AnyHashable : Any]! {
|
|
104
|
+
return [:]
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@objc(submit:merchantId:additionalData:)
|
|
108
|
+
func submit(_ node: NSNumber, merchantId: String, additionalData: NSDictionary) {
|
|
109
|
+
DispatchQueue.main.async {
|
|
110
|
+
let component = self.bridge.uiManager.view(forReactTag: node) as! RNPEBankAccountView
|
|
111
|
+
component.submit(merchantId, additionalData: additionalData)
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@objc
|
|
116
|
+
func hideKeyboard(_ node: NSNumber) {
|
|
117
|
+
DispatchQueue.main.async {
|
|
118
|
+
let component = self.bridge.uiManager.view(forReactTag: node) as! RNPEBankAccountView
|
|
119
|
+
component.hideKeyboard()
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@objc
|
|
124
|
+
func showKeyboard(_ node: NSNumber) {
|
|
125
|
+
DispatchQueue.main.async {
|
|
126
|
+
let component = self.bridge.uiManager.view(forReactTag: node) as! RNPEBankAccountView
|
|
127
|
+
component.showKeyboard()
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CreditCardView.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 6/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PayEngineSDK
|
|
10
|
+
|
|
11
|
+
class RNPECreditCardView: UIView {
|
|
12
|
+
var view: ICardNumberView?
|
|
13
|
+
|
|
14
|
+
override init(frame: CGRect) {
|
|
15
|
+
super.init(frame: frame)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
required init?(coder: NSCoder) {
|
|
19
|
+
super.init(coder: coder)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@objc var additionalFields: String = "" {
|
|
23
|
+
didSet {
|
|
24
|
+
setupView()
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
private func setupView() {
|
|
29
|
+
// debugPrint("PayEngine instance \(String(describing: PayEngineNative.instance))")
|
|
30
|
+
// let zipField = PEField(name: "address_zip", type: "text", placeholder: "Zip code", isRequired: true, keyboardType: .alphabet, pattern: #"^(?:\d{5}(?:-\d{4})?|[ABCEGHJKLMNPRSTVXY]\d[A-Z] ?\d[A-Z]\d)$"#)
|
|
31
|
+
|
|
32
|
+
var customFields: [PEField] = []
|
|
33
|
+
if let fields: [RNPEField] = try? JSONDecoder().decode([RNPEField].self, from: additionalFields.data(using: .utf8)!) {
|
|
34
|
+
if (fields.count > 0) {
|
|
35
|
+
for i in 0...fields.count - 1 {
|
|
36
|
+
let f = fields[i]
|
|
37
|
+
let field = PEField(name: f.name, type: f.type, placeholder: f.placeholder, isRequired: f.isRequired, keyboardType: RNPEUtils.mapKeyboardType(keyboardType: f.keyboardType), pattern: f.pattern)
|
|
38
|
+
customFields.append(field)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
debugPrint("Could not parse additional fields \(additionalFields)")
|
|
43
|
+
}
|
|
44
|
+
RNPayEngineNative.instance?.createSecureView(additionalFields: customFields) { [unowned self] result in
|
|
45
|
+
switch result {
|
|
46
|
+
case .success(let view):
|
|
47
|
+
self.view = view
|
|
48
|
+
self.view!.detectSizeChanges { size in
|
|
49
|
+
// self.frame.size = size
|
|
50
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_SIZE_CHANGES, body: ["width": size.width, "height": size.height])
|
|
51
|
+
debugPrint("Could not parse additional fields \(self.additionalFields)")
|
|
52
|
+
}
|
|
53
|
+
self.addSubview(self.view!)
|
|
54
|
+
case .failure(let error):
|
|
55
|
+
debugPrint("Error: \(error)")
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
func submit(_ merchantId: String, additionalData: NSDictionary) {
|
|
61
|
+
guard let view = self.view else {
|
|
62
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["error": "View is not ready"])
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
DispatchQueue.main.async {
|
|
66
|
+
view.createCard(merchantId: merchantId, additionalData: additionalData as! [String : Any]) { result in
|
|
67
|
+
switch result {
|
|
68
|
+
case .success(let card):
|
|
69
|
+
debugPrint("Card created \(card)")
|
|
70
|
+
if let json = try? JSONEncoder().encode(card) {
|
|
71
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["card": String(decoding: json, as: UTF8.self)])
|
|
72
|
+
} else {
|
|
73
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["error": "Unable to encode card object"])
|
|
74
|
+
}
|
|
75
|
+
case .failure(let error):
|
|
76
|
+
RNPEEventEmitter.emitter.sendEvent(withName: RNPEEvents.EVENT_CARD_RESPOND, body: ["error": error.localizedDescription])
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
func hideKeyboard() {
|
|
83
|
+
view?.hideKeyboard()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
func showKeyboard() {
|
|
87
|
+
view?.showKeyboard()
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@objc(RNPECreditCardView)
|
|
92
|
+
class RNPECreditCardViewManager: RCTViewManager {
|
|
93
|
+
|
|
94
|
+
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
95
|
+
return true
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
override func view() -> UIView! {
|
|
99
|
+
return RNPECreditCardView()
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
override func constantsToExport() -> [AnyHashable : Any]! {
|
|
103
|
+
return [:]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@objc(submit:merchantId:additionalData:)
|
|
107
|
+
func submit(_ node: NSNumber, merchantId: String, additionalData: NSDictionary) {
|
|
108
|
+
DispatchQueue.main.async {
|
|
109
|
+
let component = self.bridge.uiManager.view(forReactTag: node) as! RNPECreditCardView
|
|
110
|
+
component.submit(merchantId, additionalData: additionalData)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
@objc
|
|
115
|
+
func hideKeyboard(_ node: NSNumber) {
|
|
116
|
+
DispatchQueue.main.async {
|
|
117
|
+
let component = self.bridge.uiManager.view(forReactTag: node) as! RNPECreditCardView
|
|
118
|
+
component.hideKeyboard()
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@objc
|
|
123
|
+
func showKeyboard(_ node: NSNumber) {
|
|
124
|
+
DispatchQueue.main.async {
|
|
125
|
+
let component = self.bridge.uiManager.view(forReactTag: node) as! RNPECreditCardView
|
|
126
|
+
component.showKeyboard()
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Events.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 11/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
class RNPEEvents {
|
|
11
|
+
static let EVENT_SIZE_CHANGES = "onSizeChanges"
|
|
12
|
+
static let EVENT_BANK_ACCOUNT_RESPOND = "onBankAccountRespond"
|
|
13
|
+
static let EVENT_CARD_RESPOND = "onCardRespond"
|
|
14
|
+
static let EVENT_READY = "onReady"
|
|
15
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PayEngineField.swift
|
|
3
|
+
// react-native-payengine
|
|
4
|
+
//
|
|
5
|
+
// Created by Tri Nguyen on 5/9/2024.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
public struct RNPEField: Codable {
|
|
11
|
+
var name: String
|
|
12
|
+
var type: String
|
|
13
|
+
var placeholder: String
|
|
14
|
+
var keyboardType: String
|
|
15
|
+
var isRequired: Bool
|
|
16
|
+
var pattern: String?
|
|
17
|
+
|
|
18
|
+
init(name: String, type: String, placeholder: String, keyboardType: String, isRequired: Bool, pattern: String?) {
|
|
19
|
+
self.name = name
|
|
20
|
+
self.type = type
|
|
21
|
+
self.placeholder = placeholder
|
|
22
|
+
self.keyboardType = keyboardType
|
|
23
|
+
self.isRequired = isRequired
|
|
24
|
+
self.pattern = pattern
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#import <React/RCTBridgeModule.h>
|
|
2
|
+
#import <Foundation/Foundation.h>
|
|
3
|
+
#import <React/RCTViewManager.h>
|
|
4
|
+
#import <React/RCTEventEmitter.h>
|
|
5
|
+
#import <React/RCTUIManager.h>
|
|
6
|
+
|
|
7
|
+
@interface RCT_EXTERN_MODULE(RNPayEngineNative, NSObject)
|
|
8
|
+
|
|
9
|
+
RCT_EXTERN_METHOD(setConfig: (NSString *)publicKey baseURL:(NSString *)baseURL)
|
|
10
|
+
|
|
11
|
+
RCT_EXTERN_METHOD(createFraudMonitorSession:(NSString *)merchantId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
12
|
+
|
|
13
|
+
RCT_EXTERN_METHOD(getBrowserInfo:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
14
|
+
|
|
15
|
+
RCT_EXTERN_METHOD(isApplePaySupported:(NSString *)merchantId resolver:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)
|
|
16
|
+
|
|
17
|
+
+ (BOOL)requiresMainQueueSetup
|
|
18
|
+
{
|
|
19
|
+
return NO;
|
|
20
|
+
}
|
|
21
|
+
@end
|
|
22
|
+
|
|
23
|
+
@interface RCT_EXTERN_MODULE(RNPECreditCardView, RCTViewManager)
|
|
24
|
+
|
|
25
|
+
RCT_EXTERN_METHOD(submit:(nonnull NSNumber*)reactTag merchantId:(NSString *)merchantId additionalData:(NSDictionary *)additionalData)
|
|
26
|
+
|
|
27
|
+
RCT_EXTERN_METHOD(showKeyboard:(nonnull NSNumber*)reactTag)
|
|
28
|
+
RCT_EXTERN_METHOD(hideKeyboard:(nonnull NSNumber*)reactTag)
|
|
29
|
+
|
|
30
|
+
RCT_EXPORT_VIEW_PROPERTY(additionalFields, NSString)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@end
|
|
34
|
+
|
|
35
|
+
@interface RCT_EXTERN_MODULE(RNPEBankAccountView, RCTViewManager)
|
|
36
|
+
|
|
37
|
+
RCT_EXTERN_METHOD(submit:(nonnull NSNumber*)reactTag merchantId:(NSString *)merchantId additionalData:(NSDictionary *)additionalData)
|
|
38
|
+
|
|
39
|
+
RCT_EXTERN_METHOD(showKeyboard:(nonnull NSNumber*)reactTag)
|
|
40
|
+
RCT_EXTERN_METHOD(hideKeyboard:(nonnull NSNumber*)reactTag)
|
|
41
|
+
|
|
42
|
+
RCT_EXPORT_VIEW_PROPERTY(additionalFields, NSString)
|
|
43
|
+
|
|
44
|
+
@end
|
|
45
|
+
|
|
46
|
+
@interface RCT_EXTERN_MODULE(RNPEApplePayButtonManager, RCTViewManager)
|
|
47
|
+
|
|
48
|
+
RCT_EXPORT_VIEW_PROPERTY(paymentRequest, NSString)
|
|
49
|
+
RCT_EXPORT_VIEW_PROPERTY(onPmSheetDidDismiss, RCTBubblingEventBlock)
|
|
50
|
+
RCT_EXPORT_VIEW_PROPERTY(onPmTokenDidReturn, RCTBubblingEventBlock)
|
|
51
|
+
RCT_EXPORT_VIEW_PROPERTY(onPmTokenNotAvailable, RCTBubblingEventBlock)
|
|
52
|
+
RCT_EXPORT_VIEW_PROPERTY(onPmError, RCTBubblingEventBlock)
|
|
53
|
+
|
|
54
|
+
@end
|
|
55
|
+
|
|
56
|
+
@interface RCT_EXTERN_MODULE(RNPEEventEmitter, RCTEventEmitter)
|
|
57
|
+
|
|
58
|
+
RCT_EXTERN_METHOD(supportedEvents)
|
|
59
|
+
|
|
60
|
+
@end
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/// old stuffs
|
|
64
|
+
@interface RCT_EXTERN_MODULE(Payengine, NSObject)
|
|
65
|
+
RCT_EXTERN_METHOD(multiply:(float)a withB:(float)b
|
|
66
|
+
withResolver:(RCTPromiseResolveBlock)resolve
|
|
67
|
+
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
68
|
+
|
|
69
|
+
+ (BOOL)requiresMainQueueSetup
|
|
70
|
+
{
|
|
71
|
+
return NO;
|
|
72
|
+
}
|
|
73
|
+
@end
|