@jetthai/cuora 1.1.128-dev-2 → 1.1.128
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/CHANGELOG.md +0 -424
- package/package.json +1 -1
- package/src/api/activity.js +0 -28
- package/src/api/auth.js +0 -6
- package/src/api/common.js +1 -2
- package/src/api/game.js +4 -5
- package/src/api/mailbox.js +5 -9
- package/src/api/payment.js +8 -103
- package/src/api/user.js +0 -2
- package/src/machine/activity/activity.js +16 -56
- package/src/machine/activity/activity_cash.js +14 -78
- package/src/machine/activity/diamond_shop_activity_cash.js +92 -57
- package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
- package/src/machine/activity/fafafa_activity.js +1 -8
- package/src/machine/activity/friend_invite_friends_activity.js +1 -3
- package/src/machine/activity/index.js +0 -6
- package/src/machine/activity/roulette_activity_v2.js +2 -11
- package/src/machine/activity/sign_in_activity.js +13 -20
- package/src/machine/auth.js +5 -54
- package/src/machine/bank_binding.js +12 -112
- package/src/machine/bank_binding_amb.js +1 -6
- package/src/machine/common.js +24 -92
- package/src/machine/deposit/amb.js +3 -5
- package/src/machine/deposit/crypto.js +10 -14
- package/src/machine/deposit/crypto_button.js +5 -9
- package/src/machine/deposit/crypto_cash.js +5 -2
- package/src/machine/deposit/direct.js +15 -2
- package/src/machine/deposit/direct_cash.js +26 -6
- package/src/machine/deposit/float.js +3 -5
- package/src/machine/deposit/index.js +0 -14
- package/src/machine/deposit/loadcard_cash.js +27 -6
- package/src/machine/deposit/loadcard_vn.js +13 -2
- package/src/machine/deposit/manual_cash.js +38 -89
- package/src/machine/deposit/manual_vn.js +53 -99
- package/src/machine/deposit/qrcode_cash.js +23 -12
- package/src/machine/deposit/qrcode_v2.js +14 -3
- package/src/machine/deposit/usdt_cash.js +2 -0
- package/src/machine/deposit/vpay.js +3 -5
- package/src/machine/game_search_cash.js +12 -137
- package/src/machine/game_search_v2.js +4 -4
- package/src/machine/game_v2_1.js +7 -131
- package/src/machine/inbox.js +34 -259
- package/src/machine/index.js +0 -6
- package/src/machine/leaderboard.js +8 -31
- package/src/machine/reward_cash.js +1 -1
- package/src/machine/side_v2.js +1 -1
- package/src/machine/user_sign_up.js +7 -71
- package/src/machine/withdraw/index.js +0 -6
- package/src/machine/withdraw/withdraw_crypto.js +66 -1
- package/src/machine/withdraw/withdraw_manual_cash.js +14 -44
- package/src/machine/withdraw/withdraw_vn.js +7 -42
- package/src/machine/withdraw/withdraw_vn2.js +37 -64
- package/src/util/constant.js +0 -18
- package/src/util/deviceToken.js +2 -2
- package/src/machine/activity/cash_rain_activity.js +0 -153
- package/src/machine/activity/instant_rebate_activity.js +0 -214
- package/src/machine/activity/vip_card_activity.js +0 -140
- package/src/machine/deposit/crypto_bank.js +0 -317
- package/src/machine/deposit/crypto_bank_cash.js +0 -280
- package/src/machine/deposit/crypto_qrcode.js +0 -147
- package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
- package/src/machine/deposit/crypto_way.js +0 -220
- package/src/machine/deposit/crypto_way_cash.js +0 -242
- package/src/machine/deposit/krway.js +0 -151
- package/src/machine/game_info.js +0 -57
- package/src/machine/honor_board_cash.js +0 -63
- package/src/machine/user_photo.js +0 -65
- package/src/machine/withdraw/withdraw_crypto2.js +0 -540
- package/src/machine/withdraw/withdraw_krway.js +0 -207
- package/src/machine/withdraw/withdraw_manual.js +0 -595
|
@@ -19,7 +19,6 @@ export default function (request) {
|
|
|
19
19
|
options: [],
|
|
20
20
|
sourceAddress: '',
|
|
21
21
|
|
|
22
|
-
selectedChannel: null,
|
|
23
22
|
selectedAmount: null,
|
|
24
23
|
selectedCrypto: null,
|
|
25
24
|
selectedNetwork: null,
|
|
@@ -110,7 +109,7 @@ export default function (request) {
|
|
|
110
109
|
},
|
|
111
110
|
{
|
|
112
111
|
actions: 'setAmount',
|
|
113
|
-
cond: '
|
|
112
|
+
cond: (context, event) => context.siteConfig?.walletMode === '2',
|
|
114
113
|
},
|
|
115
114
|
{
|
|
116
115
|
target: 'debouncing',
|
|
@@ -226,7 +225,7 @@ export default function (request) {
|
|
|
226
225
|
actions: 'setResult',
|
|
227
226
|
},
|
|
228
227
|
onError: {
|
|
229
|
-
target: '
|
|
228
|
+
target: 'calculated',
|
|
230
229
|
},
|
|
231
230
|
},
|
|
232
231
|
},
|
|
@@ -244,16 +243,12 @@ export default function (request) {
|
|
|
244
243
|
return {
|
|
245
244
|
selectedAmount: null,
|
|
246
245
|
calculation: null,
|
|
247
|
-
result: null,
|
|
248
246
|
}
|
|
249
247
|
}),
|
|
250
248
|
setInitData: assign((context, event) => {
|
|
251
249
|
const { siteConfig, paymentDetail } = event.data
|
|
252
|
-
const cryptos =
|
|
253
|
-
|
|
254
|
-
?.filter((element) => element.category === context.currentCategory)
|
|
255
|
-
?.map((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
256
|
-
const currentPayment = cryptos[0]
|
|
250
|
+
const cryptos = paymentDetail?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
251
|
+
const currentPayment = cryptos.find((element) => element.category === context.currentCategory)
|
|
257
252
|
const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart(String(i + 1), 2, '0')}`, icon: 'channel' }))
|
|
258
253
|
const defaultNetworks =
|
|
259
254
|
cryptos[0].networkName.map((value, i) => {
|
|
@@ -311,6 +306,7 @@ export default function (request) {
|
|
|
311
306
|
icon: value,
|
|
312
307
|
}
|
|
313
308
|
}) || []
|
|
309
|
+
|
|
314
310
|
const properties = {
|
|
315
311
|
selectedCrypto: event.data,
|
|
316
312
|
networks,
|
|
@@ -130,6 +130,7 @@ export default function (request, context) {
|
|
|
130
130
|
value: crypto.method,
|
|
131
131
|
icon: crypto.channel,
|
|
132
132
|
}))
|
|
133
|
+
|
|
133
134
|
const defaultNetworks = cryptos[0].networkName.map((value, i) => {
|
|
134
135
|
return {
|
|
135
136
|
label: cryptos[0].networkOptional?.[i],
|
|
@@ -137,6 +138,7 @@ export default function (request, context) {
|
|
|
137
138
|
icon: value,
|
|
138
139
|
}
|
|
139
140
|
})
|
|
141
|
+
|
|
140
142
|
return {
|
|
141
143
|
cryptos,
|
|
142
144
|
networks: defaultNetworks,
|
|
@@ -155,6 +157,7 @@ export default function (request, context) {
|
|
|
155
157
|
icon: value,
|
|
156
158
|
}
|
|
157
159
|
})
|
|
160
|
+
|
|
158
161
|
return {
|
|
159
162
|
networks,
|
|
160
163
|
selectedCrypto: selectedCrypto,
|
|
@@ -201,6 +204,7 @@ export default function (request, context) {
|
|
|
201
204
|
setPromotion: assign((context, event) => {
|
|
202
205
|
const { selectedCrypto, selectedAmount } = context
|
|
203
206
|
const promotion = event.data
|
|
207
|
+
|
|
204
208
|
return {
|
|
205
209
|
promotion,
|
|
206
210
|
selectedAmount: max(promotion.minimumAmount, selectedCrypto.minimum, selectedAmount, 0),
|
|
@@ -237,7 +241,7 @@ export default function (request, context) {
|
|
|
237
241
|
)
|
|
238
242
|
},
|
|
239
243
|
submitDeposit: async (context, event) => {
|
|
240
|
-
const { selectedCrypto, selectedNetwork, calculation, sourceAddress
|
|
244
|
+
const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context
|
|
241
245
|
return await request.send(
|
|
242
246
|
payment.submitDepositTransactionCrypto({
|
|
243
247
|
method: selectedCrypto.method,
|
|
@@ -245,7 +249,6 @@ export default function (request, context) {
|
|
|
245
249
|
cryptoCurrency: selectedCrypto.channel,
|
|
246
250
|
cryptoNetwork: selectedNetwork.value,
|
|
247
251
|
sourceAddress: sourceAddress,
|
|
248
|
-
promotionsNo: promotion?.promotionsNo,
|
|
249
252
|
})
|
|
250
253
|
)
|
|
251
254
|
},
|
|
@@ -88,6 +88,10 @@ export default function (request) {
|
|
|
88
88
|
CALCULATE: {
|
|
89
89
|
target: 'debouncing',
|
|
90
90
|
},
|
|
91
|
+
CONFIRM: {
|
|
92
|
+
target: 'pending',
|
|
93
|
+
cond: (context, event) => !!context.calculation,
|
|
94
|
+
},
|
|
91
95
|
SUBMIT: [
|
|
92
96
|
{
|
|
93
97
|
target: 'pending',
|
|
@@ -182,13 +186,19 @@ export default function (request) {
|
|
|
182
186
|
amount: null,
|
|
183
187
|
selectedBank: banks[0],
|
|
184
188
|
calculation: null,
|
|
185
|
-
result: null,
|
|
186
189
|
}
|
|
187
190
|
}),
|
|
188
191
|
setInitData: assign((context, event) => {
|
|
189
192
|
const { siteConfig, paymentDetail } = event.data
|
|
190
193
|
const directs = paymentDetail.filter((element) => element.category === context.currentCategory)
|
|
191
|
-
|
|
194
|
+
let currentDirect = null
|
|
195
|
+
let currentMethod = null
|
|
196
|
+
if (siteConfig.walletMode === '4') {
|
|
197
|
+
currentDirect = directs.find((direct) => parseFloat(`${direct.charge || 0}`) === 0)
|
|
198
|
+
} else {
|
|
199
|
+
currentDirect = directs[0]
|
|
200
|
+
}
|
|
201
|
+
|
|
192
202
|
return {
|
|
193
203
|
siteConfig,
|
|
194
204
|
paymentDetail,
|
|
@@ -199,6 +209,7 @@ export default function (request) {
|
|
|
199
209
|
}),
|
|
200
210
|
setBanks: assign((context, event) => {
|
|
201
211
|
const banks = event.data
|
|
212
|
+
|
|
202
213
|
return {
|
|
203
214
|
banks,
|
|
204
215
|
selectedBank: banks[0],
|
|
@@ -255,6 +266,7 @@ export default function (request) {
|
|
|
255
266
|
amount,
|
|
256
267
|
currentDirect: { maximum, minimum },
|
|
257
268
|
} = context
|
|
269
|
+
|
|
258
270
|
return amount && minimum <= +amount && +amount <= maximum
|
|
259
271
|
},
|
|
260
272
|
isSubmittable: (context, event) => {
|
|
@@ -281,6 +293,7 @@ export default function (request) {
|
|
|
281
293
|
},
|
|
282
294
|
fetchCalculation: async (context, event) => {
|
|
283
295
|
const { currentMethod, amount, promotion } = context
|
|
296
|
+
|
|
284
297
|
return await request.send(
|
|
285
298
|
payment.getDepositExpectedResult({
|
|
286
299
|
method: currentMethod,
|
|
@@ -76,7 +76,7 @@ export default function (request, context) {
|
|
|
76
76
|
actions: 'setResult',
|
|
77
77
|
},
|
|
78
78
|
onError: {
|
|
79
|
-
target: '
|
|
79
|
+
target: 'calculated',
|
|
80
80
|
},
|
|
81
81
|
},
|
|
82
82
|
},
|
|
@@ -90,7 +90,7 @@ export default function (request, context) {
|
|
|
90
90
|
internal: false,
|
|
91
91
|
},
|
|
92
92
|
SELECT_DIRECT: {
|
|
93
|
-
target: '.
|
|
93
|
+
target: '.debouncing',
|
|
94
94
|
actions: 'setDirect',
|
|
95
95
|
internal: false,
|
|
96
96
|
},
|
|
@@ -107,10 +107,24 @@ export default function (request, context) {
|
|
|
107
107
|
},
|
|
108
108
|
{
|
|
109
109
|
actions: {
|
|
110
|
+
reset: assign((context, event) => {
|
|
111
|
+
const { userBanks } = context
|
|
112
|
+
return {
|
|
113
|
+
selectedAmount: null,
|
|
114
|
+
selectedUserBank: userBanks[0],
|
|
115
|
+
calculation: null,
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
110
118
|
setInitData: assign((context, event) => {
|
|
111
119
|
const { paymentDetail, selectedAmount, promotion } = context
|
|
112
|
-
const directs = paymentDetail
|
|
113
|
-
|
|
120
|
+
const directs = paymentDetail
|
|
121
|
+
.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
122
|
+
.map((direct) => {
|
|
123
|
+
direct.disabled = promotion?.promotionsNo !== 'none' && direct.charge > 0
|
|
124
|
+
return direct
|
|
125
|
+
})
|
|
126
|
+
const selectedDirect = context.selectedDirect || directs.find((direct) => !direct.disabled)
|
|
127
|
+
|
|
114
128
|
return {
|
|
115
129
|
directs,
|
|
116
130
|
selectedDirect,
|
|
@@ -170,6 +184,7 @@ export default function (request, context) {
|
|
|
170
184
|
selectedAmount,
|
|
171
185
|
selectedDirect: { maximum, minimum },
|
|
172
186
|
} = context
|
|
187
|
+
|
|
173
188
|
return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
|
|
174
189
|
},
|
|
175
190
|
isSubmittable: (context, event) => {
|
|
@@ -178,6 +193,10 @@ export default function (request, context) {
|
|
|
178
193
|
},
|
|
179
194
|
},
|
|
180
195
|
services: {
|
|
196
|
+
fetchInitData: async (context, event) => {
|
|
197
|
+
const [paymentDetail = []] = await Promise.all([request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))])
|
|
198
|
+
return { paymentDetail }
|
|
199
|
+
},
|
|
181
200
|
fetchBanksList: async (context, event) => {
|
|
182
201
|
const { selectedDirect, bankMap } = context
|
|
183
202
|
const method = selectedDirect?.method
|
|
@@ -192,11 +211,12 @@ export default function (request, context) {
|
|
|
192
211
|
},
|
|
193
212
|
fetchCalculation: async (context, event) => {
|
|
194
213
|
const { selectedDirect, selectedAmount, promotion } = context
|
|
214
|
+
|
|
195
215
|
return await request.send(
|
|
196
216
|
payment.getDepositExpectedResult({
|
|
197
217
|
method: selectedDirect.method,
|
|
198
218
|
amount: selectedAmount,
|
|
199
|
-
promotionsNo: promotion?.
|
|
219
|
+
promotionsNo: promotion?.activityNo,
|
|
200
220
|
})
|
|
201
221
|
)
|
|
202
222
|
},
|
|
@@ -207,7 +227,7 @@ export default function (request, context) {
|
|
|
207
227
|
method: selectedDirect.method,
|
|
208
228
|
amount: selectedAmount,
|
|
209
229
|
applyerBankCode: selectedUserBank.bankCode,
|
|
210
|
-
promotionsNo: promotion?.
|
|
230
|
+
promotionsNo: promotion?.activityNo,
|
|
211
231
|
})
|
|
212
232
|
)
|
|
213
233
|
},
|
|
@@ -245,7 +245,7 @@ export default function (request) {
|
|
|
245
245
|
actions: {
|
|
246
246
|
setUserAccount: assign((context, event) => {
|
|
247
247
|
return {
|
|
248
|
-
userAccount: event.data?.[0],
|
|
248
|
+
userAccount: event.data.bankInfo?.[0],
|
|
249
249
|
}
|
|
250
250
|
}),
|
|
251
251
|
setPromotion: assign((context, event) => {
|
|
@@ -310,7 +310,7 @@ export default function (request) {
|
|
|
310
310
|
},
|
|
311
311
|
guards: {
|
|
312
312
|
hasUserAccount: (context, event) => {
|
|
313
|
-
return event.data?.[0]
|
|
313
|
+
return event.data.bankInfo?.[0]
|
|
314
314
|
},
|
|
315
315
|
isGrandTotalEnable: (context, event) => {
|
|
316
316
|
return context.grandTotalEnable === 1
|
|
@@ -318,9 +318,7 @@ export default function (request) {
|
|
|
318
318
|
},
|
|
319
319
|
services: {
|
|
320
320
|
fetchPaymentInfo: async (context, event) => {
|
|
321
|
-
|
|
322
|
-
const filterArray = bankInfo?.filter((item) => item.bindingType !== 'CRYPTO' && item.bindingType !== 'EWALLET')
|
|
323
|
-
return filterArray || []
|
|
321
|
+
return await request.send(payment.getPaymentInfo())
|
|
324
322
|
},
|
|
325
323
|
initialize: async (context, event) => {
|
|
326
324
|
const [{ config }, payments, bankList] = await Promise.all([
|
|
@@ -8,7 +8,6 @@ import direct from './direct.js'
|
|
|
8
8
|
import amb from './amb.js'
|
|
9
9
|
import float from './float.js'
|
|
10
10
|
import vpay from './vpay.js'
|
|
11
|
-
import krway from './krway.js'
|
|
12
11
|
import usdt from './usdt.js'
|
|
13
12
|
import manual_cash from './manual_cash.js'
|
|
14
13
|
import qrcode_cash from './qrcode_cash.js'
|
|
@@ -16,12 +15,6 @@ import usdt_cash from './usdt_cash.js'
|
|
|
16
15
|
import crypto_cash from './crypto_cash.js'
|
|
17
16
|
import direct_cash from './direct_cash.js'
|
|
18
17
|
import loadcard_cash from './loadcard_cash.js'
|
|
19
|
-
import crypto_bank from './crypto_bank.js'
|
|
20
|
-
import crypto_qrcode from './crypto_qrcode.js'
|
|
21
|
-
import crypto_way from './crypto_way.js'
|
|
22
|
-
import crypto_bank_cash from './crypto_bank_cash.js'
|
|
23
|
-
import crypto_qrcode_cash from './crypto_qrcode_cash.js'
|
|
24
|
-
import crypto_way_cash from './crypto_way_cash.js'
|
|
25
18
|
|
|
26
19
|
export default {
|
|
27
20
|
manual_vn,
|
|
@@ -35,17 +28,10 @@ export default {
|
|
|
35
28
|
float,
|
|
36
29
|
vpay,
|
|
37
30
|
usdt,
|
|
38
|
-
krway,
|
|
39
31
|
manual_cash,
|
|
40
32
|
qrcode_cash,
|
|
41
33
|
usdt_cash,
|
|
42
34
|
crypto_cash,
|
|
43
35
|
direct_cash,
|
|
44
36
|
loadcard_cash,
|
|
45
|
-
crypto_bank,
|
|
46
|
-
crypto_qrcode,
|
|
47
|
-
crypto_way,
|
|
48
|
-
crypto_bank_cash,
|
|
49
|
-
crypto_qrcode_cash,
|
|
50
|
-
crypto_way_cash,
|
|
51
37
|
}
|
|
@@ -85,7 +85,7 @@ export default function (request, context) {
|
|
|
85
85
|
actions: 'setResult',
|
|
86
86
|
},
|
|
87
87
|
onError: {
|
|
88
|
-
target: '
|
|
88
|
+
target: 'calculated',
|
|
89
89
|
},
|
|
90
90
|
},
|
|
91
91
|
},
|
|
@@ -113,8 +113,15 @@ export default function (request, context) {
|
|
|
113
113
|
actions: {
|
|
114
114
|
setInitData: assign((context, event) => {
|
|
115
115
|
const { paymentDetail, selectedAmount, promotion } = context
|
|
116
|
-
const loadcards = paymentDetail
|
|
117
|
-
|
|
116
|
+
const loadcards = paymentDetail
|
|
117
|
+
.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
118
|
+
.map((item) => {
|
|
119
|
+
item.disabled = promotion?.promotionsNo !== 'none' && item.charge > 0
|
|
120
|
+
return item
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
const selectedLoadcard = loadcards.find((item) => !item.disabled)
|
|
124
|
+
|
|
118
125
|
return {
|
|
119
126
|
paymentDetail,
|
|
120
127
|
loadcards,
|
|
@@ -126,8 +133,13 @@ export default function (request, context) {
|
|
|
126
133
|
setPromotion: assign((context, event) => {
|
|
127
134
|
const { selectedAmount } = context
|
|
128
135
|
const promotion = event.data
|
|
129
|
-
const loadcards = context.loadcards
|
|
130
|
-
|
|
136
|
+
const loadcards = context.loadcards.map((item) => {
|
|
137
|
+
item.disabled = promotion.promotionsNo !== 'none' && item.charge > 0
|
|
138
|
+
return item
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const selectedLoadcard = loadcards.find((item) => !item.disabled)
|
|
142
|
+
|
|
131
143
|
return {
|
|
132
144
|
promotion,
|
|
133
145
|
loadcards,
|
|
@@ -176,7 +188,16 @@ export default function (request, context) {
|
|
|
176
188
|
}
|
|
177
189
|
}),
|
|
178
190
|
},
|
|
179
|
-
guards: {
|
|
191
|
+
guards: {
|
|
192
|
+
isSubmittable: (context, event) => {
|
|
193
|
+
const { cardNumber, serialNumber } = context
|
|
194
|
+
return cardNumber && serialNumber
|
|
195
|
+
},
|
|
196
|
+
jumpLinkEnable: (context, event) => {
|
|
197
|
+
const { selectedCard } = context
|
|
198
|
+
return selectedCard.jumpLinkEnable === 1
|
|
199
|
+
},
|
|
200
|
+
},
|
|
180
201
|
services: {
|
|
181
202
|
fetchCalculation: async (context, event) => {
|
|
182
203
|
const { selectedLoadcard, selectedAmount, promotion } = context
|
|
@@ -261,13 +261,24 @@ export default function (request) {
|
|
|
261
261
|
cardNumber: null,
|
|
262
262
|
serialNumber: null,
|
|
263
263
|
calculation: null,
|
|
264
|
-
result: null,
|
|
265
264
|
}
|
|
266
265
|
}),
|
|
267
266
|
setInitData: assign((context, event) => {
|
|
268
267
|
const { siteConfig, paymentDetail } = event.data
|
|
268
|
+
const { promotion = {} } = context
|
|
269
|
+
const { activityNo, promotionsNo } = promotion
|
|
269
270
|
const cards = paymentDetail.filter((element) => element.category === context.currentCategory)
|
|
270
|
-
|
|
271
|
+
let selectedCard = null
|
|
272
|
+
if (siteConfig.walletMode === '4') {
|
|
273
|
+
if ((!!activityNo && activityNo !== 'none') || (!!promotionsNo && promotionsNo !== 'none')) {
|
|
274
|
+
selectedCard = cards.find((card) => parseFloat(`${card.charge || 0}`) === 0)
|
|
275
|
+
} else {
|
|
276
|
+
selectedCard = cards[0]
|
|
277
|
+
}
|
|
278
|
+
} else {
|
|
279
|
+
selectedQrcode = qrcodes[0]
|
|
280
|
+
}
|
|
281
|
+
|
|
271
282
|
return {
|
|
272
283
|
siteConfig,
|
|
273
284
|
paymentDetail,
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
+
import common from '../../api/common.js'
|
|
3
4
|
import { max } from '../../util/index.js'
|
|
4
5
|
|
|
5
6
|
export default function (request, context) {
|
|
6
|
-
const {
|
|
7
|
-
const { paymentDetail = [], promotion, selectedAmount, siteConfig = {} } = context || {}
|
|
7
|
+
const { paymentDetail = [], promotion, selectedAmount } = context || {}
|
|
8
8
|
|
|
9
9
|
return createMachine(
|
|
10
10
|
{
|
|
11
11
|
id: 'manual_cash',
|
|
12
12
|
initial: 'loading',
|
|
13
13
|
context: {
|
|
14
|
-
siteConfig,
|
|
15
14
|
paymentDetail,
|
|
16
15
|
promotion,
|
|
17
16
|
selectedAmount,
|
|
18
17
|
|
|
19
|
-
bankList: [],
|
|
20
|
-
bindingPaymentList: {},
|
|
21
|
-
bindingPaymentInfo: {},
|
|
22
18
|
houseBanks: [],
|
|
23
19
|
userBanks: [],
|
|
20
|
+
banks: [],
|
|
24
21
|
|
|
25
22
|
selectedHouseBank: null,
|
|
26
23
|
selectedUserBank: null,
|
|
27
24
|
userAccountNumber: null,
|
|
28
|
-
userIfscCode: null,
|
|
29
25
|
userAccountName: null,
|
|
30
|
-
userAccountBranchName: null,
|
|
31
|
-
userAccountBranchCode: null,
|
|
32
|
-
transactionId: null,
|
|
33
26
|
depositTime: null,
|
|
34
27
|
receipt: null,
|
|
35
28
|
|
|
@@ -86,32 +79,21 @@ export default function (request, context) {
|
|
|
86
79
|
SELECT_USER_BANK: {
|
|
87
80
|
actions: 'setUserBank',
|
|
88
81
|
},
|
|
89
|
-
INPUT_USER_ACCOUNT_BRANCH_NAME: {
|
|
90
|
-
actions: 'setUserAccountBranchName',
|
|
91
|
-
},
|
|
92
|
-
INPUT_USER_ACCOUNT_BRANCH_CODE: {
|
|
93
|
-
actions: 'setUserAccountBranchCode',
|
|
94
|
-
},
|
|
95
82
|
INPUT_USER_ACCOUNT_NUMBER: {
|
|
96
83
|
actions: 'setUserAccountNumber',
|
|
97
84
|
},
|
|
98
|
-
INPUT_USER_IFSC_CODE: {
|
|
99
|
-
actions: 'setUserIfscCode',
|
|
100
|
-
},
|
|
101
85
|
INPUT_USER_ACCOUNT_NAME: {
|
|
102
86
|
actions: 'setUserAccountName',
|
|
103
87
|
},
|
|
104
88
|
SET_RECEIPT: {
|
|
105
89
|
actions: 'setReceipt',
|
|
106
90
|
},
|
|
107
|
-
INPUT_TRANSACTION_ID: {
|
|
108
|
-
actions: 'setTransactionId',
|
|
109
|
-
},
|
|
110
91
|
SET_DEPOSIT_TIME: {
|
|
111
92
|
actions: 'setDepositTime',
|
|
112
93
|
},
|
|
113
94
|
SUBMIT: {
|
|
114
95
|
target: 'submitting',
|
|
96
|
+
cond: 'isSubmittable',
|
|
115
97
|
},
|
|
116
98
|
},
|
|
117
99
|
},
|
|
@@ -148,28 +130,27 @@ export default function (request, context) {
|
|
|
148
130
|
{
|
|
149
131
|
actions: {
|
|
150
132
|
setInitData: assign((context, event) => {
|
|
151
|
-
const { currentPayment,
|
|
152
|
-
const
|
|
153
|
-
const allBankList = bankList || []
|
|
133
|
+
const { currentPayment, banks, paymentInfo, processing } = event.data
|
|
134
|
+
const playerBanks = paymentInfo?.bankInfo || []
|
|
154
135
|
|
|
155
136
|
const houseBanks = currentPayment.banks.map((bank) => {
|
|
156
|
-
const foundBank =
|
|
137
|
+
const foundBank = banks.find((item) => item.bankCode === bank.bankName)
|
|
157
138
|
bank.bankCode = bank.bankName // because api has no bankCode field
|
|
158
139
|
bank.displayText = foundBank?.shortName
|
|
159
140
|
bank.imageUrl = foundBank?.imageUrl
|
|
160
|
-
return
|
|
141
|
+
return bank
|
|
161
142
|
})
|
|
162
143
|
|
|
163
|
-
const
|
|
164
|
-
const foundBank =
|
|
144
|
+
const formattedPlayerBanks = playerBanks.map((bank) => {
|
|
145
|
+
const foundBank = banks.find((item) => item.bankCode === bank.bankCode)
|
|
165
146
|
bank.displayText = `${foundBank?.shortName} ${bank.accountNumber.slice(-5)}`
|
|
166
147
|
bank.imageUrl = foundBank?.imageUrl
|
|
167
|
-
return
|
|
148
|
+
return bank
|
|
168
149
|
})
|
|
169
150
|
|
|
170
151
|
const userBanks = [
|
|
171
|
-
...
|
|
172
|
-
...
|
|
152
|
+
...formattedPlayerBanks,
|
|
153
|
+
...banks.map((bank) => ({
|
|
173
154
|
...bank,
|
|
174
155
|
displayText: bank.shortName,
|
|
175
156
|
})),
|
|
@@ -180,15 +161,11 @@ export default function (request, context) {
|
|
|
180
161
|
method: currentPayment.method,
|
|
181
162
|
processing,
|
|
182
163
|
houseBanks,
|
|
183
|
-
selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
|
|
184
164
|
selectedHouseBank: houseBanks[0],
|
|
185
165
|
userBanks,
|
|
186
166
|
selectedUserBank: userBanks[0],
|
|
187
167
|
userAccountNumber: userBanks[0].accountNumber,
|
|
188
|
-
userIfscCode: userBanks[0].ifscCode,
|
|
189
168
|
userAccountName: userBanks[0].holderName,
|
|
190
|
-
userAccountBranchName: userBanks[0].branch,
|
|
191
|
-
userAccountBranchCode: userBanks[0].branchCode,
|
|
192
169
|
}
|
|
193
170
|
}),
|
|
194
171
|
setHouseBank: assign((context, event) => {
|
|
@@ -215,24 +192,11 @@ export default function (request, context) {
|
|
|
215
192
|
}
|
|
216
193
|
}),
|
|
217
194
|
setUserBank: assign((context, event) => {
|
|
218
|
-
const { accountNumber,
|
|
195
|
+
const { accountNumber, holderName } = event.data
|
|
219
196
|
return {
|
|
220
197
|
selectedUserBank: event.data,
|
|
221
198
|
userAccountNumber: accountNumber,
|
|
222
|
-
userIfscCode: ifscCode,
|
|
223
199
|
userAccountName: holderName,
|
|
224
|
-
userAccountBranchName: branch,
|
|
225
|
-
userAccountBranchCode: branchCode,
|
|
226
|
-
}
|
|
227
|
-
}),
|
|
228
|
-
setUserAccountBranchName: assign((context, event) => {
|
|
229
|
-
return {
|
|
230
|
-
userAccountBranchName: event.data,
|
|
231
|
-
}
|
|
232
|
-
}),
|
|
233
|
-
setUserAccountBranchCode: assign((context, event) => {
|
|
234
|
-
return {
|
|
235
|
-
userAccountBranchCode: event.data,
|
|
236
200
|
}
|
|
237
201
|
}),
|
|
238
202
|
setUserAccountNumber: assign((context, event) => {
|
|
@@ -240,21 +204,11 @@ export default function (request, context) {
|
|
|
240
204
|
userAccountNumber: event.data,
|
|
241
205
|
}
|
|
242
206
|
}),
|
|
243
|
-
setUserIfscCode: assign((context, event) => {
|
|
244
|
-
return {
|
|
245
|
-
userIfscCode: event.data,
|
|
246
|
-
}
|
|
247
|
-
}),
|
|
248
207
|
setUserAccountName: assign((context, event) => {
|
|
249
208
|
return {
|
|
250
209
|
userAccountName: event.data,
|
|
251
210
|
}
|
|
252
211
|
}),
|
|
253
|
-
setTransactionId: assign((context, event) => {
|
|
254
|
-
return {
|
|
255
|
-
transactionId: event.data,
|
|
256
|
-
}
|
|
257
|
-
}),
|
|
258
212
|
setDepositTime: assign((context, event) => {
|
|
259
213
|
return {
|
|
260
214
|
depositTime: event.data,
|
|
@@ -270,6 +224,11 @@ export default function (request, context) {
|
|
|
270
224
|
promotion: event.data,
|
|
271
225
|
}
|
|
272
226
|
}),
|
|
227
|
+
setPromotionDefaultAmount: assign((context, event) => {
|
|
228
|
+
return {
|
|
229
|
+
selectedAmount: context.promotion.minimumAmount,
|
|
230
|
+
}
|
|
231
|
+
}),
|
|
273
232
|
},
|
|
274
233
|
guards: {
|
|
275
234
|
isCalculable: (context, event) => {
|
|
@@ -279,27 +238,36 @@ export default function (request, context) {
|
|
|
279
238
|
} = context
|
|
280
239
|
return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
|
|
281
240
|
},
|
|
241
|
+
isCalculated: (context, event) => {
|
|
242
|
+
return context.calculation
|
|
243
|
+
},
|
|
244
|
+
isSubmittable: (context, event) => {
|
|
245
|
+
const { selectedAmount, userAccountNumber, userAccountName, depositTime, receipt } = context
|
|
246
|
+
return selectedAmount && userAccountNumber && userAccountName && depositTime && receipt
|
|
247
|
+
},
|
|
282
248
|
isProcessing: (context, event) => {
|
|
283
249
|
return context.processing
|
|
284
250
|
},
|
|
251
|
+
hasMinPromotionDeposit: (context, event) => {
|
|
252
|
+
return context.promotion?.minimumAmount
|
|
253
|
+
},
|
|
285
254
|
},
|
|
286
255
|
services: {
|
|
287
256
|
fetchInitData: async (context, event) => {
|
|
288
|
-
const
|
|
289
|
-
|
|
257
|
+
const currentPayment = context.paymentDetail.find(
|
|
258
|
+
(element) => element.category === context.currentCategory && element.transferType === 'deposit'
|
|
259
|
+
)
|
|
290
260
|
|
|
291
|
-
const [
|
|
261
|
+
const [banks, paymentInfo, orders] = await Promise.all([
|
|
292
262
|
request.send(payment.getBankList(currentPayment.method)),
|
|
293
|
-
|
|
294
|
-
request.send(payment.getBindingPaymentInfo({ appSecret })),
|
|
263
|
+
request.send(payment.getPaymentInfo()),
|
|
295
264
|
request.send(payment.getPendingOrder({ transferType: 'DEPOSIT' })),
|
|
296
265
|
])
|
|
297
266
|
|
|
298
267
|
return {
|
|
299
268
|
currentPayment,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
bindingPaymentInfo,
|
|
269
|
+
banks,
|
|
270
|
+
paymentInfo,
|
|
303
271
|
processing: orders[0],
|
|
304
272
|
}
|
|
305
273
|
},
|
|
@@ -314,36 +282,17 @@ export default function (request, context) {
|
|
|
314
282
|
)
|
|
315
283
|
},
|
|
316
284
|
submitDeposit: async (context, event) => {
|
|
317
|
-
const {
|
|
318
|
-
|
|
319
|
-
selectedAmount,
|
|
320
|
-
selectedHouseBank,
|
|
321
|
-
selectedUserBank,
|
|
322
|
-
userAccountNumber,
|
|
323
|
-
userIfscCode,
|
|
324
|
-
userAccountName,
|
|
325
|
-
userAccountBranchName,
|
|
326
|
-
userAccountBranchCode,
|
|
327
|
-
transactionId,
|
|
328
|
-
depositTime,
|
|
329
|
-
receipt,
|
|
330
|
-
promotion,
|
|
331
|
-
} = context
|
|
285
|
+
const { method, selectedAmount, selectedHouseBank, selectedUserBank, userAccountNumber, userAccountName, depositTime, receipt, promotion } =
|
|
286
|
+
context
|
|
332
287
|
return await request.send(
|
|
333
288
|
payment.submitDepositTransactionBank({
|
|
334
289
|
method,
|
|
335
290
|
amount: selectedAmount,
|
|
336
291
|
targetBankCode: selectedHouseBank.bankName,
|
|
337
292
|
targetAccountNumber: selectedHouseBank.accountNumber,
|
|
338
|
-
targetIfscCode: selectedHouseBank.ifscCode,
|
|
339
|
-
targetUpi: selectedHouseBank.upi,
|
|
340
293
|
applyerBankCode: selectedUserBank.bankCode,
|
|
341
294
|
applyerAccountNumber: userAccountNumber,
|
|
342
|
-
applyerIfscCode: userIfscCode,
|
|
343
295
|
applyerHolderName: userAccountName,
|
|
344
|
-
applyerBranch: userAccountBranchName,
|
|
345
|
-
applyerBranchCode: userAccountBranchCode,
|
|
346
|
-
transactionId,
|
|
347
296
|
depositTime,
|
|
348
297
|
receipt,
|
|
349
298
|
promotionsNo: promotion?.promotionsNo,
|