@jetthai/cuora 1.0.204 → 1.0.302-dev-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 +848 -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 +3 -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} +72 -45
- 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 +70 -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 +24 -17
- package/src/machine/leaderboard.js +31 -8
- package/src/machine/navbar.js +57 -0
- 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 +117 -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
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
import { max } from '../../util/index.js'
|
|
4
|
+
|
|
5
|
+
export default function (request, context) {
|
|
6
|
+
const { appSecret } = request.config
|
|
7
|
+
const { paymentDetail = [], promotion, selectedAmount, siteConfig = {} } = context || {}
|
|
8
|
+
|
|
9
|
+
return createMachine(
|
|
10
|
+
{
|
|
11
|
+
id: 'manual_cash',
|
|
12
|
+
initial: 'loading',
|
|
13
|
+
context: {
|
|
14
|
+
siteConfig,
|
|
15
|
+
paymentDetail,
|
|
16
|
+
promotion,
|
|
17
|
+
selectedAmount,
|
|
18
|
+
|
|
19
|
+
bankList: [],
|
|
20
|
+
bindingPaymentList: {},
|
|
21
|
+
bindingPaymentInfo: {},
|
|
22
|
+
houseBanks: [],
|
|
23
|
+
userBanks: [],
|
|
24
|
+
|
|
25
|
+
selectedHouseBank: null,
|
|
26
|
+
selectedUserBank: null,
|
|
27
|
+
userAccountNumber: null,
|
|
28
|
+
userIfscCode: null,
|
|
29
|
+
userAccountName: null,
|
|
30
|
+
userAccountBranchName: null,
|
|
31
|
+
userAccountBranchCode: null,
|
|
32
|
+
transactionId: null,
|
|
33
|
+
depositTime: null,
|
|
34
|
+
receipt: null,
|
|
35
|
+
|
|
36
|
+
currentCategory: 'manual',
|
|
37
|
+
method: null,
|
|
38
|
+
currentPayment: null,
|
|
39
|
+
currentApplyerBank: null,
|
|
40
|
+
|
|
41
|
+
calculation: null,
|
|
42
|
+
processing: null,
|
|
43
|
+
},
|
|
44
|
+
states: {
|
|
45
|
+
loading: {
|
|
46
|
+
invoke: {
|
|
47
|
+
src: 'fetchInitData',
|
|
48
|
+
onDone: {
|
|
49
|
+
target: 'checking',
|
|
50
|
+
actions: 'setInitData',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
checking: {
|
|
55
|
+
always: [
|
|
56
|
+
{
|
|
57
|
+
target: 'submitted',
|
|
58
|
+
cond: 'isProcessing',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
target: 'debouncing',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
loaded: {},
|
|
66
|
+
debouncing: {
|
|
67
|
+
entry: 'clearCalculation',
|
|
68
|
+
after: {
|
|
69
|
+
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
calculating: {
|
|
73
|
+
invoke: {
|
|
74
|
+
src: 'fetchCalculation',
|
|
75
|
+
onDone: {
|
|
76
|
+
target: 'calculated',
|
|
77
|
+
actions: 'setCalculation',
|
|
78
|
+
},
|
|
79
|
+
onError: {
|
|
80
|
+
target: 'loaded',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
calculated: {
|
|
85
|
+
on: {
|
|
86
|
+
SELECT_USER_BANK: {
|
|
87
|
+
actions: 'setUserBank',
|
|
88
|
+
},
|
|
89
|
+
INPUT_USER_ACCOUNT_BRANCH_NAME: {
|
|
90
|
+
actions: 'setUserAccountBranchName',
|
|
91
|
+
},
|
|
92
|
+
INPUT_USER_ACCOUNT_BRANCH_CODE: {
|
|
93
|
+
actions: 'setUserAccountBranchCode',
|
|
94
|
+
},
|
|
95
|
+
INPUT_USER_ACCOUNT_NUMBER: {
|
|
96
|
+
actions: 'setUserAccountNumber',
|
|
97
|
+
},
|
|
98
|
+
INPUT_USER_IFSC_CODE: {
|
|
99
|
+
actions: 'setUserIfscCode',
|
|
100
|
+
},
|
|
101
|
+
INPUT_USER_ACCOUNT_NAME: {
|
|
102
|
+
actions: 'setUserAccountName',
|
|
103
|
+
},
|
|
104
|
+
SET_RECEIPT: {
|
|
105
|
+
actions: 'setReceipt',
|
|
106
|
+
},
|
|
107
|
+
INPUT_TRANSACTION_ID: {
|
|
108
|
+
actions: 'setTransactionId',
|
|
109
|
+
},
|
|
110
|
+
SET_DEPOSIT_TIME: {
|
|
111
|
+
actions: 'setDepositTime',
|
|
112
|
+
},
|
|
113
|
+
SUBMIT: {
|
|
114
|
+
target: 'submitting',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
submitting: {
|
|
119
|
+
invoke: {
|
|
120
|
+
src: 'submitDeposit',
|
|
121
|
+
onDone: {
|
|
122
|
+
target: 'submitted',
|
|
123
|
+
actions: 'setProcessing',
|
|
124
|
+
},
|
|
125
|
+
onError: {
|
|
126
|
+
target: 'loaded',
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
submitted: {},
|
|
131
|
+
},
|
|
132
|
+
on: {
|
|
133
|
+
SET_PROMOTION: {
|
|
134
|
+
target: 'debouncing',
|
|
135
|
+
actions: 'setPromotion',
|
|
136
|
+
internal: false,
|
|
137
|
+
},
|
|
138
|
+
INPUT_AMOUNT: {
|
|
139
|
+
target: 'debouncing',
|
|
140
|
+
actions: 'inputAmount',
|
|
141
|
+
internal: false,
|
|
142
|
+
},
|
|
143
|
+
SELECT_HOUSE_BANK: {
|
|
144
|
+
actions: 'setHouseBank',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
actions: {
|
|
150
|
+
setInitData: assign((context, event) => {
|
|
151
|
+
const { currentPayment, bankList, bindingPaymentInfo, processing } = event.data
|
|
152
|
+
const userBankLsit = bindingPaymentInfo.bankList || []
|
|
153
|
+
const allBankList = bankList || []
|
|
154
|
+
|
|
155
|
+
const houseBanks = currentPayment.banks.map((bank) => {
|
|
156
|
+
const foundBank = allBankList.find((item) => item.bankCode === bank.bankName)
|
|
157
|
+
bank.bankCode = bank.bankName // because api has no bankCode field
|
|
158
|
+
bank.displayText = foundBank?.shortName
|
|
159
|
+
bank.imageUrl = foundBank?.imageUrl
|
|
160
|
+
return { ...bank, ...foundBank }
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
const formattedUserBanks = userBankLsit.map((bank) => {
|
|
164
|
+
const foundBank = allBankList.find((item) => item.bankCode === bank.bankCode)
|
|
165
|
+
bank.displayText = `${foundBank?.shortName} ${bank.accountNumber.slice(-5)}`
|
|
166
|
+
bank.imageUrl = foundBank?.imageUrl
|
|
167
|
+
return { ...bank, ...foundBank }
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
const userBanks = [
|
|
171
|
+
...formattedUserBanks,
|
|
172
|
+
...allBankList.map((bank) => ({
|
|
173
|
+
...bank,
|
|
174
|
+
displayText: bank.shortName,
|
|
175
|
+
})),
|
|
176
|
+
]
|
|
177
|
+
|
|
178
|
+
return {
|
|
179
|
+
currentPayment,
|
|
180
|
+
method: currentPayment.method,
|
|
181
|
+
processing,
|
|
182
|
+
houseBanks,
|
|
183
|
+
selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
|
|
184
|
+
selectedHouseBank: houseBanks[0],
|
|
185
|
+
userBanks,
|
|
186
|
+
selectedUserBank: userBanks[0],
|
|
187
|
+
userAccountNumber: userBanks[0].accountNumber,
|
|
188
|
+
userIfscCode: userBanks[0].ifscCode,
|
|
189
|
+
userAccountName: userBanks[0].holderName,
|
|
190
|
+
userAccountBranchName: userBanks[0].branch,
|
|
191
|
+
userAccountBranchCode: userBanks[0].branchCode,
|
|
192
|
+
}
|
|
193
|
+
}),
|
|
194
|
+
setHouseBank: assign((context, event) => {
|
|
195
|
+
return {
|
|
196
|
+
selectedHouseBank: event.data,
|
|
197
|
+
}
|
|
198
|
+
}),
|
|
199
|
+
inputAmount: assign((context, event) => {
|
|
200
|
+
return { selectedAmount: event.data }
|
|
201
|
+
}),
|
|
202
|
+
setCalculation: assign((context, event) => {
|
|
203
|
+
return {
|
|
204
|
+
calculation: event.data,
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
setProcessing: assign((context, event) => {
|
|
208
|
+
return {
|
|
209
|
+
processing: event.data,
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
clearCalculation: assign((context, event) => {
|
|
213
|
+
return {
|
|
214
|
+
calculation: null,
|
|
215
|
+
}
|
|
216
|
+
}),
|
|
217
|
+
setUserBank: assign((context, event) => {
|
|
218
|
+
const { accountNumber, ifscCode, holderName, branch, branchCode } = event.data
|
|
219
|
+
return {
|
|
220
|
+
selectedUserBank: event.data,
|
|
221
|
+
userAccountNumber: accountNumber,
|
|
222
|
+
userIfscCode: ifscCode,
|
|
223
|
+
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
|
+
}
|
|
237
|
+
}),
|
|
238
|
+
setUserAccountNumber: assign((context, event) => {
|
|
239
|
+
return {
|
|
240
|
+
userAccountNumber: event.data,
|
|
241
|
+
}
|
|
242
|
+
}),
|
|
243
|
+
setUserIfscCode: assign((context, event) => {
|
|
244
|
+
return {
|
|
245
|
+
userIfscCode: event.data,
|
|
246
|
+
}
|
|
247
|
+
}),
|
|
248
|
+
setUserAccountName: assign((context, event) => {
|
|
249
|
+
return {
|
|
250
|
+
userAccountName: event.data,
|
|
251
|
+
}
|
|
252
|
+
}),
|
|
253
|
+
setTransactionId: assign((context, event) => {
|
|
254
|
+
return {
|
|
255
|
+
transactionId: event.data,
|
|
256
|
+
}
|
|
257
|
+
}),
|
|
258
|
+
setDepositTime: assign((context, event) => {
|
|
259
|
+
return {
|
|
260
|
+
depositTime: event.data,
|
|
261
|
+
}
|
|
262
|
+
}),
|
|
263
|
+
setReceipt: assign((context, event) => {
|
|
264
|
+
return {
|
|
265
|
+
receipt: event.data,
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
268
|
+
setPromotion: assign((context, event) => {
|
|
269
|
+
return {
|
|
270
|
+
promotion: event.data,
|
|
271
|
+
}
|
|
272
|
+
}),
|
|
273
|
+
},
|
|
274
|
+
guards: {
|
|
275
|
+
isCalculable: (context, event) => {
|
|
276
|
+
const {
|
|
277
|
+
selectedAmount,
|
|
278
|
+
currentPayment: { maximum, minimum },
|
|
279
|
+
} = context
|
|
280
|
+
return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
|
|
281
|
+
},
|
|
282
|
+
isProcessing: (context, event) => {
|
|
283
|
+
return context.processing
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
services: {
|
|
287
|
+
fetchInitData: async (context, event) => {
|
|
288
|
+
const { paymentDetail = [] } = context
|
|
289
|
+
const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
290
|
+
|
|
291
|
+
const [bankList, bindingPaymentInfo, orders] = await Promise.all([
|
|
292
|
+
request.send(payment.getBankList(currentPayment.method)),
|
|
293
|
+
// request.send(payment.getBindingPaymentList({ appSecret })),
|
|
294
|
+
request.send(payment.getBindingPaymentInfo({ appSecret })),
|
|
295
|
+
request.send(payment.getPendingOrder({ transferType: 'DEPOSIT' })),
|
|
296
|
+
])
|
|
297
|
+
|
|
298
|
+
return {
|
|
299
|
+
currentPayment,
|
|
300
|
+
bankList,
|
|
301
|
+
// bindingPaymentList,
|
|
302
|
+
bindingPaymentInfo,
|
|
303
|
+
processing: orders[0],
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
fetchCalculation: async (context, event) => {
|
|
307
|
+
const { method, selectedAmount, promotion } = context
|
|
308
|
+
return await request.send(
|
|
309
|
+
payment.getDepositExpectedResult({
|
|
310
|
+
method,
|
|
311
|
+
amount: selectedAmount,
|
|
312
|
+
promotionsNo: promotion?.promotionsNo,
|
|
313
|
+
})
|
|
314
|
+
)
|
|
315
|
+
},
|
|
316
|
+
submitDeposit: async (context, event) => {
|
|
317
|
+
const {
|
|
318
|
+
method,
|
|
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
|
|
332
|
+
return await request.send(
|
|
333
|
+
payment.submitDepositTransactionBank({
|
|
334
|
+
method,
|
|
335
|
+
amount: selectedAmount,
|
|
336
|
+
targetBankCode: selectedHouseBank.bankName,
|
|
337
|
+
targetAccountNumber: selectedHouseBank.accountNumber,
|
|
338
|
+
targetIfscCode: selectedHouseBank.ifscCode,
|
|
339
|
+
targetUpi: selectedHouseBank.upi,
|
|
340
|
+
applyerBankCode: selectedUserBank.bankCode,
|
|
341
|
+
applyerAccountNumber: userAccountNumber,
|
|
342
|
+
applyerIfscCode: userIfscCode,
|
|
343
|
+
applyerHolderName: userAccountName,
|
|
344
|
+
applyerBranch: userAccountBranchName,
|
|
345
|
+
applyerBranchCode: userAccountBranchCode,
|
|
346
|
+
transactionId,
|
|
347
|
+
depositTime,
|
|
348
|
+
receipt,
|
|
349
|
+
promotionsNo: promotion?.promotionsNo,
|
|
350
|
+
})
|
|
351
|
+
)
|
|
352
|
+
},
|
|
353
|
+
},
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
}
|