@jetthai/cuora 1.0.205 → 1.0.302-sl-1
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/.husky/pre-commit +4 -0
- package/.prettierignore +1 -0
- package/CHANGELOG.md +846 -0
- package/README.md +6 -0
- package/package.json +6 -9
- package/src/api/activity.js +43 -2
- package/src/api/auth.js +22 -7
- package/src/api/common.js +2 -1
- package/src/api/game.js +20 -7
- package/src/api/mailbox.js +9 -5
- package/src/api/payment.js +167 -19
- package/src/api/user.js +7 -0
- package/src/lib/fingerprint.js +9779 -0
- package/src/machine/activity/activity.js +111 -26
- package/src/machine/activity/activity_cash.js +159 -0
- package/src/machine/activity/cash_rain_activity.js +153 -0
- package/src/machine/activity/continue_deposit_activity.js +11 -2
- package/src/machine/activity/deposit_activity.js +13 -4
- package/src/machine/activity/diamond_shop_activity_cash.js +179 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +54 -89
- package/src/machine/activity/fafafa_activity.js +34 -19
- package/src/machine/activity/{affiliate_invite_friends_activity.js → friend_invite_friends_activity.js} +70 -41
- package/src/machine/activity/index.js +22 -4
- package/src/machine/activity/instant_rebate_activity.js +217 -0
- package/src/machine/activity/invite_friends_activity.js +14 -14
- package/src/machine/activity/jackpot.js +74 -0
- package/src/machine/activity/otp_verified_activity.js +74 -0
- package/src/machine/activity/ranking_activity.js +11 -2
- package/src/machine/activity/roulette_activity_v2.js +90 -0
- package/src/machine/activity/sign_in_activity.js +21 -14
- package/src/machine/activity/sign_in_monthly_activity.js +65 -0
- package/src/machine/activity/specify_bets_activity.js +25 -3
- package/src/machine/activity/specify_turnover_activity.js +25 -3
- package/src/machine/activity/time_bomb_activity.js +11 -2
- package/src/machine/activity/vip_card_activity.js +140 -0
- package/src/machine/auth.js +141 -27
- package/src/machine/auth_otp_v2.js +10 -4
- package/src/machine/auth_otp_v3.js +11 -3
- package/src/machine/bank_binding.js +112 -12
- package/src/machine/bank_binding_amb.js +145 -0
- package/src/machine/common.js +113 -25
- package/src/machine/deposit/amb.js +92 -0
- package/src/machine/deposit/crypto.js +50 -29
- package/src/machine/deposit/crypto_bank.js +317 -0
- package/src/machine/deposit/crypto_bank_cash.js +287 -0
- package/src/machine/deposit/crypto_button.js +174 -39
- package/src/machine/deposit/crypto_cash.js +255 -0
- package/src/machine/deposit/crypto_qrcode.js +148 -0
- package/src/machine/deposit/crypto_qrcode_cash.js +131 -0
- package/src/machine/deposit/crypto_way.js +239 -0
- package/src/machine/deposit/crypto_way_cash.js +256 -0
- package/src/machine/deposit/deposit_fc.js +8 -5
- package/src/machine/deposit/direct.js +111 -16
- package/src/machine/deposit/direct_cash.js +217 -0
- package/src/machine/deposit/float.js +366 -0
- package/src/machine/deposit/index.js +43 -2
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/loadcard_cash.js +207 -0
- package/src/machine/deposit/loadcard_vn.js +191 -43
- package/src/machine/deposit/manual_cash.js +356 -0
- package/src/machine/deposit/manual_vn.js +182 -60
- package/src/machine/deposit/qrcode_cash.js +217 -0
- package/src/machine/deposit/qrcode_v2.js +285 -52
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/usdt_cash.js +138 -0
- package/src/machine/deposit/vpay.js +359 -0
- package/src/machine/game_favorite_v2.js +74 -28
- package/src/machine/game_info.js +57 -0
- package/src/machine/game_search_cash.js +390 -0
- package/src/machine/game_search_v2.js +64 -24
- package/src/machine/game_v2_1.js +662 -0
- package/src/machine/honor_board_cash.js +63 -0
- package/src/machine/inbox.js +259 -34
- package/src/machine/index.js +22 -17
- package/src/machine/leaderboard.js +31 -8
- package/src/machine/promotions.js +171 -0
- package/src/machine/reward.js +74 -7
- package/src/machine/reward_cash.js +219 -0
- package/src/machine/roulette_v2.js +276 -0
- package/src/machine/setting.js +5 -2
- package/src/machine/side_cash.js +110 -0
- package/src/machine/side_v2.js +33 -28
- package/src/machine/user_photo.js +65 -0
- package/src/machine/user_sign_up.js +101 -17
- package/src/machine/withdraw/index.js +23 -0
- package/src/machine/{withdraw_vn.js → withdraw/withdraw_amb.js} +146 -78
- package/src/machine/{withdraw_crypto.js → withdraw/withdraw_crypto.js} +220 -69
- package/src/machine/withdraw/withdraw_crypto2.js +540 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +319 -0
- package/src/machine/{withdraw_fc.js → withdraw/withdraw_fc.js} +2 -2
- package/src/machine/withdraw/withdraw_krway.js +207 -0
- package/src/machine/withdraw/withdraw_manual.js +595 -0
- package/src/machine/withdraw/withdraw_manual_cash.js +303 -0
- package/src/machine/withdraw/withdraw_vn.js +533 -0
- package/src/machine/withdraw/withdraw_vn2.js +548 -0
- package/src/request/request.js +10 -5
- package/src/util/constant.js +19 -1
- package/src/util/deviceToken.js +18 -8
- package/src/util/index.js +2 -1
- package/src/util/math.js +4 -0
- package/src/util/storage.js +22 -22
- package/dist/bundle.mjs +0 -18462
- package/rollup.config.js +0 -16
- package/src/machine/auth_otp.js +0 -201
- package/src/machine/deposit/qrcode_vn.js +0 -206
- package/src/machine/game.js +0 -285
- package/src/machine/game_favorite.js +0 -123
- package/src/machine/game_search.js +0 -244
- package/src/machine/game_v2.js +0 -356
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
+
import common from '../../api/common.js'
|
|
3
4
|
|
|
4
5
|
export default function (request) {
|
|
6
|
+
const { appSecret } = request.config
|
|
5
7
|
return createMachine(
|
|
6
8
|
{
|
|
7
9
|
id: 'qrcode',
|
|
8
10
|
initial: 'loading',
|
|
9
11
|
context: {
|
|
12
|
+
siteConfig: null,
|
|
10
13
|
qrcodes: null,
|
|
11
14
|
options: null,
|
|
12
15
|
|
|
@@ -15,18 +18,24 @@ export default function (request) {
|
|
|
15
18
|
|
|
16
19
|
calculation: null,
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
paymentDetail: [],
|
|
19
22
|
currentCategory: 'qrcode',
|
|
20
23
|
currentMethod: null,
|
|
21
24
|
|
|
22
25
|
result: null,
|
|
26
|
+
|
|
27
|
+
grandTotalEnable: 1,
|
|
28
|
+
|
|
29
|
+
// use for wallet mode 3 & 4
|
|
30
|
+
promotion: null,
|
|
31
|
+
bonusPreviewData: [],
|
|
23
32
|
},
|
|
24
33
|
states: {
|
|
25
34
|
loading: {
|
|
26
35
|
invoke: {
|
|
27
36
|
src: 'fetchInitData',
|
|
28
37
|
onDone: {
|
|
29
|
-
target: '
|
|
38
|
+
target: 'checking',
|
|
30
39
|
actions: 'setInitData',
|
|
31
40
|
},
|
|
32
41
|
onError: {
|
|
@@ -34,32 +43,151 @@ export default function (request) {
|
|
|
34
43
|
},
|
|
35
44
|
},
|
|
36
45
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
checking: {
|
|
47
|
+
always: [
|
|
48
|
+
{
|
|
49
|
+
target: 'fetching',
|
|
50
|
+
cond: (context, event) => {
|
|
51
|
+
const { siteConfig = {}, promotion = {}, selectedQrcode } = context
|
|
52
|
+
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
53
|
+
return !!selectedQrcode && walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
54
|
+
},
|
|
42
55
|
},
|
|
43
|
-
|
|
56
|
+
{
|
|
44
57
|
target: 'debouncing',
|
|
45
|
-
actions: '
|
|
58
|
+
actions: 'setPromotionDefaultAmount',
|
|
59
|
+
cond: (context, event) => {
|
|
60
|
+
const { siteConfig = {}, promotion = {} } = context
|
|
61
|
+
return siteConfig.walletMode === '3' && !!promotion?.minimumAmount
|
|
62
|
+
},
|
|
46
63
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
{ target: 'loaded' },
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
fetching: {
|
|
68
|
+
invoke: {
|
|
69
|
+
src: 'fetchBonusPreview',
|
|
70
|
+
onDone: {
|
|
71
|
+
target: 'loaded',
|
|
72
|
+
actions: 'setBonusPreview',
|
|
73
|
+
},
|
|
74
|
+
onError: {
|
|
75
|
+
target: 'loaded',
|
|
50
76
|
},
|
|
51
77
|
},
|
|
52
78
|
},
|
|
53
|
-
|
|
79
|
+
fail: {},
|
|
80
|
+
loaded: {
|
|
81
|
+
entry: 'reset',
|
|
54
82
|
on: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
83
|
+
SELECT_QRCODE: [
|
|
84
|
+
{
|
|
85
|
+
target: 'fetching',
|
|
86
|
+
actions: 'setQrcode',
|
|
87
|
+
cond: (context, event) => {
|
|
88
|
+
const { siteConfig = {}, promotion = {} } = context
|
|
89
|
+
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
90
|
+
return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
target: 'debouncing',
|
|
95
|
+
actions: ['setQrcode', 'setPromotionDefaultAmount'],
|
|
96
|
+
cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
actions: 'setQrcode',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
SELECT_AMOUNT: [
|
|
103
|
+
{
|
|
104
|
+
target: 'debouncing',
|
|
105
|
+
actions: 'setAmount',
|
|
106
|
+
cond: 'isDoubleWalletMode',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
target: 'pending',
|
|
110
|
+
actions: 'addAmount',
|
|
111
|
+
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
target: 'pending',
|
|
115
|
+
actions: 'setAmount',
|
|
116
|
+
cond: 'isFreeWalletMode',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
target: 'debouncing',
|
|
120
|
+
actions: 'addAmount',
|
|
121
|
+
cond: 'isGrandTotalEnable',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
target: 'debouncing',
|
|
125
|
+
actions: 'setAmount',
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
KEY_IN: [
|
|
129
|
+
{
|
|
130
|
+
target: 'pending',
|
|
131
|
+
actions: 'setAmount',
|
|
132
|
+
cond: 'isFreeWalletMode',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
target: 'calculating',
|
|
136
|
+
actions: 'setAmount',
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
pending: {
|
|
142
|
+
on: {
|
|
143
|
+
SELECT_AMOUNT: [
|
|
144
|
+
{
|
|
145
|
+
actions: 'addAmount',
|
|
146
|
+
cond: 'isGrandTotalEnable',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
actions: 'setAmount',
|
|
150
|
+
},
|
|
151
|
+
],
|
|
59
152
|
KEY_IN: {
|
|
60
|
-
target: 'debouncing',
|
|
61
153
|
actions: 'setAmount',
|
|
62
154
|
},
|
|
155
|
+
CONFIRM: {
|
|
156
|
+
target: 'calculating',
|
|
157
|
+
},
|
|
158
|
+
BACK: {
|
|
159
|
+
target: 'loaded',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
debouncing: {
|
|
164
|
+
on: {
|
|
165
|
+
SELECT_AMOUNT: [
|
|
166
|
+
{
|
|
167
|
+
target: 'debouncing',
|
|
168
|
+
actions: 'setAmount',
|
|
169
|
+
cond: 'isDoubleWalletMode',
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
target: 'debouncing',
|
|
173
|
+
actions: 'addAmount',
|
|
174
|
+
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
target: 'debouncing',
|
|
178
|
+
actions: 'setAmount',
|
|
179
|
+
cond: 'isFreeWalletMode',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
target: 'debouncing',
|
|
183
|
+
actions: 'addAmount',
|
|
184
|
+
cond: 'isGrandTotalEnable',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
target: 'debouncing',
|
|
188
|
+
actions: 'setAmount',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
63
191
|
BACK: {
|
|
64
192
|
target: 'loaded',
|
|
65
193
|
},
|
|
@@ -70,21 +198,39 @@ export default function (request) {
|
|
|
70
198
|
},
|
|
71
199
|
},
|
|
72
200
|
},
|
|
73
|
-
fail: {},
|
|
74
201
|
calculable: {
|
|
75
202
|
entry: 'clearCalculation',
|
|
76
203
|
on: {
|
|
77
|
-
SELECT_AMOUNT:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
204
|
+
SELECT_AMOUNT: [
|
|
205
|
+
{
|
|
206
|
+
target: 'debouncing',
|
|
207
|
+
actions: 'setAmount',
|
|
208
|
+
cond: 'isDoubleWalletMode',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
target: 'pending',
|
|
212
|
+
actions: 'addAmount',
|
|
213
|
+
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
target: 'pending',
|
|
217
|
+
actions: 'setAmount',
|
|
218
|
+
cond: 'isFreeWalletMode',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
target: 'debouncing',
|
|
222
|
+
actions: 'addAmount',
|
|
223
|
+
cond: 'isGrandTotalEnable',
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
target: 'debouncing',
|
|
227
|
+
actions: 'setAmount',
|
|
228
|
+
},
|
|
229
|
+
],
|
|
81
230
|
KEY_IN: {
|
|
82
|
-
target: '
|
|
231
|
+
target: 'calculating',
|
|
83
232
|
actions: 'setAmount',
|
|
84
233
|
},
|
|
85
|
-
CALCULATE: {
|
|
86
|
-
target: 'debouncing',
|
|
87
|
-
},
|
|
88
234
|
BACK: {
|
|
89
235
|
target: 'loaded',
|
|
90
236
|
},
|
|
@@ -93,10 +239,17 @@ export default function (request) {
|
|
|
93
239
|
calculating: {
|
|
94
240
|
invoke: {
|
|
95
241
|
src: 'fetchCalculation',
|
|
96
|
-
onDone:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
242
|
+
onDone: [
|
|
243
|
+
{
|
|
244
|
+
target: 'submitting',
|
|
245
|
+
actions: 'setCalculation',
|
|
246
|
+
cond: 'isFreeWalletMode',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
target: 'calculated',
|
|
250
|
+
actions: 'setCalculation',
|
|
251
|
+
},
|
|
252
|
+
],
|
|
100
253
|
onError: {
|
|
101
254
|
target: 'calculable',
|
|
102
255
|
},
|
|
@@ -104,12 +257,29 @@ export default function (request) {
|
|
|
104
257
|
},
|
|
105
258
|
calculated: {
|
|
106
259
|
on: {
|
|
107
|
-
SELECT_AMOUNT:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
260
|
+
SELECT_AMOUNT: [
|
|
261
|
+
{
|
|
262
|
+
target: 'pending',
|
|
263
|
+
actions: 'addAmount',
|
|
264
|
+
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
target: 'pending',
|
|
268
|
+
actions: 'setAmount',
|
|
269
|
+
cond: 'isFreeWalletMode',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
target: 'debouncing',
|
|
273
|
+
actions: 'addAmount',
|
|
274
|
+
cond: 'isGrandTotalEnable',
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
target: 'debouncing',
|
|
278
|
+
actions: 'setAmount',
|
|
279
|
+
},
|
|
280
|
+
],
|
|
111
281
|
KEY_IN: {
|
|
112
|
-
target: '
|
|
282
|
+
target: 'calculating',
|
|
113
283
|
actions: 'setAmount',
|
|
114
284
|
},
|
|
115
285
|
CONFIRM: {
|
|
@@ -132,19 +302,35 @@ export default function (request) {
|
|
|
132
302
|
actions: 'setResult',
|
|
133
303
|
},
|
|
134
304
|
onError: {
|
|
135
|
-
target: '
|
|
305
|
+
target: 'loaded',
|
|
136
306
|
},
|
|
137
307
|
},
|
|
138
308
|
},
|
|
139
309
|
submitted: {
|
|
140
310
|
on: {
|
|
141
|
-
SELECT_QRCODE:
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
311
|
+
SELECT_QRCODE: [
|
|
312
|
+
{
|
|
313
|
+
target: 'fetching',
|
|
314
|
+
actions: 'setQrcode',
|
|
315
|
+
cond: (context, event) => {
|
|
316
|
+
const { siteConfig = {}, promotion = {} } = context
|
|
317
|
+
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
318
|
+
return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
target: 'loaded',
|
|
323
|
+
actions: 'setQrcode',
|
|
324
|
+
},
|
|
325
|
+
],
|
|
145
326
|
},
|
|
146
327
|
},
|
|
147
328
|
},
|
|
329
|
+
on: {
|
|
330
|
+
SET_PROMOTION: {
|
|
331
|
+
actions: 'setPromotion',
|
|
332
|
+
},
|
|
333
|
+
},
|
|
148
334
|
},
|
|
149
335
|
{
|
|
150
336
|
actions: {
|
|
@@ -152,18 +338,26 @@ export default function (request) {
|
|
|
152
338
|
return {
|
|
153
339
|
selectedAmount: null,
|
|
154
340
|
calculation: null,
|
|
341
|
+
result: null,
|
|
155
342
|
}
|
|
156
343
|
}),
|
|
157
344
|
setInitData: assign((context, event) => {
|
|
158
|
-
const
|
|
159
|
-
const qrcodes =
|
|
160
|
-
|
|
345
|
+
const { siteConfig, paymentDetail } = event.data
|
|
346
|
+
const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory)
|
|
347
|
+
const selectedQrcode = qrcodes[0]
|
|
161
348
|
return {
|
|
162
|
-
|
|
349
|
+
siteConfig,
|
|
350
|
+
paymentDetail,
|
|
163
351
|
qrcodes,
|
|
164
|
-
selectedQrcode
|
|
165
|
-
currentMethod:
|
|
166
|
-
options:
|
|
352
|
+
selectedQrcode,
|
|
353
|
+
currentMethod: selectedQrcode?.method,
|
|
354
|
+
options: selectedQrcode?.optional,
|
|
355
|
+
grandTotalEnable: selectedQrcode?.grandTotalEnable,
|
|
356
|
+
}
|
|
357
|
+
}),
|
|
358
|
+
setBonusPreview: assign((context, event) => {
|
|
359
|
+
return {
|
|
360
|
+
bonusPreviewData: event.data.bonus,
|
|
167
361
|
}
|
|
168
362
|
}),
|
|
169
363
|
setQrcode: assign((context, event) => {
|
|
@@ -171,6 +365,7 @@ export default function (request) {
|
|
|
171
365
|
selectedQrcode: event.data,
|
|
172
366
|
currentMethod: event.data.method,
|
|
173
367
|
options: event.data.optional,
|
|
368
|
+
grandTotalEnable: event.data.grandTotalEnable,
|
|
174
369
|
}
|
|
175
370
|
}),
|
|
176
371
|
addAmount: assign((context, event) => {
|
|
@@ -194,26 +389,64 @@ export default function (request) {
|
|
|
194
389
|
result: event.data,
|
|
195
390
|
}
|
|
196
391
|
}),
|
|
392
|
+
setPromotion: assign((context, event) => {
|
|
393
|
+
const promotion = event.data
|
|
394
|
+
return {
|
|
395
|
+
promotion,
|
|
396
|
+
}
|
|
397
|
+
}),
|
|
398
|
+
setPromotionDefaultAmount: assign((context, event) => {
|
|
399
|
+
return {
|
|
400
|
+
selectedAmount: context.promotion.minimumAmount,
|
|
401
|
+
}
|
|
402
|
+
}),
|
|
403
|
+
},
|
|
404
|
+
guards: {
|
|
405
|
+
isDoubleWalletMode: (context, event) => {
|
|
406
|
+
return context.siteConfig?.walletMode === '4'
|
|
407
|
+
},
|
|
408
|
+
isFreeWalletMode: (context, event) => {
|
|
409
|
+
return context.siteConfig?.walletMode === '2'
|
|
410
|
+
},
|
|
411
|
+
isGrandTotalEnable: (context, event) => {
|
|
412
|
+
return context.grandTotalEnable === 1
|
|
413
|
+
},
|
|
197
414
|
},
|
|
198
415
|
services: {
|
|
199
416
|
fetchInitData: async (context, event) => {
|
|
200
|
-
|
|
417
|
+
const [{ config }, paymentDetail = []] = await Promise.all([
|
|
418
|
+
request.send(common.getConfig({ appSecret })),
|
|
419
|
+
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
420
|
+
])
|
|
421
|
+
const siteConfig = JSON.parse(window.atob(config))
|
|
422
|
+
return { siteConfig, paymentDetail }
|
|
423
|
+
},
|
|
424
|
+
fetchBonusPreview: async (context, event) => {
|
|
425
|
+
const { currentMethod, promotion } = context
|
|
426
|
+
return await request.send(
|
|
427
|
+
payment.getBonusPreview({
|
|
428
|
+
method: currentMethod,
|
|
429
|
+
promotionsNo: promotion?.activityNo,
|
|
430
|
+
})
|
|
431
|
+
)
|
|
201
432
|
},
|
|
202
433
|
fetchCalculation: async (context, event) => {
|
|
203
|
-
const { currentMethod, selectedAmount } = context
|
|
434
|
+
const { currentMethod, selectedAmount, promotion } = context
|
|
204
435
|
return await request.send(
|
|
205
436
|
payment.getDepositExpectedResult({
|
|
206
437
|
method: currentMethod,
|
|
207
438
|
amount: selectedAmount,
|
|
439
|
+
promotionsNo: promotion?.activityNo,
|
|
208
440
|
})
|
|
209
441
|
)
|
|
210
442
|
},
|
|
211
443
|
submitDeposit: async (context, event) => {
|
|
212
|
-
const { currentMethod, selectedAmount } = context
|
|
444
|
+
const { currentMethod, selectedAmount, promotion } = context
|
|
213
445
|
return await request.send(
|
|
214
|
-
payment.
|
|
446
|
+
payment.submitDepositTransaction({
|
|
215
447
|
method: currentMethod,
|
|
216
448
|
amount: selectedAmount,
|
|
449
|
+
promotionsNo: promotion?.activityNo,
|
|
217
450
|
})
|
|
218
451
|
)
|
|
219
452
|
},
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '@jetthai/cuora/src/api/payment.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'usdt',
|
|
8
|
+
initial: 'loading',
|
|
9
|
+
context: {
|
|
10
|
+
paymentDetails: [],
|
|
11
|
+
currentCategory: 'usdt',
|
|
12
|
+
currentPayment: null,
|
|
13
|
+
networks: [],
|
|
14
|
+
selectedNetwork: null,
|
|
15
|
+
|
|
16
|
+
resultMap: {},
|
|
17
|
+
result: {
|
|
18
|
+
action: '',
|
|
19
|
+
cdtime: null,
|
|
20
|
+
accountNumber: '', // crypto address
|
|
21
|
+
currency: '',
|
|
22
|
+
network: '',
|
|
23
|
+
name: '',
|
|
24
|
+
qrcode: '',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
states: {
|
|
28
|
+
loading: {
|
|
29
|
+
invoke: {
|
|
30
|
+
src: 'fetchPayments',
|
|
31
|
+
onDone: {
|
|
32
|
+
target: 'fetching',
|
|
33
|
+
actions: 'setPayment',
|
|
34
|
+
},
|
|
35
|
+
onError: {
|
|
36
|
+
target: '#usdt.fail',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
finding: {
|
|
41
|
+
always: [
|
|
42
|
+
{
|
|
43
|
+
target: 'idle',
|
|
44
|
+
actions: 'setResultFromLocal',
|
|
45
|
+
cond: 'isFound',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
target: 'fetching',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
fetching: {
|
|
53
|
+
invoke: {
|
|
54
|
+
src: 'submitDeposit',
|
|
55
|
+
onDone: {
|
|
56
|
+
target: 'idle',
|
|
57
|
+
actions: 'setResult',
|
|
58
|
+
},
|
|
59
|
+
onError: {
|
|
60
|
+
target: 'idle',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
idle: {},
|
|
65
|
+
fail: {},
|
|
66
|
+
},
|
|
67
|
+
on: {
|
|
68
|
+
SET_NETWORK: {
|
|
69
|
+
target: '.finding',
|
|
70
|
+
actions: 'setNetwork',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
actions: {
|
|
76
|
+
setPayment: assign((context, event) => {
|
|
77
|
+
const currentPayment = event.data.find((element) => element.category === context.currentCategory)
|
|
78
|
+
const defaultNetworks = currentPayment.networkName.map((value, i) => {
|
|
79
|
+
return {
|
|
80
|
+
label: currentPayment.networkOptional?.[i],
|
|
81
|
+
value,
|
|
82
|
+
icon: value,
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
networks: defaultNetworks,
|
|
88
|
+
selectedNetwork: defaultNetworks[0],
|
|
89
|
+
currentPayment,
|
|
90
|
+
}
|
|
91
|
+
}),
|
|
92
|
+
setNetwork: assign((context, event) => {
|
|
93
|
+
return { selectedNetwork: event.data }
|
|
94
|
+
}),
|
|
95
|
+
setResultFromLocal: assign((context, event) => {
|
|
96
|
+
const { resultMap, selectedNetwork } = context
|
|
97
|
+
return { result: resultMap[selectedNetwork.value] }
|
|
98
|
+
}),
|
|
99
|
+
setResult: assign((context, event) => {
|
|
100
|
+
const { resultMap, selectedNetwork } = context
|
|
101
|
+
const { action, cdtime, accountNumber, currency, network, name, qrcode } = event.data
|
|
102
|
+
const result = {
|
|
103
|
+
action,
|
|
104
|
+
cdtime,
|
|
105
|
+
accountNumber,
|
|
106
|
+
currency,
|
|
107
|
+
network,
|
|
108
|
+
name,
|
|
109
|
+
qrcode,
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
result,
|
|
114
|
+
resultMap: {
|
|
115
|
+
...resultMap,
|
|
116
|
+
[selectedNetwork.value]: result,
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
},
|
|
121
|
+
guards: {
|
|
122
|
+
isFound: (context, event) => {
|
|
123
|
+
const { resultMap, selectedNetwork } = context
|
|
124
|
+
return resultMap[selectedNetwork.value]
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
services: {
|
|
128
|
+
fetchPayments: async (context, event) => {
|
|
129
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
130
|
+
},
|
|
131
|
+
submitDeposit: async (context, event) => {
|
|
132
|
+
const { currentPayment, selectedNetwork } = context
|
|
133
|
+
return await request.send(
|
|
134
|
+
payment.submitDepositTransactionCrypto({
|
|
135
|
+
method: currentPayment.method,
|
|
136
|
+
cryptoCurrency: currentPayment.channel,
|
|
137
|
+
cryptoNetwork: selectedNetwork.value,
|
|
138
|
+
})
|
|
139
|
+
)
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
)
|
|
144
|
+
}
|