react-native-payengine 2.0.5 → 2.0.8
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 +26 -11
- package/android/build.gradle +2 -2
- package/android/payment-sdk-debug-1.0.3.aar +0 -0
- package/android/payment-sdk-release-1.0.3.aar +0 -0
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButton.kt +33 -10
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButtonManager.kt +17 -7
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEPaymentRequest.kt +20 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +2 -2
- 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 +219 -328
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.private.swiftinterface-e +2 -14
- 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 +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios.swiftinterface-e +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64/PayEngineSDK.framework/PayEngineSDK +0 -0
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Headers/PayEngineSDK-Swift.h +4 -4
- 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 +219 -328
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface-e +2 -14
- 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 +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/arm64-apple-ios-simulator.swiftinterface-e +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.abi.json +219 -328
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface-e +2 -14
- 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 +2 -14
- package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/Modules/PayEngineSDK.swiftmodule/x86_64-apple-ios-simulator.swiftinterface-e +2 -14
- 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 +7 -7
- package/ios/Sources/Classes/ApplePay/RNPEApplePayPaymentRequest.swift +41 -2
- package/ios/Sources/Classes/RNPayEngineNative.swift +12 -10
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +3 -1
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +6 -3
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/PEPaymentRequest.js +71 -1
- package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -1
- package/lib/commonjs/index.js +24 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js +3 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +6 -3
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -1
- package/lib/module/components/v2/PEPaymentRequest.js +58 -0
- package/lib/module/components/v2/PEPaymentRequest.js.map +1 -1
- package/lib/module/index.js +2 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/v2/PEPaymentRequest.d.ts +39 -1
- package/lib/typescript/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +4 -1
- package/src/components/v2/GooglePay/PEGooglePayButton.tsx +9 -4
- package/src/components/v2/PEPaymentRequest.ts +65 -6
- package/src/index.tsx +6 -1
- package/android/payment-sdk-debug-1.0.2.aar +0 -0
- package/android/payment-sdk-release-1.0.2.aar +0 -0
|
@@ -4,6 +4,7 @@ export class PEPaymentRequest {
|
|
|
4
4
|
constructor(merchantId, paymentAmount) {
|
|
5
5
|
let currencyCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'USD';
|
|
6
6
|
let paymentItems = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
7
|
+
let platformOptions = arguments.length > 4 ? arguments[4] : undefined;
|
|
7
8
|
|
|
8
9
|
_defineProperty(this, "merchantId", void 0);
|
|
9
10
|
|
|
@@ -13,10 +14,67 @@ export class PEPaymentRequest {
|
|
|
13
14
|
|
|
14
15
|
_defineProperty(this, "paymentItems", []);
|
|
15
16
|
|
|
17
|
+
_defineProperty(this, "platformOptions", void 0);
|
|
18
|
+
|
|
16
19
|
this.merchantId = merchantId;
|
|
17
20
|
this.paymentAmount = paymentAmount;
|
|
18
21
|
this.currencyCode = currencyCode;
|
|
19
22
|
this.paymentItems = paymentItems;
|
|
23
|
+
this.platformOptions = platformOptions;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
export let RNPEContactField;
|
|
28
|
+
|
|
29
|
+
(function (RNPEContactField) {
|
|
30
|
+
RNPEContactField["name"] = "name";
|
|
31
|
+
RNPEContactField["postalAddress"] = "postalAddress";
|
|
32
|
+
RNPEContactField["emailAddress"] = "emailAddress";
|
|
33
|
+
RNPEContactField["phoneNumber"] = "phoneNumber";
|
|
34
|
+
RNPEContactField["phoneticName"] = "phoneticName";
|
|
35
|
+
})(RNPEContactField || (RNPEContactField = {}));
|
|
36
|
+
|
|
37
|
+
export class RNPEApplePayOptions {
|
|
38
|
+
constructor(params) {
|
|
39
|
+
_defineProperty(this, "requiredBillingContactFields", []);
|
|
40
|
+
|
|
41
|
+
_defineProperty(this, "requiredShippingContactFields", []);
|
|
42
|
+
|
|
43
|
+
this.requiredBillingContactFields = params.requiredBillingContactFields;
|
|
44
|
+
this.requiredShippingContactFields = params.requiredShippingContactFields;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
export class RNPEGooglePayBillingAddressParameters {
|
|
49
|
+
constructor() {
|
|
50
|
+
_defineProperty(this, "format", 'FULL');
|
|
51
|
+
|
|
52
|
+
_defineProperty(this, "phoneNumberRequired", false);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
export class RNPEGooglePayShippingAddressParameters {
|
|
57
|
+
constructor() {
|
|
58
|
+
_defineProperty(this, "allowedCountryCodes", undefined);
|
|
59
|
+
|
|
60
|
+
_defineProperty(this, "phoneNumberRequired", false);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
export class RNPEGooglePayOptions {
|
|
65
|
+
constructor(params) {
|
|
66
|
+
_defineProperty(this, "billingAddressRequired", void 0);
|
|
67
|
+
|
|
68
|
+
_defineProperty(this, "billingAddressParameters", void 0);
|
|
69
|
+
|
|
70
|
+
_defineProperty(this, "shippingAddressRequired", void 0);
|
|
71
|
+
|
|
72
|
+
_defineProperty(this, "shippingAddressParameters", void 0);
|
|
73
|
+
|
|
74
|
+
this.billingAddressRequired = params.billingAddressRequired;
|
|
75
|
+
this.billingAddressParameters = params.billingAddressParameters;
|
|
76
|
+
this.shippingAddressRequired = params.shippingAddressRequired;
|
|
77
|
+
this.shippingAddressParameters = params.shippingAddressParameters;
|
|
20
78
|
}
|
|
21
79
|
|
|
22
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PEPaymentRequest","constructor","merchantId","paymentAmount","currencyCode","paymentItems"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["\nexport class PEPaymentRequest {\n merchantId: string;\n paymentAmount: number;\n currencyCode?: 'USD' | 'CAD' = 'USD';\n paymentItems?: {\n amount: number;\n label: string;\n }[] = []
|
|
1
|
+
{"version":3,"names":["PEPaymentRequest","constructor","merchantId","paymentAmount","currencyCode","paymentItems","platformOptions","RNPEContactField","RNPEApplePayOptions","params","requiredBillingContactFields","requiredShippingContactFields","RNPEGooglePayBillingAddressParameters","RNPEGooglePayShippingAddressParameters","undefined","RNPEGooglePayOptions","billingAddressRequired","billingAddressParameters","shippingAddressRequired","shippingAddressParameters"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;\n\nexport class PEPaymentRequest {\n merchantId: string;\n paymentAmount: number;\n currencyCode?: 'USD' | 'CAD' = 'USD';\n paymentItems?: {\n amount: number;\n label: string;\n }[] = [];\n platformOptions?: RNPEPaymentOptions;\n\n constructor(\n merchantId: string,\n paymentAmount: number,\n currencyCode: 'USD' | 'CAD' = 'USD',\n paymentItems: {\n amount: number;\n label: string;\n }[] = [],\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\nexport enum RNPEContactField {\n name = 'name',\n postalAddress = 'postalAddress',\n emailAddress = 'emailAddress',\n phoneNumber = 'phoneNumber',\n phoneticName = 'phoneticName',\n}\n\nexport class RNPEApplePayOptions {\n requiredBillingContactFields?: RNPEContactField[] = [];\n requiredShippingContactFields?: RNPEContactField[] = [];\n\n constructor(params: {\n requiredBillingContactFields: RNPEContactField[];\n requiredShippingContactFields: RNPEContactField[];\n }) {\n this.requiredBillingContactFields = params.requiredBillingContactFields;\n this.requiredShippingContactFields = params.requiredShippingContactFields;\n }\n}\n\nexport class RNPEGooglePayBillingAddressParameters {\n format: 'FULL' | 'MIN' = 'FULL'\n phoneNumberRequired: boolean = false\n}\n\nexport class RNPEGooglePayShippingAddressParameters {\n allowedCountryCodes?: string[] = undefined\n phoneNumberRequired: boolean = false\n}\n\nexport class RNPEGooglePayOptions {\n billingAddressRequired: boolean;\n billingAddressParameters?: any;\n shippingAddressRequired: boolean;\n shippingAddressParameters?: any;\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,OAAO,MAAMA,gBAAN,CAAuB;EAU5BC,WAAW,CACTC,UADS,EAETC,aAFS,EAST;IAAA,IANAC,YAMA,uEAN8B,KAM9B;IAAA,IALAC,YAKA,uEAFM,EAEN;IAAA,IADAC,eACA;;IAAA;;IAAA;;IAAA,sCAhB6B,KAgB7B;;IAAA,sCAZI,EAYJ;;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;;AAzB2B;AA4B9B,WAAYC,gBAAZ;;WAAYA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;GAAAA,gB,KAAAA,gB;;AAQZ,OAAO,MAAMC,mBAAN,CAA0B;EAI/BP,WAAW,CAACQ,MAAD,EAGR;IAAA,sDANiD,EAMjD;;IAAA,uDALkD,EAKlD;;IACD,KAAKC,4BAAL,GAAoCD,MAAM,CAACC,4BAA3C;IACA,KAAKC,6BAAL,GAAqCF,MAAM,CAACE,6BAA5C;EACD;;AAV8B;AAajC,OAAO,MAAMC,qCAAN,CAA4C;EAAA;IAAA,gCACxB,MADwB;;IAAA,6CAElB,KAFkB;EAAA;;AAAA;AAKnD,OAAO,MAAMC,sCAAN,CAA6C;EAAA;IAAA,6CACjBC,SADiB;;IAAA,6CAEnB,KAFmB;EAAA;;AAAA;AAKpD,OAAO,MAAMC,oBAAN,CAA2B;EAMhCd,WAAW,CAACQ,MAAD,EAKR;IAAA;;IAAA;;IAAA;;IAAA;;IACD,KAAKO,sBAAL,GAA8BP,MAAM,CAACO,sBAArC;IACA,KAAKC,wBAAL,GAAgCR,MAAM,CAACQ,wBAAvC;IACA,KAAKC,uBAAL,GAA+BT,MAAM,CAACS,uBAAtC;IACA,KAAKC,yBAAL,GAAiCV,MAAM,CAACU,yBAAxC;EACD;;AAhB+B"}
|
package/lib/module/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { PEBankAccountView, PEBankAccountViewMethods } from './components/v2/Sec
|
|
|
5
5
|
import { PayEngineProvider } from './components/v2/PayEngineProvider';
|
|
6
6
|
import PayEngineNative from './components/v2/PayEngineNative';
|
|
7
7
|
import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
|
|
8
|
-
import { PEPaymentRequest } from './components/v2/PEPaymentRequest';
|
|
8
|
+
import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';
|
|
9
9
|
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
10
10
|
import * as PayEngineUtils from './utils/index';
|
|
11
11
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
@@ -24,5 +24,5 @@ PayEngineUtils, PayEngineProvider, PayEngineNative, // securefields
|
|
|
24
24
|
PEKeyboardType, // credit card
|
|
25
25
|
PECreditCardView, PECreditCardViewMethods, // bank account
|
|
26
26
|
PEBankAccountView, PEBankAccountViewMethods, // Apple Pay
|
|
27
|
-
PEApplePayButton, PEPaymentRequest, PEGooglePayButton };
|
|
27
|
+
PEApplePayButton, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters, PEPaymentRequest, PEGooglePayButton };
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PayEngine","NativeModules","Platform","PECreditCardView","PECreditCardViewMethods","PEBankAccountView","PEBankAccountViewMethods","PayEngineProvider","PayEngineNative","PEApplePayButton","PEPaymentRequest","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 } 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\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 PEPaymentRequest,\n PEGooglePayButton,\n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,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,
|
|
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\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 RNPEGooglePayBillingAddressParameters, \n RNPEGooglePayShippingAddressParameters,\n PEPaymentRequest,\n PEGooglePayButton,\n \n};\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,wBAAtB;AACA,SAASC,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,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;AAEA,MAAMC,aAAa,GAChB,iFAAD,GACAhB,QAAQ,CAACiB,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGrB,aAAa,CAACsB,SAAd,GACpBtB,aAAa,CAACsB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEEtB,SAFF,EAKE;AACAgB,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,EAwBEC,qCAxBF,EAyBEC,sCAzBF,EA0BEJ,gBA1BF,EA2BEK,iBA3BF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
declare type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;
|
|
1
2
|
export declare class PEPaymentRequest {
|
|
2
3
|
merchantId: string;
|
|
3
4
|
paymentAmount: number;
|
|
@@ -6,8 +7,45 @@ export declare class PEPaymentRequest {
|
|
|
6
7
|
amount: number;
|
|
7
8
|
label: string;
|
|
8
9
|
}[];
|
|
10
|
+
platformOptions?: RNPEPaymentOptions;
|
|
9
11
|
constructor(merchantId: string, paymentAmount: number, currencyCode?: 'USD' | 'CAD', paymentItems?: {
|
|
10
12
|
amount: number;
|
|
11
13
|
label: string;
|
|
12
|
-
}[]);
|
|
14
|
+
}[], platformOptions?: RNPEPaymentOptions);
|
|
13
15
|
}
|
|
16
|
+
export declare enum RNPEContactField {
|
|
17
|
+
name = "name",
|
|
18
|
+
postalAddress = "postalAddress",
|
|
19
|
+
emailAddress = "emailAddress",
|
|
20
|
+
phoneNumber = "phoneNumber",
|
|
21
|
+
phoneticName = "phoneticName"
|
|
22
|
+
}
|
|
23
|
+
export declare class RNPEApplePayOptions {
|
|
24
|
+
requiredBillingContactFields?: RNPEContactField[];
|
|
25
|
+
requiredShippingContactFields?: RNPEContactField[];
|
|
26
|
+
constructor(params: {
|
|
27
|
+
requiredBillingContactFields: RNPEContactField[];
|
|
28
|
+
requiredShippingContactFields: RNPEContactField[];
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export declare class RNPEGooglePayBillingAddressParameters {
|
|
32
|
+
format: 'FULL' | 'MIN';
|
|
33
|
+
phoneNumberRequired: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare class RNPEGooglePayShippingAddressParameters {
|
|
36
|
+
allowedCountryCodes?: string[];
|
|
37
|
+
phoneNumberRequired: boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare class RNPEGooglePayOptions {
|
|
40
|
+
billingAddressRequired: boolean;
|
|
41
|
+
billingAddressParameters?: any;
|
|
42
|
+
shippingAddressRequired: boolean;
|
|
43
|
+
shippingAddressParameters?: any;
|
|
44
|
+
constructor(params: {
|
|
45
|
+
billingAddressRequired: boolean;
|
|
46
|
+
shippingAddressRequired: boolean;
|
|
47
|
+
billingAddressParameters?: RNPEGooglePayBillingAddressParameters;
|
|
48
|
+
shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -8,9 +8,9 @@ import type PEBankAccount from './components/v2/SecureFields/PEBankAccount';
|
|
|
8
8
|
import { PayEngineProvider } from './components/v2/PayEngineProvider';
|
|
9
9
|
import PayEngineNative from './components/v2/PayEngineNative';
|
|
10
10
|
import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
|
|
11
|
-
import { PEPaymentRequest } from './components/v2/PEPaymentRequest';
|
|
11
|
+
import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';
|
|
12
12
|
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
13
13
|
import * as PayEngineUtils from './utils/index';
|
|
14
14
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
15
15
|
declare const PayEngineStatic: any;
|
|
16
|
-
export { PayEngineStatic, PayEngine, IPayEngineConfig, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, PEPaymentRequest, PEGooglePayButton, };
|
|
16
|
+
export { PayEngineStatic, PayEngine, IPayEngineConfig, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters, PEPaymentRequest, PEGooglePayButton, };
|
package/package.json
CHANGED
|
@@ -65,7 +65,10 @@ PEApplePayButtonMethods,
|
|
|
65
65
|
return (
|
|
66
66
|
<RNPEApplePayButton
|
|
67
67
|
style={{ height: 32, width: '100%', ...(props.style as object) }}
|
|
68
|
-
paymentRequest={JSON.stringify(
|
|
68
|
+
paymentRequest={JSON.stringify({
|
|
69
|
+
...props.paymentRequest,
|
|
70
|
+
...props.paymentRequest.platformOptions
|
|
71
|
+
})}
|
|
69
72
|
onPmError={pmError}
|
|
70
73
|
onPmTokenDidReturn={pmTokenDidReturn}
|
|
71
74
|
onPmSheetDidDismiss={pmSheetDidDismiss}
|
|
@@ -8,8 +8,9 @@ const { RNPEEventEmitter } = NativeModules;
|
|
|
8
8
|
const RNPEGooglePayButton = requireNativeComponent<NativePEGooglePayViewProps>('RNPEGooglePayButton');
|
|
9
9
|
|
|
10
10
|
interface NativePEGooglePayViewProps extends ViewProps {
|
|
11
|
-
amount: number;
|
|
12
|
-
merchantId: string;
|
|
11
|
+
// amount: number;
|
|
12
|
+
// merchantId: string;
|
|
13
|
+
paymentRequest: string;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
|
|
@@ -66,8 +67,12 @@ export const PEGooglePayButton = React.forwardRef<
|
|
|
66
67
|
return (
|
|
67
68
|
<RNPEGooglePayButton
|
|
68
69
|
style={{ height: 32, width: '100%', ...(props.style as object) }}
|
|
69
|
-
amount={props.paymentRequest.paymentAmount}
|
|
70
|
-
merchantId={props.paymentRequest.merchantId}
|
|
70
|
+
// amount={props.paymentRequest.paymentAmount}
|
|
71
|
+
// merchantId={props.paymentRequest.merchantId}
|
|
72
|
+
paymentRequest={JSON.stringify({
|
|
73
|
+
...props.paymentRequest,
|
|
74
|
+
...props.paymentRequest.platformOptions
|
|
75
|
+
})}
|
|
71
76
|
/>
|
|
72
77
|
);
|
|
73
78
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
type RNPEPaymentOptions = RNPEGooglePayOptions | RNPEApplePayOptions;
|
|
1
2
|
|
|
2
3
|
export class PEPaymentRequest {
|
|
3
4
|
merchantId: string;
|
|
@@ -6,15 +7,73 @@ export class PEPaymentRequest {
|
|
|
6
7
|
paymentItems?: {
|
|
7
8
|
amount: number;
|
|
8
9
|
label: string;
|
|
9
|
-
}[] = []
|
|
10
|
+
}[] = [];
|
|
11
|
+
platformOptions?: RNPEPaymentOptions;
|
|
10
12
|
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
constructor(
|
|
14
|
+
merchantId: string,
|
|
15
|
+
paymentAmount: number,
|
|
16
|
+
currencyCode: 'USD' | 'CAD' = 'USD',
|
|
17
|
+
paymentItems: {
|
|
18
|
+
amount: number;
|
|
19
|
+
label: string;
|
|
20
|
+
}[] = [],
|
|
21
|
+
platformOptions?: RNPEPaymentOptions
|
|
22
|
+
) {
|
|
15
23
|
this.merchantId = merchantId;
|
|
16
24
|
this.paymentAmount = paymentAmount;
|
|
17
25
|
this.currencyCode = currencyCode;
|
|
18
26
|
this.paymentItems = paymentItems;
|
|
27
|
+
this.platformOptions = platformOptions;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export enum RNPEContactField {
|
|
32
|
+
name = 'name',
|
|
33
|
+
postalAddress = 'postalAddress',
|
|
34
|
+
emailAddress = 'emailAddress',
|
|
35
|
+
phoneNumber = 'phoneNumber',
|
|
36
|
+
phoneticName = 'phoneticName',
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class RNPEApplePayOptions {
|
|
40
|
+
requiredBillingContactFields?: RNPEContactField[] = [];
|
|
41
|
+
requiredShippingContactFields?: RNPEContactField[] = [];
|
|
42
|
+
|
|
43
|
+
constructor(params: {
|
|
44
|
+
requiredBillingContactFields: RNPEContactField[];
|
|
45
|
+
requiredShippingContactFields: RNPEContactField[];
|
|
46
|
+
}) {
|
|
47
|
+
this.requiredBillingContactFields = params.requiredBillingContactFields;
|
|
48
|
+
this.requiredShippingContactFields = params.requiredShippingContactFields;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export class RNPEGooglePayBillingAddressParameters {
|
|
53
|
+
format: 'FULL' | 'MIN' = 'FULL'
|
|
54
|
+
phoneNumberRequired: boolean = false
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class RNPEGooglePayShippingAddressParameters {
|
|
58
|
+
allowedCountryCodes?: string[] = undefined
|
|
59
|
+
phoneNumberRequired: boolean = false
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export class RNPEGooglePayOptions {
|
|
63
|
+
billingAddressRequired: boolean;
|
|
64
|
+
billingAddressParameters?: any;
|
|
65
|
+
shippingAddressRequired: boolean;
|
|
66
|
+
shippingAddressParameters?: any;
|
|
67
|
+
|
|
68
|
+
constructor(params: {
|
|
69
|
+
billingAddressRequired: boolean;
|
|
70
|
+
shippingAddressRequired: boolean;
|
|
71
|
+
billingAddressParameters?: RNPEGooglePayBillingAddressParameters;
|
|
72
|
+
shippingAddressParameters?: RNPEGooglePayShippingAddressParameters;
|
|
73
|
+
}) {
|
|
74
|
+
this.billingAddressRequired = params.billingAddressRequired;
|
|
75
|
+
this.billingAddressParameters = params.billingAddressParameters;
|
|
76
|
+
this.shippingAddressRequired = params.shippingAddressRequired;
|
|
77
|
+
this.shippingAddressParameters = params.shippingAddressParameters;
|
|
19
78
|
}
|
|
20
|
-
}
|
|
79
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import type PEBankAccount from './components/v2/SecureFields/PEBankAccount';
|
|
|
15
15
|
import { PayEngineProvider } from './components/v2/PayEngineProvider';
|
|
16
16
|
import PayEngineNative from './components/v2/PayEngineNative';
|
|
17
17
|
import { PEApplePayButton } from './components/v2/ApplePay/PEApplePayButton';
|
|
18
|
-
import { PEPaymentRequest } from './components/v2/PEPaymentRequest';
|
|
18
|
+
import { PEPaymentRequest, RNPEApplePayOptions, RNPEContactField, RNPEGooglePayBillingAddressParameters, RNPEGooglePayShippingAddressParameters } from './components/v2/PEPaymentRequest';
|
|
19
19
|
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
20
20
|
import * as PayEngineUtils from './utils/index';
|
|
21
21
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
@@ -59,6 +59,11 @@ export {
|
|
|
59
59
|
PEBankAccount,
|
|
60
60
|
// Apple Pay
|
|
61
61
|
PEApplePayButton,
|
|
62
|
+
RNPEApplePayOptions,
|
|
63
|
+
RNPEContactField,
|
|
64
|
+
RNPEGooglePayBillingAddressParameters,
|
|
65
|
+
RNPEGooglePayShippingAddressParameters,
|
|
62
66
|
PEPaymentRequest,
|
|
63
67
|
PEGooglePayButton,
|
|
68
|
+
|
|
64
69
|
};
|
|
Binary file
|
|
Binary file
|