react-native-tpay 1.3.11 → 1.3.12
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/ios/Source/Configuration/TransactionConfiguration.swift +41 -14
- package/ios/Source/Extension/Models/PaymentChannel+Compare.swift +7 -0
- package/ios/Source/Model/Domain/BankPayment.swift +1 -0
- package/ios/Source/Model/Domain/BlikPayment.swift +1 -0
- package/ios/Source/Model/Domain/CardPayment.swift +1 -0
- package/ios/Source/Model/Domain/ConfigurationResult.swift +5 -0
- package/ios/Source/Model/Domain/DigitalWalletPayment.swift +1 -0
- package/ios/Source/Model/Domain/PayPoPayment.swift +1 -0
- package/ios/Source/Model/Domain/PaymentChannelError.swift +3 -0
- package/ios/Source/Model/Transportation/Transportation+BankPayment.swift +0 -1
- package/ios/Source/Model/Transportation/Transportation+SingleTransaction.swift +1 -0
- package/ios/Source/Model/Transportation/Transportation+TokenPayment.swift +1 -0
- package/ios/Source/Presentation/PaymentPresentation.swift +5 -0
- package/ios/Source/TpaySDK.swift +6 -6
- package/lib/commonjs/model/screenless/transfer_payment.js +1 -2
- package/lib/commonjs/model/screenless/transfer_payment.js.map +1 -1
- package/lib/module/model/screenless/transfer_payment.js +1 -2
- package/lib/module/model/screenless/transfer_payment.js.map +1 -1
- package/lib/typescript/src/model/screenless/transfer_payment.d.ts +1 -2
- package/lib/typescript/src/model/screenless/transfer_payment.d.ts.map +1 -1
- package/package.json +3 -3
- package/react-native-tpay.podspec +1 -1
- package/src/model/screenless/transfer_payment.ts +0 -3
|
@@ -18,8 +18,9 @@ final class TransactionConfiguration {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
let payerContext = makeTransactionPayerContext(from: singleTransaction)
|
|
21
|
+
let notification = makeNotification(from: singleTransaction.notifications)
|
|
21
22
|
|
|
22
|
-
return SingleTransaction(amount: singleTransaction.amount, description: singleTransaction.description, hiddenDescription: singleTransaction.hiddenDescription, payerContext: payerContext)
|
|
23
|
+
return SingleTransaction(amount: singleTransaction.amount, description: singleTransaction.description, hiddenDescription: singleTransaction.hiddenDescription, payerContext: payerContext, notification: notification)
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
static func cardTokenTransaction(transactionConfiguration: String) -> Transaction? {
|
|
@@ -28,7 +29,9 @@ final class TransactionConfiguration {
|
|
|
28
29
|
return nil
|
|
29
30
|
}
|
|
30
31
|
let payerContext = makeTokenPayerContext(from: tokenPayment)
|
|
31
|
-
|
|
32
|
+
let notification = makeNotification(from: tokenPayment.notifications)
|
|
33
|
+
|
|
34
|
+
return SingleTransaction(amount: tokenPayment.amount, description: tokenPayment.description, hiddenDescription: tokenPayment.hiddenDescription, payerContext: payerContext, notification: notification)
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
static func addCard(tokenisationConfiguration: String) -> TokenizationData? {
|
|
@@ -50,6 +53,7 @@ final class TransactionConfiguration {
|
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
let callbacks = makeCallbacksConfiguration(from: cardPayment.callbacks)
|
|
56
|
+
let notification = makeNotification(from: cardPayment.callbacks.notifications)
|
|
53
57
|
|
|
54
58
|
let card = cardPayment.creditCard.flatMap { creditCard -> Headless.Models.Card? in
|
|
55
59
|
Headless.Models.Card(number: creditCard.number, expiryDate: .init(month: creditCard.expiryDate.month, year: creditCard.expiryDate.year), securityCode: creditCard.securityCode, shouldTokenize: creditCard.config.shouldSave)
|
|
@@ -66,7 +70,9 @@ final class TransactionConfiguration {
|
|
|
66
70
|
paymentChannel: paymentChannel,
|
|
67
71
|
card: card,
|
|
68
72
|
cardToken: cardToken,
|
|
69
|
-
callbacks: callbacks
|
|
73
|
+
callbacks: callbacks,
|
|
74
|
+
notification: notification
|
|
75
|
+
)
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
static func blikPayment(blikPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> BlikPayment? {
|
|
@@ -78,6 +84,7 @@ final class TransactionConfiguration {
|
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
let callbacks = makeCallbacksConfiguration(from: blikPayment.callbacks)
|
|
87
|
+
let notification = makeNotification(from: blikPayment.callbacks.notifications)
|
|
81
88
|
|
|
82
89
|
return .init(amount: blikPayment.paymentDetails.amount,
|
|
83
90
|
description: blikPayment.paymentDetails.description,
|
|
@@ -86,25 +93,33 @@ final class TransactionConfiguration {
|
|
|
86
93
|
token: blikPayment.code,
|
|
87
94
|
alias: blikPayment.alias?.value,
|
|
88
95
|
paymentChannel: paymentChannel,
|
|
89
|
-
callbacks: callbacks
|
|
96
|
+
callbacks: callbacks,
|
|
97
|
+
notification: notification
|
|
98
|
+
)
|
|
90
99
|
}
|
|
91
100
|
|
|
92
|
-
static func bankPayment(bankPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> BankPayment? {
|
|
101
|
+
static func bankPayment(bankPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) throws -> BankPayment? {
|
|
93
102
|
guard let bankPaymentData = bankPaymentConfiguration.data(using: .utf8),
|
|
94
103
|
let bankPayment = try? JSONDecoder().decode(T.BankPayment.self, from: bankPaymentData),
|
|
95
|
-
let payer = makePayer(from: bankPayment.payer)
|
|
96
|
-
let paymentChannel = paymentChannels.first(where: { $0.paymentKind == .pbl }) else {
|
|
104
|
+
let payer = makePayer(from: bankPayment.payer) else {
|
|
97
105
|
return nil
|
|
98
106
|
}
|
|
99
107
|
|
|
108
|
+
guard let paymentChannel = paymentChannels.first(where: { $0.has(channelId: bankPayment.channelId) }) else {
|
|
109
|
+
throw PaymentChannelError.unknownPaymentChannel
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
let callbacks = makeCallbacksConfiguration(from: bankPayment.callbacks)
|
|
113
|
+
let notification = makeNotification(from: bankPayment.callbacks.notifications)
|
|
101
114
|
|
|
102
115
|
return .init(amount: bankPayment.paymentDetails.amount,
|
|
103
116
|
description: bankPayment.paymentDetails.description,
|
|
104
117
|
hiddenDescription: bankPayment.paymentDetails.hiddenDescription,
|
|
105
118
|
payerContext: .init(payer: payer),
|
|
106
119
|
paymentChannel: paymentChannel,
|
|
107
|
-
callbacks: callbacks
|
|
120
|
+
callbacks: callbacks,
|
|
121
|
+
notification: notification
|
|
122
|
+
)
|
|
108
123
|
}
|
|
109
124
|
|
|
110
125
|
static func digitalWalletPayment(digitalWalletPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> DigitalWalletPayment? {
|
|
@@ -116,6 +131,7 @@ final class TransactionConfiguration {
|
|
|
116
131
|
}
|
|
117
132
|
|
|
118
133
|
let callbacks = makeCallbacksConfiguration(from: digitalWalletPayment.callbacks)
|
|
134
|
+
let notification = makeNotification(from: digitalWalletPayment.callbacks.notifications)
|
|
119
135
|
|
|
120
136
|
return .init(amount: digitalWalletPayment.paymentDetails.amount,
|
|
121
137
|
description: digitalWalletPayment.paymentDetails.description,
|
|
@@ -123,7 +139,9 @@ final class TransactionConfiguration {
|
|
|
123
139
|
payerContext: .init(payer: payer),
|
|
124
140
|
paymentChannel: paymentChannel,
|
|
125
141
|
token: digitalWalletPayment.applePayToken,
|
|
126
|
-
callbacks: callbacks
|
|
142
|
+
callbacks: callbacks,
|
|
143
|
+
notification: notification
|
|
144
|
+
)
|
|
127
145
|
}
|
|
128
146
|
|
|
129
147
|
static func payPoPayment(payPoPaymentConfiguration: String, paymentChannels: [Headless.Models.PaymentChannel]) -> PayPoPayment? {
|
|
@@ -135,13 +153,16 @@ final class TransactionConfiguration {
|
|
|
135
153
|
}
|
|
136
154
|
|
|
137
155
|
let callbacks = makeCallbacksConfiguration(from: payPoPayment.callbacks)
|
|
156
|
+
let notification = makeNotification(from: payPoPayment.callbacks.notifications)
|
|
138
157
|
|
|
139
158
|
return .init(amount: payPoPayment.paymentDetails.amount,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
description: payPoPayment.paymentDetails.description,
|
|
160
|
+
hiddenDescription: payPoPayment.paymentDetails.hiddenDescription,
|
|
161
|
+
payerContext: .init(payer: payer),
|
|
162
|
+
paymentChannel: paymentChannel,
|
|
163
|
+
callbacks: callbacks,
|
|
164
|
+
notification: notification
|
|
165
|
+
)
|
|
145
166
|
}
|
|
146
167
|
|
|
147
168
|
|
|
@@ -220,4 +241,10 @@ final class TransactionConfiguration {
|
|
|
220
241
|
return CardToken.Brand.other(brand)
|
|
221
242
|
}
|
|
222
243
|
}
|
|
244
|
+
|
|
245
|
+
private static func makeNotification(from notifications: T.Callbacks.Notifications?) -> Tpay.NotificationConfiguration? {
|
|
246
|
+
|
|
247
|
+
guard let notifications = notifications else { return nil }
|
|
248
|
+
return Tpay.NotificationConfiguration(url: URL(string: notifications.url), email: notifications.email)
|
|
249
|
+
}
|
|
223
250
|
}
|
|
@@ -11,6 +11,7 @@ struct ConfigurationResult: Encodable {
|
|
|
11
11
|
static let paymentCompleted = "paymentCompleted"
|
|
12
12
|
static let paymentCancelled = "paymentCancelled"
|
|
13
13
|
static let paymentError = "paymentError"
|
|
14
|
+
static let paymentClosed = "moduleClosed"
|
|
14
15
|
static let tokenPaymentCompleted = "tokenPaymentCompleted"
|
|
15
16
|
static let tokenPaymentCancelled = "tokenPaymentCancelled"
|
|
16
17
|
static let tokenPaymentError = "tokenPaymentError"
|
|
@@ -66,6 +67,10 @@ struct ConfigurationResult: Encodable {
|
|
|
66
67
|
return .errorResult(type: Constant.tokenPaymentError, error: error)
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
static func paymentClosed() -> ConfigurationResult {
|
|
71
|
+
return .init(type: Constant.paymentClosed, message: nil)
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
static func tokenizationCompleted() -> ConfigurationResult {
|
|
70
75
|
return .init(type: Constant.tokenizationCompleted, message: nil)
|
|
71
76
|
}
|
|
@@ -33,6 +33,11 @@ final class PaymentPresentation: PaymentDelegate {
|
|
|
33
33
|
complete()
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
func onPaymentClosed() {
|
|
37
|
+
paymentResult?(ConfigurationResult.paymentClosed().toJson())
|
|
38
|
+
complete()
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
func onPaymentCancelled(transactionId: String) {
|
|
37
42
|
paymentResult?(ConfigurationResult.paymentCancelled(transactionId: transactionId).toJson())
|
|
38
43
|
complete()
|
package/ios/Source/TpaySDK.swift
CHANGED
|
@@ -302,14 +302,14 @@ final class TpayRNModule: NSObject, RCTBridgeModule {
|
|
|
302
302
|
}
|
|
303
303
|
|
|
304
304
|
private func invokeBankPayment(_ json: String, resolve: @escaping RCTPromiseResolveBlock, paymentChannels: [Headless.Models.PaymentChannel]) {
|
|
305
|
-
guard let bankPayment = TransactionConfiguration.bankPayment(bankPaymentConfiguration: json, paymentChannels: paymentChannels) else {
|
|
306
|
-
resolve(ScreenlessResult.methodCallError().toJson())
|
|
307
|
-
return
|
|
308
|
-
}
|
|
309
|
-
|
|
310
305
|
do {
|
|
306
|
+
guard let bankPayment = try TransactionConfiguration.bankPayment(bankPaymentConfiguration: json, paymentChannels: paymentChannels) else {
|
|
307
|
+
resolve(ScreenlessResult.methodCallError().toJson())
|
|
308
|
+
return
|
|
309
|
+
}
|
|
310
|
+
|
|
311
311
|
try TpayModule.configure(callbacks: bankPayment.callbacks)
|
|
312
|
-
try Headless.invokePayment(for: bankPayment, using: bankPayment.paymentChannel) { result in
|
|
312
|
+
try Headless.invokePayment(for: bankPayment, using: bankPayment.paymentChannel, allowedPaymentKinds: Headless.Models.PaymentKind.allCases) { result in
|
|
313
313
|
switch result {
|
|
314
314
|
case let .success(transaction):
|
|
315
315
|
resolve(ScreenlessResult.paymentCreated(continueUrl: transaction.continueUrl, transactionId: transaction.ongoingTransaction.id).toJson())
|
|
@@ -12,10 +12,9 @@ class TransferPayment extends _screenless_payment.ScreenlessPayment {
|
|
|
12
12
|
/**
|
|
13
13
|
* @param channelId - channel id of a bank in Tpay system
|
|
14
14
|
*/
|
|
15
|
-
constructor(channelId,
|
|
15
|
+
constructor(channelId, paymentDetails, payer, callbacks) {
|
|
16
16
|
super(paymentDetails, payer, callbacks);
|
|
17
17
|
this.channelId = channelId;
|
|
18
|
-
this.bankName = bankName;
|
|
19
18
|
}
|
|
20
19
|
}
|
|
21
20
|
exports.TransferPayment = TransferPayment;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_screenless_payment","require","TransferPayment","ScreenlessPayment","constructor","channelId","
|
|
1
|
+
{"version":3,"names":["_screenless_payment","require","TransferPayment","ScreenlessPayment","constructor","channelId","paymentDetails","payer","callbacks","exports"],"sourceRoot":"../../../../src","sources":["model/screenless/transfer_payment.ts"],"mappings":";;;;;;AAGA,IAAAA,mBAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACO,MAAMC,eAAe,SAASC,qCAAiB,CAAC;EAGrD;AACF;AACA;EACEC,WAAWA,CACTC,SAAiB,EACjBC,cAA8B,EAC9BC,KAAY,EACZC,SAAoB,EACpB;IACA,KAAK,CAACF,cAAc,EAAEC,KAAK,EAAEC,SAAS,CAAC;IACvC,IAAI,CAACH,SAAS,GAAGA,SAAS;EAC5B;AACF;AAACI,OAAA,CAAAP,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -9,10 +9,9 @@ export class TransferPayment extends ScreenlessPayment {
|
|
|
9
9
|
/**
|
|
10
10
|
* @param channelId - channel id of a bank in Tpay system
|
|
11
11
|
*/
|
|
12
|
-
constructor(channelId,
|
|
12
|
+
constructor(channelId, paymentDetails, payer, callbacks) {
|
|
13
13
|
super(paymentDetails, payer, callbacks);
|
|
14
14
|
this.channelId = channelId;
|
|
15
|
-
this.bankName = bankName;
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
17
|
//# sourceMappingURL=transfer_payment.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ScreenlessPayment","TransferPayment","constructor","channelId","
|
|
1
|
+
{"version":3,"names":["ScreenlessPayment","TransferPayment","constructor","channelId","paymentDetails","payer","callbacks"],"sourceRoot":"../../../../src","sources":["model/screenless/transfer_payment.ts"],"mappings":";;AAGA,SAASA,iBAAiB,QAAQ,sBAAsB;;AAExD;AACA;AACA;AACA,OAAO,MAAMC,eAAe,SAASD,iBAAiB,CAAC;EAGrD;AACF;AACA;EACEE,WAAWA,CACTC,SAAiB,EACjBC,cAA8B,EAC9BC,KAAY,EACZC,SAAoB,EACpB;IACA,KAAK,CAACF,cAAc,EAAEC,KAAK,EAAEC,SAAS,CAAC;IACvC,IAAI,CAACH,SAAS,GAAGA,SAAS;EAC5B;AACF","ignoreList":[]}
|
|
@@ -7,10 +7,9 @@ import { ScreenlessPayment } from "./screenless_payment";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class TransferPayment extends ScreenlessPayment {
|
|
9
9
|
channelId: number;
|
|
10
|
-
bankName: string;
|
|
11
10
|
/**
|
|
12
11
|
* @param channelId - channel id of a bank in Tpay system
|
|
13
12
|
*/
|
|
14
|
-
constructor(channelId: number,
|
|
13
|
+
constructor(channelId: number, paymentDetails: PaymentDetails, payer: Payer, callbacks: Callbacks);
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=transfer_payment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer_payment.d.ts","sourceRoot":"","sources":["../../../../../src/model/screenless/transfer_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,iBAAiB;IACpD,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"transfer_payment.d.ts","sourceRoot":"","sources":["../../../../../src/model/screenless/transfer_payment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD;;GAEG;AACH,qBAAa,eAAgB,SAAQ,iBAAiB;IACpD,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;gBAED,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS;CAKvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-tpay",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.12",
|
|
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",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@react-native-community/cli": "15.0.0-alpha.2",
|
|
59
59
|
"@react-native/babel-preset": "0.79.2",
|
|
60
60
|
"@react-native/eslint-config": "^0.78.0",
|
|
61
|
-
"@release-it/conventional-changelog": "^
|
|
61
|
+
"@release-it/conventional-changelog": "^10.0.3",
|
|
62
62
|
"@types/jest": "^29.5.5",
|
|
63
63
|
"@types/react": "^19.0.0",
|
|
64
64
|
"commitlint": "^19.6.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react": "19.0.0",
|
|
73
73
|
"react-native": "0.79.2",
|
|
74
74
|
"react-native-builder-bob": "^0.40.11",
|
|
75
|
-
"release-it": "^
|
|
75
|
+
"release-it": "^19.1.0",
|
|
76
76
|
"turbo": "^1.10.7",
|
|
77
77
|
"typescript": "^5.8.3"
|
|
78
78
|
},
|
|
@@ -8,20 +8,17 @@ import { ScreenlessPayment } from "./screenless_payment";
|
|
|
8
8
|
*/
|
|
9
9
|
export class TransferPayment extends ScreenlessPayment {
|
|
10
10
|
channelId: number;
|
|
11
|
-
bankName: string;
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* @param channelId - channel id of a bank in Tpay system
|
|
15
14
|
*/
|
|
16
15
|
constructor(
|
|
17
16
|
channelId: number,
|
|
18
|
-
bankName: string,
|
|
19
17
|
paymentDetails: PaymentDetails,
|
|
20
18
|
payer: Payer,
|
|
21
19
|
callbacks: Callbacks
|
|
22
20
|
) {
|
|
23
21
|
super(paymentDetails, payer, callbacks);
|
|
24
22
|
this.channelId = channelId;
|
|
25
|
-
this.bankName = bankName;
|
|
26
23
|
}
|
|
27
24
|
}
|