react-native-payengine 2.0.17 → 2.0.18-alpha.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 +96 -65
- 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/build.gradle +2 -2
- package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +65 -3
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +1 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/bankaccount/RNBankAccountViewManager.kt +16 -3
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/creditcard/RNPECreditCardViewManager.kt +15 -4
- package/ios/PayEngineSDK.xcframework/Info.plist +5 -5
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +430 -149
- 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 +1785 -5517
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +35 -129
- 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 +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +35 -129
- 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_x86_64-simulator/PayEngineSDK.framework/Headers/KDataCollector.h +4 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountAnalyticsViewController.h +0 -20
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/KountPrivate.h +61 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +860 -298
- 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 +1785 -5517
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +35 -129
- 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 +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +1785 -5517
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +35 -129
- 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 +35 -129
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +35 -129
- 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/Sources/Classes/RNPEEventEmitter.swift +1 -1
- package/ios/Sources/Classes/RNPayEngineNative.swift +125 -64
- package/ios/Sources/Classes/SecureFields/RNPEEvents.swift +1 -0
- package/ios/Sources/Payengine.m +6 -0
- package/lib/commonjs/components/PayEngine.js +1 -1
- package/lib/commonjs/components/PayEngine.js.map +1 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +124 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js +78 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +53 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/PEPaymentRequest.js +121 -0
- package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
- package/lib/commonjs/components/v2/PayEngineNative.js +182 -4
- package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
- package/lib/commonjs/components/v2/PayEngineProvider.js +52 -0
- package/lib/commonjs/components/v2/PayEngineProvider.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/BankAccountView.js +71 -0
- package/lib/commonjs/components/v2/SecureFields/BankAccountView.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/CreditCardView.js +82 -0
- package/lib/commonjs/components/v2/SecureFields/CreditCardView.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/IPEField.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/ITokenizationData.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/PEBankAccount.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/PECard.js.map +1 -1
- package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js +20 -3
- package/lib/commonjs/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
- package/lib/commonjs/index.js +17 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/index.js +20 -0
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +26 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/components/PayEngine.js +1 -1
- package/lib/module/components/PayEngine.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js +124 -0
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js +75 -0
- package/lib/module/components/v2/ApplePay/PEApplePayInterfaces.js.map +1 -1
- package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -1
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +53 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/module/components/v2/PEPaymentRequest.js +119 -0
- package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
- package/lib/module/components/v2/PayEngineNative.js +184 -5
- package/lib/module/components/v2/PayEngineNative.js.map +1 -1
- package/lib/module/components/v2/PayEngineProvider.js +51 -0
- package/lib/module/components/v2/PayEngineProvider.js.map +1 -1
- package/lib/module/components/v2/SecureFields/BankAccountView.js +71 -0
- package/lib/module/components/v2/SecureFields/BankAccountView.js.map +1 -1
- package/lib/module/components/v2/SecureFields/CreditCardView.js +82 -0
- package/lib/module/components/v2/SecureFields/CreditCardView.js.map +1 -1
- package/lib/module/components/v2/SecureFields/IPEField.js.map +1 -1
- package/lib/module/components/v2/SecureFields/ITokenizationData.js.map +1 -1
- package/lib/module/components/v2/SecureFields/PEBankAccount.js.map +1 -1
- package/lib/module/components/v2/SecureFields/PECard.js.map +1 -1
- package/lib/module/components/v2/SecureFields/PEKeyboardType.js +16 -1
- package/lib/module/components/v2/SecureFields/PEKeyboardType.js.map +1 -1
- package/lib/module/index.js +10 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/index.js +19 -0
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/module/utils/index.js +27 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/components/PayEngine.d.ts +1 -1
- package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +217 -12
- package/lib/typescript/components/v2/ApplePay/PEApplePayInterfaces.d.ts +180 -1
- package/lib/typescript/components/v2/GooglePay/PEGooglePayAddress.d.ts +30 -0
- package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +99 -0
- package/lib/typescript/components/v2/PEPaymentRequest.d.ts +130 -9
- package/lib/typescript/components/v2/PayEngineNative.d.ts +165 -7
- package/lib/typescript/components/v2/PayEngineProvider.d.ts +51 -0
- package/lib/typescript/components/v2/SecureFields/BankAccountView.d.ts +103 -0
- package/lib/typescript/components/v2/SecureFields/CreditCardView.d.ts +114 -0
- package/lib/typescript/components/v2/SecureFields/IPEField.d.ts +49 -0
- package/lib/typescript/components/v2/SecureFields/ITokenizationData.d.ts +14 -0
- package/lib/typescript/components/v2/SecureFields/PEBankAccount.d.ts +36 -0
- package/lib/typescript/components/v2/SecureFields/PECard.d.ts +44 -0
- package/lib/typescript/components/v2/SecureFields/PEKeyboardType.d.ts +16 -1
- package/lib/typescript/index.d.ts +11 -5
- package/lib/typescript/interfaces/index.d.ts +35 -1
- package/lib/typescript/utils/index.d.ts +21 -0
- package/package.json +6 -3
- package/src/components/PayEngine.tsx +1 -1
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +225 -12
- package/src/components/v2/ApplePay/PEApplePayInterfaces.ts +221 -8
- package/src/components/v2/GooglePay/PEGooglePayAddress.ts +39 -1
- package/src/components/v2/GooglePay/PEGooglePayButton.tsx +113 -9
- package/src/components/v2/PEPaymentRequest.ts +151 -13
- package/src/components/v2/PayEngineNative.tsx +196 -9
- package/src/components/v2/PayEngineProvider.tsx +52 -1
- package/src/components/v2/SecureFields/BankAccountView.tsx +108 -1
- package/src/components/v2/SecureFields/CreditCardView.tsx +118 -1
- package/src/components/v2/SecureFields/IPEField.ts +55 -0
- package/src/components/v2/SecureFields/ITokenizationData.ts +17 -2
- package/src/components/v2/SecureFields/PEBankAccount.ts +42 -0
- package/src/components/v2/SecureFields/PECard.ts +52 -0
- package/src/components/v2/SecureFields/PEKeyboardType.ts +18 -1
- package/src/index.tsx +23 -5
- package/src/interfaces/index.ts +40 -2
- package/src/utils/index.ts +21 -0
- package/android/.gradle/6.1.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.1.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.1.1/gc.properties +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/CustomWindow.h +0 -25
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIControl+CustomControl.h +0 -33
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/UIViewController+TouchControl.h +0 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPEEventEmitter","NativeModules","RNPEGooglePayButton","requireNativeComponent","peEventEmitter","NativeEventEmitter","PEGooglePayButton","React","forwardRef","props","ref","useImperativeHandle","useEffect","listener1","addListener","args","token","metadata","metadataString","billingAddress","billingAddressString","shippingAddress","shippingAddressString","console","log","JSON","parse","onTokenDidReturn","undefined","listener2","error","onPaymentFailed","Error","listener3","onPaymentSheetDismissed","remove","Platform","OS","height","width","style","stringify","paymentRequest","platformOptions"],"sources":["PEGooglePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { NativeEventEmitter, NativeModules, Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\nimport type { PEGooglePayAddress } from './PEGooglePayAddress';\n\nconst { RNPEEventEmitter } = NativeModules;\n\nconst RNPEGooglePayButton = requireNativeComponent<NativePEGooglePayViewProps>('RNPEGooglePayButton');\n\ninterface NativePEGooglePayViewProps extends ViewProps {\n // amount: number;\n // merchantId: string;\n paymentRequest: string;\n}\n\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\nexport interface PEGooglePayButtonProps extends ViewProps {\n paymentRequest: PEPaymentRequest;\n onTokenDidReturn?: (token: string
|
|
1
|
+
{"version":3,"names":["RNPEEventEmitter","NativeModules","RNPEGooglePayButton","requireNativeComponent","peEventEmitter","NativeEventEmitter","PEGooglePayButton","React","forwardRef","props","ref","useImperativeHandle","useEffect","listener1","addListener","args","token","metadata","metadataString","billingAddress","billingAddressString","shippingAddress","shippingAddressString","console","log","JSON","parse","onTokenDidReturn","undefined","listener2","error","onPaymentFailed","Error","listener3","onPaymentSheetDismissed","remove","Platform","OS","height","width","style","stringify","paymentRequest","platformOptions"],"sources":["PEGooglePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { NativeEventEmitter, NativeModules, Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\nimport type { PEGooglePayAddress } from './PEGooglePayAddress';\n\nconst { RNPEEventEmitter } = NativeModules;\n\nconst RNPEGooglePayButton = requireNativeComponent<NativePEGooglePayViewProps>('RNPEGooglePayButton');\n\ninterface NativePEGooglePayViewProps extends ViewProps {\n // amount: number;\n // merchantId: string;\n paymentRequest: string;\n}\n\nconst peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);\n\n/**\n * Props for rendering the Google Pay payment button.\n *\n * This interface defines the configuration and callback handlers\n * used when initiating a Google Pay transaction.\n *\n * @category Google Pay\n */\nexport interface PEGooglePayButtonProps extends ViewProps {\n /**\n * The payment request containing merchant details, amount, currency,\n * and optional payment item breakdown.\n *\n * This object defines the core transaction that will be processed.\n */\n paymentRequest: PEPaymentRequest;\n\n /**\n * Callback triggered when a Google Pay token is successfully returned.\n *\n * @param token - The Google Pay payment token as a string.\n * @param metadata - Additional transaction metadata (if available).\n * @param billingAddress - The billing address provided by Google Pay (optional).\n * @param shippingAddress - The shipping address provided by Google Pay (optional).\n *\n * Example usage:\n * ```ts\n * onTokenDidReturn: (token, metadata, billingAddress, shippingAddress) => {\n * console.log(\"Token:\", token);\n * }\n * ```\n */\n onTokenDidReturn?: (\n token: string,\n metadata?: any,\n billingAddress?: PEGooglePayAddress,\n shippingAddress?: PEGooglePayAddress\n ) => void;\n\n /**\n * Callback triggered when the Google Pay sheet is dismissed\n * without completing the payment.\n *\n * Useful for UI updates or restoring state.\n */\n onPaymentSheetDismissed?: () => void;\n\n /**\n * Callback triggered when a payment fails during processing.\n *\n * @param error - An error object describing the cause of the failure.\n *\n * Example:\n * ```ts\n * onPaymentFailed: (error) => {\n * console.error(\"Payment failed:\", error.message);\n * }\n * ```\n */\n onPaymentFailed?: (error: Error) => void;\n}\n\n/**\n * Interface for defining methods related to the Google Pay button.\n *\n * Currently empty, this interface serves as a placeholder for any\n * platform-specific Google Pay button methods that may be added in the future.\n *\n * @category Google Pay\n */\nexport interface PEGooglePayButtonMethods { }\n\n/**\n * A React Native component for rendering a Google Pay button.\n *\n * This button allows users to initiate a Google Pay transaction using the\n * provided `paymentRequest`. The component communicates with native code\n * and emits events through a shared event emitter (`peEventEmitter`) to\n * notify the JavaScript layer about the payment result.\n *\n * ## Example Usage:\n * ```tsx\n * const paymentRequest = {\n * merchantId: 'your-merchant-id',\n * paymentAmount: 10.00,\n * paymentItems: [\n * { label: 'Test Item', amount: 10.00 }\n * ],\n * platformOptions: {\n * billingAddressRequired: true,\n * shippingAddressRequired: true,\n * },\n * };\n * \n * <PEGooglePayButton\n * paymentRequest={paymentRequest}\n * onPaymentFailed={(error) => {\n * console.log(\"Payment failed\", error);\n * }}\n * onPaymentSheetDismissed={() => {\n * console.log(\"Payment sheet dismissed\");\n * }}\n * onTokenDidReturn={(token, metadata, billingAddress, shippingAddress) => {\n * console.log(\"Payment successful\", token, metadata, billingAddress, shippingAddress);\n * }}\n * />\n * ```\n *\n * ## Platform Support:\n * - **Android only**: On iOS, this component renders a fallback message.\n *\n * @param props - See {@link PEGooglePayButtonProps}\n * @returns A Google Pay button on Android or a fallback message on iOS.\n *\n * @category Google Pay\n */\nexport const PEGooglePayButton = React.forwardRef<\n PEGooglePayButtonMethods,\n PEGooglePayButtonProps\n>((props, ref) => {\n\n React.useImperativeHandle(ref, () => ({\n }));\n\n React.useEffect(() => {\n const listener1 = peEventEmitter.addListener('onGooglePayRespond', args => {\n const { token, metadata: metadataString, billingAddress: billingAddressString, shippingAddress: shippingAddressString } = args;\n console.log('ON token', token, metadataString, billingAddressString, shippingAddressString)\n const metadata = metadataString ? JSON.parse(metadataString) : null;\n const billingAddress = billingAddressString ? JSON.parse(billingAddressString) as PEGooglePayAddress : null;\n const shippingAddress = shippingAddressString ? JSON.parse(shippingAddressString) as PEGooglePayAddress : null;\n\n props.onTokenDidReturn?.(token, metadata, billingAddress ?? undefined, shippingAddress ?? undefined)\n });\n\n const listener2 = peEventEmitter.addListener('onGooglePayError', args => {\n const { error } = args;\n console.log('ON error', error)\n props.onPaymentFailed?.(new Error(error))\n });\n\n const listener3 = peEventEmitter.addListener('onGooglePayDismiss', () => {\n console.log('ON dismiss')\n props.onPaymentSheetDismissed?.()\n });\n\n return () => {\n listener1.remove();\n listener2.remove();\n listener3.remove();\n }\n }, []);\n\n if (Platform.OS !== 'android') {\n return <Text>Google Pay is not supported on this platform</Text>\n }\n\n return (\n <RNPEGooglePayButton\n style={{ height: 32, width: '100%', ...(props.style as object) }}\n // amount={props.paymentRequest.paymentAmount}\n // merchantId={props.paymentRequest.merchantId} \n paymentRequest={JSON.stringify({\n ...props.paymentRequest,\n ...props.paymentRequest.platformOptions\n })}\n />\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAIA,MAAM;EAAEA;AAAF,IAAuBC,0BAA7B;AAEA,MAAMC,mBAAmB,GAAG,IAAAC,mCAAA,EAAmD,qBAAnD,CAA5B;AAQA,MAAMC,cAAc,GAAG,IAAIC,+BAAJ,CAAuBL,gBAAvB,CAAvB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMM,iBAAiB,gBAAGC,KAAK,CAACC,UAAN,CAG/B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAEhBH,KAAK,CAACI,mBAAN,CAA0BD,GAA1B,EAA+B,OAAO,EAAP,CAA/B;EAGAH,KAAK,CAACK,SAAN,CAAgB,MAAM;IACpB,MAAMC,SAAS,GAAGT,cAAc,CAACU,WAAf,CAA2B,oBAA3B,EAAiDC,IAAI,IAAI;MAAA;;MACzE,MAAM;QAAEC,KAAF;QAASC,QAAQ,EAAEC,cAAnB;QAAmCC,cAAc,EAAEC,oBAAnD;QAAyEC,eAAe,EAAEC;MAA1F,IAAoHP,IAA1H;MACAQ,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBR,KAAxB,EAA+BE,cAA/B,EAA+CE,oBAA/C,EAAqEE,qBAArE;MACA,MAAML,QAAQ,GAAGC,cAAc,GAAGO,IAAI,CAACC,KAAL,CAAWR,cAAX,CAAH,GAAgC,IAA/D;MACA,MAAMC,cAAc,GAAGC,oBAAoB,GAAGK,IAAI,CAACC,KAAL,CAAWN,oBAAX,CAAH,GAA4D,IAAvG;MACA,MAAMC,eAAe,GAAGC,qBAAqB,GAAGG,IAAI,CAACC,KAAL,CAAWJ,qBAAX,CAAH,GAA6D,IAA1G;MAEA,yBAAAb,KAAK,CAACkB,gBAAN,qFAAAlB,KAAK,EAAoBO,KAApB,EAA2BC,QAA3B,EAAqCE,cAAc,IAAIS,SAAvD,EAAkEP,eAAe,IAAIO,SAArF,CAAL;IACD,CARiB,CAAlB;IAUA,MAAMC,SAAS,GAAGzB,cAAc,CAACU,WAAf,CAA2B,kBAA3B,EAA+CC,IAAI,IAAI;MAAA;;MACvE,MAAM;QAAEe;MAAF,IAAYf,IAAlB;MACAQ,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBM,KAAxB;MACA,yBAAArB,KAAK,CAACsB,eAAN,qFAAAtB,KAAK,EAAmB,IAAIuB,KAAJ,CAAUF,KAAV,CAAnB,CAAL;IACD,CAJiB,CAAlB;IAMA,MAAMG,SAAS,GAAG7B,cAAc,CAACU,WAAf,CAA2B,oBAA3B,EAAiD,MAAM;MAAA;;MACvES,OAAO,CAACC,GAAR,CAAY,YAAZ;MACA,yBAAAf,KAAK,CAACyB,uBAAN,qFAAAzB,KAAK;IACN,CAHiB,CAAlB;IAKA,OAAO,MAAM;MACXI,SAAS,CAACsB,MAAV;MACAN,SAAS,CAACM,MAAV;MACAF,SAAS,CAACE,MAAV;IACD,CAJD;EAKD,CA3BD,EA2BG,EA3BH;;EA6BA,IAAIC,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;IAC7B,oBAAO,oBAAC,iBAAD,uDAAP;EACD;;EAED,oBACE,oBAAC,mBAAD;IACE,KAAK,EAAE;MAAEC,MAAM,EAAE,EAAV;MAAcC,KAAK,EAAE,MAArB;MAA6B,GAAI9B,KAAK,CAAC+B;IAAvC,CADT,CAEE;IACA;IAHF;IAIE,cAAc,EAAEf,IAAI,CAACgB,SAAL,CAAe,EAC7B,GAAGhC,KAAK,CAACiC,cADoB;MAE7B,GAAGjC,KAAK,CAACiC,cAAN,CAAqBC;IAFK,CAAf;EAJlB,EADF;AAWD,CApDgC,CAA1B"}
|
|
@@ -7,7 +7,52 @@ exports.RNPEGooglePayShippingAddressParameters = exports.RNPEGooglePayOptions =
|
|
|
7
7
|
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* A union type that represents platform-specific payment options.
|
|
12
|
+
*
|
|
13
|
+
* This can either be `RNPEGooglePayOptions` or `RNPEApplePayOptions`, depending
|
|
14
|
+
* on the platform.
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A class representing a payment request containing all necessary transaction details.
|
|
20
|
+
*
|
|
21
|
+
* This includes merchant identifier, total payment amount, currency code,
|
|
22
|
+
* individual payment items, and optional platform-specific configurations
|
|
23
|
+
* such as Apple Pay or Google Pay options.
|
|
24
|
+
*/
|
|
10
25
|
class PEPaymentRequest {
|
|
26
|
+
/**
|
|
27
|
+
* The unique identifier for the merchant initiating the transaction.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The total amount to be charged for the transaction.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The currency code used for the transaction. Defaults to `'USD'`.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* List of items representing the breakdown of the transaction.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Platform-specific options for customizing the payment experience
|
|
44
|
+
* (e.g., Apple Pay or Google Pay settings).
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Constructs a new instance of [PEPaymentRequest].
|
|
49
|
+
*
|
|
50
|
+
* @param merchantId - The merchant's unique identifier.
|
|
51
|
+
* @param paymentAmount - The total transaction amount.
|
|
52
|
+
* @param currencyCode - The currency code (either `'USD'` or `'CAD'`).
|
|
53
|
+
* @param paymentItems - An array of individual summary items.
|
|
54
|
+
* @param platformOptions - Optional platform-specific payment configuration.
|
|
55
|
+
*/
|
|
11
56
|
constructor(merchantId, paymentAmount) {
|
|
12
57
|
let currencyCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'USD';
|
|
13
58
|
let paymentItems = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
@@ -31,9 +76,33 @@ class PEPaymentRequest {
|
|
|
31
76
|
}
|
|
32
77
|
|
|
33
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Represents an individual item in a payment transaction.
|
|
81
|
+
*
|
|
82
|
+
* Each item includes a label and an associated amount.
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
|
|
34
86
|
|
|
35
87
|
exports.PEPaymentRequest = PEPaymentRequest;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Contact fields that can be requested from the user during Apple Pay transactions.
|
|
91
|
+
*
|
|
92
|
+
* These fields specify what customer information (e.g., name, email, address) is required.
|
|
93
|
+
*
|
|
94
|
+
* @category Apple Pay
|
|
95
|
+
*/
|
|
36
96
|
let RNPEContactField;
|
|
97
|
+
/**
|
|
98
|
+
* Options specific to Apple Pay payment flow.
|
|
99
|
+
*
|
|
100
|
+
* Includes configuration for required billing and shipping contact fields,
|
|
101
|
+
* as well as available shipping methods.
|
|
102
|
+
*
|
|
103
|
+
* @category Apple Pay
|
|
104
|
+
*/
|
|
105
|
+
|
|
37
106
|
exports.RNPEContactField = RNPEContactField;
|
|
38
107
|
|
|
39
108
|
(function (RNPEContactField) {
|
|
@@ -45,6 +114,17 @@ exports.RNPEContactField = RNPEContactField;
|
|
|
45
114
|
})(RNPEContactField || (exports.RNPEContactField = RNPEContactField = {}));
|
|
46
115
|
|
|
47
116
|
class RNPEApplePayOptions {
|
|
117
|
+
/**
|
|
118
|
+
* Contact fields required for billing (e.g., name, address).
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Contact fields required for shipping (e.g., phone number, address).
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* List of available shipping methods shown to the user.
|
|
127
|
+
*/
|
|
48
128
|
constructor(params) {
|
|
49
129
|
_defineProperty(this, "requiredBillingContactFields", []);
|
|
50
130
|
|
|
@@ -58,6 +138,14 @@ class RNPEApplePayOptions {
|
|
|
58
138
|
}
|
|
59
139
|
|
|
60
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Represents the billing address parameters for Google Pay in React Native.
|
|
143
|
+
*
|
|
144
|
+
* Specifies the address format and whether a phone number is required.
|
|
145
|
+
*
|
|
146
|
+
* @category Google Pay
|
|
147
|
+
*/
|
|
148
|
+
|
|
61
149
|
|
|
62
150
|
exports.RNPEApplePayOptions = RNPEApplePayOptions;
|
|
63
151
|
|
|
@@ -69,6 +157,14 @@ class RNPEGooglePayBillingAddressParameters {
|
|
|
69
157
|
}
|
|
70
158
|
|
|
71
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Represents the shipping address parameters for Google Pay in React Native.
|
|
162
|
+
*
|
|
163
|
+
* Specifies the allowed countries and whether a phone number is required.
|
|
164
|
+
*
|
|
165
|
+
* @category Google Pay
|
|
166
|
+
*/
|
|
167
|
+
|
|
72
168
|
|
|
73
169
|
exports.RNPEGooglePayBillingAddressParameters = RNPEGooglePayBillingAddressParameters;
|
|
74
170
|
|
|
@@ -80,10 +176,35 @@ class RNPEGooglePayShippingAddressParameters {
|
|
|
80
176
|
}
|
|
81
177
|
|
|
82
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* A class representing Google Pay-specific payment options for React Native.
|
|
181
|
+
*
|
|
182
|
+
* This includes flags and parameters for requiring billing and shipping addresses.
|
|
183
|
+
*
|
|
184
|
+
* @category Google Pay
|
|
185
|
+
*/
|
|
186
|
+
|
|
83
187
|
|
|
84
188
|
exports.RNPEGooglePayShippingAddressParameters = RNPEGooglePayShippingAddressParameters;
|
|
85
189
|
|
|
86
190
|
class RNPEGooglePayOptions {
|
|
191
|
+
/** Whether a billing address is required for the transaction. */
|
|
192
|
+
|
|
193
|
+
/** Additional parameters for billing address collection (platform-specific). */
|
|
194
|
+
|
|
195
|
+
/** Whether a shipping address is required for the transaction. */
|
|
196
|
+
|
|
197
|
+
/** Additional parameters for shipping address collection (platform-specific). */
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Creates a new instance of `RNPEGooglePayOptions`.
|
|
201
|
+
*
|
|
202
|
+
* @param params - The configuration object for Google Pay options.
|
|
203
|
+
* @param params.billingAddressRequired - Whether billing address is required.
|
|
204
|
+
* @param params.shippingAddressRequired - Whether shipping address is required.
|
|
205
|
+
* @param params.billingAddressParameters - Optional parameters for billing address.
|
|
206
|
+
* @param params.shippingAddressParameters - Optional parameters for shipping address.
|
|
207
|
+
*/
|
|
87
208
|
constructor(params) {
|
|
88
209
|
_defineProperty(this, "billingAddressRequired", void 0);
|
|
89
210
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PEPaymentRequest","constructor","merchantId","paymentAmount","currencyCode","paymentItems","platformOptions","RNPEContactField","RNPEApplePayOptions","params","requiredBillingContactFields","requiredShippingContactFields","shippingMethods","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","undefined","RNPEGooglePayOptions","billingAddressRequired","billingAddressParameters","shippingAddressRequired","shippingAddressParameters"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["import type { PEApplePayShippingMethod } from \"./ApplePay/PEApplePayInterfaces\";\n\
|
|
1
|
+
{"version":3,"names":["PEPaymentRequest","constructor","merchantId","paymentAmount","currencyCode","paymentItems","platformOptions","RNPEContactField","RNPEApplePayOptions","params","requiredBillingContactFields","requiredShippingContactFields","shippingMethods","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","undefined","RNPEGooglePayOptions","billingAddressRequired","billingAddressParameters","shippingAddressRequired","shippingAddressParameters"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["import type { PEApplePayShippingMethod } from \"./ApplePay/PEApplePayInterfaces\";\n\n/**\n * A union type that represents platform-specific payment options.\n * \n * This can either be `RNPEGooglePayOptions` or `RNPEApplePayOptions`, depending\n * on the platform.\n * \n */\nexport type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;\n\n/**\n * A class representing a payment request containing all necessary transaction details.\n *\n * This includes merchant identifier, total payment amount, currency code,\n * individual payment items, and optional platform-specific configurations\n * such as Apple Pay or Google Pay options.\n */\nexport class PEPaymentRequest {\n /**\n * The unique identifier for the merchant initiating the transaction.\n */\n merchantId: string;\n\n /**\n * The total amount to be charged for the transaction.\n */\n paymentAmount: number;\n\n /**\n * The currency code used for the transaction. Defaults to `'USD'`.\n */\n currencyCode?: 'USD' | 'CAD' = 'USD';\n\n /**\n * List of items representing the breakdown of the transaction.\n */\n paymentItems?: PESummaryItem[] = [];\n\n /**\n * Platform-specific options for customizing the payment experience\n * (e.g., Apple Pay or Google Pay settings).\n */\n platformOptions?: RNPEPaymentOptions;\n\n /**\n * Constructs a new instance of [PEPaymentRequest].\n *\n * @param merchantId - The merchant's unique identifier.\n * @param paymentAmount - The total transaction amount.\n * @param currencyCode - The currency code (either `'USD'` or `'CAD'`).\n * @param paymentItems - An array of individual summary items.\n * @param platformOptions - Optional platform-specific payment configuration.\n */\n constructor(\n merchantId: string,\n paymentAmount: number,\n currencyCode: 'USD' | 'CAD' = 'USD',\n paymentItems: PESummaryItem[] = [],\n platformOptions?: RNPEPaymentOptions\n ) {\n this.merchantId = merchantId;\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n this.platformOptions = platformOptions;\n }\n}\n\n/**\n * Represents an individual item in a payment transaction.\n *\n * Each item includes a label and an associated amount.\n *\n */\nexport interface PESummaryItem {\n /** A descriptive label for the payment item (e.g., \"Item 1\"). */\n label: string;\n\n /** The monetary amount for this item. */\n amount: number;\n}\n\n/**\n * Contact fields that can be requested from the user during Apple Pay transactions.\n *\n * These fields specify what customer information (e.g., name, email, address) is required.\n *\n * @category Apple Pay\n */\nexport enum RNPEContactField {\n /** The customer's full name. */\n name = 'name',\n\n /** The customer's postal address. */\n postalAddress = 'postalAddress',\n\n /** The customer's email address. */\n emailAddress = 'emailAddress',\n\n /** The customer's phone number. */\n phoneNumber = 'phoneNumber',\n\n /** The phonetic spelling of the customer's name. */\n phoneticName = 'phoneticName',\n}\n\n\n/**\n * Options specific to Apple Pay payment flow.\n *\n * Includes configuration for required billing and shipping contact fields,\n * as well as available shipping methods.\n *\n * @category Apple Pay\n */\nexport class RNPEApplePayOptions {\n /**\n * Contact fields required for billing (e.g., name, address).\n */\n requiredBillingContactFields?: RNPEContactField[] = [];\n\n /**\n * Contact fields required for shipping (e.g., phone number, address).\n */\n requiredShippingContactFields?: RNPEContactField[] = [];\n\n /**\n * List of available shipping methods shown to the user.\n */\n shippingMethods?: PEApplePayShippingMethod[] = [];\n\n constructor(params: {\n requiredBillingContactFields: RNPEContactField[];\n requiredShippingContactFields: RNPEContactField[];\n shippingMethods: PEApplePayShippingMethod[];\n }) {\n this.requiredBillingContactFields = params.requiredBillingContactFields;\n this.requiredShippingContactFields = params.requiredShippingContactFields;\n this.shippingMethods = params.shippingMethods;\n }\n}\n\n/**\n * Represents the billing address parameters for Google Pay in React Native.\n *\n * Specifies the address format and whether a phone number is required.\n *\n * @category Google Pay\n */\nexport class RNPEGooglePayBillingAddressParameters {\n /**\n * The format of the billing address.\n * \n * - `'FULL'`: Includes street, city, state, and postal code.\n * - `'MIN'`: Minimal format with limited address details.\n */\n format: 'FULL' | 'MIN' = 'FULL';\n\n /**\n * Whether a phone number is required in the billing address.\n */\n phoneNumberRequired: boolean = false;\n}\n\n/**\n * Represents the shipping address parameters for Google Pay in React Native.\n *\n * Specifies the allowed countries and whether a phone number is required.\n *\n * @category Google Pay\n */\nexport class RNPEGooglePayShippingAddressParameters {\n /**\n * A list of allowed country codes for shipping (e.g., `[\"US\", \"CA\"]`).\n */\n allowedCountryCodes?: string[] = undefined;\n\n /**\n * Whether a phone number is required in the shipping address.\n */\n phoneNumberRequired: boolean = false;\n}\n\n/**\n * A class representing Google Pay-specific payment options for React Native.\n * \n * This includes flags and parameters for requiring billing and shipping addresses.\n * \n * @category Google Pay\n */\nexport class RNPEGooglePayOptions {\n /** Whether a billing address is required for the transaction. */\n billingAddressRequired: boolean;\n\n /** Additional parameters for billing address collection (platform-specific). */\n billingAddressParameters?: RNPEGooglePayBillingAddressParameters;\n\n /** Whether a shipping address is required for the transaction. */\n shippingAddressRequired: boolean;\n\n /** Additional parameters for shipping address collection (platform-specific). */\n shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;\n\n /**\n * Creates a new instance of `RNPEGooglePayOptions`.\n * \n * @param params - The configuration object for Google Pay options.\n * @param params.billingAddressRequired - Whether billing address is required.\n * @param params.shippingAddressRequired - Whether shipping address is required.\n * @param params.billingAddressParameters - Optional parameters for billing address.\n * @param params.shippingAddressParameters - Optional parameters for shipping address.\n */\n constructor(params: {\n billingAddressRequired: boolean;\n shippingAddressRequired: boolean;\n billingAddressParameters?: RNPEGooglePayBillingAddressParameters;\n shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;\n }) {\n this.billingAddressRequired = params.billingAddressRequired;\n this.billingAddressParameters = params.billingAddressParameters;\n this.shippingAddressRequired = params.shippingAddressRequired;\n this.shippingAddressParameters = params.shippingAddressParameters;\n }\n}\n"],"mappings":";;;;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,gBAAN,CAAuB;EAC5B;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;AACA;;EAGE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEC,WAAW,CACTC,UADS,EAETC,aAFS,EAMT;IAAA,IAHAC,YAGA,uEAH8B,KAG9B;IAAA,IAFAC,YAEA,uEAFgC,EAEhC;IAAA,IADAC,eACA;;IAAA;;IAAA;;IAAA,sCA5B6B,KA4B7B;;IAAA,sCAvB+B,EAuB/B;;IAAA;;IACA,KAAKJ,UAAL,GAAkBA,UAAlB;IACA,KAAKC,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,eAAL,GAAuBA,eAAvB;EACD;;AAhD2B;AAmD9B;AACA;AACA;AACA;AACA;AACA;;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;IACYC,gB;AAkBZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;WAzBYA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;GAAAA,gB,gCAAAA,gB;;AA0BL,MAAMC,mBAAN,CAA0B;EAC/B;AACF;AACA;;EAGE;AACF;AACA;;EAGE;AACF;AACA;EAGEP,WAAW,CAACQ,MAAD,EAIR;IAAA,sDAhBiD,EAgBjD;;IAAA,uDAXkD,EAWlD;;IAAA,yCAN4C,EAM5C;;IACD,KAAKC,4BAAL,GAAoCD,MAAM,CAACC,4BAA3C;IACA,KAAKC,6BAAL,GAAqCF,MAAM,CAACE,6BAA5C;IACA,KAAKC,eAAL,GAAuBH,MAAM,CAACG,eAA9B;EACD;;AAxB8B;AA2BjC;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,qCAAN,CAA4C;EAAA;IAAA,gCAOxB,MAPwB;;IAAA,6CAYlB,KAZkB;EAAA;;AAAA;AAenD;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,sCAAN,CAA6C;EAAA;IAAA,6CAIjBC,SAJiB;;IAAA,6CASnB,KATmB;EAAA;;AAAA;AAYpD;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,oBAAN,CAA2B;EAChC;;EAGA;;EAGA;;EAGA;;EAGA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEf,WAAW,CAACQ,MAAD,EAKR;IAAA;;IAAA;;IAAA;;IAAA;;IACD,KAAKQ,sBAAL,GAA8BR,MAAM,CAACQ,sBAArC;IACA,KAAKC,wBAAL,GAAgCT,MAAM,CAACS,wBAAvC;IACA,KAAKC,uBAAL,GAA+BV,MAAM,CAACU,uBAAtC;IACA,KAAKC,yBAAL,GAAiCX,MAAM,CAACW,yBAAxC;EACD;;AAhC+B"}
|
|
@@ -9,22 +9,79 @@ var _reactNative = require("react-native");
|
|
|
9
9
|
|
|
10
10
|
var _interfaces = require("../../interfaces");
|
|
11
11
|
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
|
|
12
14
|
const {
|
|
13
|
-
RNPayEngineNative
|
|
15
|
+
RNPayEngineNative,
|
|
16
|
+
RNPEEventEmitter
|
|
14
17
|
} = _reactNative.NativeModules;
|
|
18
|
+
/**
|
|
19
|
+
* Represents an access token used for authenticating with the PayEngine SDK.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* The access token contains the actual token string and the duration (in seconds)
|
|
23
|
+
* for which the token remains valid. This is typically retrieved from your backend
|
|
24
|
+
* and used for making authenticated requests.
|
|
25
|
+
*
|
|
26
|
+
* @property accessToken - The access token string.
|
|
27
|
+
* @property expiresIn - The time (in seconds) until the token expires.
|
|
28
|
+
*
|
|
29
|
+
* @category PayEngine
|
|
30
|
+
*/
|
|
15
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Provides an interface for interacting with the native PayEngine SDK.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* `PayEngineNative` acts as a bridge between your React Native JavaScript code and
|
|
37
|
+
* the native PayEngine SDKs on iOS and Android. It utilizes React Native's
|
|
38
|
+
* Native Modules and platform channels to enable core payment functionalities.
|
|
39
|
+
*
|
|
40
|
+
* These include:
|
|
41
|
+
* - Fraud monitoring
|
|
42
|
+
* - Browser/device info retrieval
|
|
43
|
+
* - Support detection for Apple Pay and Google Pay
|
|
44
|
+
*
|
|
45
|
+
*
|
|
46
|
+
* @category PayEngine
|
|
47
|
+
*/
|
|
16
48
|
class PayEngineNative {
|
|
49
|
+
constructor() {}
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves a fraud monitoring session ID from the native PayEngine SDK.
|
|
52
|
+
*
|
|
53
|
+
*
|
|
54
|
+
* @param merchantId - The unique identifier for the merchant.
|
|
55
|
+
* @returns A `Promise<string>` containing the fraud monitoring session ID.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
|
|
17
59
|
static async createFraudMonitorSession(merchantId) {
|
|
18
60
|
return RNPayEngineNative.createFraudMonitorSession(merchantId);
|
|
19
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Retrieves browser-related information from the native PayEngine SDK.
|
|
64
|
+
*
|
|
65
|
+
* @returns A `Promise<string>` containing browser and device details.
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
|
|
20
69
|
|
|
21
70
|
static async getBrowserInfo() {
|
|
22
71
|
return RNPayEngineNative.getBrowserInfo();
|
|
23
72
|
}
|
|
24
73
|
/**
|
|
25
|
-
* @deprecated
|
|
26
|
-
*
|
|
27
|
-
*
|
|
74
|
+
* @deprecated Use {@link PayEngineNative.userCanPay} instead.
|
|
75
|
+
*
|
|
76
|
+
* Checks if platform-native payments (Apple Pay or Google Pay) are supported on the current device.
|
|
77
|
+
*
|
|
78
|
+
* @remarks
|
|
79
|
+
* This method has been deprecated in favor of {@link PayEngineNative.userCanPay}, which allows specifying
|
|
80
|
+
* the payment provider explicitly.
|
|
81
|
+
*
|
|
82
|
+
* @param merchantId - The unique identifier for the merchant.
|
|
83
|
+
* @returns A `Promise<boolean>` indicating whether the platform-specific payment method is supported.
|
|
84
|
+
*
|
|
28
85
|
*/
|
|
29
86
|
|
|
30
87
|
|
|
@@ -37,6 +94,22 @@ class PayEngineNative {
|
|
|
37
94
|
|
|
38
95
|
return false;
|
|
39
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Checks if the user can make payments using Apple Pay (iOS) or Google Pay (Android).
|
|
99
|
+
*
|
|
100
|
+
* @remarks
|
|
101
|
+
* This method verifies whether the current device and platform support the selected payment provider.
|
|
102
|
+
* It performs a platform-specific check using the native PayEngine SDK for either Apple Pay or Google Pay.
|
|
103
|
+
*
|
|
104
|
+
* ## Supported Providers
|
|
105
|
+
* - `PayProvider.googlePay` (Android only)
|
|
106
|
+
* - `PayProvider.applePay` (iOS only)
|
|
107
|
+
*
|
|
108
|
+
* @param provider - The payment provider to check support for.
|
|
109
|
+
* @param merchantId - The unique identifier for the merchant.
|
|
110
|
+
* @returns A `Promise<boolean>` indicating whether the selected payment method is supported.
|
|
111
|
+
*/
|
|
112
|
+
|
|
40
113
|
|
|
41
114
|
static async userCanPay(provider, merchantId) {
|
|
42
115
|
if (provider == _interfaces.PayProvider.applePay && _reactNative.Platform.OS == 'ios') {
|
|
@@ -47,8 +120,113 @@ class PayEngineNative {
|
|
|
47
120
|
|
|
48
121
|
return false;
|
|
49
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Sets the callback function that provides an access token when required by PayEngine.
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* When the PayEngine SDK needs an access token, it will call this callback function
|
|
128
|
+
* to request the host application to fetch a new token from its backend.
|
|
129
|
+
*
|
|
130
|
+
* The SDK uses this token internally to make calls to merchant related APIs which require merchant's credentials.
|
|
131
|
+
*
|
|
132
|
+
* ## Important:
|
|
133
|
+
* - PayEngine will invoke this callback **whenever an access token is needed or needs to be refreshed**.
|
|
134
|
+
* - The integrator must ensure that the token retrieval logic is secure and efficient in their backend.
|
|
135
|
+
* - For more details on how to retrieve the access token from Payengine, refer to the official documentation:
|
|
136
|
+
* [PayEngine Merchant Session](https://docs.payengine.co/merchant-session#obtaining-a-new-merchant-session)
|
|
137
|
+
*
|
|
138
|
+
* ## Example Usage
|
|
139
|
+
* ```ts
|
|
140
|
+
* const fetchAccessToken = async (): Promise<AccessToken> => {
|
|
141
|
+
* try {
|
|
142
|
+
* // Make a network request to your server to fetch the token
|
|
143
|
+
* // Your server then makes a request to Payengine securely and returns the results back in response
|
|
144
|
+
* const response = await fetch("https://yourserver.com/accessToken");
|
|
145
|
+
*
|
|
146
|
+
* if (!response.ok) {
|
|
147
|
+
* throw new Error(`Server responded with status ${response.status}`);
|
|
148
|
+
* }
|
|
149
|
+
*
|
|
150
|
+
* const data = await response.json();
|
|
151
|
+
*
|
|
152
|
+
* // Extract the token and expiration from your server's response
|
|
153
|
+
* const token = data.access_token;
|
|
154
|
+
* const expiresIn = data.expires_in;
|
|
155
|
+
*
|
|
156
|
+
* return { accessToken: token, expiresIn };
|
|
157
|
+
* } catch (e) {
|
|
158
|
+
* throw new Error("Failed to fetch access token: " + e);
|
|
159
|
+
* }
|
|
160
|
+
* };
|
|
161
|
+
*
|
|
162
|
+
* // This is where you supply the callback to the SDK
|
|
163
|
+
* PayEngineNative.setFetchAccessTokenCallback(fetchAccessToken);
|
|
164
|
+
* ```
|
|
165
|
+
*
|
|
166
|
+
* @param callback - A function that returns a `Promise<AccessToken>`. The function must handle
|
|
167
|
+
* errors properly in case token retrieval fails.
|
|
168
|
+
*/
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
static async setFetchAccessTokenCallback(callback) {
|
|
172
|
+
PayEngineNative.fetchAccessTokenCallback = callback;
|
|
173
|
+
|
|
174
|
+
if (!PayEngineNative.isFetchCallbackListenerRegistered) {
|
|
175
|
+
PayEngineNative.emitter.addListener("fetchAccessToken", async () => {
|
|
176
|
+
try {
|
|
177
|
+
const result = await PayEngineNative.fetchAccessTokenCallback();
|
|
178
|
+
RNPayEngineNative.provideFetchAccessTokenResult(result);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
RNPayEngineNative.provideFetchAccessTokenResult(null);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
PayEngineNative.isFetchCallbackListenerRegistered = true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
RNPayEngineNative.configureFetchAccessTokenCallback();
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Logs out the current merchant by invalidating the access token.
|
|
190
|
+
*
|
|
191
|
+
* @remarks
|
|
192
|
+
* While access tokens automatically expire, it's **strongly recommended** to explicitly invalidate
|
|
193
|
+
* them when a merchant's session ends on the server.
|
|
194
|
+
*
|
|
195
|
+
* Relying solely on token expiration can introduce **security vulnerabilities**
|
|
196
|
+
* and result in a **suboptimal user experience**.
|
|
197
|
+
*
|
|
198
|
+
* Calling this method ensures that the merchant's session is terminated,
|
|
199
|
+
* preventing any further authenticated requests until a new login is performed.
|
|
200
|
+
*
|
|
201
|
+
* For more details, refer to the official documentation:
|
|
202
|
+
* [PayEngine Merchant Session](https://docs.payengine.co/merchant-session)
|
|
203
|
+
*
|
|
204
|
+
* ## Example Usage
|
|
205
|
+
* ```ts
|
|
206
|
+
* const merchantId = "your_merchant_id_here";
|
|
207
|
+
* await PayEngineNative.logout(merchantId);
|
|
208
|
+
* console.log("Merchant session terminated.");
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* This ensures that no further authenticated requests can be made
|
|
212
|
+
* until a new access token is fetched.
|
|
213
|
+
*
|
|
214
|
+
* @param merchantId - The unique identifier of the merchant whose session should be invalidated.
|
|
215
|
+
* @returns A `Promise` indicating the completion of the logout process.
|
|
216
|
+
*/
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
static async logout(merchantId) {
|
|
220
|
+
return RNPayEngineNative.logout(merchantId);
|
|
221
|
+
}
|
|
50
222
|
|
|
51
223
|
}
|
|
52
224
|
|
|
53
225
|
exports.default = PayEngineNative;
|
|
226
|
+
|
|
227
|
+
_defineProperty(PayEngineNative, "emitter", new _reactNative.NativeEventEmitter(RNPEEventEmitter));
|
|
228
|
+
|
|
229
|
+
_defineProperty(PayEngineNative, "isFetchCallbackListenerRegistered", false);
|
|
230
|
+
|
|
231
|
+
_defineProperty(PayEngineNative, "fetchAccessTokenCallback", null);
|
|
54
232
|
//# sourceMappingURL=PayEngineNative.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPayEngineNative","NativeModules","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","Platform","OS","isApplePaySupported","isGooglePaySupported","userCanPay","provider","PayProvider","applePay","googlePay"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\nimport { PayProvider } from \"../../interfaces\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nexport default class PayEngineNative {\n static async createFraudMonitorSession(merchantId: string) { \n return RNPayEngineNative.createFraudMonitorSession(merchantId);\n }\n\n static async getBrowserInfo() {\n return RNPayEngineNative.getBrowserInfo();\n }\n\n /**\n * @deprecated use userCanPay instead\n * @param merchantId \n * @returns \n */\n static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (Platform.OS === 'android') {\n return await RNPayEngineNative.isGooglePaySupported(merchantId);\n }\n return false;\n }\n\n static async userCanPay(provider: PayProvider, merchantId: string) {\n if (provider == PayProvider.applePay && Platform.OS == 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (provider === PayProvider.googlePay && Platform.OS === 'android') {\n return await RNPayEngineNative.isGooglePaySupported(merchantId);\n }\n return false;\n }\n}"],"mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAM;EAAEA;AAAF,IAAwBC,0BAA9B;;AAEe,MAAMC,eAAN,CAAsB;EACG,aAAzBC,yBAAyB,CAACC,UAAD,EAAqB;IACzD,OAAOJ,iBAAiB,CAACG,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;;EAE0B,aAAdC,cAAc,GAAG;IAC5B,OAAOL,iBAAiB,CAACK,cAAlB,EAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACqC,aAAtBC,sBAAsB,CAACF,UAAD,EAAqB;IACtD,IAAIG,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMR,iBAAiB,CAACS,mBAAlB,CAAsCL,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIG,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;MACpC,OAAO,MAAMR,iBAAiB,CAACU,oBAAlB,CAAuCN,UAAvC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;;EAEsB,aAAVO,UAAU,CAACC,QAAD,EAAwBR,UAAxB,EAA4C;IACjE,IAAIQ,QAAQ,IAAIC,uBAAA,CAAYC,QAAxB,IAAoCP,qBAAA,CAASC,EAAT,IAAe,KAAvD,EAA8D;MAC5D,OAAO,MAAMR,iBAAiB,CAACS,mBAAlB,CAAsCL,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIQ,QAAQ,KAAKC,uBAAA,CAAYE,SAAzB,IAAsCR,qBAAA,CAASC,EAAT,KAAgB,SAA1D,EAAqE;MAC1E,OAAO,MAAMR,iBAAiB,CAACU,oBAAlB,CAAuCN,UAAvC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;;AA9BkC"}
|
|
1
|
+
{"version":3,"names":["RNPayEngineNative","RNPEEventEmitter","NativeModules","PayEngineNative","constructor","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","Platform","OS","isApplePaySupported","isGooglePaySupported","userCanPay","provider","PayProvider","applePay","googlePay","setFetchAccessTokenCallback","callback","fetchAccessTokenCallback","isFetchCallbackListenerRegistered","emitter","addListener","result","provideFetchAccessTokenResult","error","configureFetchAccessTokenCallback","logout","NativeEventEmitter"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeEventEmitter, NativeModules, Platform } from \"react-native\";\nimport { PayProvider } from \"../../interfaces\";\n\nconst { RNPayEngineNative, RNPEEventEmitter } = NativeModules;\n\n/**\n * Represents an access token used for authenticating with the PayEngine SDK.\n *\n * @remarks\n * The access token contains the actual token string and the duration (in seconds)\n * for which the token remains valid. This is typically retrieved from your backend\n * and used for making authenticated requests.\n *\n * @property accessToken - The access token string.\n * @property expiresIn - The time (in seconds) until the token expires.\n * \n * @category PayEngine\n */\nexport type AccessToken = {\n accessToken: string;\n expiresIn: number;\n};\n\n/**\n * A callback function that provides an access token to the PayEngine SDK.\n *\n * @returns A promise resolving to a valid {@link AccessToken}.\n * \n * @category PayEngine\n */\nexport type FetchAccessTokenCallback = () => Promise<AccessToken>;\n\n/**\n * Provides an interface for interacting with the native PayEngine SDK.\n *\n * @remarks\n * `PayEngineNative` acts as a bridge between your React Native JavaScript code and\n * the native PayEngine SDKs on iOS and Android. It utilizes React Native's\n * Native Modules and platform channels to enable core payment functionalities.\n *\n * These include:\n * - Fraud monitoring\n * - Browser/device info retrieval\n * - Support detection for Apple Pay and Google Pay\n *\n *\n * @category PayEngine\n */\nexport default class PayEngineNative {\n private static emitter = new NativeEventEmitter(RNPEEventEmitter);\n\n private static isFetchCallbackListenerRegistered = false;\n\n private static fetchAccessTokenCallback: FetchAccessTokenCallback | null = null;\n\n\n private constructor() { }\n\n /**\n * Retrieves a fraud monitoring session ID from the native PayEngine SDK.\n *\n *\n * @param merchantId - The unique identifier for the merchant.\n * @returns A `Promise<string>` containing the fraud monitoring session ID.\n */\n static async createFraudMonitorSession(merchantId: string): Promise<string> {\n return RNPayEngineNative.createFraudMonitorSession(merchantId);\n }\n\n /**\n * Retrieves browser-related information from the native PayEngine SDK.\n *\n * @returns A `Promise<string>` containing browser and device details.\n *\n */\n static async getBrowserInfo(): Promise<string> {\n return RNPayEngineNative.getBrowserInfo();\n }\n\n /**\n * @deprecated Use {@link PayEngineNative.userCanPay} instead.\n *\n * Checks if platform-native payments (Apple Pay or Google Pay) are supported on the current device.\n *\n * @remarks\n * This method has been deprecated in favor of {@link PayEngineNative.userCanPay}, which allows specifying\n * the payment provider explicitly.\n *\n * @param merchantId - The unique identifier for the merchant.\n * @returns A `Promise<boolean>` indicating whether the platform-specific payment method is supported.\n *\n */\n static async isPlatformPaySupported(merchantId: string): Promise<boolean> {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (Platform.OS === 'android') {\n return await RNPayEngineNative.isGooglePaySupported(merchantId);\n }\n return false;\n }\n\n /**\n * Checks if the user can make payments using Apple Pay (iOS) or Google Pay (Android).\n *\n * @remarks\n * This method verifies whether the current device and platform support the selected payment provider.\n * It performs a platform-specific check using the native PayEngine SDK for either Apple Pay or Google Pay.\n *\n * ## Supported Providers\n * - `PayProvider.googlePay` (Android only)\n * - `PayProvider.applePay` (iOS only)\n *\n * @param provider - The payment provider to check support for.\n * @param merchantId - The unique identifier for the merchant.\n * @returns A `Promise<boolean>` indicating whether the selected payment method is supported.\n */\n static async userCanPay(provider: PayProvider, merchantId: string): Promise<boolean> {\n if (provider == PayProvider.applePay && Platform.OS == 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (provider === PayProvider.googlePay && Platform.OS === 'android') {\n return await RNPayEngineNative.isGooglePaySupported(merchantId);\n }\n return false;\n }\n\n\n /**\n * Sets the callback function that provides an access token when required by PayEngine.\n *\n * @remarks\n * When the PayEngine SDK needs an access token, it will call this callback function\n * to request the host application to fetch a new token from its backend.\n * \n * The SDK uses this token internally to make calls to merchant related APIs which require merchant's credentials.\n *\n * ## Important:\n * - PayEngine will invoke this callback **whenever an access token is needed or needs to be refreshed**.\n * - The integrator must ensure that the token retrieval logic is secure and efficient in their backend.\n * - For more details on how to retrieve the access token from Payengine, refer to the official documentation:\n * [PayEngine Merchant Session](https://docs.payengine.co/merchant-session#obtaining-a-new-merchant-session)\n *\n * ## Example Usage\n * ```ts\n * const fetchAccessToken = async (): Promise<AccessToken> => {\n * try {\n * // Make a network request to your server to fetch the token\n * // Your server then makes a request to Payengine securely and returns the results back in response\n * const response = await fetch(\"https://yourserver.com/accessToken\");\n * \n * if (!response.ok) {\n * throw new Error(`Server responded with status ${response.status}`);\n * }\n * \n * const data = await response.json();\n * \n * // Extract the token and expiration from your server's response\n * const token = data.access_token;\n * const expiresIn = data.expires_in;\n *\n * return { accessToken: token, expiresIn };\n * } catch (e) {\n * throw new Error(\"Failed to fetch access token: \" + e);\n * }\n * };\n * \n * // This is where you supply the callback to the SDK\n * PayEngineNative.setFetchAccessTokenCallback(fetchAccessToken);\n * ```\n *\n * @param callback - A function that returns a `Promise<AccessToken>`. The function must handle\n * errors properly in case token retrieval fails.\n */\n static async setFetchAccessTokenCallback(callback: FetchAccessTokenCallback) {\n PayEngineNative.fetchAccessTokenCallback = callback;\n\n if (!PayEngineNative.isFetchCallbackListenerRegistered) {\n PayEngineNative.emitter.addListener(\"fetchAccessToken\", async () => {\n try {\n const result = await PayEngineNative.fetchAccessTokenCallback!();\n RNPayEngineNative.provideFetchAccessTokenResult(result);\n } catch (error) {\n RNPayEngineNative.provideFetchAccessTokenResult(null);\n }\n });\n PayEngineNative.isFetchCallbackListenerRegistered = true;\n }\n\n\n RNPayEngineNative.configureFetchAccessTokenCallback();\n }\n\n /**\n * Logs out the current merchant by invalidating the access token.\n *\n * @remarks\n * While access tokens automatically expire, it's **strongly recommended** to explicitly invalidate\n * them when a merchant's session ends on the server.\n *\n * Relying solely on token expiration can introduce **security vulnerabilities** \n * and result in a **suboptimal user experience**.\n *\n * Calling this method ensures that the merchant's session is terminated, \n * preventing any further authenticated requests until a new login is performed.\n *\n * For more details, refer to the official documentation: \n * [PayEngine Merchant Session](https://docs.payengine.co/merchant-session)\n *\n * ## Example Usage\n * ```ts\n * const merchantId = \"your_merchant_id_here\";\n * await PayEngineNative.logout(merchantId);\n * console.log(\"Merchant session terminated.\");\n * ```\n *\n * This ensures that no further authenticated requests can be made\n * until a new access token is fetched.\n *\n * @param merchantId - The unique identifier of the merchant whose session should be invalidated.\n * @returns A `Promise` indicating the completion of the logout process.\n */\n static async logout(merchantId: string): Promise<void> {\n return RNPayEngineNative.logout(merchantId);\n }\n}"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,MAAM;EAAEA,iBAAF;EAAqBC;AAArB,IAA0CC,0BAAhD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMC,eAAN,CAAsB;EAQ3BC,WAAW,GAAG,CAAG;EAEzB;AACF;AACA;AACA;AACA;AACA;AACA;;;EACwC,aAAzBC,yBAAyB,CAACC,UAAD,EAAsC;IAC1E,OAAON,iBAAiB,CAACK,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;;;EAC6B,aAAdC,cAAc,GAAoB;IAC7C,OAAOP,iBAAiB,CAACO,cAAlB,EAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACqC,aAAtBC,sBAAsB,CAACF,UAAD,EAAuC;IACxE,IAAIG,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMV,iBAAiB,CAACW,mBAAlB,CAAsCL,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIG,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;MACpC,OAAO,MAAMV,iBAAiB,CAACY,oBAAlB,CAAuCN,UAAvC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACyB,aAAVO,UAAU,CAACC,QAAD,EAAwBR,UAAxB,EAA8D;IACnF,IAAIQ,QAAQ,IAAIC,uBAAA,CAAYC,QAAxB,IAAoCP,qBAAA,CAASC,EAAT,IAAe,KAAvD,EAA8D;MAC5D,OAAO,MAAMV,iBAAiB,CAACW,mBAAlB,CAAsCL,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIQ,QAAQ,KAAKC,uBAAA,CAAYE,SAAzB,IAAsCR,qBAAA,CAASC,EAAT,KAAgB,SAA1D,EAAqE;MAC1E,OAAO,MAAMV,iBAAiB,CAACY,oBAAlB,CAAuCN,UAAvC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;EAGD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EAC0C,aAA3BY,2BAA2B,CAACC,QAAD,EAAqC;IAC3EhB,eAAe,CAACiB,wBAAhB,GAA2CD,QAA3C;;IAEA,IAAI,CAAChB,eAAe,CAACkB,iCAArB,EAAwD;MACtDlB,eAAe,CAACmB,OAAhB,CAAwBC,WAAxB,CAAoC,kBAApC,EAAwD,YAAY;QAClE,IAAI;UACF,MAAMC,MAAM,GAAG,MAAMrB,eAAe,CAACiB,wBAAhB,EAArB;UACApB,iBAAiB,CAACyB,6BAAlB,CAAgDD,MAAhD;QACD,CAHD,CAGE,OAAOE,KAAP,EAAc;UACd1B,iBAAiB,CAACyB,6BAAlB,CAAgD,IAAhD;QACD;MACF,CAPD;MAQAtB,eAAe,CAACkB,iCAAhB,GAAoD,IAApD;IACD;;IAGDrB,iBAAiB,CAAC2B,iCAAlB;EACD;EAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;EACqB,aAANC,MAAM,CAACtB,UAAD,EAAoC;IACrD,OAAON,iBAAiB,CAAC4B,MAAlB,CAAyBtB,UAAzB,CAAP;EACD;;AA9KkC;;;;gBAAhBH,e,aACM,IAAI0B,+BAAJ,CAAuB5B,gBAAvB,C;;gBADNE,e,uCAGgC,K;;gBAHhCA,e,8BAKwD,I"}
|
|
@@ -17,6 +17,58 @@ const {
|
|
|
17
17
|
RNPayEngineNative
|
|
18
18
|
} = _reactNative.NativeModules;
|
|
19
19
|
const PayEngineContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
20
|
+
/**
|
|
21
|
+
* A provider that initializes and manages PayEngine's configuration across the app.
|
|
22
|
+
*
|
|
23
|
+
* `PayEngineProvider` ensures that PayEngine's SDK is properly set up by loading
|
|
24
|
+
* the necessary configurations before rendering the app. It must wrap the root widget
|
|
25
|
+
* for the payment functionalities to work correctly.
|
|
26
|
+
*
|
|
27
|
+
* ## Usage
|
|
28
|
+
*
|
|
29
|
+
* Before using PayEngine in your application, wrap your app inside [PayEngineProvider]
|
|
30
|
+
* and pass an `IPayEngineConfig` instance containing your public key, script URL, and optional log level.
|
|
31
|
+
*
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const PE_CONFIG: IPayEngineConfig = {
|
|
34
|
+
* publicKey: PUBLIC_KEY,
|
|
35
|
+
* scriptURL: "https://staging-sandbox.payengine.dev/",
|
|
36
|
+
* logLevel: 1,
|
|
37
|
+
* };
|
|
38
|
+
*
|
|
39
|
+
* return (
|
|
40
|
+
* <PayEngineProvider config={PE_CONFIG}>
|
|
41
|
+
* <NavigationContainer>
|
|
42
|
+
* <DrawerNavigator />
|
|
43
|
+
* </NavigationContainer>
|
|
44
|
+
* </PayEngineProvider>
|
|
45
|
+
* );
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* ## How It Works
|
|
49
|
+
*
|
|
50
|
+
* 1. The `PayEngineProvider` component accepts a configuration object (`IPayEngineConfig`) containing
|
|
51
|
+
* the `publicKey`, `scriptURL`, and `logLevel`.
|
|
52
|
+
* 2. It initializes the PayEngine SDK with the `publicKey`
|
|
53
|
+
* and `scriptURL` from the configuration.
|
|
54
|
+
* 3. The provider uses the `React.useEffect` hook to ensure that the configuration is set up
|
|
55
|
+
* before rendering the children.
|
|
56
|
+
* 4. While loading the configuration, an `ActivityIndicator` is displayed. Once the SDK is set up,
|
|
57
|
+
* it renders the provided child components.
|
|
58
|
+
*
|
|
59
|
+
* ## Properties:
|
|
60
|
+
*
|
|
61
|
+
* - **`config`**: The configuration required for PayEngine (type: `IPayEngineConfig`).
|
|
62
|
+
* - `publicKey`: The public key for authentication.
|
|
63
|
+
* - `scriptURL`: The URL for the PayEngine script.
|
|
64
|
+
* - `logLevel`: The log level for debugging (optional).
|
|
65
|
+
*
|
|
66
|
+
* - **`children`**: The child components or widgets to be rendered after PayEngine is initialized.
|
|
67
|
+
*
|
|
68
|
+
*
|
|
69
|
+
* @category SecureFields
|
|
70
|
+
*/
|
|
71
|
+
|
|
20
72
|
exports.PayEngineContext = PayEngineContext;
|
|
21
73
|
|
|
22
74
|
const PayEngineProvider = _ref => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPayEngineNative","NativeModules","PayEngineContext","createContext","undefined","PayEngineProvider","config","children","loading","setLoading","React","useState","useEffect","setConfig","publicKey","scriptURL","Error"],"sources":["PayEngineProvider.tsx"],"sourcesContent":["import React, { createContext } from \"react\";\nimport type { IPayEngineConfig } from \"../../interfaces\";\nimport { ActivityIndicator, NativeModules } from \"react-native\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nconst PayEngineContext = createContext<IPayEngineConfig | undefined>(undefined);\n\nconst PayEngineProvider = ({ config, children }: { config: IPayEngineConfig, children: React.ReactNode }) => {\n const [loading, setLoading] = React.useState(true);\n\n React.useEffect(() => {\n setLoading(true);\n RNPayEngineNative.setConfig(config.publicKey, config.scriptURL)\n setLoading(false);\n }, [config]);\n\n if (!config) {\n throw new Error('PayEngineProvider: config is required');\n }\n\n return <PayEngineContext.Provider value={config}>\n {loading ? <ActivityIndicator /> : children}\n </PayEngineContext.Provider>\n}
|
|
1
|
+
{"version":3,"names":["RNPayEngineNative","NativeModules","PayEngineContext","createContext","undefined","PayEngineProvider","config","children","loading","setLoading","React","useState","useEffect","setConfig","publicKey","scriptURL","Error"],"sources":["PayEngineProvider.tsx"],"sourcesContent":["import React, { createContext } from \"react\";\nimport type { IPayEngineConfig } from \"../../interfaces\";\nimport { ActivityIndicator, NativeModules } from \"react-native\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nconst PayEngineContext = createContext<IPayEngineConfig | undefined>(undefined);\n\n/**\n * A provider that initializes and manages PayEngine's configuration across the app.\n *\n * `PayEngineProvider` ensures that PayEngine's SDK is properly set up by loading\n * the necessary configurations before rendering the app. It must wrap the root widget\n * for the payment functionalities to work correctly.\n *\n * ## Usage\n *\n * Before using PayEngine in your application, wrap your app inside [PayEngineProvider]\n * and pass an `IPayEngineConfig` instance containing your public key, script URL, and optional log level.\n *\n * ```tsx\n * const PE_CONFIG: IPayEngineConfig = {\n * publicKey: PUBLIC_KEY,\n * scriptURL: \"https://staging-sandbox.payengine.dev/\",\n * logLevel: 1,\n * };\n *\n * return (\n * <PayEngineProvider config={PE_CONFIG}>\n * <NavigationContainer>\n * <DrawerNavigator />\n * </NavigationContainer>\n * </PayEngineProvider>\n * );\n * ```\n *\n * ## How It Works\n *\n * 1. The `PayEngineProvider` component accepts a configuration object (`IPayEngineConfig`) containing \n * the `publicKey`, `scriptURL`, and `logLevel`.\n * 2. It initializes the PayEngine SDK with the `publicKey` \n * and `scriptURL` from the configuration.\n * 3. The provider uses the `React.useEffect` hook to ensure that the configuration is set up \n * before rendering the children.\n * 4. While loading the configuration, an `ActivityIndicator` is displayed. Once the SDK is set up, \n * it renders the provided child components.\n *\n * ## Properties:\n *\n * - **`config`**: The configuration required for PayEngine (type: `IPayEngineConfig`).\n * - `publicKey`: The public key for authentication.\n * - `scriptURL`: The URL for the PayEngine script.\n * - `logLevel`: The log level for debugging (optional).\n *\n * - **`children`**: The child components or widgets to be rendered after PayEngine is initialized.\n *\n *\n * @category SecureFields\n */\nconst PayEngineProvider = ({ config, children }: { config: IPayEngineConfig, children: React.ReactNode }) => {\n const [loading, setLoading] = React.useState(true);\n\n React.useEffect(() => {\n setLoading(true);\n RNPayEngineNative.setConfig(config.publicKey, config.scriptURL)\n setLoading(false);\n }, [config]);\n\n if (!config) {\n throw new Error('PayEngineProvider: config is required');\n }\n\n return <PayEngineContext.Provider value={config}>\n {loading ? <ActivityIndicator /> : children}\n </PayEngineContext.Provider>\n};\n\nexport {\n PayEngineContext,\n PayEngineProvider\n};"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;AAEA,MAAM;EAAEA;AAAF,IAAwBC,0BAA9B;AAEA,MAAMC,gBAAgB,gBAAG,IAAAC,oBAAA,EAA4CC,SAA5C,CAAzB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,MAAMC,iBAAiB,GAAG,QAAmF;EAAA,IAAlF;IAAEC,MAAF;IAAUC;EAAV,CAAkF;;EAC3G,MAAM,CAACC,OAAD,EAAUC,UAAV,IAAwBC,cAAA,CAAMC,QAAN,CAAe,IAAf,CAA9B;;EAEAD,cAAA,CAAME,SAAN,CAAgB,MAAM;IACpBH,UAAU,CAAC,IAAD,CAAV;IACAT,iBAAiB,CAACa,SAAlB,CAA4BP,MAAM,CAACQ,SAAnC,EAA8CR,MAAM,CAACS,SAArD;IACAN,UAAU,CAAC,KAAD,CAAV;EACD,CAJD,EAIG,CAACH,MAAD,CAJH;;EAMA,IAAI,CAACA,MAAL,EAAa;IACX,MAAM,IAAIU,KAAJ,CAAU,uCAAV,CAAN;EACD;;EAED,oBAAO,6BAAC,gBAAD,CAAkB,QAAlB;IAA2B,KAAK,EAAEV;EAAlC,GACJE,OAAO,gBAAG,6BAAC,8BAAD,OAAH,GAA2BD,QAD9B,CAAP;AAGD,CAhBD"}
|
|
@@ -21,6 +21,77 @@ const RNPEBankAccountView = (0, _reactNative.requireNativeComponent)(COMPONENT_N
|
|
|
21
21
|
|
|
22
22
|
const RNPEBankAccountViewManager = _reactNative.UIManager[COMPONENT_NAME];
|
|
23
23
|
const peEventEmitter = new _reactNative.NativeEventEmitter(RNPEEventEmitter);
|
|
24
|
+
/**
|
|
25
|
+
* Props for the `PEBankAccountView` component.
|
|
26
|
+
*
|
|
27
|
+
* Allows optional configuration of additional input fields that can be rendered
|
|
28
|
+
* alongside the standard bank account fields.
|
|
29
|
+
*
|
|
30
|
+
* These fields can be used to collect extra information such as account holder type,
|
|
31
|
+
* billing address, or custom metadata required by the merchant.
|
|
32
|
+
*
|
|
33
|
+
* @category SecureFields
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const fields: IPEField[] = [
|
|
38
|
+
* {
|
|
39
|
+
* name: "accountHolderType",
|
|
40
|
+
* type: "text",
|
|
41
|
+
* placeholder: "Account Holder Type",
|
|
42
|
+
* keyboardType: PEKeyboardType.Alphabet,
|
|
43
|
+
* isRequired: false
|
|
44
|
+
* }
|
|
45
|
+
* ];
|
|
46
|
+
*
|
|
47
|
+
* <PEBankAccountView additionalFields={fields} />
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A secure form widget for entering a customer's bank account information.
|
|
53
|
+
*
|
|
54
|
+
* [PEBankAccountView] provides a UI component for securely collecting bank account details.
|
|
55
|
+
* It does not store data locally and instead tokenizes the information using PayEngine.
|
|
56
|
+
*
|
|
57
|
+
* ## Features:
|
|
58
|
+
* - Securely collects bank account details.
|
|
59
|
+
* - Supports additional customizable fields.
|
|
60
|
+
* - Provides methods to show/hide the keyboard.
|
|
61
|
+
* - Allows tokenizing the entered data for safe storage.
|
|
62
|
+
*
|
|
63
|
+
* ## Usage Example:
|
|
64
|
+
*
|
|
65
|
+
* ```tsx
|
|
66
|
+
* const formRef = React.createRef<PEBankAccountViewMethods>();
|
|
67
|
+
*
|
|
68
|
+
* return (
|
|
69
|
+
* <View style={styles.container}>
|
|
70
|
+
* <Text>Welcome to PayEngine React Native SDK example</Text>
|
|
71
|
+
* <View style={{ width: '100%' }}>
|
|
72
|
+
* <PEBankAccountView ref={formRef} />
|
|
73
|
+
* <Button disabled={submitting} onPress={() => createBankAccount()} title="Create Bank Account" />
|
|
74
|
+
* </View>
|
|
75
|
+
* <ScrollView style={{ flex: 1, width: '100%', backgroundColor: 'lightyellow', padding: 10, marginVertical: 20 }}>
|
|
76
|
+
* <Text>{JSON.stringify(secureFieldsResult, null, 4)}</Text>
|
|
77
|
+
* </ScrollView>
|
|
78
|
+
* </View>
|
|
79
|
+
* );
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* ## How It Works:
|
|
83
|
+
* 1. Create an instance of [PEBankAccountView], optionally passing additional fields.
|
|
84
|
+
* 2. Display the form inside your widget tree.
|
|
85
|
+
* 3. Use [showKeyboard] and [hideKeyboard] to manage input focus.
|
|
86
|
+
* 4. Call [submit] to securely send the bank account data and receive a token.
|
|
87
|
+
*
|
|
88
|
+
* ## Methods:
|
|
89
|
+
* - **`showKeyboard()`**: Manually shows the on-screen keyboard.
|
|
90
|
+
* - **`hideKeyboard()`**: Hides the on-screen keyboard.
|
|
91
|
+
* - **`submit()`**: Submits the entered data and retrieves a tokenized version of the bank account data.
|
|
92
|
+
*
|
|
93
|
+
* @category SecureFields
|
|
94
|
+
*/
|
|
24
95
|
const PEBankAccountView = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
25
96
|
const formRef = React.useRef();
|
|
26
97
|
const [height, setHeight] = React.useState(0);
|