@jetthai/cuora 1.1.471 → 1.1.472-dev.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/.claude/commands/sync-ai-prompts.md +88 -1
- package/.claude/settings.local.json +3 -1
- package/.github/copilot-instructions.md +64 -57
- package/.husky/post-checkout +3 -3
- package/.husky/pre-push +1 -1
- package/.prettierignore +2 -1
- package/AGENTS.md +64 -57
- package/AI_PROMPT_SOURCE.md +64 -57
- package/CHANGELOG.md +194 -6
- package/CLAUDE.md +64 -57
- package/GEMINI.md +64 -57
- package/README.md +11 -12
- package/package.json +1 -1
- package/scripts/auto-version.js +1 -0
- package/scripts/branch-auto-npm-publish.js +9 -2
- package/src/api/account.js +0 -1
- package/src/api/activity.js +2 -38
- package/src/api/auth.js +0 -31
- package/src/api/game.js +0 -10
- package/src/api/payment.js +1 -52
- package/src/api/user.js +0 -16
- package/src/index.js +2 -2
- package/src/machine/activity/activity_cash.js +50 -23
- package/src/machine/activity/diamond_shop_activity_cash.js +0 -1
- package/src/machine/activity/fafafa_activity.js +0 -10
- package/src/machine/activity/index.js +0 -12
- package/src/machine/auth.js +4 -60
- package/src/machine/auth_otp_v3.js +0 -3
- package/src/machine/common.js +0 -55
- package/src/machine/deposit/index.js +0 -28
- package/src/machine/deposit/manual_cash.js +0 -8
- package/src/machine/game_info.js +1 -12
- package/src/machine/game_v2_1.js +1 -89
- package/src/machine/honor_board_cash.js +15 -18
- package/src/machine/inbox.js +0 -12
- package/src/machine/index.js +0 -32
- package/src/machine/reward_cash.js +0 -39
- package/src/machine/user_reset_password.js +0 -13
- package/src/machine/user_sign_up.js +3 -0
- package/src/machine/websocket.js +0 -4
- package/src/machine/withdraw/index.js +0 -6
- package/src/request/request.js +1 -29
- package/src/util/constant.js +0 -1
- package/src/util/index.js +1 -4
- package/src/machine/activity/activity.js +0 -209
- package/src/machine/activity/diamond_shop_activity_fc.js +0 -196
- package/src/machine/activity/diamond_shop_activity_vn.js +0 -178
- package/src/machine/activity/invite_friends_activity.js +0 -114
- package/src/machine/activity/mini_game_activity.js +0 -68
- package/src/machine/activity/return_bonus_activity.js +0 -153
- package/src/machine/auth_otp_v2.js +0 -177
- package/src/machine/bank_binding_amb.js +0 -146
- package/src/machine/bonus.js +0 -76
- package/src/machine/deposit/amb.js +0 -93
- package/src/machine/deposit/crypto_bank.js +0 -330
- package/src/machine/deposit/crypto_qrcode.js +0 -148
- package/src/machine/deposit/crypto_way.js +0 -252
- package/src/machine/deposit/deposit_fc.js +0 -272
- package/src/machine/deposit/direct.js +0 -310
- package/src/machine/deposit/float.js +0 -375
- package/src/machine/deposit/krway.js +0 -151
- package/src/machine/deposit/loadcard_vn.js +0 -351
- package/src/machine/deposit/manual_vn.js +0 -458
- package/src/machine/deposit/qrcode_v2.js +0 -338
- package/src/machine/deposit/usdt.js +0 -144
- package/src/machine/deposit/virtual_bank_vn.js +0 -269
- package/src/machine/deposit/vpay.js +0 -368
- package/src/machine/game_hot_new.js +0 -79
- package/src/machine/game_replay.js +0 -46
- package/src/machine/game_search_v2.js +0 -401
- package/src/machine/honor_board.js +0 -132
- package/src/machine/merge.js +0 -57
- package/src/machine/payment_data.js +0 -86
- package/src/machine/promotions.js +0 -170
- package/src/machine/reward.js +0 -255
- package/src/machine/reward_fc.js +0 -98
- package/src/machine/side.js +0 -154
- package/src/machine/side_v2.js +0 -211
- package/src/machine/vip_table.js +0 -57
- package/src/machine/welcome.js +0 -110
- package/src/machine/withdraw/withdraw_crypto_cash.js +0 -327
- package/src/machine/withdraw/withdraw_krway.js +0 -223
- package/src/machine/withdraw/withdraw_manual.js +0 -536
- package/src/util/math.js +0 -4
|
@@ -1,536 +0,0 @@
|
|
|
1
|
-
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import findLastIndex from 'lodash/findLastIndex.js'
|
|
3
|
-
import payment from '../../api/payment.js'
|
|
4
|
-
|
|
5
|
-
export default function (request) {
|
|
6
|
-
const { appSecret } = request.config
|
|
7
|
-
return createMachine(
|
|
8
|
-
{
|
|
9
|
-
id: 'withdraw_manual',
|
|
10
|
-
initial: 'loading',
|
|
11
|
-
context: {
|
|
12
|
-
mode: null,
|
|
13
|
-
siteConfig: null,
|
|
14
|
-
userInfo: null,
|
|
15
|
-
paymentDetail: [],
|
|
16
|
-
bindingPaymentInfo: {},
|
|
17
|
-
bindingPaymentList: {},
|
|
18
|
-
boundBanks: [],
|
|
19
|
-
balance: null,
|
|
20
|
-
charge: null,
|
|
21
|
-
realAmount: null,
|
|
22
|
-
applyId: null,
|
|
23
|
-
currentBank: null,
|
|
24
|
-
currentWithdrawLimit: null,
|
|
25
|
-
targetWithdrawLimit: null,
|
|
26
|
-
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
27
|
-
enableWithdrawAmount: 0,
|
|
28
|
-
enableWithdraw: false,
|
|
29
|
-
withdrawRules: [],
|
|
30
|
-
withdrawRule: {},
|
|
31
|
-
withdrawCheck: {},
|
|
32
|
-
freeGameDetail: [],
|
|
33
|
-
amount: null,
|
|
34
|
-
calculation: null,
|
|
35
|
-
|
|
36
|
-
// otp
|
|
37
|
-
requestId: null,
|
|
38
|
-
number: null,
|
|
39
|
-
email: null,
|
|
40
|
-
ttl: null,
|
|
41
|
-
},
|
|
42
|
-
states: {
|
|
43
|
-
loading: {
|
|
44
|
-
invoke: {
|
|
45
|
-
src: 'fetchInitData',
|
|
46
|
-
onDone: {
|
|
47
|
-
target: 'pending',
|
|
48
|
-
actions: ['setInitData', 'preset'],
|
|
49
|
-
},
|
|
50
|
-
onError: {
|
|
51
|
-
target: 'fail',
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
pending: {
|
|
56
|
-
on: {
|
|
57
|
-
SET_MODE: {
|
|
58
|
-
target: 'fetching',
|
|
59
|
-
actions: 'setMode',
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
fetching: {
|
|
64
|
-
invoke: {
|
|
65
|
-
src: 'fetchWithdrawRules',
|
|
66
|
-
onDone: {
|
|
67
|
-
target: 'cash',
|
|
68
|
-
actions: 'updateWithdrawCondition',
|
|
69
|
-
},
|
|
70
|
-
onError: {
|
|
71
|
-
target: '#withdraw_manual.fail',
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
cash: {
|
|
76
|
-
initial: 'checking',
|
|
77
|
-
states: {
|
|
78
|
-
checking: {
|
|
79
|
-
always: [
|
|
80
|
-
{ target: 'inProcessing', cond: 'haveProcessing' },
|
|
81
|
-
{ target: 'unbound', cond: 'isBankNotBound' },
|
|
82
|
-
{ target: 'withdrawCheck' },
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
withdrawCheck: {
|
|
86
|
-
invoke: {
|
|
87
|
-
src: 'withdrawCheck',
|
|
88
|
-
onDone: [
|
|
89
|
-
{
|
|
90
|
-
target: 'checkingWithdrawStatus',
|
|
91
|
-
actions: assign((context, event) => {
|
|
92
|
-
return {
|
|
93
|
-
withdrawCheck: event.data,
|
|
94
|
-
}
|
|
95
|
-
}),
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
onError: {
|
|
99
|
-
target: '#withdraw_manual.fail',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
checkingWithdrawStatus: {
|
|
104
|
-
always: [
|
|
105
|
-
// 提款最低存款金額
|
|
106
|
-
{ target: 'notWithdrawMinDepositAmount', cond: 'isNotWithdrawMinDepositAmount' },
|
|
107
|
-
// 提款冷卻時間
|
|
108
|
-
{ target: 'passWithdrawCooldownTime', cond: 'isPassWithdrawCooldownTime' },
|
|
109
|
-
// 提款服務時間
|
|
110
|
-
{ target: 'withdrawServiceTime', cond: 'isNotWIthdrawServiceTime' },
|
|
111
|
-
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
112
|
-
{ target: 'withdrawable' },
|
|
113
|
-
],
|
|
114
|
-
},
|
|
115
|
-
notWithdrawMinDepositAmount: {},
|
|
116
|
-
passWithdrawCooldownTime: {},
|
|
117
|
-
withdrawServiceTime: {},
|
|
118
|
-
notWithdrawable: {},
|
|
119
|
-
unbound: {
|
|
120
|
-
// to bank_binding.js
|
|
121
|
-
},
|
|
122
|
-
inProcessing: {},
|
|
123
|
-
withdrawable: {
|
|
124
|
-
on: {
|
|
125
|
-
SET_CURRENT_BANK: {
|
|
126
|
-
actions: assign((context, event) => {
|
|
127
|
-
return {
|
|
128
|
-
currentBank: event.data,
|
|
129
|
-
}
|
|
130
|
-
}),
|
|
131
|
-
},
|
|
132
|
-
SET_ATTACHMENT_TYPE: {
|
|
133
|
-
actions: 'setAttachmentType',
|
|
134
|
-
},
|
|
135
|
-
SUBMIT: [
|
|
136
|
-
{
|
|
137
|
-
target: 'pooling',
|
|
138
|
-
cond: (context, event) => {
|
|
139
|
-
const { amount, attachmentType } = context
|
|
140
|
-
return attachmentType === 'pool' && amount > 0
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
target: 'submitting',
|
|
145
|
-
cond: 'isAvailableAmount',
|
|
146
|
-
},
|
|
147
|
-
],
|
|
148
|
-
},
|
|
149
|
-
},
|
|
150
|
-
debouncing: {
|
|
151
|
-
after: {
|
|
152
|
-
1000: [
|
|
153
|
-
{
|
|
154
|
-
target: 'calculating',
|
|
155
|
-
cond: 'isAvailableAmount',
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
target: 'withdrawable',
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
},
|
|
162
|
-
},
|
|
163
|
-
calculating: {
|
|
164
|
-
invoke: {
|
|
165
|
-
src: 'fetchCalculation',
|
|
166
|
-
onDone: {
|
|
167
|
-
target: 'withdrawable',
|
|
168
|
-
actions: 'setCalculation',
|
|
169
|
-
},
|
|
170
|
-
onError: {
|
|
171
|
-
target: 'withdrawable',
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
submitting: {
|
|
176
|
-
invoke: {
|
|
177
|
-
src: 'submitWithdraw',
|
|
178
|
-
onDone: [
|
|
179
|
-
{
|
|
180
|
-
target: '#withdraw_manual.otp',
|
|
181
|
-
actions: 'setOtp',
|
|
182
|
-
cond: 'isOtpRequired',
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
target: 'submitted',
|
|
186
|
-
},
|
|
187
|
-
],
|
|
188
|
-
onError: {
|
|
189
|
-
target: 'withdrawable',
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
},
|
|
193
|
-
submitted: {
|
|
194
|
-
entry: assign((context, event) => {
|
|
195
|
-
const { applyId, balance, realAmount, charge } = event.data
|
|
196
|
-
return { applyId, balance, realAmount, charge }
|
|
197
|
-
}),
|
|
198
|
-
invoke: {
|
|
199
|
-
src: 'fetchPaymentData',
|
|
200
|
-
onDone: {
|
|
201
|
-
target: 'inProcessing',
|
|
202
|
-
actions: 'setPaymentData',
|
|
203
|
-
},
|
|
204
|
-
onError: {
|
|
205
|
-
target: '#withdraw_manual.fail',
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
pooling: {
|
|
210
|
-
invoke: {
|
|
211
|
-
src: 'pool',
|
|
212
|
-
onDone: { target: 'pooled' },
|
|
213
|
-
onError: {
|
|
214
|
-
target: 'withdrawable',
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
pooled: {},
|
|
219
|
-
},
|
|
220
|
-
on: {
|
|
221
|
-
SET_AMOUNT: {
|
|
222
|
-
actions: ['setAmount', 'clearCalculation'],
|
|
223
|
-
},
|
|
224
|
-
CALCULATE: {
|
|
225
|
-
target: '.debouncing',
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
otp: {
|
|
230
|
-
type: 'parallel',
|
|
231
|
-
states: {
|
|
232
|
-
countdown: {
|
|
233
|
-
after: {
|
|
234
|
-
1000: {
|
|
235
|
-
target: 'countdown',
|
|
236
|
-
actions: 'decreaseTtl',
|
|
237
|
-
cond: (context) => context.ttl > 0,
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
verification: {
|
|
242
|
-
initial: 'idle',
|
|
243
|
-
states: {
|
|
244
|
-
idle: {
|
|
245
|
-
on: {
|
|
246
|
-
ACKNOWLEDGE: {
|
|
247
|
-
target: 'acknowledging',
|
|
248
|
-
},
|
|
249
|
-
RESET_OTP: {
|
|
250
|
-
target: 'reset',
|
|
251
|
-
},
|
|
252
|
-
BACK: [
|
|
253
|
-
{
|
|
254
|
-
target: '#withdraw_manual.cash.withdrawable',
|
|
255
|
-
},
|
|
256
|
-
],
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
acknowledging: {
|
|
260
|
-
invoke: {
|
|
261
|
-
src: 'acknowledge',
|
|
262
|
-
onDone: [
|
|
263
|
-
{
|
|
264
|
-
target: '#withdraw_manual.cash.submitted',
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
onError: {
|
|
268
|
-
target: 'idle',
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
},
|
|
272
|
-
reset: {
|
|
273
|
-
invoke: {
|
|
274
|
-
src: 'resetOtp',
|
|
275
|
-
onDone: {
|
|
276
|
-
target: 'idle',
|
|
277
|
-
actions: 'setVerificationData',
|
|
278
|
-
},
|
|
279
|
-
onError: { target: 'idle' },
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
fail: {},
|
|
287
|
-
},
|
|
288
|
-
on: {
|
|
289
|
-
REFRESH: {
|
|
290
|
-
target: 'loading',
|
|
291
|
-
},
|
|
292
|
-
},
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
actions: {
|
|
296
|
-
setInitData: assign((context, event) => {
|
|
297
|
-
const { bindingPaymentList = {}, bindingPaymentInfo = {} } = event.data
|
|
298
|
-
const toBeUsed = ['bankList', 'cryptoList', 'ewalletList']
|
|
299
|
-
const copiedBindingPaymentInfo = JSON.parse(JSON.stringify(bindingPaymentInfo))
|
|
300
|
-
const filterTypes = Object.keys(copiedBindingPaymentInfo).filter((type) => toBeUsed.includes(type))
|
|
301
|
-
|
|
302
|
-
let combinedData = []
|
|
303
|
-
filterTypes.forEach((type) => {
|
|
304
|
-
combinedData = combinedData.concat(copiedBindingPaymentInfo[type])
|
|
305
|
-
})
|
|
306
|
-
return { bindingPaymentList, bindingPaymentInfo, boundBanks: combinedData, currentBank: combinedData[0] }
|
|
307
|
-
}),
|
|
308
|
-
preset: assign((context, event) => {
|
|
309
|
-
return {
|
|
310
|
-
attachmentType: 'withdraw',
|
|
311
|
-
}
|
|
312
|
-
}),
|
|
313
|
-
setMode: assign((context, event) => {
|
|
314
|
-
return {
|
|
315
|
-
mode: event.data,
|
|
316
|
-
}
|
|
317
|
-
}),
|
|
318
|
-
updateWithdrawCondition: assign((context, event) => {
|
|
319
|
-
const { enableWithdraw, enableWithdrawAmount, currentWithdrawLimit, targetWithdrawLimit, balance, freeGameDetail, freeGameExpired } =
|
|
320
|
-
event.data
|
|
321
|
-
const withdrawRules = event.data?.rules || []
|
|
322
|
-
const rules = withdrawRules.filter((rule) => rule.maxWithdrawAmount > 0)
|
|
323
|
-
const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
324
|
-
|
|
325
|
-
let maxWithdrawAmount = 0
|
|
326
|
-
|
|
327
|
-
if (lastMatchedIndex > -1) {
|
|
328
|
-
rules[lastMatchedIndex].match = true
|
|
329
|
-
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
330
|
-
} else if (rules.length > 0) {
|
|
331
|
-
maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
332
|
-
} else {
|
|
333
|
-
maxWithdrawAmount = balance
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
return {
|
|
337
|
-
balance,
|
|
338
|
-
currentWithdrawLimit,
|
|
339
|
-
targetWithdrawLimit,
|
|
340
|
-
maxWithdrawAmount,
|
|
341
|
-
enableWithdrawAmount: +enableWithdrawAmount,
|
|
342
|
-
enableWithdraw,
|
|
343
|
-
withdrawRules,
|
|
344
|
-
freeGameDetail,
|
|
345
|
-
freeGameExpired,
|
|
346
|
-
}
|
|
347
|
-
}),
|
|
348
|
-
setWithdrawRulePreview: assign((context, event) => {
|
|
349
|
-
return {
|
|
350
|
-
withdrawRule: event.data,
|
|
351
|
-
}
|
|
352
|
-
}),
|
|
353
|
-
setPaymentData: assign((context, event) => {
|
|
354
|
-
const { paymentDetail } = event.data
|
|
355
|
-
return { paymentDetail }
|
|
356
|
-
}),
|
|
357
|
-
setOtp: assign((context, event) => {
|
|
358
|
-
const { request_id, number, email, ttl } = event.data
|
|
359
|
-
return {
|
|
360
|
-
requestId: request_id,
|
|
361
|
-
number,
|
|
362
|
-
email,
|
|
363
|
-
ttl,
|
|
364
|
-
}
|
|
365
|
-
}),
|
|
366
|
-
decreaseTtl: assign((context, evnet) => {
|
|
367
|
-
const second = context.ttl
|
|
368
|
-
return {
|
|
369
|
-
ttl: Math.max(second - 1000, 0),
|
|
370
|
-
}
|
|
371
|
-
}),
|
|
372
|
-
setVerificationData: assign((context, event) => {
|
|
373
|
-
const { request_id, number, email, ttl } = event.data
|
|
374
|
-
return {
|
|
375
|
-
requestId: request_id,
|
|
376
|
-
number,
|
|
377
|
-
email,
|
|
378
|
-
ttl,
|
|
379
|
-
}
|
|
380
|
-
}),
|
|
381
|
-
setAttachmentType: assign((context, event) => {
|
|
382
|
-
return {
|
|
383
|
-
attachmentType: event.data,
|
|
384
|
-
}
|
|
385
|
-
}),
|
|
386
|
-
setCalculation: assign((context, event) => {
|
|
387
|
-
// V2接口轉換中回傳的資料結構不同
|
|
388
|
-
const { data } = event.data
|
|
389
|
-
if (data) {
|
|
390
|
-
return {
|
|
391
|
-
calculation: data,
|
|
392
|
-
}
|
|
393
|
-
} else {
|
|
394
|
-
return {
|
|
395
|
-
calculation: event.data,
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}),
|
|
399
|
-
clearCalculation: assign((context, event) => {
|
|
400
|
-
return {
|
|
401
|
-
calculation: null,
|
|
402
|
-
}
|
|
403
|
-
}),
|
|
404
|
-
setAmount: assign((context, event) => {
|
|
405
|
-
return {
|
|
406
|
-
amount: event.data,
|
|
407
|
-
}
|
|
408
|
-
}),
|
|
409
|
-
},
|
|
410
|
-
guards: {
|
|
411
|
-
isAvailableAmount: (context, event) => {
|
|
412
|
-
const { paymentDetail, currentBank, amount, userInfo } = context
|
|
413
|
-
const { minimum = 0, maximum = 0 } = paymentDetail?.[0] || {}
|
|
414
|
-
const { balance = 0 } = userInfo || {}
|
|
415
|
-
const lastMax = Math.min(parseFloat(balance), maximum)
|
|
416
|
-
return !!currentBank && amount > 0 && minimum <= amount && amount <= lastMax
|
|
417
|
-
},
|
|
418
|
-
hasAttachmentType: (context, event) => {
|
|
419
|
-
return ['withdraw', 'pool'].includes(context.attachmentType)
|
|
420
|
-
},
|
|
421
|
-
haveProcessing: (context, event) => {
|
|
422
|
-
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
423
|
-
},
|
|
424
|
-
isBankNotBound: (context, event) => {
|
|
425
|
-
return !context.boundBanks?.length
|
|
426
|
-
},
|
|
427
|
-
isConvertible: (context, event) => {
|
|
428
|
-
const { enableWithdraw, freeGameDetail } = context
|
|
429
|
-
const isFreeGame = freeGameDetail?.length > 0
|
|
430
|
-
if (isFreeGame) {
|
|
431
|
-
return freeGameDetail[0]?.freeGameCount === freeGameDetail[0]?.freeGameUsedCount
|
|
432
|
-
} else {
|
|
433
|
-
return enableWithdraw
|
|
434
|
-
}
|
|
435
|
-
},
|
|
436
|
-
isNotWithdrawable: (context, event) => {
|
|
437
|
-
const { balance, enableWithdraw, paymentDetail } = context
|
|
438
|
-
const minWithdrawAmount = paymentDetail[0]?.minimum || 0
|
|
439
|
-
return !enableWithdraw || balance < minWithdrawAmount
|
|
440
|
-
},
|
|
441
|
-
isOtpRequired: (context, event) => {
|
|
442
|
-
const { request_id, number, email } = event.data || {}
|
|
443
|
-
return request_id !== undefined && (number || email)
|
|
444
|
-
},
|
|
445
|
-
isNotWithdrawMinDepositAmount: (context, event) => {
|
|
446
|
-
const { withdrawCheck } = context
|
|
447
|
-
return !withdrawCheck?.passDepositeLimit
|
|
448
|
-
},
|
|
449
|
-
isPassWithdrawCooldownTime: (context, event) => {
|
|
450
|
-
const { withdrawCheck } = context
|
|
451
|
-
return !withdrawCheck?.passWithdrawCooldownTime
|
|
452
|
-
},
|
|
453
|
-
isNotWIthdrawServiceTime: (context, event) => {
|
|
454
|
-
const { withdrawCheck } = context
|
|
455
|
-
return !withdrawCheck?.withdrawInServiceTime
|
|
456
|
-
},
|
|
457
|
-
},
|
|
458
|
-
services: {
|
|
459
|
-
fetchInitData: async (context, event) => {
|
|
460
|
-
const [bindingPaymentList = {}, bindingPaymentInfo = {}] = await Promise.all([
|
|
461
|
-
request.send(payment.getBindingPaymentList({ appSecret })),
|
|
462
|
-
request.send(payment.getBindingPaymentInfo({ appSecret })),
|
|
463
|
-
])
|
|
464
|
-
return { bindingPaymentList, bindingPaymentInfo }
|
|
465
|
-
},
|
|
466
|
-
fetchPaymentData: async (context, event) => {
|
|
467
|
-
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
|
|
468
|
-
return { paymentDetail }
|
|
469
|
-
},
|
|
470
|
-
fetchWithdrawRules: async (context, event) => {
|
|
471
|
-
const { mode } = context
|
|
472
|
-
return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: mode }))
|
|
473
|
-
},
|
|
474
|
-
fetchWithdrawRulePreview: async (context, event) => {
|
|
475
|
-
const data = await request.send(payment.getWithdrawRulePreview({ applyType: 'giveup' }))
|
|
476
|
-
return data
|
|
477
|
-
},
|
|
478
|
-
fetchCalculation: async (context, event) => {
|
|
479
|
-
const { paymentDetail, currentBank, amount } = context
|
|
480
|
-
const { method } = paymentDetail?.[0] || {}
|
|
481
|
-
const { cryptoCurrency } = currentBank || {}
|
|
482
|
-
return await request.send(payment.getCryptoWithdrawExpectedResult({ method, amount, cryptoCurrency }))
|
|
483
|
-
},
|
|
484
|
-
submitWithdraw: async (context, event) => {
|
|
485
|
-
const { currentBank, amount } = context
|
|
486
|
-
const { method } = context.paymentDetail[0]
|
|
487
|
-
const { bindingType } = currentBank || {}
|
|
488
|
-
|
|
489
|
-
let branchTemp = ''
|
|
490
|
-
if (bindingType === 'BANK' && !['GCASH', 'PAYM', 'PIX'].includes(currentBank.bankCode)) {
|
|
491
|
-
branchTemp = currentBank.branch
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
return await request.send(
|
|
495
|
-
payment.submitWithdrawTransactionManual({
|
|
496
|
-
method,
|
|
497
|
-
amount,
|
|
498
|
-
applyerBankCode: currentBank.bankCode || currentBank.walletCode,
|
|
499
|
-
applyerAccountNumber: currentBank.accountNumber,
|
|
500
|
-
applyerIfscCode: currentBank.ifscCode,
|
|
501
|
-
branch: branchTemp,
|
|
502
|
-
holderName: currentBank.holderName,
|
|
503
|
-
cryptoCurrency: currentBank.cryptoCurrency,
|
|
504
|
-
cryptoNetwork: currentBank.cryptoNetwork,
|
|
505
|
-
targetAddress: currentBank.cryptoAddress,
|
|
506
|
-
})
|
|
507
|
-
)
|
|
508
|
-
},
|
|
509
|
-
convertFreeCredit: async (context, event) => {
|
|
510
|
-
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
511
|
-
},
|
|
512
|
-
resetOtp: async (context, event) => {
|
|
513
|
-
const { requestId } = context
|
|
514
|
-
const { method } = context.paymentDetail[0]
|
|
515
|
-
return await request.send(payment.otpReset({ method: method, requestId }))
|
|
516
|
-
},
|
|
517
|
-
acknowledge: async (context, event) => {
|
|
518
|
-
const { requestId } = context
|
|
519
|
-
const { method } = context.paymentDetail[0]
|
|
520
|
-
const code = event.data
|
|
521
|
-
return await request.send(payment.otpAcknowledge({ method: method, requestId, code }))
|
|
522
|
-
},
|
|
523
|
-
pool: async (context, event) => {
|
|
524
|
-
const { amount } = context
|
|
525
|
-
return await request.send(payment.restore({ amount }))
|
|
526
|
-
},
|
|
527
|
-
giveUp: async (context, event) => {
|
|
528
|
-
return await request.send(payment.giveUp())
|
|
529
|
-
},
|
|
530
|
-
withdrawCheck: async (context, event) => {
|
|
531
|
-
return await request.send(payment.withdrawCheck())
|
|
532
|
-
},
|
|
533
|
-
},
|
|
534
|
-
}
|
|
535
|
-
)
|
|
536
|
-
}
|
package/src/util/math.js
DELETED