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
|
@@ -180,19 +180,7 @@ public struct ApplePayConfigDataResponse : Swift.Codable {
|
|
|
180
180
|
public init(from decoder: any Swift.Decoder) throws
|
|
181
181
|
}
|
|
182
182
|
@_inheritsConvenienceInitializers @objc public class ApplePayPaymentRequest : ObjectiveC.NSObject {
|
|
183
|
-
public
|
|
184
|
-
get
|
|
185
|
-
set
|
|
186
|
-
}
|
|
187
|
-
public var paymentAmount: Swift.Double {
|
|
188
|
-
get
|
|
189
|
-
set
|
|
190
|
-
}
|
|
191
|
-
public var appleRequest: PassKit.PKPaymentRequest {
|
|
192
|
-
get
|
|
193
|
-
set
|
|
194
|
-
}
|
|
195
|
-
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD")
|
|
183
|
+
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD", requiredBillingContactFields: Swift.Set<PassKit.PKContactField> = [], requiredShippingContactFields: Swift.Set<PassKit.PKContactField> = [])
|
|
196
184
|
@objc override dynamic public init()
|
|
197
185
|
@objc deinit
|
|
198
186
|
}
|
|
@@ -282,7 +270,7 @@ public enum PEKeyboardType {
|
|
|
282
270
|
@objc func paymentError(error: any Swift.Error)
|
|
283
271
|
@objc func paymentSheetDidMDismiss()
|
|
284
272
|
@objc func paymentTokenDidReturn(token: Swift.String, completion: @escaping (PEApplePayResult) -> Swift.Void)
|
|
285
|
-
@objc func paymentTokenNotAvailable()
|
|
273
|
+
@objc func paymentTokenNotAvailable(error: (any Swift.Error)?)
|
|
286
274
|
}
|
|
287
275
|
extension UIKit.UIView {
|
|
288
276
|
@_Concurrency.MainActor(unsafe) public func pinEdges(to view: UIKit.UIView)
|
|
@@ -180,19 +180,7 @@ public struct ApplePayConfigDataResponse : Swift.Codable {
|
|
|
180
180
|
public init(from decoder: any Swift.Decoder) throws
|
|
181
181
|
}
|
|
182
182
|
@_inheritsConvenienceInitializers @objc public class ApplePayPaymentRequest : ObjectiveC.NSObject {
|
|
183
|
-
public
|
|
184
|
-
get
|
|
185
|
-
set
|
|
186
|
-
}
|
|
187
|
-
public var paymentAmount: Swift.Double {
|
|
188
|
-
get
|
|
189
|
-
set
|
|
190
|
-
}
|
|
191
|
-
public var appleRequest: PassKit.PKPaymentRequest {
|
|
192
|
-
get
|
|
193
|
-
set
|
|
194
|
-
}
|
|
195
|
-
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD")
|
|
183
|
+
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD", requiredBillingContactFields: Swift.Set<PassKit.PKContactField> = [], requiredShippingContactFields: Swift.Set<PassKit.PKContactField> = [])
|
|
196
184
|
@objc override dynamic public init()
|
|
197
185
|
@objc deinit
|
|
198
186
|
}
|
|
@@ -282,7 +270,7 @@ public enum PEKeyboardType {
|
|
|
282
270
|
@objc func paymentError(error: any Swift.Error)
|
|
283
271
|
@objc func paymentSheetDidMDismiss()
|
|
284
272
|
@objc func paymentTokenDidReturn(token: Swift.String, completion: @escaping (PayEngineSDK.PEApplePayResult) -> Swift.Void)
|
|
285
|
-
@objc func paymentTokenNotAvailable()
|
|
273
|
+
@objc func paymentTokenNotAvailable(error: (any Swift.Error)?)
|
|
286
274
|
}
|
|
287
275
|
extension UIKit.UIView {
|
|
288
276
|
@_Concurrency.MainActor(unsafe) public func pinEdges(to view: UIKit.UIView)
|
|
Binary file
|
|
@@ -180,19 +180,7 @@ public struct ApplePayConfigDataResponse : Swift.Codable {
|
|
|
180
180
|
public init(from decoder: any Swift.Decoder) throws
|
|
181
181
|
}
|
|
182
182
|
@_inheritsConvenienceInitializers @objc public class ApplePayPaymentRequest : ObjectiveC.NSObject {
|
|
183
|
-
public
|
|
184
|
-
get
|
|
185
|
-
set
|
|
186
|
-
}
|
|
187
|
-
public var paymentAmount: Swift.Double {
|
|
188
|
-
get
|
|
189
|
-
set
|
|
190
|
-
}
|
|
191
|
-
public var appleRequest: PassKit.PKPaymentRequest {
|
|
192
|
-
get
|
|
193
|
-
set
|
|
194
|
-
}
|
|
195
|
-
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD")
|
|
183
|
+
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD", requiredBillingContactFields: Swift.Set<PassKit.PKContactField> = [], requiredShippingContactFields: Swift.Set<PassKit.PKContactField> = [])
|
|
196
184
|
@objc override dynamic public init()
|
|
197
185
|
@objc deinit
|
|
198
186
|
}
|
|
@@ -282,7 +270,7 @@ public enum PEKeyboardType {
|
|
|
282
270
|
@objc func paymentError(error: any Swift.Error)
|
|
283
271
|
@objc func paymentSheetDidMDismiss()
|
|
284
272
|
@objc func paymentTokenDidReturn(token: Swift.String, completion: @escaping (PEApplePayResult) -> Swift.Void)
|
|
285
|
-
@objc func paymentTokenNotAvailable()
|
|
273
|
+
@objc func paymentTokenNotAvailable(error: (any Swift.Error)?)
|
|
286
274
|
}
|
|
287
275
|
extension UIKit.UIView {
|
|
288
276
|
@_Concurrency.MainActor(unsafe) public func pinEdges(to view: UIKit.UIView)
|
|
@@ -180,19 +180,7 @@ public struct ApplePayConfigDataResponse : Swift.Codable {
|
|
|
180
180
|
public init(from decoder: any Swift.Decoder) throws
|
|
181
181
|
}
|
|
182
182
|
@_inheritsConvenienceInitializers @objc public class ApplePayPaymentRequest : ObjectiveC.NSObject {
|
|
183
|
-
public
|
|
184
|
-
get
|
|
185
|
-
set
|
|
186
|
-
}
|
|
187
|
-
public var paymentAmount: Swift.Double {
|
|
188
|
-
get
|
|
189
|
-
set
|
|
190
|
-
}
|
|
191
|
-
public var appleRequest: PassKit.PKPaymentRequest {
|
|
192
|
-
get
|
|
193
|
-
set
|
|
194
|
-
}
|
|
195
|
-
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD")
|
|
183
|
+
@objc public func build(paymentItems: [PassKit.PKPaymentSummaryItem] = [], paymentAmount: Swift.Double, currencyCode: Swift.String = "USD", requiredBillingContactFields: Swift.Set<PassKit.PKContactField> = [], requiredShippingContactFields: Swift.Set<PassKit.PKContactField> = [])
|
|
196
184
|
@objc override dynamic public init()
|
|
197
185
|
@objc deinit
|
|
198
186
|
}
|
|
@@ -282,7 +270,7 @@ public enum PEKeyboardType {
|
|
|
282
270
|
@objc func paymentError(error: any Swift.Error)
|
|
283
271
|
@objc func paymentSheetDidMDismiss()
|
|
284
272
|
@objc func paymentTokenDidReturn(token: Swift.String, completion: @escaping (PayEngineSDK.PEApplePayResult) -> Swift.Void)
|
|
285
|
-
@objc func paymentTokenNotAvailable()
|
|
273
|
+
@objc func paymentTokenNotAvailable(error: (any Swift.Error)?)
|
|
286
274
|
}
|
|
287
275
|
extension UIKit.UIView {
|
|
288
276
|
@_Concurrency.MainActor(unsafe) public func pinEdges(to view: UIKit.UIView)
|
package/ios/PayEngineSDK.xcframework/ios-arm64_x86_64-simulator/PayEngineSDK.framework/PayEngineSDK
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -62,6 +62,13 @@ class RNPEApplePayButton: UIView {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
extension RNPEApplePayButton: PEApplePayDelegate {
|
|
65
|
+
func paymentTokenNotAvailable(error: (Error)?) {
|
|
66
|
+
debugPrint("paymentTokenNotAvailable")
|
|
67
|
+
if self.onPmError != nil {
|
|
68
|
+
self.onPmError!(["error": error?.localizedDescription ?? "Payment token not available due to unexpected error"])
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
|
|
66
73
|
func paymentError(error: Error) {
|
|
67
74
|
debugPrint("payment error \(error)")
|
|
@@ -84,13 +91,6 @@ extension RNPEApplePayButton: PEApplePayDelegate {
|
|
|
84
91
|
completion(.success)
|
|
85
92
|
}
|
|
86
93
|
|
|
87
|
-
func paymentTokenNotAvailable() {
|
|
88
|
-
debugPrint("paymentTokenNotAvailable")
|
|
89
|
-
if self.onPmError != nil {
|
|
90
|
-
self.onPmError!(["error": "Payment token not available"])
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
94
|
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -13,20 +13,59 @@ public struct RNPEApplePayPaymentRequest: Codable {
|
|
|
13
13
|
var paymentAmount: Double
|
|
14
14
|
var currencyCode: String = "USD"
|
|
15
15
|
var paymentItems: [RNPEApplePayPaymentSummaryItem]
|
|
16
|
+
var requiredBillingContactFields: Set<RNPEContactField>? = []
|
|
17
|
+
var requiredShippingContactFields: Set<RNPEContactField>? = []
|
|
16
18
|
|
|
17
|
-
init(
|
|
19
|
+
init(
|
|
20
|
+
paymentAmount: Double,
|
|
21
|
+
currencyCode: String,
|
|
22
|
+
paymentItems: [RNPEApplePayPaymentSummaryItem],
|
|
23
|
+
requiredBillingContactFields: Set<RNPEContactField> = [],
|
|
24
|
+
requiredShippingContactFields: Set<RNPEContactField> = []
|
|
25
|
+
) {
|
|
18
26
|
self.paymentAmount = paymentAmount
|
|
19
27
|
self.currencyCode = currencyCode
|
|
20
28
|
self.paymentItems = paymentItems
|
|
29
|
+
self.requiredBillingContactFields = requiredBillingContactFields
|
|
30
|
+
self.requiredShippingContactFields = requiredShippingContactFields
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
func toNative() -> ApplePayPaymentRequest {
|
|
24
34
|
let request = ApplePayPaymentRequest()
|
|
25
|
-
request.build(
|
|
35
|
+
request.build(
|
|
36
|
+
paymentItems: self.paymentItems.map { $0.toNative() },
|
|
37
|
+
paymentAmount: self.paymentAmount,
|
|
38
|
+
currencyCode: self.currencyCode,
|
|
39
|
+
requiredBillingContactFields: Set(self.requiredBillingContactFields?.map { $0.toNative() } ?? []),
|
|
40
|
+
requiredShippingContactFields: Set(self.requiredShippingContactFields?.map { $0.toNative() } ?? [])
|
|
41
|
+
)
|
|
26
42
|
return request
|
|
27
43
|
}
|
|
28
44
|
}
|
|
29
45
|
|
|
46
|
+
public enum RNPEContactField: String, Codable {
|
|
47
|
+
case postalAddress = "postalAddress"
|
|
48
|
+
case emailAddress = "emailAddress"
|
|
49
|
+
case phoneNumber = "phoneNumber"
|
|
50
|
+
case name = "name"
|
|
51
|
+
case phoneticName = "phoneticName"
|
|
52
|
+
|
|
53
|
+
func toNative() -> PKContactField {
|
|
54
|
+
switch (self) {
|
|
55
|
+
case .postalAddress:
|
|
56
|
+
return PKContactField.postalAddress;
|
|
57
|
+
case .emailAddress:
|
|
58
|
+
return PKContactField.emailAddress;
|
|
59
|
+
case .phoneNumber:
|
|
60
|
+
return PKContactField.phoneNumber;
|
|
61
|
+
case .name:
|
|
62
|
+
return PKContactField.name;
|
|
63
|
+
case .phoneticName:
|
|
64
|
+
return PKContactField.phoneticName;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
30
69
|
public struct RNPEApplePayPaymentSummaryItem: Codable {
|
|
31
70
|
var amount: Double
|
|
32
71
|
var label: String
|
|
@@ -30,18 +30,20 @@ class RNPayEngineNative: NSObject {
|
|
|
30
30
|
|
|
31
31
|
@objc(createFraudMonitorSession:resolver:rejecter:)
|
|
32
32
|
func createFraudMonitorSession(merchantId: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
DispatchQueue.main.async {
|
|
34
|
+
do {
|
|
35
|
+
let payengine = try self.getInstance()
|
|
36
|
+
payengine.createFraudMonitorSession(merchantId) { fraudResult in
|
|
37
|
+
switch fraudResult {
|
|
38
|
+
case .success(let sessionId):
|
|
39
|
+
return resolve(sessionId)
|
|
40
|
+
case .failure(let error):
|
|
41
|
+
return reject("error", "Unable to obtain session ID", error)
|
|
42
|
+
}
|
|
41
43
|
}
|
|
44
|
+
} catch {
|
|
45
|
+
return reject("error", error.localizedDescription, error)
|
|
42
46
|
}
|
|
43
|
-
} catch {
|
|
44
|
-
return reject("error", error.localizedDescription, error)
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -45,7 +45,9 @@ const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
45
45
|
width: '100%',
|
|
46
46
|
...props.style
|
|
47
47
|
},
|
|
48
|
-
paymentRequest: JSON.stringify(props.paymentRequest
|
|
48
|
+
paymentRequest: JSON.stringify({ ...props.paymentRequest,
|
|
49
|
+
...props.paymentRequest.platformOptions
|
|
50
|
+
}),
|
|
49
51
|
onPmError: pmError,
|
|
50
52
|
onPmTokenDidReturn: pmTokenDidReturn,
|
|
51
53
|
onPmSheetDidDismiss: pmSheetDidDismiss
|
|
@@ -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","JSON","stringify","paymentRequest"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: 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) => 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 props.onTokenDidReturn(event.nativeEvent.token!);\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(props.paymentRequest)} \n onPmError={pmError} \n onPmTokenDidReturn={pmTokenDidReturn} \n onPmSheetDidDismiss={pmSheetDidDismiss} \n />\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAIA,MAAMA,kBAAkB,GAAG,IAAAC,mCAAA,EAAkD,oBAAlD,CAA3B;AA4BO,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;MAC1BV,KAAK,CAACU,gBAAN,CAAuBN,KAAK,CAACG,WAAN,CAAkBI,KAAzC;IACD;EACF,CAJD;;EAMA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIZ,KAAK,CAACa,uBAAV,EAAmC;MACjCb,KAAK,CAACa,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,GAAIjB,KAAK,CAACkB;IAAvC,CADT;IAEE,cAAc,EAAEC,IAAI,CAACC,SAAL,
|
|
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","JSON","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';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: 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) => 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 props.onTokenDidReturn(event.nativeEvent.token!);\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;;;;;;AAIA,MAAMA,kBAAkB,GAAG,IAAAC,mCAAA,EAAkD,oBAAlD,CAA3B;AA4BO,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;MAC1BV,KAAK,CAACU,gBAAN,CAAuBN,KAAK,CAACG,WAAN,CAAkBI,KAAzC;IACD;EACF,CAJD;;EAMA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIZ,KAAK,CAACa,uBAAV,EAAmC;MACjCb,KAAK,CAACa,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,GAAIjB,KAAK,CAACkB;IAAvC,CADT;IAEE,cAAc,EAAEC,IAAI,CAACC,SAAL,CAAe,EAC7B,GAAGpB,KAAK,CAACqB,cADoB;MAE7B,GAAGrB,KAAK,CAACqB,cAAN,CAAqBC;IAFK,CAAf,CAFlB;IAME,SAAS,EAAEnB,OANb;IAOE,kBAAkB,EAAEM,gBAPtB;IAQE,mBAAmB,EAAEG;EARvB,EADF;AAYD,CA1C+B,CAAzB"}
|
|
@@ -61,9 +61,12 @@ const PEGooglePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
61
61
|
height: 32,
|
|
62
62
|
width: '100%',
|
|
63
63
|
...props.style
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
} // amount={props.paymentRequest.paymentAmount}
|
|
65
|
+
// merchantId={props.paymentRequest.merchantId}
|
|
66
|
+
,
|
|
67
|
+
paymentRequest: JSON.stringify({ ...props.paymentRequest,
|
|
68
|
+
...props.paymentRequest.platformOptions
|
|
69
|
+
})
|
|
67
70
|
});
|
|
68
71
|
});
|
|
69
72
|
exports.PEGooglePayButton = PEGooglePayButton;
|
|
@@ -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","console","log","onTokenDidReturn","listener2","error","onPaymentFailed","Error","listener3","onPaymentSheetDismissed","remove","Platform","OS","height","width","style","JSON","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';\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) => 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 } = args;\n console.log('ON token', token)\n props.onTokenDidReturn?.(token)\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;;;;;;AAGA,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;MAAF,IAAYD,IAAlB;MACAE,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBF,KAAxB;MACA,yBAAAP,KAAK,CAACU,gBAAN,qFAAAV,KAAK,EAAoBO,KAApB,CAAL;IACD,CAJiB,CAAlB;IAMA,MAAMI,SAAS,GAAGhB,cAAc,CAACU,WAAf,CAA2B,kBAA3B,EAA+CC,IAAI,IAAI;MAAA;;MACvE,MAAM;QAAEM;MAAF,IAAYN,IAAlB;MACAE,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBG,KAAxB;MACA,yBAAAZ,KAAK,CAACa,eAAN,qFAAAb,KAAK,EAAmB,IAAIc,KAAJ,CAAUF,KAAV,CAAnB,CAAL;IACD,CAJiB,CAAlB;IAMA,MAAMG,SAAS,GAAGpB,cAAc,CAACU,WAAf,CAA2B,oBAA3B,EAAiD,MAAM;MAAA;;MACvEG,OAAO,CAACC,GAAR,CAAY,YAAZ;MACA,yBAAAT,KAAK,CAACgB,uBAAN,qFAAAhB,KAAK;IACN,CAHiB,CAAlB;IAKA,OAAO,MAAM;MACXI,SAAS,CAACa,MAAV;MACAN,SAAS,CAACM,MAAV;MACAF,SAAS,CAACE,MAAV;IACD,CAJD;EAKD,CAvBD,EAuBG,EAvBH;;EAyBA,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,GAAIrB,KAAK,CAACsB;IAAvC,CADT,CAEE;IACA;IAHF;IAIE,cAAc,EAAEC,IAAI,CAACC,SAAL,CAAe,EAC7B,GAAGxB,KAAK,CAACyB,cADoB;MAE7B,GAAGzB,KAAK,CAACyB,cAAN,CAAqBC;IAFK,CAAf;EAJlB,EADF;AAWD,CAhDgC,CAA1B"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.PEPaymentRequest = void 0;
|
|
6
|
+
exports.RNPEGooglePayShippingAddressParameters = exports.RNPEGooglePayOptions = exports.RNPEGooglePayBillingAddressParameters = exports.RNPEContactField = exports.RNPEApplePayOptions = exports.PEPaymentRequest = void 0;
|
|
7
7
|
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
|
|
@@ -11,6 +11,7 @@ class PEPaymentRequest {
|
|
|
11
11
|
constructor(merchantId, paymentAmount) {
|
|
12
12
|
let currencyCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'USD';
|
|
13
13
|
let paymentItems = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
14
|
+
let platformOptions = arguments.length > 4 ? arguments[4] : undefined;
|
|
14
15
|
|
|
15
16
|
_defineProperty(this, "merchantId", void 0);
|
|
16
17
|
|
|
@@ -20,13 +21,82 @@ class PEPaymentRequest {
|
|
|
20
21
|
|
|
21
22
|
_defineProperty(this, "paymentItems", []);
|
|
22
23
|
|
|
24
|
+
_defineProperty(this, "platformOptions", void 0);
|
|
25
|
+
|
|
23
26
|
this.merchantId = merchantId;
|
|
24
27
|
this.paymentAmount = paymentAmount;
|
|
25
28
|
this.currencyCode = currencyCode;
|
|
26
29
|
this.paymentItems = paymentItems;
|
|
30
|
+
this.platformOptions = platformOptions;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
exports.PEPaymentRequest = PEPaymentRequest;
|
|
36
|
+
let RNPEContactField;
|
|
37
|
+
exports.RNPEContactField = RNPEContactField;
|
|
38
|
+
|
|
39
|
+
(function (RNPEContactField) {
|
|
40
|
+
RNPEContactField["name"] = "name";
|
|
41
|
+
RNPEContactField["postalAddress"] = "postalAddress";
|
|
42
|
+
RNPEContactField["emailAddress"] = "emailAddress";
|
|
43
|
+
RNPEContactField["phoneNumber"] = "phoneNumber";
|
|
44
|
+
RNPEContactField["phoneticName"] = "phoneticName";
|
|
45
|
+
})(RNPEContactField || (exports.RNPEContactField = RNPEContactField = {}));
|
|
46
|
+
|
|
47
|
+
class RNPEApplePayOptions {
|
|
48
|
+
constructor(params) {
|
|
49
|
+
_defineProperty(this, "requiredBillingContactFields", []);
|
|
50
|
+
|
|
51
|
+
_defineProperty(this, "requiredShippingContactFields", []);
|
|
52
|
+
|
|
53
|
+
this.requiredBillingContactFields = params.requiredBillingContactFields;
|
|
54
|
+
this.requiredShippingContactFields = params.requiredShippingContactFields;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
exports.RNPEApplePayOptions = RNPEApplePayOptions;
|
|
60
|
+
|
|
61
|
+
class RNPEGooglePayBillingAddressParameters {
|
|
62
|
+
constructor() {
|
|
63
|
+
_defineProperty(this, "format", 'FULL');
|
|
64
|
+
|
|
65
|
+
_defineProperty(this, "phoneNumberRequired", false);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
exports.RNPEGooglePayBillingAddressParameters = RNPEGooglePayBillingAddressParameters;
|
|
71
|
+
|
|
72
|
+
class RNPEGooglePayShippingAddressParameters {
|
|
73
|
+
constructor() {
|
|
74
|
+
_defineProperty(this, "allowedCountryCodes", undefined);
|
|
75
|
+
|
|
76
|
+
_defineProperty(this, "phoneNumberRequired", false);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
exports.RNPEGooglePayShippingAddressParameters = RNPEGooglePayShippingAddressParameters;
|
|
82
|
+
|
|
83
|
+
class RNPEGooglePayOptions {
|
|
84
|
+
constructor(params) {
|
|
85
|
+
_defineProperty(this, "billingAddressRequired", void 0);
|
|
86
|
+
|
|
87
|
+
_defineProperty(this, "billingAddressParameters", void 0);
|
|
88
|
+
|
|
89
|
+
_defineProperty(this, "shippingAddressRequired", void 0);
|
|
90
|
+
|
|
91
|
+
_defineProperty(this, "shippingAddressParameters", void 0);
|
|
92
|
+
|
|
93
|
+
this.billingAddressRequired = params.billingAddressRequired;
|
|
94
|
+
this.billingAddressParameters = params.billingAddressParameters;
|
|
95
|
+
this.shippingAddressRequired = params.shippingAddressRequired;
|
|
96
|
+
this.shippingAddressParameters = params.shippingAddressParameters;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
exports.RNPEGooglePayOptions = RNPEGooglePayOptions;
|
|
32
102
|
//# sourceMappingURL=PEPaymentRequest.js.map
|
|
@@ -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":";;;;;;;;;AAEO,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;;;IA4BlBC,gB;;;WAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;EAAAA,gB;GAAAA,gB,gCAAAA,gB;;AAQL,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;;;;AAa1B,MAAMC,qCAAN,CAA4C;EAAA;IAAA,gCACxB,MADwB;;IAAA,6CAElB,KAFkB;EAAA;;AAAA;;;;AAK5C,MAAMC,sCAAN,CAA6C;EAAA;IAAA,6CACjBC,SADiB;;IAAA,6CAEnB,KAFmB;EAAA;;AAAA;;;;AAK7C,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/commonjs/index.js
CHANGED
|
@@ -70,6 +70,30 @@ Object.defineProperty(exports, "PayEngineProvider", {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
exports.PayEngineUtils = exports.PayEngineStatic = void 0;
|
|
73
|
+
Object.defineProperty(exports, "RNPEApplePayOptions", {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return _PEPaymentRequest.RNPEApplePayOptions;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, "RNPEContactField", {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return _PEPaymentRequest.RNPEContactField;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, "RNPEGooglePayBillingAddressParameters", {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return _PEPaymentRequest.RNPEGooglePayBillingAddressParameters;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, "RNPEGooglePayShippingAddressParameters", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return _PEPaymentRequest.RNPEGooglePayShippingAddressParameters;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
73
97
|
|
|
74
98
|
var _PayEngine = _interopRequireDefault(require("./components/PayEngine"));
|
|
75
99
|
|
|
@@ -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 } 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":"
|
|
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\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;;AACA;;AAEA;;AAIA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AACA;;;;;;;;AAEA,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"}
|
|
@@ -32,7 +32,9 @@ export const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
32
32
|
width: '100%',
|
|
33
33
|
...props.style
|
|
34
34
|
},
|
|
35
|
-
paymentRequest: JSON.stringify(props.paymentRequest
|
|
35
|
+
paymentRequest: JSON.stringify({ ...props.paymentRequest,
|
|
36
|
+
...props.paymentRequest.platformOptions
|
|
37
|
+
}),
|
|
36
38
|
onPmError: pmError,
|
|
37
39
|
onPmTokenDidReturn: pmTokenDidReturn,
|
|
38
40
|
onPmSheetDidDismiss: pmSheetDidDismiss
|
|
@@ -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","JSON","stringify","paymentRequest"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '../PEPaymentRequest';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: 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) => 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 props.onTokenDidReturn(event.nativeEvent.token!);\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(props.paymentRequest)} \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;AAIA,MAAMC,kBAAkB,GAAGF,sBAAsB,CAA4B,oBAA5B,CAAjD;AA4BA,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;MAC1BV,KAAK,CAACU,gBAAN,CAAuBN,KAAK,CAACG,WAAN,CAAkBI,KAAzC;IACD;EACF,CAJD;;EAMA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIZ,KAAK,CAACa,uBAAV,EAAmC;MACjCb,KAAK,CAACa,uBAAN;IACD;EACF,CAJD;;EAMA,IAAInB,QAAQ,CAACoB,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,GAAIhB,KAAK,CAACiB;IAAvC,CADT;IAEE,cAAc,EAAEC,IAAI,CAACC,SAAL,
|
|
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","JSON","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';\n\n\nconst RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');\n\ntype NativePEApplePayEvent = {\n nativeEvent: {\n error?: string;\n token?: 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) => 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 props.onTokenDidReturn(event.nativeEvent.token!);\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;AAIA,MAAMC,kBAAkB,GAAGF,sBAAsB,CAA4B,oBAA5B,CAAjD;AA4BA,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;MAC1BV,KAAK,CAACU,gBAAN,CAAuBN,KAAK,CAACG,WAAN,CAAkBI,KAAzC;IACD;EACF,CAJD;;EAMA,MAAMC,iBAAiB,GAAG,MAAM;IAC9B,IAAIZ,KAAK,CAACa,uBAAV,EAAmC;MACjCb,KAAK,CAACa,uBAAN;IACD;EACF,CAJD;;EAMA,IAAInB,QAAQ,CAACoB,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,GAAIhB,KAAK,CAACiB;IAAvC,CADT;IAEE,cAAc,EAAEC,IAAI,CAACC,SAAL,CAAe,EAC7B,GAAGnB,KAAK,CAACoB,cADoB;MAE7B,GAAGpB,KAAK,CAACoB,cAAN,CAAqBC;IAFK,CAAf,CAFlB;IAME,SAAS,EAAElB,OANb;IAOE,kBAAkB,EAAEM,gBAPtB;IAQE,mBAAmB,EAAEG;EARvB,EADF;AAYD,CA1C+B,CAAzB"}
|
|
@@ -48,9 +48,12 @@ export const PEGooglePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
48
48
|
height: 32,
|
|
49
49
|
width: '100%',
|
|
50
50
|
...props.style
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
} // amount={props.paymentRequest.paymentAmount}
|
|
52
|
+
// merchantId={props.paymentRequest.merchantId}
|
|
53
|
+
,
|
|
54
|
+
paymentRequest: JSON.stringify({ ...props.paymentRequest,
|
|
55
|
+
...props.paymentRequest.platformOptions
|
|
56
|
+
})
|
|
54
57
|
});
|
|
55
58
|
});
|
|
56
59
|
//# sourceMappingURL=PEGooglePayButton.js.map
|
|
@@ -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","console","log","onTokenDidReturn","listener2","error","onPaymentFailed","Error","listener3","onPaymentSheetDismissed","remove","OS","height","width","style","JSON","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';\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) => 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 } = args;\n console.log('ON token', token)\n props.onTokenDidReturn?.(token)\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;AAGA,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;MAAF,IAAYD,IAAlB;MACAE,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBF,KAAxB;MACA,yBAAAP,KAAK,CAACU,gBAAN,qFAAAV,KAAK,EAAoBO,KAApB,CAAL;IACD,CAJiB,CAAlB;IAMA,MAAMI,SAAS,GAAGd,cAAc,CAACQ,WAAf,CAA2B,kBAA3B,EAA+CC,IAAI,IAAI;MAAA;;MACvE,MAAM;QAAEM;MAAF,IAAYN,IAAlB;MACAE,OAAO,CAACC,GAAR,CAAY,UAAZ,EAAwBG,KAAxB;MACA,yBAAAZ,KAAK,CAACa,eAAN,qFAAAb,KAAK,EAAmB,IAAIc,KAAJ,CAAUF,KAAV,CAAnB,CAAL;IACD,CAJiB,CAAlB;IAMA,MAAMG,SAAS,GAAGlB,cAAc,CAACQ,WAAf,CAA2B,oBAA3B,EAAiD,MAAM;MAAA;;MACvEG,OAAO,CAACC,GAAR,CAAY,YAAZ;MACA,yBAAAT,KAAK,CAACgB,uBAAN,qFAAAhB,KAAK;IACN,CAHiB,CAAlB;IAKA,OAAO,MAAM;MACXI,SAAS,CAACa,MAAV;MACAN,SAAS,CAACM,MAAV;MACAF,SAAS,CAACE,MAAV;IACD,CAJD;EAKD,CAvBD,EAuBG,EAvBH;;EAyBA,IAAIzB,QAAQ,CAAC0B,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,GAAIpB,KAAK,CAACqB;IAAvC,CADT,CAEE;IACA;IAHF;IAIE,cAAc,EAAEC,IAAI,CAACC,SAAL,CAAe,EAC7B,GAAGvB,KAAK,CAACwB,cADoB;MAE7B,GAAGxB,KAAK,CAACwB,cAAN,CAAqBC;IAFK,CAAf;EAJlB,EADF;AAWD,CAhDgC,CAA1B"}
|