react-native-tpay 1.3.24 → 1.3.26
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 +71 -0
- package/android/src/main/java/com/tpay/TpayModule.kt +10 -0
- package/ios/Source/TpayVersion.generated.swift +1 -1
- package/lib/commonjs/NativeTpay.js.map +1 -1
- package/lib/module/NativeTpay.js.map +1 -1
- package/lib/typescript/src/NativeTpay.d.ts +2 -0
- package/lib/typescript/src/NativeTpay.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-tpay.podspec +1 -1
- package/src/NativeTpay.ts +2 -0
- package/android/src/main/java/com/tpay/util/TpayBackpressUtil.kt +0 -23
package/README.md
CHANGED
|
@@ -1181,6 +1181,77 @@ const screenlessResult = await screenlessApplePayPayment(applePayPayment);
|
|
|
1181
1181
|
handleScreenlessResult(screenlessResult);
|
|
1182
1182
|
```
|
|
1183
1183
|
|
|
1184
|
+
### Two-step Apple Pay flow (early `transactionId`)
|
|
1185
|
+
|
|
1186
|
+
> [!note]
|
|
1187
|
+
> Available since **react-native-tpay 1.3.24** (iOS SDK 1.3.18). **iOS only.**
|
|
1188
|
+
|
|
1189
|
+
The classic `screenlessApplePayPayment` above performs the whole operation in a
|
|
1190
|
+
single call and returns the `transactionId` only after the payment is finished.
|
|
1191
|
+
If you need the `transactionId` earlier (for example to start polling, log it, or
|
|
1192
|
+
correlate the order before the Apple Pay sheet is shown, the same way BLIK,
|
|
1193
|
+
transfer and PayPo already work), use the two-step flow instead.
|
|
1194
|
+
|
|
1195
|
+
`screenlessApplePayPayment` keeps working unchanged, so existing integrations are
|
|
1196
|
+
not affected. Switching is opt-in. A version bump alone does not change behaviour;
|
|
1197
|
+
you must call the new methods.
|
|
1198
|
+
|
|
1199
|
+
**Step 1: create the transaction (no token yet).**
|
|
1200
|
+
`initApplePayPayment` creates a pending transaction and returns its
|
|
1201
|
+
`transactionId` before you present the Apple Pay sheet. Note there is no
|
|
1202
|
+
`applePayToken` here.
|
|
1203
|
+
|
|
1204
|
+
```typescript
|
|
1205
|
+
const initPayment = new ApplePayInitPayment(
|
|
1206
|
+
new PaymentDetails(
|
|
1207
|
+
71.15,
|
|
1208
|
+
'transaction description',
|
|
1209
|
+
'hidden description',
|
|
1210
|
+
Language.pl,
|
|
1211
|
+
),
|
|
1212
|
+
new Payer(
|
|
1213
|
+
'John Doe',
|
|
1214
|
+
'john.doe@example.com',
|
|
1215
|
+
'123456789',
|
|
1216
|
+
new Address('Test Street 1', 'Warsaw', 'PL', '00-007'),
|
|
1217
|
+
),
|
|
1218
|
+
new Callbacks(
|
|
1219
|
+
new Redirects('https://success.url', 'https://error.url'),
|
|
1220
|
+
new Notifications('https://yourdomain.com/notifications', 'email@address'),
|
|
1221
|
+
),
|
|
1222
|
+
);
|
|
1223
|
+
|
|
1224
|
+
const initResult = await initApplePayPayment(initPayment);
|
|
1225
|
+
// initResult is a ScreenlessPaymentCreated. Read the transactionId here,
|
|
1226
|
+
// before showing the Apple Pay sheet:
|
|
1227
|
+
const transactionId = initResult.transactionId;
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
**Step 2: acquire the Apple Pay token, then finalize.**
|
|
1231
|
+
Obtain the `apple_pay_token` yourself via Apple's PassKit framework (present the
|
|
1232
|
+
Apple Pay sheet). Then pass it together with the `transactionId` from step 1 to
|
|
1233
|
+
`finalizeApplePayPayment`. This call actually charges the transaction.
|
|
1234
|
+
|
|
1235
|
+
```typescript
|
|
1236
|
+
const finalizePayment = new ApplePayFinalizePayment(
|
|
1237
|
+
transactionId, // from initApplePayPayment
|
|
1238
|
+
'apple_pay_token', // from PassKit wallet authorization
|
|
1239
|
+
);
|
|
1240
|
+
|
|
1241
|
+
const screenlessResult = await finalizeApplePayPayment(finalizePayment);
|
|
1242
|
+
|
|
1243
|
+
// On success this resolves to ScreenlessPaymentCreated (the same result every
|
|
1244
|
+
// other screenless method returns, including one-step screenlessApplePayPayment).
|
|
1245
|
+
// The final "paid" confirmation arrives asynchronously on your notification URL.
|
|
1246
|
+
handleScreenlessResult(screenlessResult);
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
> [!warning]
|
|
1250
|
+
> The transaction is not paid until `finalizeApplePayPayment` completes
|
|
1251
|
+
> successfully. After `initApplePayPayment` the transaction exists but is still
|
|
1252
|
+
> unpaid. If you never call `finalizeApplePayPayment`, the transaction stays
|
|
1253
|
+
> unpaid.
|
|
1254
|
+
|
|
1184
1255
|
## License
|
|
1185
1256
|
|
|
1186
1257
|
This library is released under the [MIT License](https://opensource.org/license/mit/).
|
|
@@ -119,6 +119,16 @@ class TpayModule(
|
|
|
119
119
|
handleScreenlessResult(TpayScreenlessResult.MethodCallError(APPLE_PAY_NOT_AVAILABLE), promise)
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
@ReactMethod
|
|
123
|
+
fun initApplePayPayment(json: String, promise: Promise) {
|
|
124
|
+
handleScreenlessResult(TpayScreenlessResult.MethodCallError(APPLE_PAY_NOT_AVAILABLE), promise)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@ReactMethod
|
|
128
|
+
fun finalizeApplePayPayment(json: String, promise: Promise) {
|
|
129
|
+
handleScreenlessResult(TpayScreenlessResult.MethodCallError(APPLE_PAY_NOT_AVAILABLE), promise)
|
|
130
|
+
}
|
|
131
|
+
|
|
122
132
|
@ReactMethod
|
|
123
133
|
fun screenlessAmbiguousBLIKPayment(json: String, promise: Promise) = catchAndHandleScreenlessException(promise) {
|
|
124
134
|
val payment = AmbiguousBLIKPayment.fromJson(json)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated from package.json — do not edit manually.
|
|
2
|
-
let reactNativeTpayVersion: String = "1.3.
|
|
2
|
+
let reactNativeTpayVersion: String = "1.3.26"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTpay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_default","exports","default","TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTpay.ts"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAAmD,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAiCpCC,gCAAmB,CAACC,GAAG,CAAO,cAAc,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTpay.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","get"],"sourceRoot":"../../src","sources":["NativeTpay.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAiClD,eAAeA,mBAAmB,CAACC,GAAG,CAAO,cAAc,CAAC","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ export interface Spec extends TurboModule {
|
|
|
10
10
|
screenlessTransferPayment(transferPayment: string): Promise<string>;
|
|
11
11
|
screenlessGooglePayPayment(googlePayPayment: string): Promise<string>;
|
|
12
12
|
screenlessApplePayPayment(applePayPayment: string): Promise<string>;
|
|
13
|
+
initApplePayPayment(applePayInitPayment: string): Promise<string>;
|
|
14
|
+
finalizeApplePayPayment(applePayFinalizePayment: string): Promise<string>;
|
|
13
15
|
screenlessRatyPekaoPayment(ratyPekaoPayment: string): Promise<string>;
|
|
14
16
|
screenlessPayPoPayment(payPoPayment: string): Promise<string>;
|
|
15
17
|
configureGooglePayUtils(configuration: string): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeTpay.d.ts","sourceRoot":"","sources":["../../../src/NativeTpay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cA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aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAGjC,2BAA2B,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAChD;;AAGD,wBAA6D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpay",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.26",
|
|
4
4
|
"description": "The Tpay SDK empowers your app to seamlessly integrate Tpay’s payment functionalities, providing a comprehensive and developer-friendly solution for managing payments.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
package/src/NativeTpay.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface Spec extends TurboModule {
|
|
|
17
17
|
screenlessTransferPayment(transferPayment: string): Promise<string>;
|
|
18
18
|
screenlessGooglePayPayment(googlePayPayment: string): Promise<string>;
|
|
19
19
|
screenlessApplePayPayment(applePayPayment: string): Promise<string>;
|
|
20
|
+
initApplePayPayment(applePayInitPayment: string): Promise<string>;
|
|
21
|
+
finalizeApplePayPayment(applePayFinalizePayment: string): Promise<string>;
|
|
20
22
|
screenlessRatyPekaoPayment(ratyPekaoPayment: string): Promise<string>;
|
|
21
23
|
screenlessPayPoPayment(payPoPayment: string): Promise<string>;
|
|
22
24
|
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
package com.tpay.util
|
|
2
|
-
|
|
3
|
-
import com.tpay.sdk.api.models.Presentable
|
|
4
|
-
import java.util.ArrayDeque
|
|
5
|
-
|
|
6
|
-
object TpayBackpressUtil {
|
|
7
|
-
private var sheet: Presentable? = null
|
|
8
|
-
|
|
9
|
-
val isModuleVisible: Boolean
|
|
10
|
-
get() = sheet != null
|
|
11
|
-
|
|
12
|
-
fun set(sheet: Presentable) {
|
|
13
|
-
this.sheet = sheet
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
fun remove() {
|
|
17
|
-
sheet = null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
fun onBackPressed() {
|
|
21
|
-
sheet?.onBackPressed()
|
|
22
|
-
}
|
|
23
|
-
}
|