react-native-payengine 2.0.9 → 2.0.10
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/android/build.gradle +2 -2
- package/android/payment-sdk-debug-1.0.4.aar +0 -0
- package/android/payment-sdk-release-1.0.4.aar +0 -0
- package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +21 -0
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButton.kt +26 -35
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +2 -1
- 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 +187 -38
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +1 -1
- 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_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +4 -2
- 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 +187 -38
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +187 -38
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +1 -1
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +1 -1
- 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/Sources/Classes/ApplePay/RNPEApplePayButton.swift +75 -9
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +11 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayContact.js +2 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayContact.js.map +1 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js +2 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +9 -3
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/PayEngineNative.js +19 -1
- package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
- package/lib/commonjs/index.js +8 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/interfaces/index.js +12 -0
- package/lib/commonjs/interfaces/index.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js +11 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayContact.js +2 -0
- package/lib/module/components/v2/ApplePay/PEApplePayContact.js.map +1 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js +2 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayAddress.js.map +1 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +9 -3
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/module/components/v2/PayEngineNative.js +18 -1
- package/lib/module/components/v2/PayEngineNative.js.map +1 -1
- package/lib/module/index.js +2 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/interfaces/index.js +5 -0
- package/lib/module/interfaces/index.js.map +1 -1
- package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +2 -1
- package/lib/typescript/components/v2/ApplePay/PEApplePayContact.d.ts +14 -0
- package/lib/typescript/components/v2/GooglePay/PEGooglePayAddress.d.ts +11 -0
- package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +2 -1
- package/lib/typescript/components/v2/PayEngineNative.d.ts +7 -0
- package/lib/typescript/index.d.ts +4 -1
- package/lib/typescript/interfaces/index.d.ts +4 -0
- package/package.json +1 -1
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +13 -3
- package/src/components/v2/ApplePay/PEApplePayContact.ts +14 -0
- package/src/components/v2/GooglePay/PEGooglePayAddress.ts +11 -0
- package/src/components/v2/GooglePay/PEGooglePayButton.tsx +9 -4
- package/src/components/v2/PayEngineNative.tsx +16 -1
- package/src/index.tsx +6 -2
- package/src/interfaces/index.ts +5 -0
- package/android/payment-sdk-debug-1.0.3.aar +0 -0
- package/android/payment-sdk-release-1.0.3.aar +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPEApplePayButton","requireNativeComponent","PEApplePayButton","React","forwardRef","props","ref","useImperativeHandle","pmError","event","onPaymentFailed","Error","nativeEvent","error","pmTokenDidReturn","onTokenDidReturn","token","pmSheetDidDismiss","onPaymentSheetDismissed","Platform","OS","height","width","style","
|
|
1
|
+
{"version":3,"names":["RNPEApplePayButton","requireNativeComponent","PEApplePayButton","React","forwardRef","props","ref","useImperativeHandle","pmError","event","onPaymentFailed","Error","nativeEvent","error","pmTokenDidReturn","onTokenDidReturn","token","metadata","metadataString","billingContact","billingContactString","shippingContact","shippingContactString","console","log","JSON","parse","undefined","pmSheetDidDismiss","onPaymentSheetDismissed","Platform","OS","height","width","style","stringify","paymentRequest","platformOptions"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\nimport type { PEApplePayContact } from './PEApplePayContact';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: string;\n metadata?: any;\n billingContact?: string;\n shippingContact?: string;\n };\n};\n\ninterface NativePEApplePayViewProps extends ViewProps {\n paymentRequest: string;\n onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;\n onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;\n onPmError: (event: NativePEApplePayEvent) => void;\n}\n\nexport interface PEApplePayButtonProps extends ViewProps {\n paymentRequest: PEPaymentRequest;\n onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;\n onPaymentSheetDismissed?: () => void;\n onPaymentFailed?: (error: Error) => void;\n}\n\nexport interface PEApplePayButtonMethods {\n \n}\n\n\nexport const PEApplePayButton = React.forwardRef<\nPEApplePayButtonMethods,\n PEApplePayButtonProps\n>((props, ref) => {\n\n React.useImperativeHandle(ref, () => ({\n }));\n\n const pmError = (event: NativePEApplePayEvent) => {\n if (props.onPaymentFailed) {\n props.onPaymentFailed(new Error(event.nativeEvent.error));\n }\n };\n\n const pmTokenDidReturn = (event: NativePEApplePayEvent) => {\n if (props.onTokenDidReturn) {\n const { token, metadata: metadataString, billingContact: billingContactString, shippingContact: shippingContactString } = event.nativeEvent;\n console.log('ON token', token, metadataString, billingContactString, shippingContactString)\n const metadata = metadataString ? JSON.parse(metadataString) : null;\n const billingContact = billingContactString ? JSON.parse(billingContactString) as PEApplePayContact : null;\n const shippingContact = shippingContactString ? JSON.parse(shippingContactString) as PEApplePayContact : null;\n\n props.onTokenDidReturn(token!, metadata, billingContact ?? undefined, shippingContact ?? undefined);\n }\n };\n\n const pmSheetDidDismiss = () => {\n if (props.onPaymentSheetDismissed) {\n props.onPaymentSheetDismissed();\n }\n }\n\n if (Platform.OS !== 'ios') {\n return <Text>Apple Pay is not supported on this platform</Text>\n }\n \n return (\n <RNPEApplePayButton \n style={{ height: 32, width: '100%', ...(props.style as object) }} \n paymentRequest={JSON.stringify({\n ...props.paymentRequest,\n ...props.paymentRequest.platformOptions\n })} \n onPmError={pmError} \n onPmTokenDidReturn={pmTokenDidReturn} \n onPmSheetDidDismiss={pmSheetDidDismiss} \n />\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAKA,MAAMA,kBAAkB,GAAG,IAAAC,mCAAA,EAAkD,oBAAlD,CAA3B;AA+BO,MAAMC,gBAAgB,gBAAGC,KAAK,CAACC,UAAN,CAG9B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAEhBH,KAAK,CAACI,mBAAN,CAA0BD,GAA1B,EAA+B,OAAO,EAAP,CAA/B;;EAGA,MAAME,OAAO,GAAIC,KAAD,IAAkC;IAChD,IAAIJ,KAAK,CAACK,eAAV,EAA2B;MACzBL,KAAK,CAACK,eAAN,CAAsB,IAAIC,KAAJ,CAAUF,KAAK,CAACG,WAAN,CAAkBC,KAA5B,CAAtB;IACD;EACF,CAJD;;EAMA,MAAMC,gBAAgB,GAAIL,KAAD,IAAkC;IACzD,IAAIJ,KAAK,CAACU,gBAAV,EAA4B;MAC1B,MAAM;QAAEC,KAAF;QAASC,QAAQ,EAAEC,cAAnB;QAAmCC,cAAc,EAAEC,oBAAnD;QAAyEC,eAAe,EAAEC;MAA1F,IAAoHb,KAAK,CAACG,WAAhI;MACAW,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,GAA2D,IAAtG;MACA,MAAMC,eAAe,GAAGC,qBAAqB,GAAGG,IAAI,CAACC,KAAL,CAAWJ,qBAAX,CAAH,GAA4D,IAAzG;MAEAjB,KAAK,CAACU,gBAAN,CAAuBC,KAAvB,EAA+BC,QAA/B,EAAyCE,cAAc,IAAIQ,SAA3D,EAAsEN,eAAe,IAAIM,SAAzF;IACD;EACF,CAVD;;EAYA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIvB,KAAK,CAACwB,uBAAV,EAAmC;MACjCxB,KAAK,CAACwB,uBAAN;IACD;EACF,CAJD;;EAMA,IAAIC,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;IACzB,oBAAO,oBAAC,iBAAD,sDAAP;EACD;;EAED,oBACE,oBAAC,kBAAD;IACE,KAAK,EAAE;MAAEC,MAAM,EAAE,EAAV;MAAcC,KAAK,EAAE,MAArB;MAA6B,GAAI5B,KAAK,CAAC6B;IAAvC,CADT;IAEE,cAAc,EAAET,IAAI,CAACU,SAAL,CAAe,EAC7B,GAAG9B,KAAK,CAAC+B,cADoB;MAE7B,GAAG/B,KAAK,CAAC+B,cAAN,CAAqBC;IAFK,CAAf,CAFlB;IAME,SAAS,EAAE7B,OANb;IAOE,kBAAkB,EAAEM,gBAPtB;IAQE,mBAAmB,EAAEc;EARvB,EADF;AAYD,CAhD+B,CAAzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["PEApplePayContact.ts"],"sourcesContent":["export interface PEApplePayContact {\n givenName?: string;\n familyName?: string;\n addressLines?: string[];\n locality?: string;\n administrativeArea?: string;\n postalCode?: string;\n country?: string;\n countryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n emailAddress?: string;\n phoneNumber?: string;\n}"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["PEGooglePayAddress.ts"],"sourcesContent":["export interface PEGooglePayAddress {\n address1?: string;\n address2?: string;\n address3?: string;\n administrativeArea?: string;\n countryCode?: string;\n locality?: string;\n name?: string;\n phoneNumber?: string;\n postalCode?: string;\n}"],"mappings":""}
|
|
@@ -25,10 +25,16 @@ const PEGooglePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
25
25
|
var _props$onTokenDidRetu;
|
|
26
26
|
|
|
27
27
|
const {
|
|
28
|
-
token
|
|
28
|
+
token,
|
|
29
|
+
metadata: metadataString,
|
|
30
|
+
billingAddress: billingAddressString,
|
|
31
|
+
shippingAddress: shippingAddressString
|
|
29
32
|
} = args;
|
|
30
|
-
console.log('ON token', token);
|
|
31
|
-
|
|
33
|
+
console.log('ON token', token, metadataString, billingAddressString, shippingAddressString);
|
|
34
|
+
const metadata = metadataString ? JSON.parse(metadataString) : null;
|
|
35
|
+
const billingAddress = billingAddressString ? JSON.parse(billingAddressString) : null;
|
|
36
|
+
const shippingAddress = shippingAddressString ? JSON.parse(shippingAddressString) : null;
|
|
37
|
+
(_props$onTokenDidRetu = props.onTokenDidReturn) === null || _props$onTokenDidRetu === void 0 ? void 0 : _props$onTokenDidRetu.call(props, token, metadata, billingAddress ?? undefined, shippingAddress ?? undefined);
|
|
32
38
|
});
|
|
33
39
|
const listener2 = peEventEmitter.addListener('onGooglePayError', args => {
|
|
34
40
|
var _props$onPaymentFaile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPEEventEmitter","NativeModules","RNPEGooglePayButton","requireNativeComponent","peEventEmitter","NativeEventEmitter","PEGooglePayButton","React","forwardRef","props","ref","useImperativeHandle","useEffect","listener1","addListener","args","token","console","log","onTokenDidReturn","listener2","error","onPaymentFailed","Error","listener3","onPaymentSheetDismissed","remove","Platform","OS","height","width","style","
|
|
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, metadata?: any, billingAddress?: PEGooglePayAddress, shippingAddress?: PEGooglePayAddress) => void;\n onPaymentSheetDismissed?: () => void;\n onPaymentFailed?: (error: Error) => void;\n}\n\nexport interface PEGooglePayButtonMethods {\n \n}\n\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;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,6 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
9
|
|
|
10
|
+
var _interfaces = require("../../interfaces");
|
|
11
|
+
|
|
10
12
|
const {
|
|
11
13
|
RNPayEngineNative
|
|
12
14
|
} = _reactNative.NativeModules;
|
|
@@ -19,12 +21,28 @@ class PayEngineNative {
|
|
|
19
21
|
static async getBrowserInfo() {
|
|
20
22
|
return RNPayEngineNative.getBrowserInfo();
|
|
21
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated use userCanPay instead
|
|
26
|
+
* @param merchantId
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
|
|
22
30
|
|
|
23
31
|
static async isPlatformPaySupported(merchantId) {
|
|
24
32
|
if (_reactNative.Platform.OS === 'ios') {
|
|
25
33
|
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
26
34
|
} else if (_reactNative.Platform.OS === 'android') {
|
|
27
|
-
return
|
|
35
|
+
return await RNPayEngineNative.isGooglePaySupported(merchantId);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static async userCanPay(provider, merchantId) {
|
|
42
|
+
if (provider == _interfaces.PayProvider.applePay && _reactNative.Platform.OS == 'ios') {
|
|
43
|
+
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
44
|
+
} else if (provider === _interfaces.PayProvider.googlePay && _reactNative.Platform.OS === 'android') {
|
|
45
|
+
return await RNPayEngineNative.isGooglePaySupported(merchantId);
|
|
28
46
|
}
|
|
29
47
|
|
|
30
48
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPayEngineNative","NativeModules","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","Platform","OS","isApplePaySupported"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\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 static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (Platform.OS === 'android') {\n return
|
|
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"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -70,6 +70,12 @@ Object.defineProperty(exports, "PayEngineProvider", {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
exports.PayEngineUtils = exports.PayEngineStatic = void 0;
|
|
73
|
+
Object.defineProperty(exports, "PayProvider", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _index.PayProvider;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
73
79
|
Object.defineProperty(exports, "RNPEApplePayOptions", {
|
|
74
80
|
enumerable: true,
|
|
75
81
|
get: function () {
|
|
@@ -99,6 +105,8 @@ var _PayEngine = _interopRequireDefault(require("./components/PayEngine"));
|
|
|
99
105
|
|
|
100
106
|
var _reactNative = require("react-native");
|
|
101
107
|
|
|
108
|
+
var _index = require("./interfaces/index");
|
|
109
|
+
|
|
102
110
|
var _CreditCardView = require("./components/v2/SecureFields/CreditCardView");
|
|
103
111
|
|
|
104
112
|
var _BankAccountView = require("./components/v2/SecureFields/BankAccountView");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","PayEngineStatic","NativeModules","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\nimport { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';\nimport { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","PayEngineStatic","NativeModules","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport { PayProvider } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\nimport { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';\nimport { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\nimport type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';\nimport type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayContact';\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n PayProvider,\n // v2 starting here\n PayEngineUtils,\n PayEngineProvider,\n PayEngineNative,\n // securefields\n PEKeyboardType,\n IPEField,\n // credit card\n PECreditCardView,\n PECreditCardViewMethods,\n PECard,\n // bank account\n PEBankAccountView,\n PEBankAccountViewMethods,\n PEBankAccount,\n // Apple Pay\n PEApplePayButton,\n RNPEApplePayOptions, \n RNPEContactField,\n PEApplePayContact,\n RNPEGooglePayBillingAddressParameters, \n RNPEGooglePayShippingAddressParameters,\n PEPaymentRequest,\n PEGooglePayButton,\n PEGooglePayAddress\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAIA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AACA;;;;;;;;AAIA,MAAMA,aAAa,GAChB,iFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGC,0BAAA,CAAcC,SAAd,GACpBD,0BAAA,CAAcC,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ"}
|
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PayProvider = void 0;
|
|
7
|
+
let PayProvider;
|
|
8
|
+
exports.PayProvider = PayProvider;
|
|
9
|
+
|
|
10
|
+
(function (PayProvider) {
|
|
11
|
+
PayProvider[PayProvider["googlePay"] = 0] = "googlePay";
|
|
12
|
+
PayProvider[PayProvider["applePay"] = 1] = "applePay";
|
|
13
|
+
})(PayProvider || (exports.PayProvider = PayProvider = {}));
|
|
2
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export interface IPayEngineConfig {\n publicKey: string;\n version?: string;\n scriptURL?: string;\n logLevel?: number;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["PayProvider"],"sources":["index.ts"],"sourcesContent":["export interface IPayEngineConfig {\n publicKey: string;\n version?: string;\n scriptURL?: string;\n logLevel?: number;\n}\n\nexport enum PayProvider {\n googlePay,\n applePay\n}"],"mappings":";;;;;;IAOYA,W;;;WAAAA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,2BAAAA,W"}
|
|
@@ -12,7 +12,17 @@ export const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
12
12
|
|
|
13
13
|
const pmTokenDidReturn = event => {
|
|
14
14
|
if (props.onTokenDidReturn) {
|
|
15
|
-
|
|
15
|
+
const {
|
|
16
|
+
token,
|
|
17
|
+
metadata: metadataString,
|
|
18
|
+
billingContact: billingContactString,
|
|
19
|
+
shippingContact: shippingContactString
|
|
20
|
+
} = event.nativeEvent;
|
|
21
|
+
console.log('ON token', token, metadataString, billingContactString, shippingContactString);
|
|
22
|
+
const metadata = metadataString ? JSON.parse(metadataString) : null;
|
|
23
|
+
const billingContact = billingContactString ? JSON.parse(billingContactString) : null;
|
|
24
|
+
const shippingContact = shippingContactString ? JSON.parse(shippingContactString) : null;
|
|
25
|
+
props.onTokenDidReturn(token, metadata, billingContact ?? undefined, shippingContact ?? undefined);
|
|
16
26
|
}
|
|
17
27
|
};
|
|
18
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","Platform","requireNativeComponent","Text","RNPEApplePayButton","PEApplePayButton","forwardRef","props","ref","useImperativeHandle","pmError","event","onPaymentFailed","Error","nativeEvent","error","pmTokenDidReturn","onTokenDidReturn","token","pmSheetDidDismiss","onPaymentSheetDismissed","OS","height","width","style","
|
|
1
|
+
{"version":3,"names":["React","Platform","requireNativeComponent","Text","RNPEApplePayButton","PEApplePayButton","forwardRef","props","ref","useImperativeHandle","pmError","event","onPaymentFailed","Error","nativeEvent","error","pmTokenDidReturn","onTokenDidReturn","token","metadata","metadataString","billingContact","billingContactString","shippingContact","shippingContactString","console","log","JSON","parse","undefined","pmSheetDidDismiss","onPaymentSheetDismissed","OS","height","width","style","stringify","paymentRequest","platformOptions"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\nimport type { PEApplePayContact } from './PEApplePayContact';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: string;\n metadata?: any;\n billingContact?: string;\n shippingContact?: string;\n };\n};\n\ninterface NativePEApplePayViewProps extends ViewProps {\n paymentRequest: string;\n onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;\n onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;\n onPmError: (event: NativePEApplePayEvent) => void;\n}\n\nexport interface PEApplePayButtonProps extends ViewProps {\n paymentRequest: PEPaymentRequest;\n onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;\n onPaymentSheetDismissed?: () => void;\n onPaymentFailed?: (error: Error) => void;\n}\n\nexport interface PEApplePayButtonMethods {\n \n}\n\n\nexport const PEApplePayButton = React.forwardRef<\nPEApplePayButtonMethods,\n PEApplePayButtonProps\n>((props, ref) => {\n\n React.useImperativeHandle(ref, () => ({\n }));\n\n const pmError = (event: NativePEApplePayEvent) => {\n if (props.onPaymentFailed) {\n props.onPaymentFailed(new Error(event.nativeEvent.error));\n }\n };\n\n const pmTokenDidReturn = (event: NativePEApplePayEvent) => {\n if (props.onTokenDidReturn) {\n const { token, metadata: metadataString, billingContact: billingContactString, shippingContact: shippingContactString } = event.nativeEvent;\n console.log('ON token', token, metadataString, billingContactString, shippingContactString)\n const metadata = metadataString ? JSON.parse(metadataString) : null;\n const billingContact = billingContactString ? JSON.parse(billingContactString) as PEApplePayContact : null;\n const shippingContact = shippingContactString ? JSON.parse(shippingContactString) as PEApplePayContact : null;\n\n props.onTokenDidReturn(token!, metadata, billingContact ?? undefined, shippingContact ?? undefined);\n }\n };\n\n const pmSheetDidDismiss = () => {\n if (props.onPaymentSheetDismissed) {\n props.onPaymentSheetDismissed();\n }\n }\n\n if (Platform.OS !== 'ios') {\n return <Text>Apple Pay is not supported on this platform</Text>\n }\n \n return (\n <RNPEApplePayButton \n style={{ height: 32, width: '100%', ...(props.style as object) }} \n paymentRequest={JSON.stringify({\n ...props.paymentRequest,\n ...props.paymentRequest.platformOptions\n })} \n onPmError={pmError} \n onPmTokenDidReturn={pmTokenDidReturn} \n onPmSheetDidDismiss={pmSheetDidDismiss} \n />\n );\n});\n"],"mappings":"AACA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,sBAAnB,EAA2CC,IAA3C,QAAkE,cAAlE;AAKA,MAAMC,kBAAkB,GAAGF,sBAAsB,CAA4B,oBAA5B,CAAjD;AA+BA,OAAO,MAAMG,gBAAgB,gBAAGL,KAAK,CAACM,UAAN,CAG9B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAEhBR,KAAK,CAACS,mBAAN,CAA0BD,GAA1B,EAA+B,OAAO,EAAP,CAA/B;;EAGA,MAAME,OAAO,GAAIC,KAAD,IAAkC;IAChD,IAAIJ,KAAK,CAACK,eAAV,EAA2B;MACzBL,KAAK,CAACK,eAAN,CAAsB,IAAIC,KAAJ,CAAUF,KAAK,CAACG,WAAN,CAAkBC,KAA5B,CAAtB;IACD;EACF,CAJD;;EAMA,MAAMC,gBAAgB,GAAIL,KAAD,IAAkC;IACzD,IAAIJ,KAAK,CAACU,gBAAV,EAA4B;MAC1B,MAAM;QAAEC,KAAF;QAASC,QAAQ,EAAEC,cAAnB;QAAmCC,cAAc,EAAEC,oBAAnD;QAAyEC,eAAe,EAAEC;MAA1F,IAAoHb,KAAK,CAACG,WAAhI;MACAW,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,GAA2D,IAAtG;MACA,MAAMC,eAAe,GAAGC,qBAAqB,GAAGG,IAAI,CAACC,KAAL,CAAWJ,qBAAX,CAAH,GAA4D,IAAzG;MAEAjB,KAAK,CAACU,gBAAN,CAAuBC,KAAvB,EAA+BC,QAA/B,EAAyCE,cAAc,IAAIQ,SAA3D,EAAsEN,eAAe,IAAIM,SAAzF;IACD;EACF,CAVD;;EAYA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIvB,KAAK,CAACwB,uBAAV,EAAmC;MACjCxB,KAAK,CAACwB,uBAAN;IACD;EACF,CAJD;;EAMA,IAAI9B,QAAQ,CAAC+B,EAAT,KAAgB,KAApB,EAA2B;IACzB,oBAAO,oBAAC,IAAD,sDAAP;EACD;;EAED,oBACE,oBAAC,kBAAD;IACE,KAAK,EAAE;MAAEC,MAAM,EAAE,EAAV;MAAcC,KAAK,EAAE,MAArB;MAA6B,GAAI3B,KAAK,CAAC4B;IAAvC,CADT;IAEE,cAAc,EAAER,IAAI,CAACS,SAAL,CAAe,EAC7B,GAAG7B,KAAK,CAAC8B,cADoB;MAE7B,GAAG9B,KAAK,CAAC8B,cAAN,CAAqBC;IAFK,CAAf,CAFlB;IAME,SAAS,EAAE5B,OANb;IAOE,kBAAkB,EAAEM,gBAPtB;IAQE,mBAAmB,EAAEc;EARvB,EADF;AAYD,CAhD+B,CAAzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["PEApplePayContact.ts"],"sourcesContent":["export interface PEApplePayContact {\n givenName?: string;\n familyName?: string;\n addressLines?: string[];\n locality?: string;\n administrativeArea?: string;\n postalCode?: string;\n country?: string;\n countryCode?: string;\n subAdministrativeArea?: string;\n subLocality?: string;\n emailAddress?: string;\n phoneNumber?: string;\n}"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["PEGooglePayAddress.ts"],"sourcesContent":["export interface PEGooglePayAddress {\n address1?: string;\n address2?: string;\n address3?: string;\n administrativeArea?: string;\n countryCode?: string;\n locality?: string;\n name?: string;\n phoneNumber?: string;\n postalCode?: string;\n}"],"mappings":""}
|
|
@@ -12,10 +12,16 @@ export const PEGooglePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
12
12
|
var _props$onTokenDidRetu;
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
|
-
token
|
|
15
|
+
token,
|
|
16
|
+
metadata: metadataString,
|
|
17
|
+
billingAddress: billingAddressString,
|
|
18
|
+
shippingAddress: shippingAddressString
|
|
16
19
|
} = args;
|
|
17
|
-
console.log('ON token', token);
|
|
18
|
-
|
|
20
|
+
console.log('ON token', token, metadataString, billingAddressString, shippingAddressString);
|
|
21
|
+
const metadata = metadataString ? JSON.parse(metadataString) : null;
|
|
22
|
+
const billingAddress = billingAddressString ? JSON.parse(billingAddressString) : null;
|
|
23
|
+
const shippingAddress = shippingAddressString ? JSON.parse(shippingAddressString) : null;
|
|
24
|
+
(_props$onTokenDidRetu = props.onTokenDidReturn) === null || _props$onTokenDidRetu === void 0 ? void 0 : _props$onTokenDidRetu.call(props, token, metadata, billingAddress ?? undefined, shippingAddress ?? undefined);
|
|
19
25
|
});
|
|
20
26
|
const listener2 = peEventEmitter.addListener('onGooglePayError', args => {
|
|
21
27
|
var _props$onPaymentFaile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","NativeEventEmitter","NativeModules","Platform","requireNativeComponent","Text","RNPEEventEmitter","RNPEGooglePayButton","peEventEmitter","PEGooglePayButton","forwardRef","props","ref","useImperativeHandle","useEffect","listener1","addListener","args","token","console","log","onTokenDidReturn","listener2","error","onPaymentFailed","Error","listener3","onPaymentSheetDismissed","remove","OS","height","width","style","
|
|
1
|
+
{"version":3,"names":["React","NativeEventEmitter","NativeModules","Platform","requireNativeComponent","Text","RNPEEventEmitter","RNPEGooglePayButton","peEventEmitter","PEGooglePayButton","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","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, metadata?: any, billingAddress?: PEGooglePayAddress, shippingAddress?: PEGooglePayAddress) => void;\n onPaymentSheetDismissed?: () => void;\n onPaymentFailed?: (error: Error) => void;\n}\n\nexport interface PEGooglePayButtonMethods {\n \n}\n\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,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,kBAAT,EAA6BC,aAA7B,EAA4CC,QAA5C,EAAsDC,sBAAtD,EAA8EC,IAA9E,QAAqG,cAArG;AAIA,MAAM;EAAEC;AAAF,IAAuBJ,aAA7B;AAEA,MAAMK,mBAAmB,GAAGH,sBAAsB,CAA6B,qBAA7B,CAAlD;AAQA,MAAMI,cAAc,GAAG,IAAIP,kBAAJ,CAAuBK,gBAAvB,CAAvB;AAcA,OAAO,MAAMG,iBAAiB,gBAAGT,KAAK,CAACU,UAAN,CAG/B,CAACC,KAAD,EAAQC,GAAR,KAAgB;EAEhBZ,KAAK,CAACa,mBAAN,CAA0BD,GAA1B,EAA+B,OAAO,EAAP,CAA/B;EAGAZ,KAAK,CAACc,SAAN,CAAgB,MAAM;IACpB,MAAMC,SAAS,GAAGP,cAAc,CAACQ,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,GAAGvB,cAAc,CAACQ,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,GAAG3B,cAAc,CAACQ,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,IAAIlC,QAAQ,CAACmC,EAAT,KAAgB,SAApB,EAA+B;IAC7B,oBAAO,oBAAC,IAAD,uDAAP;EACD;;EAED,oBACE,oBAAC,mBAAD;IACE,KAAK,EAAE;MAAEC,MAAM,EAAE,EAAV;MAAcC,KAAK,EAAE,MAArB;MAA6B,GAAI7B,KAAK,CAAC8B;IAAvC,CADT,CAEE;IACA;IAHF;IAIE,cAAc,EAAEd,IAAI,CAACe,SAAL,CAAe,EAC7B,GAAG/B,KAAK,CAACgC,cADoB;MAE7B,GAAGhC,KAAK,CAACgC,cAAN,CAAqBC;IAFK,CAAf;EAJlB,EADF;AAWD,CApDgC,CAA1B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NativeModules, Platform } from "react-native";
|
|
2
|
+
import { PayProvider } from "../../interfaces";
|
|
2
3
|
const {
|
|
3
4
|
RNPayEngineNative
|
|
4
5
|
} = NativeModules;
|
|
@@ -10,12 +11,28 @@ export default class PayEngineNative {
|
|
|
10
11
|
static async getBrowserInfo() {
|
|
11
12
|
return RNPayEngineNative.getBrowserInfo();
|
|
12
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated use userCanPay instead
|
|
16
|
+
* @param merchantId
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
|
|
13
20
|
|
|
14
21
|
static async isPlatformPaySupported(merchantId) {
|
|
15
22
|
if (Platform.OS === 'ios') {
|
|
16
23
|
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
17
24
|
} else if (Platform.OS === 'android') {
|
|
18
|
-
return
|
|
25
|
+
return await RNPayEngineNative.isGooglePaySupported(merchantId);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static async userCanPay(provider, merchantId) {
|
|
32
|
+
if (provider == PayProvider.applePay && Platform.OS == 'ios') {
|
|
33
|
+
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
34
|
+
} else if (provider === PayProvider.googlePay && Platform.OS === 'android') {
|
|
35
|
+
return await RNPayEngineNative.isGooglePaySupported(merchantId);
|
|
19
36
|
}
|
|
20
37
|
|
|
21
38
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","RNPayEngineNative","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","OS","isApplePaySupported"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\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 static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (Platform.OS === 'android') {\n return
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","PayProvider","RNPayEngineNative","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","OS","isApplePaySupported","isGooglePaySupported","userCanPay","provider","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,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AACA,SAASC,WAAT,QAA4B,kBAA5B;AAEA,MAAM;EAAEC;AAAF,IAAwBH,aAA9B;AAEA,eAAe,MAAMI,eAAN,CAAsB;EACG,aAAzBC,yBAAyB,CAACC,UAAD,EAAqB;IACzD,OAAOH,iBAAiB,CAACE,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;;EAE0B,aAAdC,cAAc,GAAG;IAC5B,OAAOJ,iBAAiB,CAACI,cAAlB,EAAP;EACD;EAED;AACF;AACA;AACA;AACA;;;EACqC,aAAtBC,sBAAsB,CAACF,UAAD,EAAqB;IACtD,IAAIL,QAAQ,CAACQ,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMN,iBAAiB,CAACO,mBAAlB,CAAsCJ,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIL,QAAQ,CAACQ,EAAT,KAAgB,SAApB,EAA+B;MACpC,OAAO,MAAMN,iBAAiB,CAACQ,oBAAlB,CAAuCL,UAAvC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;;EAEsB,aAAVM,UAAU,CAACC,QAAD,EAAwBP,UAAxB,EAA4C;IACjE,IAAIO,QAAQ,IAAIX,WAAW,CAACY,QAAxB,IAAoCb,QAAQ,CAACQ,EAAT,IAAe,KAAvD,EAA8D;MAC5D,OAAO,MAAMN,iBAAiB,CAACO,mBAAlB,CAAsCJ,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIO,QAAQ,KAAKX,WAAW,CAACa,SAAzB,IAAsCd,QAAQ,CAACQ,EAAT,KAAgB,SAA1D,EAAqE;MAC1E,OAAO,MAAMN,iBAAiB,CAACQ,oBAAlB,CAAuCL,UAAvC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;;AA9BkC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PayEngine from './components/PayEngine';
|
|
2
2
|
import { NativeModules, Platform } from 'react-native';
|
|
3
|
+
import { PayProvider } from './interfaces/index';
|
|
3
4
|
import { PECreditCardView, PECreditCardViewMethods } from './components/v2/SecureFields/CreditCardView';
|
|
4
5
|
import { PEBankAccountView, PEBankAccountViewMethods } from './components/v2/SecureFields/BankAccountView';
|
|
5
6
|
import { PayEngineProvider } from './components/v2/PayEngineProvider';
|
|
@@ -19,7 +20,7 @@ const PayEngineStatic = NativeModules.Payengine ? NativeModules.Payengine : new
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
});
|
|
22
|
-
export { PayEngineStatic, PayEngine, // v2 starting here
|
|
23
|
+
export { PayEngineStatic, PayEngine, PayProvider, // v2 starting here
|
|
23
24
|
PayEngineUtils, PayEngineProvider, PayEngineNative, // securefields
|
|
24
25
|
PEKeyboardType, // credit card
|
|
25
26
|
PECreditCardView, PECreditCardViewMethods, // bank account
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PayEngine","NativeModules","Platform","PECreditCardView","PECreditCardViewMethods","PEBankAccountView","PEBankAccountViewMethods","PayEngineProvider","PayEngineNative","PEApplePayButton","PEPaymentRequest","RNPEApplePayOptions","RNPEContactField","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","PEGooglePayButton","PayEngineUtils","PEKeyboardType","LINKING_ERROR","select","ios","default","PayEngineStatic","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\nimport { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';\nimport { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n
|
|
1
|
+
{"version":3,"names":["PayEngine","NativeModules","Platform","PayProvider","PECreditCardView","PECreditCardViewMethods","PEBankAccountView","PEBankAccountViewMethods","PayEngineProvider","PayEngineNative","PEApplePayButton","PEPaymentRequest","RNPEApplePayOptions","RNPEContactField","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","PEGooglePayButton","PayEngineUtils","PEKeyboardType","LINKING_ERROR","select","ios","default","PayEngineStatic","Payengine","Proxy","get","Error"],"sources":["index.tsx"],"sourcesContent":["import PayEngine from './components/PayEngine';\nimport { NativeModules, Platform } from 'react-native';\nimport type { IPayEngineConfig } from './interfaces/index';\nimport { PayProvider } from './interfaces/index';\nimport {\n PECreditCardView,\n PECreditCardViewMethods,\n} from './components/v2/SecureFields/CreditCardView';\nimport {\n PEBankAccountView,\n PEBankAccountViewMethods,\n} from './components/v2/SecureFields/BankAccountView';\nimport type IPEField from './components/v2/SecureFields/IPEField';\nimport type PECard from './components/v2/SecureFields/PECard';\nimport type PEBankAccount from './components/v2/SecureFields/PEBankAccount';\nimport { PayEngineProvider } from './components/v2/PayEngineProvider';\nimport PayEngineNative from './components/v2/PayEngineNative';\nimport { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';\nimport { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';\nimport { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';\nimport * as PayEngineUtils from './utils/index';\nimport PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';\nimport type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';\nimport type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayContact';\n\nconst LINKING_ERROR =\n `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst PayEngineStatic = NativeModules.Payengine\n ? NativeModules.Payengine\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport {\n PayEngineStatic,\n PayEngine,\n IPayEngineConfig,\n PayProvider,\n // v2 starting here\n PayEngineUtils,\n PayEngineProvider,\n PayEngineNative,\n // securefields\n PEKeyboardType,\n IPEField,\n // credit card\n PECreditCardView,\n PECreditCardViewMethods,\n PECard,\n // bank account\n PEBankAccountView,\n PEBankAccountViewMethods,\n PEBankAccount,\n // Apple Pay\n PEApplePayButton,\n RNPEApplePayOptions, \n RNPEContactField,\n PEApplePayContact,\n RNPEGooglePayBillingAddressParameters, \n RNPEGooglePayShippingAddressParameters,\n PEPaymentRequest,\n PEGooglePayButton,\n PEGooglePayAddress\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SACEC,gBADF,EAEEC,uBAFF,QAGO,6CAHP;AAIA,SACEC,iBADF,EAEEC,wBAFF,QAGO,8CAHP;AAOA,SAASC,iBAAT,QAAkC,mCAAlC;AACA,OAAOC,eAAP,MAA4B,iCAA5B;AACA,SAASC,gBAAT,QAAiC,2CAAjC;AACA,SAASC,gBAAT,EAA2BC,mBAA3B,EAAgDC,gBAAhD,EAAkEC,qCAAlE,EAAyGC,sCAAzG,QAAuJ,kCAAvJ;AACA,SAASC,iBAAT,QAAkC,6CAAlC;AACA,OAAO,KAAKC,cAAZ,MAAgC,eAAhC;AACA,OAAOC,cAAP,MAA2B,6CAA3B;AAIA,MAAMC,aAAa,GAChB,iFAAD,GACAjB,QAAQ,CAACkB,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGtB,aAAa,CAACuB,SAAd,GACpBvB,aAAa,CAACuB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEEvB,SAFF,EAIEG,WAJF,EAKE;AACAc,cANF,EAOET,iBAPF,EAQEC,eARF,EASE;AACAS,cAVF,EAYE;AACAd,gBAbF,EAcEC,uBAdF,EAgBE;AACAC,iBAjBF,EAkBEC,wBAlBF,EAoBE;AACAG,gBArBF,EAsBEE,mBAtBF,EAuBEC,gBAvBF,EAyBEC,qCAzBF,EA0BEC,sCA1BF,EA2BEJ,gBA3BF,EA4BEK,iBA5BF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export interface IPayEngineConfig {\n publicKey: string;\n version?: string;\n scriptURL?: string;\n logLevel?: number;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":["PayProvider"],"sources":["index.ts"],"sourcesContent":["export interface IPayEngineConfig {\n publicKey: string;\n version?: string;\n scriptURL?: string;\n logLevel?: number;\n}\n\nexport enum PayProvider {\n googlePay,\n applePay\n}"],"mappings":"AAOA,WAAYA,WAAZ;;WAAYA,W;EAAAA,W,CAAAA,W;EAAAA,W,CAAAA,W;GAAAA,W,KAAAA,W"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
4
|
+
import type { PEApplePayContact } from './PEApplePayContact';
|
|
4
5
|
export interface PEApplePayButtonProps extends ViewProps {
|
|
5
6
|
paymentRequest: PEPaymentRequest;
|
|
6
|
-
onTokenDidReturn?: (token: string) => void;
|
|
7
|
+
onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;
|
|
7
8
|
onPaymentSheetDismissed?: () => void;
|
|
8
9
|
onPaymentFailed?: (error: Error) => void;
|
|
9
10
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PEApplePayContact {
|
|
2
|
+
givenName?: string;
|
|
3
|
+
familyName?: string;
|
|
4
|
+
addressLines?: string[];
|
|
5
|
+
locality?: string;
|
|
6
|
+
administrativeArea?: string;
|
|
7
|
+
postalCode?: string;
|
|
8
|
+
country?: string;
|
|
9
|
+
countryCode?: string;
|
|
10
|
+
subAdministrativeArea?: string;
|
|
11
|
+
subLocality?: string;
|
|
12
|
+
emailAddress?: string;
|
|
13
|
+
phoneNumber?: string;
|
|
14
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
3
|
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
4
|
+
import type { PEGooglePayAddress } from './PEGooglePayAddress';
|
|
4
5
|
export interface PEGooglePayButtonProps extends ViewProps {
|
|
5
6
|
paymentRequest: PEPaymentRequest;
|
|
6
|
-
onTokenDidReturn?: (token: string) => void;
|
|
7
|
+
onTokenDidReturn?: (token: string, metadata?: any, billingAddress?: PEGooglePayAddress, shippingAddress?: PEGooglePayAddress) => void;
|
|
7
8
|
onPaymentSheetDismissed?: () => void;
|
|
8
9
|
onPaymentFailed?: (error: Error) => void;
|
|
9
10
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import { PayProvider } from "../../interfaces";
|
|
1
2
|
export default class PayEngineNative {
|
|
2
3
|
static createFraudMonitorSession(merchantId: string): Promise<any>;
|
|
3
4
|
static getBrowserInfo(): Promise<any>;
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated use userCanPay instead
|
|
7
|
+
* @param merchantId
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
4
10
|
static isPlatformPaySupported(merchantId: string): Promise<any>;
|
|
11
|
+
static userCanPay(provider: PayProvider, merchantId: string): Promise<any>;
|
|
5
12
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PayEngine from './components/PayEngine';
|
|
2
2
|
import type { IPayEngineConfig } from './interfaces/index';
|
|
3
|
+
import { PayProvider } from './interfaces/index';
|
|
3
4
|
import { PECreditCardView, PECreditCardViewMethods } from './components/v2/SecureFields/CreditCardView';
|
|
4
5
|
import { PEBankAccountView, PEBankAccountViewMethods } from './components/v2/SecureFields/BankAccountView';
|
|
5
6
|
import type IPEField from './components/v2/SecureFields/IPEField';
|
|
@@ -12,5 +13,7 @@ import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayB
|
|
|
12
13
|
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
13
14
|
import * as PayEngineUtils from './utils/index';
|
|
14
15
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
16
|
+
import type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';
|
|
17
|
+
import type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayContact';
|
|
15
18
|
declare const PayEngineStatic: any;
|
|
16
|
-
export { PayEngineStatic, PayEngine, IPayEngineConfig, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters, PEPaymentRequest, PEGooglePayButton, };
|
|
19
|
+
export { PayEngineStatic, PayEngine, IPayEngineConfig, PayProvider, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, RNPEApplePayOptions, RNPEContactField, PEApplePayContact, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters, PEPaymentRequest, PEGooglePayButton, PEGooglePayAddress };
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';
|
|
4
4
|
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
5
|
+
import type { PEApplePayContact } from './PEApplePayContact';
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
const RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');
|
|
@@ -9,7 +10,10 @@ const RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RN
|
|
|
9
10
|
type NativePEApplePayEvent = {
|
|
10
11
|
nativeEvent: {
|
|
11
12
|
error?: string;
|
|
12
|
-
token?: string
|
|
13
|
+
token?: string;
|
|
14
|
+
metadata?: any;
|
|
15
|
+
billingContact?: string;
|
|
16
|
+
shippingContact?: string;
|
|
13
17
|
};
|
|
14
18
|
};
|
|
15
19
|
|
|
@@ -22,7 +26,7 @@ interface NativePEApplePayViewProps extends ViewProps {
|
|
|
22
26
|
|
|
23
27
|
export interface PEApplePayButtonProps extends ViewProps {
|
|
24
28
|
paymentRequest: PEPaymentRequest;
|
|
25
|
-
onTokenDidReturn?: (token: string) => void;
|
|
29
|
+
onTokenDidReturn?: (token: string, metadata?: any, billingContact?: PEApplePayContact, shippingContact?: PEApplePayContact) => void;
|
|
26
30
|
onPaymentSheetDismissed?: () => void;
|
|
27
31
|
onPaymentFailed?: (error: Error) => void;
|
|
28
32
|
}
|
|
@@ -48,7 +52,13 @@ PEApplePayButtonMethods,
|
|
|
48
52
|
|
|
49
53
|
const pmTokenDidReturn = (event: NativePEApplePayEvent) => {
|
|
50
54
|
if (props.onTokenDidReturn) {
|
|
51
|
-
|
|
55
|
+
const { token, metadata: metadataString, billingContact: billingContactString, shippingContact: shippingContactString } = event.nativeEvent;
|
|
56
|
+
console.log('ON token', token, metadataString, billingContactString, shippingContactString)
|
|
57
|
+
const metadata = metadataString ? JSON.parse(metadataString) : null;
|
|
58
|
+
const billingContact = billingContactString ? JSON.parse(billingContactString) as PEApplePayContact : null;
|
|
59
|
+
const shippingContact = shippingContactString ? JSON.parse(shippingContactString) as PEApplePayContact : null;
|
|
60
|
+
|
|
61
|
+
props.onTokenDidReturn(token!, metadata, billingContact ?? undefined, shippingContact ?? undefined);
|
|
52
62
|
}
|
|
53
63
|
};
|
|
54
64
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PEApplePayContact {
|
|
2
|
+
givenName?: string;
|
|
3
|
+
familyName?: string;
|
|
4
|
+
addressLines?: string[];
|
|
5
|
+
locality?: string;
|
|
6
|
+
administrativeArea?: string;
|
|
7
|
+
postalCode?: string;
|
|
8
|
+
country?: string;
|
|
9
|
+
countryCode?: string;
|
|
10
|
+
subAdministrativeArea?: string;
|
|
11
|
+
subLocality?: string;
|
|
12
|
+
emailAddress?: string;
|
|
13
|
+
phoneNumber?: string;
|
|
14
|
+
}
|