payme-mini-app 0.4.27 → 0.4.28
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/android/build.gradle +1 -1
- package/android/src/main/java/com/paymeminiapp/RNPayMEMiniAppModule.kt +97 -37
- package/ios/RNPayMEMiniApp.swift +4 -1
- package/lib/typescript/index.type.d.ts +9 -0
- package/lib/typescript/index.type.d.ts.map +1 -1
- package/package.json +1 -1
- package/payme-mini-app.podspec +1 -1
- package/src/index.type.ts +7 -0
package/android/build.gradle
CHANGED
|
@@ -74,7 +74,7 @@ dependencies {
|
|
|
74
74
|
//noinspection GradleDynamicVersion
|
|
75
75
|
implementation "com.facebook.react:react-native"
|
|
76
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
|
-
implementation 'com.github.PayME-Miniapp:native-android:0.0.
|
|
77
|
+
implementation 'com.github.PayME-Miniapp:native-android:0.0.78'
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (isNewArchitectureEnabled()) {
|
|
@@ -65,39 +65,67 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
|
|
|
65
65
|
val action = openingParam.getString("action") ?: "PAYME"
|
|
66
66
|
val phone = openingParam.getString("phone") ?: ""
|
|
67
67
|
val data = openingParam.getMap("data")
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
|
|
69
|
+
if (action == "DEPOSIT" || action == "WITHDRAW" || action == "TRANSFER") {
|
|
70
|
+
val description = if (data?.hasKey("description") == true) data.getString("description") else ""
|
|
71
|
+
val isBackToApp = if (data?.hasKey("isBackToApp") == true) data.getBoolean("isBackToApp") else true
|
|
72
|
+
val amount = if (data?.hasKey("amount") == true) data.getInt("amount") else null
|
|
73
|
+
val additionalData = DepositWithdrawTransferData(description, amount, isBackToApp)
|
|
74
|
+
val openMiniAppData = getOpenMiniAppData(action, phone, additionalData)
|
|
75
|
+
payMEMiniApp?.openMiniApp(
|
|
76
|
+
getTypeOpenMiniApp(type),
|
|
77
|
+
openMiniAppData
|
|
78
|
+
)
|
|
79
|
+
return
|
|
72
80
|
}
|
|
73
81
|
if (action == "SERVICE") {
|
|
74
|
-
service = data?.getString("service") ?: ""
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
82
|
+
val service = data?.getString("service") ?: ""
|
|
83
|
+
val isBackToApp = if (data?.hasKey("isBackToApp") == true) data.getBoolean("isBackToApp") else true
|
|
84
|
+
val additionalData = ServiceData(service, isBackToApp)
|
|
85
|
+
val openMiniAppData = getOpenMiniAppData(action, phone, additionalData)
|
|
86
|
+
payMEMiniApp?.openMiniApp(
|
|
87
|
+
getTypeOpenMiniApp(type),
|
|
88
|
+
openMiniAppData
|
|
89
|
+
)
|
|
90
|
+
return
|
|
79
91
|
}
|
|
80
|
-
var transactionId: String? = null
|
|
81
|
-
var note: String? = null
|
|
82
|
-
var ipnUrl: String? = null
|
|
83
92
|
if (action == "PAY") {
|
|
84
|
-
transactionId = data?.getString("transactionId")
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
val transactionId = data?.getString("transactionId")
|
|
94
|
+
val amount = data?.getInt("amount")
|
|
95
|
+
val note = if (data?.hasKey("note") == true) data.getString("note") else ""
|
|
96
|
+
val ipnUrl = if (data?.hasKey("ipnUrl") == true) data.getString("ipnUrl") else ""
|
|
97
|
+
var paymentData: PaymentData?= null
|
|
98
|
+
if (amount != null && transactionId != null) {
|
|
99
|
+
paymentData = PaymentData(transactionId, amount, note, ipnUrl)
|
|
100
|
+
}
|
|
101
|
+
val openMiniAppData = getOpenMiniAppData(action, phone, paymentData)
|
|
102
|
+
payMEMiniApp?.openMiniApp(
|
|
103
|
+
getTypeOpenMiniApp(type),
|
|
104
|
+
openMiniAppData
|
|
105
|
+
)
|
|
106
|
+
return
|
|
87
107
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
108
|
+
if (action == "PAYMENT") {
|
|
109
|
+
val transaction = data?.getString("transaction")
|
|
110
|
+
var paymentData: PaymentDirectData?= null
|
|
111
|
+
if (transaction != null) {
|
|
112
|
+
paymentData = PaymentDirectData(transaction)
|
|
113
|
+
}
|
|
114
|
+
val openMiniAppData = getOpenMiniAppData(action, phone, paymentData)
|
|
115
|
+
payMEMiniApp?.openMiniApp(
|
|
116
|
+
getTypeOpenMiniApp(type),
|
|
117
|
+
openMiniAppData
|
|
118
|
+
)
|
|
119
|
+
return
|
|
92
120
|
}
|
|
93
|
-
if (action == "
|
|
94
|
-
|
|
121
|
+
if (action == "OPEN" || action == "KYC" || action == "PAYME") {
|
|
122
|
+
val openMiniAppData = getOpenMiniAppData(action, phone)
|
|
123
|
+
payMEMiniApp?.openMiniApp(
|
|
124
|
+
getTypeOpenMiniApp(type),
|
|
125
|
+
openMiniAppData
|
|
126
|
+
)
|
|
127
|
+
return
|
|
95
128
|
}
|
|
96
|
-
val openMiniAppData = getOpenMiniAppData(action, phone, paymentData, additionalData, service)
|
|
97
|
-
payMEMiniApp?.openMiniApp(
|
|
98
|
-
getTypeOpenMiniApp(type),
|
|
99
|
-
openMiniAppData
|
|
100
|
-
)
|
|
101
129
|
}
|
|
102
130
|
|
|
103
131
|
private fun onResponse(actionOpenMiniApp: ActionOpenMiniApp, jsonObject: JSONObject?) {
|
|
@@ -161,33 +189,65 @@ class RNPayMEMiniAppModule(reactContext: ReactApplicationContext) :
|
|
|
161
189
|
private fun getOpenMiniAppData(
|
|
162
190
|
action: String,
|
|
163
191
|
phone: String,
|
|
164
|
-
paymentData: PaymentData? = null,
|
|
165
|
-
additionalData: DepositWithdrawTransferData? = null,
|
|
166
|
-
service: String? = null
|
|
167
192
|
): OpenMiniAppDataInterface {
|
|
168
193
|
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.OPEN) {
|
|
169
194
|
return OpenMiniAppOpenData(phone)
|
|
170
195
|
}
|
|
171
|
-
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.PAY && paymentData != null) {
|
|
172
|
-
return OpenMiniAppPaymentData(phone, paymentData!!)
|
|
173
|
-
}
|
|
174
196
|
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.PAYME) {
|
|
175
197
|
return OpenMiniAppPayMEData()
|
|
176
198
|
}
|
|
177
199
|
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.KYC) {
|
|
178
200
|
return OpenMiniAppKYCData(phone)
|
|
179
201
|
}
|
|
202
|
+
return OpenMiniAppPayMEData()
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
private fun getOpenMiniAppData(
|
|
206
|
+
action: String,
|
|
207
|
+
phone: String,
|
|
208
|
+
additionalData: DepositWithdrawTransferData? = null
|
|
209
|
+
): OpenMiniAppDataInterface {
|
|
180
210
|
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.DEPOSIT && additionalData != null) {
|
|
181
|
-
return OpenMiniAppDepositData(phone, additionalData
|
|
211
|
+
return OpenMiniAppDepositData(phone, additionalData)
|
|
182
212
|
}
|
|
183
213
|
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.WITHDRAW && additionalData != null) {
|
|
184
|
-
return OpenMiniAppWithdrawData(phone, additionalData
|
|
214
|
+
return OpenMiniAppWithdrawData(phone, additionalData)
|
|
185
215
|
}
|
|
186
216
|
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.TRANSFER && additionalData != null) {
|
|
187
|
-
return OpenMiniAppTransferData(phone, additionalData
|
|
217
|
+
return OpenMiniAppTransferData(phone, additionalData)
|
|
188
218
|
}
|
|
189
|
-
|
|
190
|
-
|
|
219
|
+
return OpenMiniAppPayMEData()
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private fun getOpenMiniAppData(
|
|
223
|
+
action: String,
|
|
224
|
+
phone: String,
|
|
225
|
+
paymentData: PaymentData? = null,
|
|
226
|
+
): OpenMiniAppDataInterface {
|
|
227
|
+
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.PAY && paymentData != null) {
|
|
228
|
+
return OpenMiniAppPaymentData(phone, paymentData)
|
|
229
|
+
}
|
|
230
|
+
return OpenMiniAppPayMEData()
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private fun getOpenMiniAppData(
|
|
234
|
+
action: String,
|
|
235
|
+
phone: String,
|
|
236
|
+
paymentData: PaymentDirectData? = null,
|
|
237
|
+
): OpenMiniAppDataInterface {
|
|
238
|
+
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.PAYMENT && paymentData != null) {
|
|
239
|
+
return OpenMiniAppPaymentDirectData(phone, paymentData)
|
|
240
|
+
}
|
|
241
|
+
return OpenMiniAppPayMEData()
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private fun getOpenMiniAppData(
|
|
245
|
+
action: String,
|
|
246
|
+
phone: String,
|
|
247
|
+
additionalData: ServiceData? = null
|
|
248
|
+
): OpenMiniAppDataInterface {
|
|
249
|
+
if (getActionOpenMiniApp(action) == ActionOpenMiniApp.SERVICE && additionalData != null) {
|
|
250
|
+
return OpenMiniAppServiceData(phone, additionalData)
|
|
191
251
|
}
|
|
192
252
|
return OpenMiniAppPayMEData()
|
|
193
253
|
}
|
package/ios/RNPayMEMiniApp.swift
CHANGED
|
@@ -22,6 +22,7 @@ class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
|
|
|
22
22
|
case "PAYME": return PayMEAction.PayME
|
|
23
23
|
case "OPEN": return PayMEAction.Open
|
|
24
24
|
case "PAY": return PayMEAction.Pay
|
|
25
|
+
case "PAYMENT": return PayMEAction.Payment
|
|
25
26
|
case "SERVICE": return PayMEAction.Service
|
|
26
27
|
case "DEPOSIT": return PayMEAction.Deposit
|
|
27
28
|
case "WITHDRAW": return PayMEAction.Withdraw
|
|
@@ -39,6 +40,8 @@ class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
|
|
|
39
40
|
return PayMEPaymentParam(
|
|
40
41
|
amount: data["amount"] as! Int, transactionId: data["transactionId"] as! String,
|
|
41
42
|
note: data["note"] as? String, ipnUrl: data["ipnUrl"] as? String)
|
|
43
|
+
case "PAYMENT":
|
|
44
|
+
return PayMEPaymentDirectParam(transaction: data["transaction"] as! String)
|
|
42
45
|
case "SERVICE":
|
|
43
46
|
return PayMEServiceParam(service: data["service"] as! String)
|
|
44
47
|
case "DEPOSIT":
|
|
@@ -58,7 +61,7 @@ class RNPayMEMiniApp: RCTEventEmitter, PayMEDelegate {
|
|
|
58
61
|
let RNVC = UIApplication.shared.delegate?.window??.rootViewController
|
|
59
62
|
self.payme.open(
|
|
60
63
|
with: PayMEOpeningParam(
|
|
61
|
-
action: openAction, phone: param["phone"] as
|
|
64
|
+
action: openAction, phone: param["phone"] as? String ?? "", data: openData), from: RNVC,
|
|
62
65
|
type: PayMEOpeningType(rawValue: type) ?? .screen)
|
|
63
66
|
}
|
|
64
67
|
}
|
|
@@ -4,12 +4,17 @@ type PayMEPaymentParam = {
|
|
|
4
4
|
note?: string;
|
|
5
5
|
ipnUrl: string;
|
|
6
6
|
};
|
|
7
|
+
type PayMEPaymentDirectParam = {
|
|
8
|
+
transaction: string;
|
|
9
|
+
};
|
|
7
10
|
type PayMEServiceParam = {
|
|
8
11
|
service: string;
|
|
12
|
+
isBackToApp?: boolean;
|
|
9
13
|
};
|
|
10
14
|
type PayMEPayParam = {
|
|
11
15
|
amount?: number;
|
|
12
16
|
description?: string;
|
|
17
|
+
isBackToApp?: boolean;
|
|
13
18
|
};
|
|
14
19
|
export type PayMEOpeningParam = {
|
|
15
20
|
action: 'PAYME';
|
|
@@ -24,6 +29,10 @@ export type PayMEOpeningParam = {
|
|
|
24
29
|
action: 'PAY';
|
|
25
30
|
phone: string;
|
|
26
31
|
data: PayMEPaymentParam;
|
|
32
|
+
} | {
|
|
33
|
+
action: 'PAYMENT';
|
|
34
|
+
phone?: string;
|
|
35
|
+
data: PayMEPaymentDirectParam;
|
|
27
36
|
} | {
|
|
28
37
|
action: 'SERVICE';
|
|
29
38
|
phone: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.type.d.ts","sourceRoot":"","sources":["../../src/index.type.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.type.d.ts","sourceRoot":"","sources":["../../src/index.type.ts"],"names":[],"mappings":"AAAA,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,MAAM,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,uBAAuB,CAAA;CAAE,GACpE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAC7D;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GACzD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAC1D;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;AAEhD,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,iBAAiB,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
package/payme-mini-app.podspec
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.swift_versions = "5.0"
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
|
-
s.dependency "PayME-Miniapp", "0.2.
|
|
19
|
+
s.dependency "PayME-Miniapp", "0.2.27"
|
|
20
20
|
s.dependency "React-Core"
|
|
21
21
|
s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
|
|
22
22
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
package/src/index.type.ts
CHANGED
|
@@ -5,13 +5,19 @@ type PayMEPaymentParam = {
|
|
|
5
5
|
ipnUrl: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
type PayMEPaymentDirectParam = {
|
|
9
|
+
transaction: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
8
12
|
type PayMEServiceParam = {
|
|
9
13
|
service: string;
|
|
14
|
+
isBackToApp?: boolean;
|
|
10
15
|
};
|
|
11
16
|
|
|
12
17
|
type PayMEPayParam = {
|
|
13
18
|
amount?: number;
|
|
14
19
|
description?: string;
|
|
20
|
+
isBackToApp?: boolean;
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
export type PayMEOpeningParam =
|
|
@@ -19,6 +25,7 @@ export type PayMEOpeningParam =
|
|
|
19
25
|
| { action: 'OPEN'; phone: string }
|
|
20
26
|
| { action: 'KYC'; phone: string }
|
|
21
27
|
| { action: 'PAY'; phone: string; data: PayMEPaymentParam }
|
|
28
|
+
| { action: 'PAYMENT'; phone?: string; data: PayMEPaymentDirectParam }
|
|
22
29
|
| { action: 'SERVICE'; phone: string; data: PayMEServiceParam }
|
|
23
30
|
| { action: 'DEPOSIT'; phone: string; data: PayMEPayParam }
|
|
24
31
|
| { action: 'WITHDRAW'; phone: string; data: PayMEPayParam }
|