react-native-payengine 2.0.2 → 2.0.5
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 +78 -1
- package/android/.gradle/6.1.1/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.1.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/caches/deviceStreaming.xml +11 -0
- package/android/build.gradle +3 -3
- package/android/payment-sdk-debug-1.0.2.aar +0 -0
- package/android/payment-sdk-release-1.0.2.aar +0 -0
- package/android/src/main/java/com/reactnativepayengine/PayenginePackage.java +2 -0
- package/android/src/main/java/com/reactnativepayengine/v2/RNPayEngineNative.kt +2 -0
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButton.kt +105 -0
- package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButtonManager.kt +56 -0
- package/android/src/main/java/com/reactnativepayengine/v2/securefields/RNPEEvents.kt +3 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js +4 -0
- package/lib/commonjs/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js +70 -0
- package/lib/commonjs/components/v2/GooglePay/PEGooglePayButton.js.map +1 -0
- package/lib/commonjs/components/v2/{ApplePay/PEPaymentRequest.js → PEPaymentRequest.js} +8 -5
- package/lib/commonjs/components/v2/PEPaymentRequest.js.map +1 -0
- package/lib/commonjs/components/v2/PayEngineNative.js +2 -0
- package/lib/commonjs/components/v2/PayEngineNative.js.map +1 -1
- package/lib/commonjs/index.js +9 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js +5 -1
- package/lib/module/components/v2/ApplePay/PEApplePayButton.js.map +1 -1
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js +56 -0
- package/lib/module/components/v2/GooglePay/PEGooglePayButton.js.map +1 -0
- package/lib/module/components/v2/PEPaymentRequest.js +23 -0
- package/lib/module/components/v2/PEPaymentRequest.js.map +1 -0
- package/lib/module/components/v2/PayEngineNative.js +2 -0
- package/lib/module/components/v2/PayEngineNative.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/v2/ApplePay/PEApplePayButton.d.ts +1 -1
- package/lib/typescript/components/v2/GooglePay/PEGooglePayButton.d.ts +12 -0
- package/lib/typescript/components/v2/PEPaymentRequest.d.ts +13 -0
- package/lib/typescript/index.d.ts +3 -2
- package/package.json +2 -2
- package/src/components/v2/ApplePay/PEApplePayButton.tsx +8 -4
- package/src/components/v2/GooglePay/PEGooglePayButton.tsx +73 -0
- package/src/components/v2/{ApplePay/PEPaymentRequest.ts → PEPaymentRequest.ts} +6 -4
- package/src/components/v2/PayEngineNative.tsx +3 -1
- package/src/index.tsx +3 -1
- package/android/paymentsdk-debug.aar +0 -0
- package/android/paymentsdk-release.aar +0 -0
- package/lib/commonjs/components/v2/ApplePay/PEPaymentRequest.js.map +0 -1
- package/lib/module/components/v2/ApplePay/PEPaymentRequest.js +0 -20
- package/lib/module/components/v2/ApplePay/PEPaymentRequest.js.map +0 -1
- package/lib/typescript/components/v2/ApplePay/PEPaymentRequest.d.ts +0 -12
package/README.md
CHANGED
|
@@ -178,7 +178,7 @@ const ApplePayScreen = () => {
|
|
|
178
178
|
checkSupport();
|
|
179
179
|
}, []);
|
|
180
180
|
|
|
181
|
-
const paymentRequest = new PEPaymentRequest(120.5, 'USD', [
|
|
181
|
+
const paymentRequest = new PEPaymentRequest(<MERCHANT_ID>, 120.5, 'USD', [
|
|
182
182
|
{
|
|
183
183
|
amount: 100.0,
|
|
184
184
|
label: 'Full Back Lounge Chair',
|
|
@@ -232,3 +232,80 @@ const ApplePayScreen = () => {
|
|
|
232
232
|
);
|
|
233
233
|
};
|
|
234
234
|
```
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
#### Google Pay
|
|
238
|
+
|
|
239
|
+
```jsx
|
|
240
|
+
import React from 'react';
|
|
241
|
+
import { View, Text, ScrollView } from 'react-native';
|
|
242
|
+
import {
|
|
243
|
+
PEGooglePayButton,
|
|
244
|
+
PEPaymentRequest,
|
|
245
|
+
PayEngineNative,
|
|
246
|
+
} from 'react-native-payengine';
|
|
247
|
+
|
|
248
|
+
const GooglePayScreen = () => {
|
|
249
|
+
const [canMakePayment, setCanMakePayment] = React.useState(false);
|
|
250
|
+
const [paymentResult, setPaymentResult] = React.useState(null);
|
|
251
|
+
|
|
252
|
+
React.useEffect(() => {
|
|
253
|
+
const checkSupport = async () => {
|
|
254
|
+
try {
|
|
255
|
+
const isSupported = await PayEngineNative.isPlatformPaySupported(
|
|
256
|
+
MERCHANT_ID
|
|
257
|
+
);
|
|
258
|
+
console.log('isSupported', isSupported);
|
|
259
|
+
setCanMakePayment(isSupported);
|
|
260
|
+
} catch (e) {
|
|
261
|
+
console.error('Apple Pay not supported', e);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
checkSupport();
|
|
265
|
+
}, []);
|
|
266
|
+
|
|
267
|
+
const paymentRequest = new PEPaymentRequest(<MERCHANT_ID>, 15.5);
|
|
268
|
+
|
|
269
|
+
const purchaseWithToken = async (token) => {
|
|
270
|
+
// send the token to your server to make a purchase
|
|
271
|
+
// ...
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<View style={styles.container}>
|
|
276
|
+
<Text>Google Pay Demo</Text>
|
|
277
|
+
{canMakePayment && (
|
|
278
|
+
<>
|
|
279
|
+
<PEGooglePayButton
|
|
280
|
+
paymentRequest={paymentRequest}
|
|
281
|
+
onTokenDidReturn={(token) => {
|
|
282
|
+
console.log('google Pay token', token);
|
|
283
|
+
// Send token to server
|
|
284
|
+
purchaseWithToken(token);
|
|
285
|
+
}}
|
|
286
|
+
onPaymentSheetDismissed={() => {
|
|
287
|
+
console.log('Payment sheet dismissed');
|
|
288
|
+
}}
|
|
289
|
+
onPaymentFailed={(error) => {
|
|
290
|
+
console.log('Payment failed', error);
|
|
291
|
+
}}
|
|
292
|
+
style={{ height: 40, margin: 20 }}
|
|
293
|
+
/>
|
|
294
|
+
<ScrollView
|
|
295
|
+
scrollEnabled
|
|
296
|
+
style={{
|
|
297
|
+
flex: 1,
|
|
298
|
+
width: '100%',
|
|
299
|
+
backgroundColor: 'lightyellow',
|
|
300
|
+
padding: 10,
|
|
301
|
+
marginVertical: 20,
|
|
302
|
+
}}
|
|
303
|
+
>
|
|
304
|
+
<Text>{JSON.stringify(paymentResult, null, 4)}</Text>
|
|
305
|
+
</ScrollView>
|
|
306
|
+
</>
|
|
307
|
+
)}
|
|
308
|
+
</View>
|
|
309
|
+
);
|
|
310
|
+
};
|
|
311
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -25,6 +25,17 @@
|
|
|
25
25
|
<option name="screenX" value="1080" />
|
|
26
26
|
<option name="screenY" value="2160" />
|
|
27
27
|
</PersistentDeviceSelectionData>
|
|
28
|
+
<PersistentDeviceSelectionData>
|
|
29
|
+
<option name="api" value="34" />
|
|
30
|
+
<option name="brand" value="Lenovo" />
|
|
31
|
+
<option name="codename" value="TB370FU" />
|
|
32
|
+
<option name="id" value="TB370FU" />
|
|
33
|
+
<option name="manufacturer" value="Lenovo" />
|
|
34
|
+
<option name="name" value="Tab P12" />
|
|
35
|
+
<option name="screenDensity" value="340" />
|
|
36
|
+
<option name="screenX" value="1840" />
|
|
37
|
+
<option name="screenY" value="2944" />
|
|
38
|
+
</PersistentDeviceSelectionData>
|
|
28
39
|
<PersistentDeviceSelectionData>
|
|
29
40
|
<option name="api" value="31" />
|
|
30
41
|
<option name="brand" value="samsung" />
|
package/android/build.gradle
CHANGED
|
@@ -164,12 +164,12 @@ dependencies {
|
|
|
164
164
|
|
|
165
165
|
implementation files("./securefields-1.7.2-debug.aar")
|
|
166
166
|
|
|
167
|
-
debugImplementation files("./
|
|
168
|
-
releaseImplementation files("./
|
|
167
|
+
debugImplementation files("./payment-sdk-debug-1.0.2.aar")
|
|
168
|
+
releaseImplementation files("./payment-sdk-debug-1.0.2.aar")
|
|
169
169
|
|
|
170
170
|
api 'com.github.Kount:kount-android-sdk:v4.3.2'
|
|
171
|
-
implementation 'com.google.android.gms:play-services-wallet:16.0.0'
|
|
172
171
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
|
|
172
|
+
implementation "com.google.android.gms:play-services-wallet:19.2.1"
|
|
173
173
|
|
|
174
174
|
// From node_modules
|
|
175
175
|
}
|
|
Binary file
|
|
Binary file
|
|
@@ -7,6 +7,7 @@ import com.facebook.react.bridge.NativeModule;
|
|
|
7
7
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
8
8
|
import com.facebook.react.uimanager.ViewManager;
|
|
9
9
|
import com.reactnativepayengine.v2.RNPayEngineNative;
|
|
10
|
+
import com.reactnativepayengine.v2.features.googlepay.RNPEGooglePayButtonManager;
|
|
10
11
|
import com.reactnativepayengine.v2.securefields.bankaccount.RNPEBankAccountViewManager;
|
|
11
12
|
import com.reactnativepayengine.v2.securefields.creditcard.RNPECreditCardViewManager;
|
|
12
13
|
|
|
@@ -33,6 +34,7 @@ public class PayenginePackage implements ReactPackage {
|
|
|
33
34
|
List<ViewManager> views = new ArrayList<>();
|
|
34
35
|
views.add(new RNPECreditCardViewManager(reactContext));
|
|
35
36
|
views.add(new RNPEBankAccountViewManager(reactContext));
|
|
37
|
+
views.add(new RNPEGooglePayButtonManager(reactContext));
|
|
36
38
|
return views;
|
|
37
39
|
}
|
|
38
40
|
|
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
8
8
|
import com.facebook.react.bridge.ReactMethod
|
|
9
9
|
import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
|
|
10
10
|
import com.payengine.paymentsdk.PayEngine
|
|
11
|
+
import com.payengine.paymentsdk.features.googlepay.PEGooglePayInterface
|
|
11
12
|
import com.payengine.paymentsdk.models.PEConfig
|
|
12
13
|
import kotlin.concurrent.thread
|
|
13
14
|
|
|
@@ -67,5 +68,6 @@ class RNPayEngineNative: ReactContextBaseJavaModule {
|
|
|
67
68
|
|
|
68
69
|
companion object {
|
|
69
70
|
var instance: PayEngine? = null
|
|
71
|
+
var googlePay: PEGooglePayInterface? = null
|
|
70
72
|
}
|
|
71
73
|
}
|
package/android/src/main/java/com/reactnativepayengine/v2/features/googlepay/RNPEGooglePayButton.kt
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
package com.reactnativepayengine.v2.features.googlepay
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import android.view.ViewGroup
|
|
6
|
+
import android.widget.LinearLayout
|
|
7
|
+
import com.facebook.react.bridge.Arguments
|
|
8
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule.RCTDeviceEventEmitter
|
|
9
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
+
import com.payengine.paymentsdk.features.googlepay.PEGooglePayDelegate
|
|
11
|
+
import com.payengine.paymentsdk.features.googlepay.PEGooglePayStatus
|
|
12
|
+
import com.payengine.paymentsdk.features.googlepay.nmi.GooglePayPaymentRequest
|
|
13
|
+
import com.reactnativepayengine.v2.RNPayEngineNative
|
|
14
|
+
import com.reactnativepayengine.v2.securefields.RNPEEvents
|
|
15
|
+
|
|
16
|
+
class RNPEGooglePayButton(private val context: ThemedReactContext, private val activity: Activity?): LinearLayout(context),
|
|
17
|
+
PEGooglePayDelegate {
|
|
18
|
+
|
|
19
|
+
private var amount: Double? = null
|
|
20
|
+
private var merchantId: String? = null
|
|
21
|
+
|
|
22
|
+
init {
|
|
23
|
+
this.orientation = VERTICAL
|
|
24
|
+
val layoutParams = LayoutParams(
|
|
25
|
+
LayoutParams.WRAP_CONTENT,
|
|
26
|
+
LayoutParams.WRAP_CONTENT
|
|
27
|
+
)
|
|
28
|
+
this.layoutParams = layoutParams
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
fun setAmount(amount: Double) {
|
|
32
|
+
this.amount = amount
|
|
33
|
+
this.setupView()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
fun setMerchantId(merchantId: String) {
|
|
37
|
+
this.merchantId = merchantId
|
|
38
|
+
this.setupView()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private fun setupView() {
|
|
42
|
+
if (amount == null || merchantId == null) return
|
|
43
|
+
|
|
44
|
+
this.activity?.let {
|
|
45
|
+
RNPayEngineNative.instance?.createGooglePay(it, this.merchantId!!) {
|
|
46
|
+
if (it is PEGooglePayStatus.Eligible) {
|
|
47
|
+
val googlepay = it.googlePayInstance
|
|
48
|
+
RNPayEngineNative.googlePay = googlepay
|
|
49
|
+
|
|
50
|
+
googlepay.delegate = this
|
|
51
|
+
googlepay.setupGooglePayButton(GooglePayPaymentRequest(amount!!)) {
|
|
52
|
+
if (it != null) {
|
|
53
|
+
this.addView(it)
|
|
54
|
+
} else {
|
|
55
|
+
this.paymentFailure(Error("Google pay is not available"))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} else if (it is PEGooglePayStatus.NotEligible) {
|
|
59
|
+
this.paymentFailure(Error("Google pay is not available: ${it.error}"))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override fun paymentFailure(error: Error) {
|
|
66
|
+
Log.d("PE", "paymentFailure: $error")
|
|
67
|
+
val params = Arguments.createMap().apply {
|
|
68
|
+
putString("error", error.localizedMessage)
|
|
69
|
+
}
|
|
70
|
+
context
|
|
71
|
+
.getJSModule(RCTDeviceEventEmitter::class.java)
|
|
72
|
+
.emit(RNPEEvents.ON_GOOGLE_PAY_ERROR, params)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
override fun paymentSheetDidDismiss() {
|
|
76
|
+
Log.d("PE", "paymentSheetDidDismiss")
|
|
77
|
+
val params = Arguments.createMap().apply {}
|
|
78
|
+
context
|
|
79
|
+
.getJSModule(RCTDeviceEventEmitter::class.java)
|
|
80
|
+
.emit(RNPEEvents.ON_GOOGLE_PAY_DISMISS, params)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
override fun paymentTokenDidReturn(token: String) {
|
|
84
|
+
Log.d("PE", "paymentTokenDidReturn: $token")
|
|
85
|
+
val params = Arguments.createMap().apply {
|
|
86
|
+
putString("token", token)
|
|
87
|
+
}
|
|
88
|
+
context
|
|
89
|
+
.getJSModule(RCTDeviceEventEmitter::class.java)
|
|
90
|
+
.emit(RNPEEvents.ON_GOOGLE_PAY_RESPOND, params)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
override fun requestLayout() {
|
|
94
|
+
super.requestLayout()
|
|
95
|
+
post(mLayoutRunnable)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private val mLayoutRunnable = Runnable {
|
|
99
|
+
measure(
|
|
100
|
+
MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
|
101
|
+
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)
|
|
102
|
+
)
|
|
103
|
+
layout(left, top, right, bottom)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
package com.reactnativepayengine.v2.features.googlepay
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Intent
|
|
5
|
+
import com.facebook.react.bridge.ActivityEventListener
|
|
6
|
+
import com.facebook.react.bridge.BaseActivityEventListener
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.uimanager.SimpleViewManager
|
|
9
|
+
import com.facebook.react.uimanager.ThemedReactContext
|
|
10
|
+
import com.facebook.react.uimanager.annotations.ReactProp
|
|
11
|
+
import com.reactnativepayengine.v2.RNPayEngineNative
|
|
12
|
+
|
|
13
|
+
class RNPEGooglePayButtonManager: SimpleViewManager<RNPEGooglePayButton> {
|
|
14
|
+
private var context: ReactApplicationContext
|
|
15
|
+
|
|
16
|
+
@ReactProp(name = "amount")
|
|
17
|
+
fun setAmount(view: RNPEGooglePayButton, amount: Double) {
|
|
18
|
+
view.setAmount(amount)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@ReactProp(name = "merchantId")
|
|
22
|
+
fun setMerchantId(view: RNPEGooglePayButton, merchantId: String) {
|
|
23
|
+
view.setMerchantId(merchantId)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
constructor(context: ReactApplicationContext) : super() {
|
|
28
|
+
this.context = context
|
|
29
|
+
|
|
30
|
+
context.addActivityEventListener(activityEventListener)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun getName(): String {
|
|
34
|
+
return REACT_CLASS;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun createViewInstance(reactContext: ThemedReactContext): RNPEGooglePayButton {
|
|
38
|
+
return RNPEGooglePayButton(reactContext, context.currentActivity)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
companion object {
|
|
43
|
+
private const val REACT_CLASS = "RNPEGooglePayButton"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
private val activityEventListener: ActivityEventListener = object : BaseActivityEventListener() {
|
|
47
|
+
override fun onActivityResult(
|
|
48
|
+
activity: Activity,
|
|
49
|
+
requestCode: Int,
|
|
50
|
+
resultCode: Int,
|
|
51
|
+
data: Intent?
|
|
52
|
+
) {
|
|
53
|
+
RNPayEngineNative.googlePay?.onActivityResult(requestCode, resultCode, data)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -5,4 +5,7 @@ object RNPEEvents {
|
|
|
5
5
|
val ON_SIZE_CHANGES = "onSizeChanges"
|
|
6
6
|
val ON_CARD_RESPOND = "onCardRespond"
|
|
7
7
|
val ON_BANK_ACCOUNT_RESPOND = "onBankAccountRespond"
|
|
8
|
+
val ON_GOOGLE_PAY_RESPOND = "onGooglePayRespond"
|
|
9
|
+
val ON_GOOGLE_PAY_ERROR = "onGooglePayError"
|
|
10
|
+
val ON_GOOGLE_PAY_DISMISS = "onGooglePayDismiss"
|
|
8
11
|
}
|
|
@@ -35,6 +35,10 @@ const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
39
|
+
return /*#__PURE__*/React.createElement(_reactNative.Text, null, "Apple Pay is not supported on this platform");
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
return /*#__PURE__*/React.createElement(RNPEApplePayButton, {
|
|
39
43
|
style: {
|
|
40
44
|
height: 32,
|
|
@@ -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","height","width","style","JSON","stringify","paymentRequest"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { requireNativeComponent, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '
|
|
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,CAAepB,KAAK,CAACqB,cAArB,CAFlB;IAGE,SAAS,EAAElB,OAHb;IAIE,kBAAkB,EAAEM,gBAJtB;IAKE,mBAAmB,EAAEG;EALvB,EADF;AASD,CAvC+B,CAAzB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.PEGooglePayButton = void 0;
|
|
7
|
+
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactNative = require("react-native");
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
RNPEEventEmitter
|
|
18
|
+
} = _reactNative.NativeModules;
|
|
19
|
+
const RNPEGooglePayButton = (0, _reactNative.requireNativeComponent)('RNPEGooglePayButton');
|
|
20
|
+
const peEventEmitter = new _reactNative.NativeEventEmitter(RNPEEventEmitter);
|
|
21
|
+
const PEGooglePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
22
|
+
React.useImperativeHandle(ref, () => ({}));
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
const listener1 = peEventEmitter.addListener('onGooglePayRespond', args => {
|
|
25
|
+
var _props$onTokenDidRetu;
|
|
26
|
+
|
|
27
|
+
const {
|
|
28
|
+
token
|
|
29
|
+
} = args;
|
|
30
|
+
console.log('ON token', token);
|
|
31
|
+
(_props$onTokenDidRetu = props.onTokenDidReturn) === null || _props$onTokenDidRetu === void 0 ? void 0 : _props$onTokenDidRetu.call(props, token);
|
|
32
|
+
});
|
|
33
|
+
const listener2 = peEventEmitter.addListener('onGooglePayError', args => {
|
|
34
|
+
var _props$onPaymentFaile;
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
error
|
|
38
|
+
} = args;
|
|
39
|
+
console.log('ON error', error);
|
|
40
|
+
(_props$onPaymentFaile = props.onPaymentFailed) === null || _props$onPaymentFaile === void 0 ? void 0 : _props$onPaymentFaile.call(props, new Error(error));
|
|
41
|
+
});
|
|
42
|
+
const listener3 = peEventEmitter.addListener('onGooglePayDismiss', () => {
|
|
43
|
+
var _props$onPaymentSheet;
|
|
44
|
+
|
|
45
|
+
console.log('ON dismiss');
|
|
46
|
+
(_props$onPaymentSheet = props.onPaymentSheetDismissed) === null || _props$onPaymentSheet === void 0 ? void 0 : _props$onPaymentSheet.call(props);
|
|
47
|
+
});
|
|
48
|
+
return () => {
|
|
49
|
+
listener1.remove();
|
|
50
|
+
listener2.remove();
|
|
51
|
+
listener3.remove();
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
|
|
55
|
+
if (_reactNative.Platform.OS !== 'android') {
|
|
56
|
+
return /*#__PURE__*/React.createElement(_reactNative.Text, null, "Google Pay is not supported on this platform");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return /*#__PURE__*/React.createElement(RNPEGooglePayButton, {
|
|
60
|
+
style: {
|
|
61
|
+
height: 32,
|
|
62
|
+
width: '100%',
|
|
63
|
+
...props.style
|
|
64
|
+
},
|
|
65
|
+
amount: props.paymentRequest.paymentAmount,
|
|
66
|
+
merchantId: props.paymentRequest.merchantId
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
exports.PEGooglePayButton = PEGooglePayButton;
|
|
70
|
+
//# sourceMappingURL=PEGooglePayButton.js.map
|
|
@@ -0,0 +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","paymentRequest","paymentAmount","merchantId"],"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}\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 />\n );\n});\n"],"mappings":";;;;;;;AACA;;AACA;;;;;;AAGA,MAAM;EAAEA;AAAF,IAAuBC,0BAA7B;AAEA,MAAMC,mBAAmB,GAAG,IAAAC,mCAAA,EAAmD,qBAAnD,CAA5B;AAOA,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;IAEE,MAAM,EAAEtB,KAAK,CAACuB,cAAN,CAAqBC,aAF/B;IAGE,UAAU,EAAExB,KAAK,CAACuB,cAAN,CAAqBE;EAHnC,EADF;AAOD,CA5CgC,CAA1B"}
|
|
@@ -8,16 +8,19 @@ exports.PEPaymentRequest = void 0;
|
|
|
8
8
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
9
|
|
|
10
10
|
class PEPaymentRequest {
|
|
11
|
-
constructor(paymentAmount) {
|
|
12
|
-
let currencyCode = arguments.length >
|
|
13
|
-
let paymentItems = arguments.length >
|
|
11
|
+
constructor(merchantId, paymentAmount) {
|
|
12
|
+
let currencyCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'USD';
|
|
13
|
+
let paymentItems = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
14
|
+
|
|
15
|
+
_defineProperty(this, "merchantId", void 0);
|
|
14
16
|
|
|
15
17
|
_defineProperty(this, "paymentAmount", void 0);
|
|
16
18
|
|
|
17
|
-
_defineProperty(this, "currencyCode",
|
|
19
|
+
_defineProperty(this, "currencyCode", 'USD');
|
|
18
20
|
|
|
19
|
-
_defineProperty(this, "paymentItems",
|
|
21
|
+
_defineProperty(this, "paymentItems", []);
|
|
20
22
|
|
|
23
|
+
this.merchantId = merchantId;
|
|
21
24
|
this.paymentAmount = paymentAmount;
|
|
22
25
|
this.currencyCode = currencyCode;
|
|
23
26
|
this.paymentItems = paymentItems;
|
|
@@ -0,0 +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 }[] = []\n\n constructor(merchantId: string, paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {\n amount: number;\n label: string;\n }[] = []) {\n this.merchantId = merchantId;\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n }\n}"],"mappings":";;;;;;;;;AACO,MAAMA,gBAAN,CAAuB;EAS5BC,WAAW,CAACC,UAAD,EAAqBC,aAArB,EAGD;IAAA,IAH6CC,YAG7C,uEAH2E,KAG3E;IAAA,IAHkFC,YAGlF,uEAAJ,EAAI;;IAAA;;IAAA;;IAAA,sCATqB,KASrB;;IAAA,sCALJ,EAKI;;IACR,KAAKH,UAAL,GAAkBA,UAAlB;IACA,KAAKC,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;EACD;;AAjB2B"}
|
|
@@ -23,6 +23,8 @@ class PayEngineNative {
|
|
|
23
23
|
static async isPlatformPaySupported(merchantId) {
|
|
24
24
|
if (_reactNative.Platform.OS === 'ios') {
|
|
25
25
|
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
26
|
+
} else if (_reactNative.Platform.OS === 'android') {
|
|
27
|
+
return true;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNPayEngineNative","NativeModules","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","Platform","OS","isApplePaySupported"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nexport default class PayEngineNative {\n static async createFraudMonitorSession(merchantId: string) {\n return RNPayEngineNative.createFraudMonitorSession(merchantId);\n }\n\n static async getBrowserInfo() {\n return RNPayEngineNative.getBrowserInfo();\n }\n\n static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n }\n return false;\n }\n}"],"mappings":";;;;;;;AAAA;;AAEA,MAAM;EAAEA;AAAF,IAAwBC,0BAA9B;;AAEe,MAAMC,eAAN,CAAsB;EACG,aAAzBC,yBAAyB,CAACC,UAAD,EAAqB;IACzD,OAAOJ,iBAAiB,CAACG,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;;EAE0B,aAAdC,cAAc,GAAG;IAC5B,OAAOL,iBAAiB,CAACK,cAAlB,EAAP;EACD;;EAEkC,aAAtBC,sBAAsB,CAACF,UAAD,EAAqB;IACtD,IAAIG,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMR,iBAAiB,CAACS,mBAAlB,CAAsCL,UAAtC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;;
|
|
1
|
+
{"version":3,"names":["RNPayEngineNative","NativeModules","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","Platform","OS","isApplePaySupported"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nexport default class PayEngineNative {\n static async createFraudMonitorSession(merchantId: string) { \n return RNPayEngineNative.createFraudMonitorSession(merchantId);\n }\n\n static async getBrowserInfo() {\n return RNPayEngineNative.getBrowserInfo();\n }\n\n static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (Platform.OS === 'android') {\n return true\n }\n return false;\n }\n}"],"mappings":";;;;;;;AAAA;;AAEA,MAAM;EAAEA;AAAF,IAAwBC,0BAA9B;;AAEe,MAAMC,eAAN,CAAsB;EACG,aAAzBC,yBAAyB,CAACC,UAAD,EAAqB;IACzD,OAAOJ,iBAAiB,CAACG,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;;EAE0B,aAAdC,cAAc,GAAG;IAC5B,OAAOL,iBAAiB,CAACK,cAAlB,EAAP;EACD;;EAEkC,aAAtBC,sBAAsB,CAACF,UAAD,EAAqB;IACtD,IAAIG,qBAAA,CAASC,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMR,iBAAiB,CAACS,mBAAlB,CAAsCL,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIG,qBAAA,CAASC,EAAT,KAAgB,SAApB,EAA+B;MACpC,OAAO,IAAP;IACD;;IACD,OAAO,KAAP;EACD;;AAhBkC"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -33,6 +33,12 @@ Object.defineProperty(exports, "PECreditCardViewMethods", {
|
|
|
33
33
|
return _CreditCardView.PECreditCardViewMethods;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "PEGooglePayButton", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _PEGooglePayButton.PEGooglePayButton;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
36
42
|
Object.defineProperty(exports, "PEKeyboardType", {
|
|
37
43
|
enumerable: true,
|
|
38
44
|
get: function () {
|
|
@@ -79,7 +85,9 @@ var _PayEngineNative = _interopRequireDefault(require("./components/v2/PayEngine
|
|
|
79
85
|
|
|
80
86
|
var _PEApplePayButton = require("./components/v2/ApplePay/PEApplePayButton");
|
|
81
87
|
|
|
82
|
-
var _PEPaymentRequest = require("./components/v2/
|
|
88
|
+
var _PEPaymentRequest = require("./components/v2/PEPaymentRequest");
|
|
89
|
+
|
|
90
|
+
var _PEGooglePayButton = require("./components/v2/GooglePay/PEGooglePayButton");
|
|
83
91
|
|
|
84
92
|
var PayEngineUtils = _interopRequireWildcard(require("./utils/index"));
|
|
85
93
|
|
|
@@ -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/
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { requireNativeComponent } from 'react-native';
|
|
2
|
+
import { Platform, requireNativeComponent, Text } from 'react-native';
|
|
3
3
|
const RNPEApplePayButton = requireNativeComponent('RNPEApplePayButton');
|
|
4
4
|
export const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
5
5
|
React.useImperativeHandle(ref, () => ({}));
|
|
@@ -22,6 +22,10 @@ export const PEApplePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
if (Platform.OS !== 'ios') {
|
|
26
|
+
return /*#__PURE__*/React.createElement(Text, null, "Apple Pay is not supported on this platform");
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
return /*#__PURE__*/React.createElement(RNPEApplePayButton, {
|
|
26
30
|
style: {
|
|
27
31
|
height: 32,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","requireNativeComponent","RNPEApplePayButton","PEApplePayButton","forwardRef","props","ref","useImperativeHandle","pmError","event","onPaymentFailed","Error","nativeEvent","error","pmTokenDidReturn","onTokenDidReturn","token","pmSheetDidDismiss","onPaymentSheetDismissed","height","width","style","JSON","stringify","paymentRequest"],"sources":["PEApplePayButton.tsx"],"sourcesContent":["\nimport * as React from 'react';\nimport { requireNativeComponent, ViewProps } from 'react-native';\nimport type { PEPaymentRequest } from '
|
|
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,CAAenB,KAAK,CAACoB,cAArB,CAFlB;IAGE,SAAS,EAAEjB,OAHb;IAIE,kBAAkB,EAAEM,gBAJtB;IAKE,mBAAmB,EAAEG;EALvB,EADF;AASD,CAvC+B,CAAzB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { NativeEventEmitter, NativeModules, Platform, requireNativeComponent, Text } from 'react-native';
|
|
3
|
+
const {
|
|
4
|
+
RNPEEventEmitter
|
|
5
|
+
} = NativeModules;
|
|
6
|
+
const RNPEGooglePayButton = requireNativeComponent('RNPEGooglePayButton');
|
|
7
|
+
const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
|
|
8
|
+
export const PEGooglePayButton = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
9
|
+
React.useImperativeHandle(ref, () => ({}));
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
const listener1 = peEventEmitter.addListener('onGooglePayRespond', args => {
|
|
12
|
+
var _props$onTokenDidRetu;
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
token
|
|
16
|
+
} = args;
|
|
17
|
+
console.log('ON token', token);
|
|
18
|
+
(_props$onTokenDidRetu = props.onTokenDidReturn) === null || _props$onTokenDidRetu === void 0 ? void 0 : _props$onTokenDidRetu.call(props, token);
|
|
19
|
+
});
|
|
20
|
+
const listener2 = peEventEmitter.addListener('onGooglePayError', args => {
|
|
21
|
+
var _props$onPaymentFaile;
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
error
|
|
25
|
+
} = args;
|
|
26
|
+
console.log('ON error', error);
|
|
27
|
+
(_props$onPaymentFaile = props.onPaymentFailed) === null || _props$onPaymentFaile === void 0 ? void 0 : _props$onPaymentFaile.call(props, new Error(error));
|
|
28
|
+
});
|
|
29
|
+
const listener3 = peEventEmitter.addListener('onGooglePayDismiss', () => {
|
|
30
|
+
var _props$onPaymentSheet;
|
|
31
|
+
|
|
32
|
+
console.log('ON dismiss');
|
|
33
|
+
(_props$onPaymentSheet = props.onPaymentSheetDismissed) === null || _props$onPaymentSheet === void 0 ? void 0 : _props$onPaymentSheet.call(props);
|
|
34
|
+
});
|
|
35
|
+
return () => {
|
|
36
|
+
listener1.remove();
|
|
37
|
+
listener2.remove();
|
|
38
|
+
listener3.remove();
|
|
39
|
+
};
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
if (Platform.OS !== 'android') {
|
|
43
|
+
return /*#__PURE__*/React.createElement(Text, null, "Google Pay is not supported on this platform");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return /*#__PURE__*/React.createElement(RNPEGooglePayButton, {
|
|
47
|
+
style: {
|
|
48
|
+
height: 32,
|
|
49
|
+
width: '100%',
|
|
50
|
+
...props.style
|
|
51
|
+
},
|
|
52
|
+
amount: props.paymentRequest.paymentAmount,
|
|
53
|
+
merchantId: props.paymentRequest.merchantId
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=PEGooglePayButton.js.map
|
|
@@ -0,0 +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","paymentRequest","paymentAmount","merchantId"],"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}\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 />\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;AAOA,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;IAEE,MAAM,EAAErB,KAAK,CAACsB,cAAN,CAAqBC,aAF/B;IAGE,UAAU,EAAEvB,KAAK,CAACsB,cAAN,CAAqBE;EAHnC,EADF;AAOD,CA5CgC,CAA1B"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
export class PEPaymentRequest {
|
|
4
|
+
constructor(merchantId, paymentAmount) {
|
|
5
|
+
let currencyCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'USD';
|
|
6
|
+
let paymentItems = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
7
|
+
|
|
8
|
+
_defineProperty(this, "merchantId", void 0);
|
|
9
|
+
|
|
10
|
+
_defineProperty(this, "paymentAmount", void 0);
|
|
11
|
+
|
|
12
|
+
_defineProperty(this, "currencyCode", 'USD');
|
|
13
|
+
|
|
14
|
+
_defineProperty(this, "paymentItems", []);
|
|
15
|
+
|
|
16
|
+
this.merchantId = merchantId;
|
|
17
|
+
this.paymentAmount = paymentAmount;
|
|
18
|
+
this.currencyCode = currencyCode;
|
|
19
|
+
this.paymentItems = paymentItems;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=PEPaymentRequest.js.map
|
|
@@ -0,0 +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 }[] = []\n\n constructor(merchantId: string, paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {\n amount: number;\n label: string;\n }[] = []) {\n this.merchantId = merchantId;\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n }\n}"],"mappings":";;AACA,OAAO,MAAMA,gBAAN,CAAuB;EAS5BC,WAAW,CAACC,UAAD,EAAqBC,aAArB,EAGD;IAAA,IAH6CC,YAG7C,uEAH2E,KAG3E;IAAA,IAHkFC,YAGlF,uEAAJ,EAAI;;IAAA;;IAAA;;IAAA,sCATqB,KASrB;;IAAA,sCALJ,EAKI;;IACR,KAAKH,UAAL,GAAkBA,UAAlB;IACA,KAAKC,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;EACD;;AAjB2B"}
|
|
@@ -14,6 +14,8 @@ export default class PayEngineNative {
|
|
|
14
14
|
static async isPlatformPaySupported(merchantId) {
|
|
15
15
|
if (Platform.OS === 'ios') {
|
|
16
16
|
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
17
|
+
} else if (Platform.OS === 'android') {
|
|
18
|
+
return true;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","RNPayEngineNative","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","OS","isApplePaySupported"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nexport default class PayEngineNative {\n static async createFraudMonitorSession(merchantId: string) {\n return RNPayEngineNative.createFraudMonitorSession(merchantId);\n }\n\n static async getBrowserInfo() {\n return RNPayEngineNative.getBrowserInfo();\n }\n\n static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n }\n return false;\n }\n}"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAM;EAAEC;AAAF,IAAwBF,aAA9B;AAEA,eAAe,MAAMG,eAAN,CAAsB;EACG,aAAzBC,yBAAyB,CAACC,UAAD,EAAqB;IACzD,OAAOH,iBAAiB,CAACE,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;;EAE0B,aAAdC,cAAc,GAAG;IAC5B,OAAOJ,iBAAiB,CAACI,cAAlB,EAAP;EACD;;EAEkC,aAAtBC,sBAAsB,CAACF,UAAD,EAAqB;IACtD,IAAIJ,QAAQ,CAACO,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMN,iBAAiB,CAACO,mBAAlB,CAAsCJ,UAAtC,CAAb;IACD;;IACD,OAAO,KAAP;EACD;;
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","RNPayEngineNative","PayEngineNative","createFraudMonitorSession","merchantId","getBrowserInfo","isPlatformPaySupported","OS","isApplePaySupported"],"sources":["PayEngineNative.tsx"],"sourcesContent":["import { NativeModules, Platform } from \"react-native\";\n\nconst { RNPayEngineNative } = NativeModules;\n\nexport default class PayEngineNative {\n static async createFraudMonitorSession(merchantId: string) { \n return RNPayEngineNative.createFraudMonitorSession(merchantId);\n }\n\n static async getBrowserInfo() {\n return RNPayEngineNative.getBrowserInfo();\n }\n\n static async isPlatformPaySupported(merchantId: string) {\n if (Platform.OS === 'ios') {\n return await RNPayEngineNative.isApplePaySupported(merchantId);\n } else if (Platform.OS === 'android') {\n return true\n }\n return false;\n }\n}"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,MAAM;EAAEC;AAAF,IAAwBF,aAA9B;AAEA,eAAe,MAAMG,eAAN,CAAsB;EACG,aAAzBC,yBAAyB,CAACC,UAAD,EAAqB;IACzD,OAAOH,iBAAiB,CAACE,yBAAlB,CAA4CC,UAA5C,CAAP;EACD;;EAE0B,aAAdC,cAAc,GAAG;IAC5B,OAAOJ,iBAAiB,CAACI,cAAlB,EAAP;EACD;;EAEkC,aAAtBC,sBAAsB,CAACF,UAAD,EAAqB;IACtD,IAAIJ,QAAQ,CAACO,EAAT,KAAgB,KAApB,EAA2B;MACzB,OAAO,MAAMN,iBAAiB,CAACO,mBAAlB,CAAsCJ,UAAtC,CAAb;IACD,CAFD,MAEO,IAAIJ,QAAQ,CAACO,EAAT,KAAgB,SAApB,EAA+B;MACpC,OAAO,IAAP;IACD;;IACD,OAAO,KAAP;EACD;;AAhBkC"}
|
package/lib/module/index.js
CHANGED
|
@@ -5,7 +5,8 @@ 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/
|
|
8
|
+
import { PEPaymentRequest } from './components/v2/PEPaymentRequest';
|
|
9
|
+
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
9
10
|
import * as PayEngineUtils from './utils/index';
|
|
10
11
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
11
12
|
const LINKING_ERROR = `The package 'react-native-payengine' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
@@ -23,5 +24,5 @@ PayEngineUtils, PayEngineProvider, PayEngineNative, // securefields
|
|
|
23
24
|
PEKeyboardType, // credit card
|
|
24
25
|
PECreditCardView, PECreditCardViewMethods, // bank account
|
|
25
26
|
PEBankAccountView, PEBankAccountViewMethods, // Apple Pay
|
|
26
|
-
PEApplePayButton, PEPaymentRequest };
|
|
27
|
+
PEApplePayButton, PEPaymentRequest, PEGooglePayButton };
|
|
27
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","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/
|
|
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,QAAiC,kCAAjC;AACA,SAASC,iBAAT,QAAkC,6CAAlC;AACA,OAAO,KAAKC,cAAZ,MAAgC,eAAhC;AACA,OAAOC,cAAP,MAA2B,6CAA3B;AAEA,MAAMC,aAAa,GAChB,iFAAD,GACAZ,QAAQ,CAACa,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,eAAe,GAAGjB,aAAa,CAACkB,SAAd,GACpBlB,aAAa,CAACkB,SADM,GAEpB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUR,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ;AAWA,SACEI,eADF,EAEElB,SAFF,EAKE;AACAY,cANF,EAOEL,iBAPF,EAQEC,eARF,EASE;AACAK,cAVF,EAYE;AACAV,gBAbF,EAcEC,uBAdF,EAgBE;AACAC,iBAjBF,EAkBEC,wBAlBF,EAoBE;AACAG,gBArBF,EAsBEC,gBAtBF,EAuBEC,iBAvBF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ViewProps } from 'react-native';
|
|
3
|
-
import type { PEPaymentRequest } from '
|
|
3
|
+
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
4
4
|
export interface PEApplePayButtonProps extends ViewProps {
|
|
5
5
|
paymentRequest: PEPaymentRequest;
|
|
6
6
|
onTokenDidReturn?: (token: string) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ViewProps } from 'react-native';
|
|
3
|
+
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
4
|
+
export interface PEGooglePayButtonProps extends ViewProps {
|
|
5
|
+
paymentRequest: PEPaymentRequest;
|
|
6
|
+
onTokenDidReturn?: (token: string) => void;
|
|
7
|
+
onPaymentSheetDismissed?: () => void;
|
|
8
|
+
onPaymentFailed?: (error: Error) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface PEGooglePayButtonMethods {
|
|
11
|
+
}
|
|
12
|
+
export declare const PEGooglePayButton: React.ForwardRefExoticComponent<PEGooglePayButtonProps & React.RefAttributes<PEGooglePayButtonMethods>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class PEPaymentRequest {
|
|
2
|
+
merchantId: string;
|
|
3
|
+
paymentAmount: number;
|
|
4
|
+
currencyCode?: 'USD' | 'CAD';
|
|
5
|
+
paymentItems?: {
|
|
6
|
+
amount: number;
|
|
7
|
+
label: string;
|
|
8
|
+
}[];
|
|
9
|
+
constructor(merchantId: string, paymentAmount: number, currencyCode?: 'USD' | 'CAD', paymentItems?: {
|
|
10
|
+
amount: number;
|
|
11
|
+
label: string;
|
|
12
|
+
}[]);
|
|
13
|
+
}
|
|
@@ -8,8 +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/
|
|
11
|
+
import { PEPaymentRequest } from './components/v2/PEPaymentRequest';
|
|
12
|
+
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
12
13
|
import * as PayEngineUtils from './utils/index';
|
|
13
14
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
14
15
|
declare const PayEngineStatic: any;
|
|
15
|
-
export { PayEngineStatic, PayEngine, IPayEngineConfig, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, PEPaymentRequest, };
|
|
16
|
+
export { PayEngineStatic, PayEngine, IPayEngineConfig, PayEngineUtils, PayEngineProvider, PayEngineNative, PEKeyboardType, IPEField, PECreditCardView, PECreditCardViewMethods, PECard, PEBankAccountView, PEBankAccountViewMethods, PEBankAccount, PEApplePayButton, PEPaymentRequest, PEGooglePayButton, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-payengine",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "PayEngine SDK for React Native",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -157,4 +157,4 @@
|
|
|
157
157
|
"caniuse-lite": "^1.0.30001658",
|
|
158
158
|
"events": "^3.3.0"
|
|
159
159
|
}
|
|
160
|
-
}
|
|
160
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { requireNativeComponent, ViewProps } from 'react-native';
|
|
4
|
-
import type { PEPaymentRequest } from '
|
|
3
|
+
import { Platform, requireNativeComponent, Text, ViewProps } from 'react-native';
|
|
4
|
+
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
const RNPEApplePayButton = requireNativeComponent<
|
|
7
|
+
const RNPEApplePayButton = requireNativeComponent<NativePEApplePayViewProps>('RNPEApplePayButton');
|
|
8
8
|
|
|
9
9
|
type NativePEApplePayEvent = {
|
|
10
10
|
nativeEvent: {
|
|
@@ -13,7 +13,7 @@ type NativePEApplePayEvent = {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
interface
|
|
16
|
+
interface NativePEApplePayViewProps extends ViewProps {
|
|
17
17
|
paymentRequest: string;
|
|
18
18
|
onPmSheetDidDismiss: (event: NativePEApplePayEvent) => void;
|
|
19
19
|
onPmTokenDidReturn: (event: NativePEApplePayEvent) => void;
|
|
@@ -57,6 +57,10 @@ PEApplePayButtonMethods,
|
|
|
57
57
|
props.onPaymentSheetDismissed();
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
if (Platform.OS !== 'ios') {
|
|
62
|
+
return <Text>Apple Pay is not supported on this platform</Text>
|
|
63
|
+
}
|
|
60
64
|
|
|
61
65
|
return (
|
|
62
66
|
<RNPEApplePayButton
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { NativeEventEmitter, NativeModules, Platform, requireNativeComponent, Text, ViewProps } from 'react-native';
|
|
4
|
+
import type { PEPaymentRequest } from '../PEPaymentRequest';
|
|
5
|
+
|
|
6
|
+
const { RNPEEventEmitter } = NativeModules;
|
|
7
|
+
|
|
8
|
+
const RNPEGooglePayButton = requireNativeComponent<NativePEGooglePayViewProps>('RNPEGooglePayButton');
|
|
9
|
+
|
|
10
|
+
interface NativePEGooglePayViewProps extends ViewProps {
|
|
11
|
+
amount: number;
|
|
12
|
+
merchantId: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const peEventEmitter = new NativeEventEmitter(RNPEEventEmitter);
|
|
16
|
+
|
|
17
|
+
export interface PEGooglePayButtonProps extends ViewProps {
|
|
18
|
+
paymentRequest: PEPaymentRequest;
|
|
19
|
+
onTokenDidReturn?: (token: string) => void;
|
|
20
|
+
onPaymentSheetDismissed?: () => void;
|
|
21
|
+
onPaymentFailed?: (error: Error) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface PEGooglePayButtonMethods {
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
export const PEGooglePayButton = React.forwardRef<
|
|
30
|
+
PEGooglePayButtonMethods,
|
|
31
|
+
PEGooglePayButtonProps
|
|
32
|
+
>((props, ref) => {
|
|
33
|
+
|
|
34
|
+
React.useImperativeHandle(ref, () => ({
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
React.useEffect(() => {
|
|
38
|
+
const listener1 = peEventEmitter.addListener('onGooglePayRespond', args => {
|
|
39
|
+
const { token } = args;
|
|
40
|
+
console.log('ON token', token)
|
|
41
|
+
props.onTokenDidReturn?.(token)
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const listener2 = peEventEmitter.addListener('onGooglePayError', args => {
|
|
45
|
+
const { error } = args;
|
|
46
|
+
console.log('ON error', error)
|
|
47
|
+
props.onPaymentFailed?.(new Error(error))
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const listener3 = peEventEmitter.addListener('onGooglePayDismiss', () => {
|
|
51
|
+
console.log('ON dismiss')
|
|
52
|
+
props.onPaymentSheetDismissed?.()
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
listener1.remove();
|
|
57
|
+
listener2.remove();
|
|
58
|
+
listener3.remove();
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
if (Platform.OS !== 'android') {
|
|
63
|
+
return <Text>Google Pay is not supported on this platform</Text>
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<RNPEGooglePayButton
|
|
68
|
+
style={{ height: 32, width: '100%', ...(props.style as object) }}
|
|
69
|
+
amount={props.paymentRequest.paymentAmount}
|
|
70
|
+
merchantId={props.paymentRequest.merchantId}
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
});
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
|
|
2
2
|
export class PEPaymentRequest {
|
|
3
|
+
merchantId: string;
|
|
3
4
|
paymentAmount: number;
|
|
4
|
-
currencyCode
|
|
5
|
-
paymentItems
|
|
5
|
+
currencyCode?: 'USD' | 'CAD' = 'USD';
|
|
6
|
+
paymentItems?: {
|
|
6
7
|
amount: number;
|
|
7
8
|
label: string;
|
|
8
|
-
}[]
|
|
9
|
+
}[] = []
|
|
9
10
|
|
|
10
|
-
constructor(paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {
|
|
11
|
+
constructor(merchantId: string, paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {
|
|
11
12
|
amount: number;
|
|
12
13
|
label: string;
|
|
13
14
|
}[] = []) {
|
|
15
|
+
this.merchantId = merchantId;
|
|
14
16
|
this.paymentAmount = paymentAmount;
|
|
15
17
|
this.currencyCode = currencyCode;
|
|
16
18
|
this.paymentItems = paymentItems;
|
|
@@ -3,7 +3,7 @@ import { NativeModules, Platform } from "react-native";
|
|
|
3
3
|
const { RNPayEngineNative } = NativeModules;
|
|
4
4
|
|
|
5
5
|
export default class PayEngineNative {
|
|
6
|
-
static async createFraudMonitorSession(merchantId: string) {
|
|
6
|
+
static async createFraudMonitorSession(merchantId: string) {
|
|
7
7
|
return RNPayEngineNative.createFraudMonitorSession(merchantId);
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -14,6 +14,8 @@ export default class PayEngineNative {
|
|
|
14
14
|
static async isPlatformPaySupported(merchantId: string) {
|
|
15
15
|
if (Platform.OS === 'ios') {
|
|
16
16
|
return await RNPayEngineNative.isApplePaySupported(merchantId);
|
|
17
|
+
} else if (Platform.OS === 'android') {
|
|
18
|
+
return true
|
|
17
19
|
}
|
|
18
20
|
return false;
|
|
19
21
|
}
|
package/src/index.tsx
CHANGED
|
@@ -15,7 +15,8 @@ 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/
|
|
18
|
+
import { PEPaymentRequest } from './components/v2/PEPaymentRequest';
|
|
19
|
+
import { PEGooglePayButton } from './components/v2/GooglePay/PEGooglePayButton';
|
|
19
20
|
import * as PayEngineUtils from './utils/index';
|
|
20
21
|
import PEKeyboardType from './components/v2/SecureFields/PEKeyboardType';
|
|
21
22
|
|
|
@@ -59,4 +60,5 @@ export {
|
|
|
59
60
|
// Apple Pay
|
|
60
61
|
PEApplePayButton,
|
|
61
62
|
PEPaymentRequest,
|
|
63
|
+
PEGooglePayButton,
|
|
62
64
|
};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PEPaymentRequest","constructor","paymentAmount","currencyCode","paymentItems"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["\nexport class PEPaymentRequest {\n paymentAmount: number;\n currencyCode: 'USD' | 'CAD';\n paymentItems: {\n amount: number;\n label: string;\n }[]\n\n constructor(paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {\n amount: number;\n label: string;\n }[] = []) {\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n }\n}"],"mappings":";;;;;;;;;AACO,MAAMA,gBAAN,CAAuB;EAQ5BC,WAAW,CAACC,aAAD,EAGD;IAAA,IAHyBC,YAGzB,uEAHuD,KAGvD;IAAA,IAH8DC,YAG9D,uEAAJ,EAAI;;IAAA;;IAAA;;IAAA;;IACR,KAAKF,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;EACD;;AAf2B"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
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; }
|
|
2
|
-
|
|
3
|
-
export class PEPaymentRequest {
|
|
4
|
-
constructor(paymentAmount) {
|
|
5
|
-
let currencyCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'USD';
|
|
6
|
-
let paymentItems = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
7
|
-
|
|
8
|
-
_defineProperty(this, "paymentAmount", void 0);
|
|
9
|
-
|
|
10
|
-
_defineProperty(this, "currencyCode", void 0);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "paymentItems", void 0);
|
|
13
|
-
|
|
14
|
-
this.paymentAmount = paymentAmount;
|
|
15
|
-
this.currencyCode = currencyCode;
|
|
16
|
-
this.paymentItems = paymentItems;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=PEPaymentRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["PEPaymentRequest","constructor","paymentAmount","currencyCode","paymentItems"],"sources":["PEPaymentRequest.ts"],"sourcesContent":["\nexport class PEPaymentRequest {\n paymentAmount: number;\n currencyCode: 'USD' | 'CAD';\n paymentItems: {\n amount: number;\n label: string;\n }[]\n\n constructor(paymentAmount: number, currencyCode: 'USD' | 'CAD' = 'USD', paymentItems: {\n amount: number;\n label: string;\n }[] = []) {\n this.paymentAmount = paymentAmount;\n this.currencyCode = currencyCode;\n this.paymentItems = paymentItems;\n }\n}"],"mappings":";;AACA,OAAO,MAAMA,gBAAN,CAAuB;EAQ5BC,WAAW,CAACC,aAAD,EAGD;IAAA,IAHyBC,YAGzB,uEAHuD,KAGvD;IAAA,IAH8DC,YAG9D,uEAAJ,EAAI;;IAAA;;IAAA;;IAAA;;IACR,KAAKF,aAAL,GAAqBA,aAArB;IACA,KAAKC,YAAL,GAAoBA,YAApB;IACA,KAAKC,YAAL,GAAoBA,YAApB;EACD;;AAf2B"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare class PEPaymentRequest {
|
|
2
|
-
paymentAmount: number;
|
|
3
|
-
currencyCode: 'USD' | 'CAD';
|
|
4
|
-
paymentItems: {
|
|
5
|
-
amount: number;
|
|
6
|
-
label: string;
|
|
7
|
-
}[];
|
|
8
|
-
constructor(paymentAmount: number, currencyCode?: 'USD' | 'CAD', paymentItems?: {
|
|
9
|
-
amount: number;
|
|
10
|
-
label: string;
|
|
11
|
-
}[]);
|
|
12
|
-
}
|