@jetthai/cuora 1.0.307-dev-2 → 1.1.0
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 +3 -854
- package/README.md +0 -6
- package/dist/bundle.mjs +18461 -0
- package/package.json +9 -6
- package/rollup.config.js +16 -0
- package/src/api/activity.js +2 -43
- package/src/api/auth.js +7 -22
- package/src/api/common.js +1 -3
- package/src/api/game.js +7 -20
- package/src/api/mailbox.js +5 -9
- package/src/api/payment.js +19 -167
- package/src/api/user.js +0 -7
- package/src/machine/activity/activity.js +26 -111
- package/src/machine/activity/{friend_invite_friends_activity.js → affiliate_invite_friends_activity.js} +41 -70
- package/src/machine/activity/continue_deposit_activity.js +2 -11
- package/src/machine/activity/deposit_activity.js +4 -13
- package/src/machine/activity/diamond_shop_activity_vn.js +89 -54
- package/src/machine/activity/fafafa_activity.js +19 -34
- package/src/machine/activity/index.js +4 -22
- package/src/machine/activity/invite_friends_activity.js +14 -14
- package/src/machine/activity/ranking_activity.js +2 -11
- package/src/machine/activity/sign_in_activity.js +14 -21
- package/src/machine/activity/specify_bets_activity.js +3 -25
- package/src/machine/activity/specify_turnover_activity.js +3 -25
- package/src/machine/activity/time_bomb_activity.js +2 -11
- package/src/machine/auth.js +21 -146
- package/src/machine/auth_otp.js +201 -0
- package/src/machine/auth_otp_v2.js +4 -10
- package/src/machine/auth_otp_v3.js +3 -11
- package/src/machine/bank_binding.js +12 -112
- package/src/machine/common.js +25 -113
- package/src/machine/deposit/crypto.js +29 -50
- package/src/machine/deposit/crypto_button.js +39 -174
- package/src/machine/deposit/deposit_fc.js +5 -8
- package/src/machine/deposit/direct.js +16 -111
- package/src/machine/deposit/index.js +2 -43
- package/src/machine/deposit/loadcard_vn.js +43 -191
- package/src/machine/deposit/manual_vn.js +60 -182
- package/src/machine/deposit/qrcode_v2.js +52 -285
- package/src/machine/deposit/qrcode_vn.js +206 -0
- package/src/machine/game.js +285 -0
- package/src/machine/game_favorite.js +123 -0
- package/src/machine/game_favorite_v2.js +28 -74
- package/src/machine/game_search.js +244 -0
- package/src/machine/game_search_v2.js +24 -64
- package/src/machine/game_v2.js +356 -0
- package/src/machine/inbox.js +34 -259
- package/src/machine/index.js +17 -26
- package/src/machine/leaderboard.js +8 -31
- package/src/machine/reward.js +7 -74
- package/src/machine/setting.js +2 -5
- package/src/machine/side_v2.js +28 -33
- package/src/machine/user_sign_up.js +17 -117
- package/src/machine/{withdraw/withdraw_crypto.js → withdraw_crypto.js} +69 -220
- package/src/machine/{withdraw/withdraw_fc.js → withdraw_fc.js} +2 -2
- package/src/machine/{withdraw/withdraw_amb.js → withdraw_vn.js} +78 -146
- package/src/request/request.js +5 -10
- package/src/util/constant.js +1 -19
- package/src/util/deviceToken.js +8 -18
- package/src/util/index.js +1 -2
- package/src/util/storage.js +22 -22
- package/.husky/pre-commit +0 -4
- package/.prettierignore +0 -1
- package/src/lib/fingerprint.js +0 -9779
- package/src/machine/activity/activity_cash.js +0 -159
- package/src/machine/activity/cash_rain_activity.js +0 -153
- package/src/machine/activity/diamond_shop_activity_cash.js +0 -179
- package/src/machine/activity/instant_rebate_activity.js +0 -195
- package/src/machine/activity/jackpot.js +0 -74
- package/src/machine/activity/otp_verified_activity.js +0 -74
- package/src/machine/activity/roulette_activity_v2.js +0 -90
- package/src/machine/activity/sign_in_monthly_activity.js +0 -65
- package/src/machine/activity/vip_card_activity.js +0 -140
- package/src/machine/bank_binding_amb.js +0 -145
- package/src/machine/deposit/amb.js +0 -92
- package/src/machine/deposit/crypto_bank.js +0 -317
- package/src/machine/deposit/crypto_bank_cash.js +0 -287
- package/src/machine/deposit/crypto_cash.js +0 -255
- package/src/machine/deposit/crypto_qrcode.js +0 -148
- package/src/machine/deposit/crypto_qrcode_cash.js +0 -131
- package/src/machine/deposit/crypto_way.js +0 -239
- package/src/machine/deposit/crypto_way_cash.js +0 -256
- package/src/machine/deposit/direct_cash.js +0 -217
- package/src/machine/deposit/float.js +0 -366
- package/src/machine/deposit/krway.js +0 -151
- package/src/machine/deposit/loadcard_cash.js +0 -207
- package/src/machine/deposit/manual_cash.js +0 -356
- package/src/machine/deposit/qrcode_cash.js +0 -217
- package/src/machine/deposit/usdt.js +0 -144
- package/src/machine/deposit/usdt_cash.js +0 -138
- package/src/machine/deposit/vpay.js +0 -359
- package/src/machine/game_info.js +0 -57
- package/src/machine/game_search_cash.js +0 -390
- package/src/machine/game_v2_1.js +0 -662
- package/src/machine/honor_board.js +0 -118
- package/src/machine/honor_board_cash.js +0 -89
- package/src/machine/navbar.js +0 -57
- package/src/machine/promotions.js +0 -171
- package/src/machine/reward_cash.js +0 -219
- package/src/machine/roulette_v2.js +0 -276
- package/src/machine/side_cash.js +0 -110
- package/src/machine/user_photo.js +0 -65
- package/src/machine/withdraw/index.js +0 -23
- package/src/machine/withdraw/withdraw_crypto2.js +0 -540
- package/src/machine/withdraw/withdraw_crypto_cash.js +0 -319
- package/src/machine/withdraw/withdraw_krway.js +0 -220
- package/src/machine/withdraw/withdraw_manual.js +0 -610
- package/src/machine/withdraw/withdraw_manual_cash.js +0 -303
- package/src/machine/withdraw/withdraw_vn.js +0 -546
- package/src/machine/withdraw/withdraw_vn2.js +0 -561
- package/src/util/math.js +0 -4
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import padStart from 'lodash/padStart.js'
|
|
3
3
|
import payment from '../../api/payment.js'
|
|
4
|
-
import common from '../../api/common.js'
|
|
5
4
|
|
|
6
5
|
export default function (request) {
|
|
7
|
-
const { appSecret } = request.config
|
|
8
6
|
return createMachine(
|
|
9
7
|
{
|
|
10
8
|
id: 'crypro_button',
|
|
11
9
|
initial: 'loading',
|
|
12
10
|
context: {
|
|
13
|
-
siteConfig: null,
|
|
14
11
|
paymentDetails: [],
|
|
15
12
|
|
|
16
13
|
channels: [],
|
|
@@ -19,7 +16,6 @@ export default function (request) {
|
|
|
19
16
|
options: [],
|
|
20
17
|
sourceAddress: '',
|
|
21
18
|
|
|
22
|
-
selectedChannel: null,
|
|
23
19
|
selectedAmount: null,
|
|
24
20
|
selectedCrypto: null,
|
|
25
21
|
selectedNetwork: null,
|
|
@@ -29,51 +25,20 @@ export default function (request) {
|
|
|
29
25
|
|
|
30
26
|
calculation: null,
|
|
31
27
|
result: null,
|
|
32
|
-
|
|
33
|
-
grandTotalEnable: 1,
|
|
34
|
-
|
|
35
|
-
// use for wallet mode 4
|
|
36
|
-
promotion: null,
|
|
37
|
-
bonusPreviewData: [],
|
|
38
28
|
},
|
|
39
29
|
states: {
|
|
40
30
|
loading: {
|
|
41
31
|
invoke: {
|
|
42
|
-
src: '
|
|
32
|
+
src: 'fetchPayments',
|
|
43
33
|
onDone: {
|
|
44
34
|
target: 'loaded',
|
|
45
|
-
actions: '
|
|
35
|
+
actions: 'setCryptos',
|
|
46
36
|
},
|
|
47
37
|
onError: {
|
|
48
38
|
target: 'fail',
|
|
49
39
|
},
|
|
50
40
|
},
|
|
51
41
|
},
|
|
52
|
-
checking: {
|
|
53
|
-
always: [
|
|
54
|
-
{
|
|
55
|
-
target: 'fetching',
|
|
56
|
-
cond: (context, event) => {
|
|
57
|
-
const { siteConfig = {}, promotion = {}, selectedCrypto } = context
|
|
58
|
-
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
59
|
-
return !!selectedCrypto && walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
{ target: 'loaded' },
|
|
63
|
-
],
|
|
64
|
-
},
|
|
65
|
-
fetching: {
|
|
66
|
-
invoke: {
|
|
67
|
-
src: 'fetchBonusPreview',
|
|
68
|
-
onDone: {
|
|
69
|
-
target: 'loaded',
|
|
70
|
-
actions: 'setBonusPreview',
|
|
71
|
-
},
|
|
72
|
-
onError: {
|
|
73
|
-
target: 'loaded',
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
42
|
loaded: {
|
|
78
43
|
on: {
|
|
79
44
|
SET_CHANNEL: {
|
|
@@ -90,7 +55,7 @@ export default function (request) {
|
|
|
90
55
|
},
|
|
91
56
|
CONFIRM: {
|
|
92
57
|
target: 'selecting',
|
|
93
|
-
cond: 'isConfirmable'
|
|
58
|
+
cond: 'isConfirmable'
|
|
94
59
|
},
|
|
95
60
|
},
|
|
96
61
|
},
|
|
@@ -98,64 +63,25 @@ export default function (request) {
|
|
|
98
63
|
selecting: {
|
|
99
64
|
entry: 'reset',
|
|
100
65
|
on: {
|
|
101
|
-
SELECT_AMOUNT:
|
|
102
|
-
{
|
|
103
|
-
target: 'debouncing',
|
|
104
|
-
actions: 'setAmount',
|
|
105
|
-
cond: 'isDoubleWalletMode',
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
actions: 'addAmount',
|
|
109
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
actions: 'setAmount',
|
|
113
|
-
cond: 'isFreeWalletMode',
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
target: 'debouncing',
|
|
117
|
-
actions: 'addAmount',
|
|
118
|
-
cond: 'isGrandTotalEnable',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
target: 'debouncing',
|
|
122
|
-
actions: 'setAmount',
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
KEY_IN: [
|
|
126
|
-
{
|
|
127
|
-
actions: 'setAmount',
|
|
128
|
-
cond: 'isFreeWalletMode',
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
target: 'debouncing',
|
|
132
|
-
actions: 'setAmount',
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
SUBMIT: {
|
|
66
|
+
SELECT_AMOUNT: {
|
|
136
67
|
target: 'debouncing',
|
|
68
|
+
actions: 'addAmount'
|
|
137
69
|
},
|
|
138
|
-
|
|
139
|
-
target: '
|
|
140
|
-
|
|
141
|
-
CLEAR_ALL: {
|
|
142
|
-
actions: 'reset',
|
|
70
|
+
KEY_IN: {
|
|
71
|
+
target: 'debouncing',
|
|
72
|
+
actions: 'setAmount'
|
|
143
73
|
},
|
|
144
|
-
|
|
74
|
+
BACK: {
|
|
75
|
+
target: 'loaded'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
145
78
|
},
|
|
146
79
|
debouncing: {
|
|
147
80
|
on: {
|
|
148
|
-
SELECT_AMOUNT:
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
cond: 'isGrandTotalEnable',
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
target: 'debouncing',
|
|
156
|
-
actions: 'setAmount',
|
|
157
|
-
},
|
|
158
|
-
],
|
|
81
|
+
SELECT_AMOUNT: {
|
|
82
|
+
target: 'debouncing',
|
|
83
|
+
actions: 'addAmount',
|
|
84
|
+
},
|
|
159
85
|
KEY_IN: {
|
|
160
86
|
target: 'debouncing',
|
|
161
87
|
actions: 'setAmount',
|
|
@@ -170,43 +96,29 @@ export default function (request) {
|
|
|
170
96
|
calculating: {
|
|
171
97
|
invoke: {
|
|
172
98
|
src: 'fetchCalculation',
|
|
173
|
-
onDone:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
cond: 'isFreeWalletMode',
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
target: 'calculated',
|
|
181
|
-
actions: 'setCalculation',
|
|
182
|
-
},
|
|
183
|
-
],
|
|
99
|
+
onDone: {
|
|
100
|
+
target: 'calculated',
|
|
101
|
+
actions: 'setCalculation',
|
|
102
|
+
},
|
|
184
103
|
onError: {
|
|
185
104
|
target: 'selecting',
|
|
186
|
-
actions: 'reset'
|
|
105
|
+
actions: 'reset'
|
|
187
106
|
},
|
|
188
107
|
},
|
|
189
108
|
},
|
|
190
109
|
calculated: {
|
|
191
110
|
on: {
|
|
192
|
-
SELECT_AMOUNT:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
cond: 'isGrandTotalEnable',
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
target: 'debouncing',
|
|
200
|
-
actions: 'setAmount',
|
|
201
|
-
},
|
|
202
|
-
],
|
|
111
|
+
SELECT_AMOUNT: {
|
|
112
|
+
target: 'debouncing',
|
|
113
|
+
actions: 'addAmount',
|
|
114
|
+
},
|
|
203
115
|
KEY_IN: {
|
|
204
116
|
target: 'debouncing',
|
|
205
117
|
actions: 'setAmount',
|
|
206
118
|
},
|
|
207
119
|
SUBMIT: {
|
|
208
120
|
target: 'submitting',
|
|
209
|
-
cond: 'isSubmittable'
|
|
121
|
+
cond: 'isSubmittable'
|
|
210
122
|
},
|
|
211
123
|
CLEAR_CALCULATION: {
|
|
212
124
|
target: 'debouncing',
|
|
@@ -226,15 +138,11 @@ export default function (request) {
|
|
|
226
138
|
actions: 'setResult',
|
|
227
139
|
},
|
|
228
140
|
onError: {
|
|
229
|
-
target: '
|
|
141
|
+
target: 'calculated',
|
|
230
142
|
},
|
|
231
143
|
},
|
|
232
144
|
},
|
|
233
|
-
submitted: {
|
|
234
|
-
},
|
|
235
|
-
on: {
|
|
236
|
-
SET_PROMOTION: {
|
|
237
|
-
actions: 'setPromotion',
|
|
145
|
+
submitted: {
|
|
238
146
|
},
|
|
239
147
|
},
|
|
240
148
|
},
|
|
@@ -244,16 +152,11 @@ export default function (request) {
|
|
|
244
152
|
return {
|
|
245
153
|
selectedAmount: null,
|
|
246
154
|
calculation: null,
|
|
247
|
-
result: null,
|
|
248
155
|
}
|
|
249
156
|
}),
|
|
250
|
-
|
|
251
|
-
const {
|
|
252
|
-
const cryptos
|
|
253
|
-
paymentDetail
|
|
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]
|
|
157
|
+
setCryptos: assign((context, event) => {
|
|
158
|
+
const cryptos = event.data?.map?.((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })) || []
|
|
159
|
+
const currentPayment = cryptos.find((element) => element.category === context.currentCategory)
|
|
257
160
|
const channels = cryptos.map((item, i) => ({ ...item, label: `Channel ${padStart(String(i + 1), 2, '0')}`, icon: 'channel' }))
|
|
258
161
|
const defaultNetworks =
|
|
259
162
|
cryptos[0].networkName.map((value, i) => {
|
|
@@ -265,16 +168,14 @@ export default function (request) {
|
|
|
265
168
|
}) || []
|
|
266
169
|
const options = cryptos[0].optional
|
|
267
170
|
return {
|
|
268
|
-
siteConfig,
|
|
269
171
|
channels,
|
|
270
172
|
cryptos,
|
|
271
173
|
networks: defaultNetworks,
|
|
272
174
|
selectedChannel: channels[0],
|
|
273
175
|
selectedCrypto: cryptos[0],
|
|
274
176
|
selectedNetwork: defaultNetworks[0],
|
|
275
|
-
grandTotalEnable: cryptos[0].grandTotalEnable,
|
|
276
177
|
currentPayment,
|
|
277
|
-
options
|
|
178
|
+
options
|
|
278
179
|
}
|
|
279
180
|
}),
|
|
280
181
|
setChannel: assign((context, event) => {
|
|
@@ -296,8 +197,7 @@ export default function (request) {
|
|
|
296
197
|
selectedNetwork: networks[0],
|
|
297
198
|
selectedAmount: null,
|
|
298
199
|
calculation: null,
|
|
299
|
-
|
|
300
|
-
options,
|
|
200
|
+
options
|
|
301
201
|
}
|
|
302
202
|
}),
|
|
303
203
|
setCrypto: assign((context, event) => {
|
|
@@ -311,6 +211,7 @@ export default function (request) {
|
|
|
311
211
|
icon: value,
|
|
312
212
|
}
|
|
313
213
|
}) || []
|
|
214
|
+
|
|
314
215
|
const properties = {
|
|
315
216
|
selectedCrypto: event.data,
|
|
316
217
|
networks,
|
|
@@ -327,11 +228,6 @@ export default function (request) {
|
|
|
327
228
|
setNetwork: assign((context, event) => {
|
|
328
229
|
return { selectedNetwork: event.data }
|
|
329
230
|
}),
|
|
330
|
-
setBonusPreview: assign((context, event) => {
|
|
331
|
-
return {
|
|
332
|
-
bonusPreviewData: event.data.bonus,
|
|
333
|
-
}
|
|
334
|
-
}),
|
|
335
231
|
addAmount: assign((context, event) => {
|
|
336
232
|
return { selectedAmount: (context.selectedAmount || 0) + event.data }
|
|
337
233
|
}),
|
|
@@ -358,23 +254,8 @@ export default function (request) {
|
|
|
358
254
|
result: event.data,
|
|
359
255
|
}
|
|
360
256
|
}),
|
|
361
|
-
setPromotion: assign((context, event) => {
|
|
362
|
-
const promotion = event.data
|
|
363
|
-
return {
|
|
364
|
-
promotion,
|
|
365
|
-
}
|
|
366
|
-
}),
|
|
367
257
|
},
|
|
368
258
|
guards: {
|
|
369
|
-
isFreeWalletMode: (context, event) => {
|
|
370
|
-
return context.siteConfig?.walletMode === '2'
|
|
371
|
-
},
|
|
372
|
-
isDoubleWalletMode: (context, event) => {
|
|
373
|
-
return context.siteConfig?.walletMode === '4'
|
|
374
|
-
},
|
|
375
|
-
isGrandTotalEnable: (context, event) => {
|
|
376
|
-
return context.grandTotalEnable === 1
|
|
377
|
-
},
|
|
378
259
|
isConfirmable: (context, event) => {
|
|
379
260
|
const { selectedCrypto, selectedNetwork } = context
|
|
380
261
|
return selectedCrypto && selectedNetwork
|
|
@@ -385,44 +266,28 @@ export default function (request) {
|
|
|
385
266
|
},
|
|
386
267
|
},
|
|
387
268
|
services: {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
request.send(common.getConfig({ appSecret })),
|
|
391
|
-
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
392
|
-
])
|
|
393
|
-
const siteConfig = JSON.parse(window.atob(config))
|
|
394
|
-
return { siteConfig, paymentDetail }
|
|
395
|
-
},
|
|
396
|
-
fetchBonusPreview: async (context, event) => {
|
|
397
|
-
const { selectedCrypto, promotion } = context
|
|
398
|
-
return await request.send(
|
|
399
|
-
payment.getBonusPreview({
|
|
400
|
-
method: selectedCrypto.method,
|
|
401
|
-
promotionsNo: promotion?.activityNo,
|
|
402
|
-
})
|
|
403
|
-
)
|
|
269
|
+
fetchPayments: async (context, event) => {
|
|
270
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
404
271
|
},
|
|
405
272
|
fetchCalculation: async (context, event) => {
|
|
406
|
-
const { selectedCrypto, selectedAmount
|
|
273
|
+
const { selectedCrypto, selectedAmount } = context
|
|
407
274
|
return await request.send(
|
|
408
275
|
payment.getDepositExpectedResult({
|
|
409
276
|
method: selectedCrypto.method,
|
|
410
277
|
amount: selectedAmount,
|
|
411
278
|
cryptoCurrency: selectedCrypto.channel,
|
|
412
|
-
promotionsNo: promotion?.activityNo,
|
|
413
279
|
})
|
|
414
280
|
)
|
|
415
281
|
},
|
|
416
282
|
submitDeposit: async (context, event) => {
|
|
417
|
-
const { selectedCrypto, selectedNetwork, calculation, sourceAddress
|
|
283
|
+
const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context
|
|
418
284
|
return await request.send(
|
|
419
|
-
payment.
|
|
285
|
+
payment.submitDepositTransaction({
|
|
420
286
|
method: selectedCrypto.method,
|
|
421
287
|
amount: calculation.actualAmount,
|
|
422
288
|
cryptoCurrency: selectedCrypto.channel,
|
|
423
289
|
cryptoNetwork: selectedNetwork.value,
|
|
424
290
|
sourceAddress: sourceAddress,
|
|
425
|
-
promotionsNo: promotion?.activityNo,
|
|
426
291
|
})
|
|
427
292
|
)
|
|
428
293
|
},
|
|
@@ -59,7 +59,9 @@ export default function (request) {
|
|
|
59
59
|
},
|
|
60
60
|
checking: {
|
|
61
61
|
entry: 'clearCalculatedResult',
|
|
62
|
-
always: [
|
|
62
|
+
always: [
|
|
63
|
+
{ target: 'debouncing', cond: 'isCalculable' },
|
|
64
|
+
{ target: 'loaded'}]
|
|
63
65
|
},
|
|
64
66
|
debouncing: {
|
|
65
67
|
after: {
|
|
@@ -130,12 +132,7 @@ export default function (request) {
|
|
|
130
132
|
actions: {
|
|
131
133
|
setCryptos: assign((context, event) => {
|
|
132
134
|
return {
|
|
133
|
-
cryptos: event.data.map((crypto) => ({
|
|
134
|
-
...crypto,
|
|
135
|
-
label: crypto.channel,
|
|
136
|
-
value: crypto.method,
|
|
137
|
-
icon: crypto.channel,
|
|
138
|
-
})),
|
|
135
|
+
cryptos: event.data.map((crypto) => ({ ...crypto, label: crypto.channel, value: crypto.method, icon: crypto.channel })),
|
|
139
136
|
}
|
|
140
137
|
}),
|
|
141
138
|
setCrypto: assign((context, event) => {
|
|
@@ -241,7 +238,7 @@ export default function (request) {
|
|
|
241
238
|
submitDeposit: async (context, event) => {
|
|
242
239
|
const { currentCrypto, currentNetwork, calculatedResult } = context
|
|
243
240
|
return await request.send(
|
|
244
|
-
payment.
|
|
241
|
+
payment.submitDepositTransaction({
|
|
245
242
|
method: currentCrypto.method,
|
|
246
243
|
amount: calculatedResult.actualAmount,
|
|
247
244
|
cryptoCurrency: currentCrypto.channel,
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
-
import common from '../../api/common.js'
|
|
4
3
|
|
|
5
4
|
export default function (request) {
|
|
6
|
-
const { appSecret } = request.config
|
|
7
5
|
return createMachine(
|
|
8
6
|
{
|
|
9
7
|
id: 'direct',
|
|
10
8
|
initial: 'loading',
|
|
11
9
|
context: {
|
|
12
|
-
|
|
13
|
-
paymentDetail: [],
|
|
10
|
+
paymentDetails: [],
|
|
14
11
|
directs: [],
|
|
15
12
|
currentDirect: null,
|
|
16
13
|
banks: [],
|
|
@@ -20,9 +17,6 @@ export default function (request) {
|
|
|
20
17
|
currentMethod: null,
|
|
21
18
|
amount: null,
|
|
22
19
|
result: null,
|
|
23
|
-
|
|
24
|
-
// use for wallet mode 3
|
|
25
|
-
promotion: null,
|
|
26
20
|
},
|
|
27
21
|
states: {
|
|
28
22
|
loading: {
|
|
@@ -44,7 +38,7 @@ export default function (request) {
|
|
|
44
38
|
invoke: {
|
|
45
39
|
src: 'fetchBanksList',
|
|
46
40
|
onDone: {
|
|
47
|
-
target: '#direct.
|
|
41
|
+
target: '#direct.loaded',
|
|
48
42
|
actions: 'setBanks',
|
|
49
43
|
},
|
|
50
44
|
onError: {
|
|
@@ -54,22 +48,6 @@ export default function (request) {
|
|
|
54
48
|
},
|
|
55
49
|
},
|
|
56
50
|
},
|
|
57
|
-
promotion: {
|
|
58
|
-
always: [
|
|
59
|
-
{
|
|
60
|
-
target: 'loaded',
|
|
61
|
-
cond: 'isDoubleWalletMode',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
target: 'calculating',
|
|
65
|
-
actions: 'setPromotionDefaultAmount',
|
|
66
|
-
cond: 'hasMinPromotionDeposit',
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
target: 'loaded',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
51
|
loaded: {
|
|
74
52
|
on: {
|
|
75
53
|
SELECT_DIRECT: {
|
|
@@ -86,61 +64,15 @@ export default function (request) {
|
|
|
86
64
|
actions: 'clearCalculation',
|
|
87
65
|
},
|
|
88
66
|
CALCULATE: {
|
|
89
|
-
target: '
|
|
67
|
+
target: 'calculating',
|
|
68
|
+
cond: 'isCalculable',
|
|
90
69
|
},
|
|
91
|
-
SUBMIT: [
|
|
92
|
-
{
|
|
93
|
-
target: 'pending',
|
|
94
|
-
cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
target: 'submitting',
|
|
98
|
-
cond: 'isSubmittable',
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
pending: {
|
|
104
|
-
on: {
|
|
105
70
|
SUBMIT: {
|
|
106
71
|
target: 'submitting',
|
|
107
72
|
cond: 'isSubmittable',
|
|
108
73
|
},
|
|
109
74
|
},
|
|
110
75
|
},
|
|
111
|
-
debouncing: {
|
|
112
|
-
on: {
|
|
113
|
-
SELECT_DIRECT: {
|
|
114
|
-
actions: ['setDirect', 'reset'],
|
|
115
|
-
target: 'loading.fetching',
|
|
116
|
-
},
|
|
117
|
-
SELECT_BANK: {
|
|
118
|
-
actions: 'setSelectedBank',
|
|
119
|
-
},
|
|
120
|
-
SET_AMOUNT: {
|
|
121
|
-
actions: ['setAmount', 'clearCalculation'],
|
|
122
|
-
},
|
|
123
|
-
CLEAR_CALCULATION: {
|
|
124
|
-
actions: 'clearCalculation',
|
|
125
|
-
},
|
|
126
|
-
CALCULATE: {
|
|
127
|
-
target: 'debouncing',
|
|
128
|
-
},
|
|
129
|
-
SUBMIT: [
|
|
130
|
-
{
|
|
131
|
-
target: 'pending',
|
|
132
|
-
cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
target: 'submitting',
|
|
136
|
-
cond: 'isSubmittable',
|
|
137
|
-
},
|
|
138
|
-
],
|
|
139
|
-
},
|
|
140
|
-
after: {
|
|
141
|
-
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
76
|
calculating: {
|
|
145
77
|
invoke: {
|
|
146
78
|
src: 'fetchCalculation',
|
|
@@ -168,11 +100,6 @@ export default function (request) {
|
|
|
168
100
|
submitted: {},
|
|
169
101
|
fail: {},
|
|
170
102
|
},
|
|
171
|
-
on: {
|
|
172
|
-
SET_PROMOTION: {
|
|
173
|
-
actions: 'setPromotion',
|
|
174
|
-
},
|
|
175
|
-
},
|
|
176
103
|
},
|
|
177
104
|
{
|
|
178
105
|
actions: {
|
|
@@ -182,23 +109,22 @@ export default function (request) {
|
|
|
182
109
|
amount: null,
|
|
183
110
|
selectedBank: banks[0],
|
|
184
111
|
calculation: null,
|
|
185
|
-
result: null,
|
|
186
112
|
}
|
|
187
113
|
}),
|
|
188
114
|
setInitData: assign((context, event) => {
|
|
189
|
-
const
|
|
190
|
-
const directs =
|
|
191
|
-
|
|
115
|
+
const paymentDetails = event.data
|
|
116
|
+
const directs = paymentDetails.filter((element) => element.category === context.currentCategory)
|
|
117
|
+
|
|
192
118
|
return {
|
|
193
|
-
|
|
194
|
-
paymentDetail,
|
|
119
|
+
paymentDetails,
|
|
195
120
|
directs,
|
|
196
|
-
currentDirect,
|
|
197
|
-
currentMethod:
|
|
121
|
+
currentDirect: directs[0],
|
|
122
|
+
currentMethod: directs[0]?.method,
|
|
198
123
|
}
|
|
199
124
|
}),
|
|
200
125
|
setBanks: assign((context, event) => {
|
|
201
126
|
const banks = event.data
|
|
127
|
+
|
|
202
128
|
return {
|
|
203
129
|
banks,
|
|
204
130
|
selectedBank: banks[0],
|
|
@@ -235,44 +161,24 @@ export default function (request) {
|
|
|
235
161
|
result: event.data,
|
|
236
162
|
}
|
|
237
163
|
}),
|
|
238
|
-
setPromotion: assign((context, event) => {
|
|
239
|
-
return {
|
|
240
|
-
promotion: event.data,
|
|
241
|
-
}
|
|
242
|
-
}),
|
|
243
|
-
setPromotionDefaultAmount: assign((context, event) => {
|
|
244
|
-
return {
|
|
245
|
-
amount: context.promotion.minimumAmount,
|
|
246
|
-
}
|
|
247
|
-
}),
|
|
248
164
|
},
|
|
249
165
|
guards: {
|
|
250
|
-
isDoubleWalletMode: (context, event) => {
|
|
251
|
-
return context.siteConfig?.walletMode === '4'
|
|
252
|
-
},
|
|
253
166
|
isCalculable: (context, event) => {
|
|
254
167
|
const {
|
|
255
168
|
amount,
|
|
256
169
|
currentDirect: { maximum, minimum },
|
|
257
170
|
} = context
|
|
171
|
+
|
|
258
172
|
return amount && minimum <= +amount && +amount <= maximum
|
|
259
173
|
},
|
|
260
174
|
isSubmittable: (context, event) => {
|
|
261
175
|
const { amount, currentMethod, selectedBank } = context
|
|
262
176
|
return amount && currentMethod && selectedBank?.bankCode
|
|
263
177
|
},
|
|
264
|
-
hasMinPromotionDeposit: (context, event) => {
|
|
265
|
-
return context.promotion?.minimumAmount
|
|
266
|
-
},
|
|
267
178
|
},
|
|
268
179
|
services: {
|
|
269
180
|
fetchInitData: async (context, event) => {
|
|
270
|
-
|
|
271
|
-
request.send(common.getConfig({ appSecret })),
|
|
272
|
-
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
273
|
-
])
|
|
274
|
-
const siteConfig = JSON.parse(window.atob(config))
|
|
275
|
-
return { siteConfig, paymentDetail }
|
|
181
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
276
182
|
},
|
|
277
183
|
fetchBanksList: async (context, event) => {
|
|
278
184
|
const { currentDirect } = context
|
|
@@ -280,23 +186,22 @@ export default function (request) {
|
|
|
280
186
|
return await request.send(payment.getBankList(method))
|
|
281
187
|
},
|
|
282
188
|
fetchCalculation: async (context, event) => {
|
|
283
|
-
const { currentMethod, amount
|
|
189
|
+
const { currentMethod, amount } = context
|
|
190
|
+
|
|
284
191
|
return await request.send(
|
|
285
192
|
payment.getDepositExpectedResult({
|
|
286
193
|
method: currentMethod,
|
|
287
194
|
amount,
|
|
288
|
-
promotionsNo: promotion?.activityNo,
|
|
289
195
|
})
|
|
290
196
|
)
|
|
291
197
|
},
|
|
292
198
|
submitDeposit: async (context, event) => {
|
|
293
|
-
const { currentMethod, amount, selectedBank
|
|
199
|
+
const { currentMethod, amount, selectedBank } = context
|
|
294
200
|
return await request.send(
|
|
295
201
|
payment.submitDepositTransactionBank({
|
|
296
202
|
method: currentMethod,
|
|
297
203
|
amount,
|
|
298
204
|
applyerBankCode: selectedBank.bankCode,
|
|
299
|
-
promotionsNo: promotion?.activityNo,
|
|
300
205
|
})
|
|
301
206
|
)
|
|
302
207
|
},
|
|
@@ -1,51 +1,10 @@
|
|
|
1
1
|
import manual_vn from './manual_vn.js'
|
|
2
2
|
import loadcard_vn from './loadcard_vn.js'
|
|
3
|
+
import qrcode_vn from './qrcode_vn.js'
|
|
3
4
|
import qrcode_v2 from './qrcode_v2.js'
|
|
4
5
|
import deposit_fc from './deposit_fc.js'
|
|
5
6
|
import crypto from './crypto.js'
|
|
6
7
|
import crypto_button from './crypto_button.js'
|
|
7
8
|
import direct from './direct.js'
|
|
8
|
-
import amb from './amb.js'
|
|
9
|
-
import float from './float.js'
|
|
10
|
-
import vpay from './vpay.js'
|
|
11
|
-
import krway from './krway.js'
|
|
12
|
-
import usdt from './usdt.js'
|
|
13
|
-
import manual_cash from './manual_cash.js'
|
|
14
|
-
import qrcode_cash from './qrcode_cash.js'
|
|
15
|
-
import usdt_cash from './usdt_cash.js'
|
|
16
|
-
import crypto_cash from './crypto_cash.js'
|
|
17
|
-
import direct_cash from './direct_cash.js'
|
|
18
|
-
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
9
|
|
|
26
|
-
export default {
|
|
27
|
-
manual_vn,
|
|
28
|
-
loadcard_vn,
|
|
29
|
-
qrcode_v2,
|
|
30
|
-
deposit_fc,
|
|
31
|
-
crypto,
|
|
32
|
-
crypto_button,
|
|
33
|
-
direct,
|
|
34
|
-
amb,
|
|
35
|
-
float,
|
|
36
|
-
vpay,
|
|
37
|
-
usdt,
|
|
38
|
-
krway,
|
|
39
|
-
manual_cash,
|
|
40
|
-
qrcode_cash,
|
|
41
|
-
usdt_cash,
|
|
42
|
-
crypto_cash,
|
|
43
|
-
direct_cash,
|
|
44
|
-
loadcard_cash,
|
|
45
|
-
crypto_bank,
|
|
46
|
-
crypto_qrcode,
|
|
47
|
-
crypto_way,
|
|
48
|
-
crypto_bank_cash,
|
|
49
|
-
crypto_qrcode_cash,
|
|
50
|
-
crypto_way_cash,
|
|
51
|
-
}
|
|
10
|
+
export default { manual_vn, loadcard_vn, qrcode_vn, qrcode_v2, deposit_fc, crypto, crypto_button, direct }
|