react-native-payengine 2.0.8 → 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/README.md +4 -3
- 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 +27 -42
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEPaymentRequest.kt +12 -0
- 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 +76 -9
- package/ios/Sources/Classes/ApplePay/RNPEApplePayPaymentRequest.swift +4 -4
- 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
|
@@ -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
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { NativeEventEmitter, NativeModules, Platform, requireNativeComponent, Text, ViewProps } from 'react-native';
|
|
4
4
|
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
5
|
+
import type { PEGooglePayAddress } from './PEGooglePayAddress';
|
|
5
6
|
|
|
6
7
|
const { RNPEEventEmitter } = NativeModules;
|
|
7
8
|
|
|
@@ -17,7 +18,7 @@ const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
|
|
|
17
18
|
|
|
18
19
|
export interface PEGooglePayButtonProps extends ViewProps {
|
|
19
20
|
paymentRequest: PEPaymentRequest;
|
|
20
|
-
onTokenDidReturn?: (token: string) => void;
|
|
21
|
+
onTokenDidReturn?: (token: string, metadata?: any, billingAddress?: PEGooglePayAddress, shippingAddress?: PEGooglePayAddress) => void;
|
|
21
22
|
onPaymentSheetDismissed?: () => void;
|
|
22
23
|
onPaymentFailed?: (error: Error) => void;
|
|
23
24
|
}
|
|
@@ -37,9 +38,13 @@ export const PEGooglePayButton = React.forwardRef<
|
|
|
37
38
|
|
|
38
39
|
React.useEffect(() => {
|
|
39
40
|
const listener1 = peEventEmitter.addListener('onGooglePayRespond', args => {
|
|
40
|
-
const { token } = args;
|
|
41
|
-
console.log('ON token', token)
|
|
42
|
-
|
|
41
|
+
const { token, metadata: metadataString, billingAddress: billingAddressString, shippingAddress: shippingAddressString } = args;
|
|
42
|
+
console.log('ON token', token, metadataString, billingAddressString, shippingAddressString)
|
|
43
|
+
const metadata = metadataString ? JSON.parse(metadataString) : null;
|
|
44
|
+
const billingAddress = billingAddressString ? JSON.parse(billingAddressString) as PEGooglePayAddress : null;
|
|
45
|
+
const shippingAddress = shippingAddressString ? JSON.parse(shippingAddressString) as PEGooglePayAddress : null;
|
|
46
|
+
|
|
47
|
+
props.onTokenDidReturn?.(token, metadata, billingAddress ?? undefined, shippingAddress ?? undefined)
|
|
43
48
|
});
|
|
44
49
|
|
|
45
50
|
const listener2 = peEventEmitter.addListener('onGooglePayError', args => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NativeModules, Platform } from "react-native";
|
|
2
|
+
import { PayProvider } from "../../interfaces";
|
|
2
3
|
|
|
3
4
|
const { RNPayEngineNative } = NativeModules;
|
|
4
5
|
|
|
@@ -11,11 +12,25 @@ export default class PayEngineNative {
|
|
|
11
12
|
return RNPayEngineNative.getBrowserInfo();
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated use userCanPay instead
|
|
17
|
+
* @param merchantId
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
14
20
|
static async isPlatformPaySupported(merchantId: string) {
|
|
15
21
|
if (Platform.OS === 'ios') {
|
|
16
22
|
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
17
23
|
} else if (Platform.OS === 'android') {
|
|
18
|
-
return
|
|
24
|
+
return await RNPayEngineNative.isGooglePaySupported(merchantId);
|
|
25
|
+
}
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static async userCanPay(provider: PayProvider, merchantId: string) {
|
|
30
|
+
if (provider == PayProvider.applePay && Platform.OS == 'ios') {
|
|
31
|
+
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
32
|
+
} else if (provider === PayProvider.googlePay && Platform.OS === 'android') {
|
|
33
|
+
return await RNPayEngineNative.isGooglePaySupported(merchantId);
|
|
19
34
|
}
|
|
20
35
|
return false;
|
|
21
36
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import PayEngine from './components/PayEngine';
|
|
2
2
|
import { NativeModules, Platform } from 'react-native';
|
|
3
3
|
import type { IPayEngineConfig } from './interfaces/index';
|
|
4
|
+
import { PayProvider } from './interfaces/index';
|
|
4
5
|
import {
|
|
5
6
|
PECreditCardView,
|
|
6
7
|
PECreditCardViewMethods,
|
|
@@ -19,6 +20,8 @@ import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayB
|
|
|
19
20
|
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
20
21
|
import * as PayEngineUtils from './utils/index';
|
|
21
22
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
23
|
+
import type { PEGooglePayAddress } from './components/v2/GooglePay/PEGooglePayAddress';
|
|
24
|
+
import type { PEApplePayContact } from './components/v2/ApplePay/PEApplePayContact';
|
|
22
25
|
|
|
23
26
|
const LINKING_ERROR =
|
|
24
27
|
`The package 'react-native-payengine' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -41,7 +44,7 @@ export {
|
|
|
41
44
|
PayEngineStatic,
|
|
42
45
|
PayEngine,
|
|
43
46
|
IPayEngineConfig,
|
|
44
|
-
|
|
47
|
+
PayProvider,
|
|
45
48
|
// v2 starting here
|
|
46
49
|
PayEngineUtils,
|
|
47
50
|
PayEngineProvider,
|
|
@@ -61,9 +64,10 @@ export {
|
|
|
61
64
|
PEApplePayButton,
|
|
62
65
|
RNPEApplePayOptions,
|
|
63
66
|
RNPEContactField,
|
|
67
|
+
PEApplePayContact,
|
|
64
68
|
RNPEGooglePayBillingAddressParameters,
|
|
65
69
|
RNPEGooglePayShippingAddressParameters,
|
|
66
70
|
PEPaymentRequest,
|
|
67
71
|
PEGooglePayButton,
|
|
68
|
-
|
|
72
|
+
PEGooglePayAddress
|
|
69
73
|
};
|
package/src/interfaces/index.ts
CHANGED
|
Binary file
|
|
Binary file
|