@jetthai/cuora 1.1.410-dev-2 → 1.1.410
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 -34
- package/package.json +1 -1
- package/src/api/payment.js +3 -15
- package/src/machine/auth.js +1 -14
- package/src/machine/auth_otp_v3.js +3 -7
- package/src/machine/deposit/crypto_bank.js +1 -6
- package/src/machine/deposit/crypto_bank_cash.js +1 -6
- package/src/machine/deposit/crypto_way.js +1 -6
- package/src/machine/deposit/crypto_way_cash.js +1 -6
- package/src/machine/withdraw/withdraw_manual.js +16 -19
- package/src/machine/withdraw/withdraw_manual_cash.js +31 -23
package/CHANGELOG.md
CHANGED
|
@@ -2,40 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
### [1.1.410-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.410-dev-1...v1.1.410-dev-2) (2026-02-05)
|
|
6
|
-
|
|
7
|
-
### [1.1.410-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.410...v1.1.410-dev-1) (2026-02-04)
|
|
8
|
-
|
|
9
|
-
### [1.1.408-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.409...v1.1.408-dev-6) (2026-01-29)
|
|
10
|
-
|
|
11
|
-
### [1.1.408-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-4...v1.1.408-dev-5) (2026-01-26)
|
|
12
|
-
|
|
13
|
-
### [1.1.408-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-3...v1.1.408-dev-4) (2026-01-23)
|
|
14
|
-
|
|
15
|
-
### [1.1.408-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-2...v1.1.408-dev-3) (2026-01-20)
|
|
16
|
-
|
|
17
|
-
### [1.1.408-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.408-dev-2) (2026-01-16)
|
|
18
|
-
|
|
19
|
-
### [1.1.408-dev-6](https://github.com/jetthai/cuora-module/compare/v1.1.409...v1.1.408-dev-6) (2026-01-29)
|
|
20
|
-
|
|
21
|
-
### [1.1.408-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-4...v1.1.408-dev-5) (2026-01-26)
|
|
22
|
-
|
|
23
|
-
### [1.1.408-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-3...v1.1.408-dev-4) (2026-01-23)
|
|
24
|
-
|
|
25
|
-
### [1.1.408-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-2...v1.1.408-dev-3) (2026-01-20)
|
|
26
|
-
|
|
27
|
-
### [1.1.408-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.408-dev-2) (2026-01-16)
|
|
28
|
-
|
|
29
|
-
### [1.1.408-dev-5](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-4...v1.1.408-dev-5) (2026-01-26)
|
|
30
|
-
|
|
31
|
-
### [1.1.408-dev-4](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-3...v1.1.408-dev-4) (2026-01-23)
|
|
32
|
-
|
|
33
|
-
### [1.1.408-dev-3](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-2...v1.1.408-dev-3) (2026-01-20)
|
|
34
|
-
|
|
35
|
-
### [1.1.408-dev-2](https://github.com/jetthai/cuora-module/compare/v1.1.408-dev-1...v1.1.408-dev-2) (2026-01-16)
|
|
36
|
-
|
|
37
|
-
### [1.1.408-dev-1](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.408-dev-1) (2026-01-16)
|
|
38
|
-
|
|
39
5
|
### [1.1.410](https://github.com/jetthai/cuora-module/compare/v1.1.409...v1.1.410) (2026-02-02)
|
|
40
6
|
|
|
41
7
|
### [1.1.409](https://github.com/jetthai/cuora-module/compare/v1.1.408...v1.1.409) (2026-01-27)
|
package/package.json
CHANGED
package/src/api/payment.js
CHANGED
|
@@ -176,12 +176,12 @@ export default {
|
|
|
176
176
|
params: { transferType: 'DEPOSIT', amount, promotionsNo },
|
|
177
177
|
}),
|
|
178
178
|
submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName }) => ({
|
|
179
|
-
url:
|
|
179
|
+
url: `payment/v2/${method}/transaction`,
|
|
180
180
|
method: 'post',
|
|
181
181
|
params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName },
|
|
182
182
|
}),
|
|
183
183
|
submitWithdrawTransactionVN: ({ method, amount, applyerBankCode, applyerAccountNumber, applyerIfscCode, branch, applyerHolderName }) => ({
|
|
184
|
-
url:
|
|
184
|
+
url: `payment/v2/${method}/transaction`,
|
|
185
185
|
method: 'post',
|
|
186
186
|
params: {
|
|
187
187
|
transferType: 'WITHDRAW',
|
|
@@ -205,7 +205,7 @@ export default {
|
|
|
205
205
|
cryptoNetwork,
|
|
206
206
|
targetAddress,
|
|
207
207
|
}) => ({
|
|
208
|
-
url: `payment/v2/${method}/
|
|
208
|
+
url: `payment/v2/${method}/transaction`,
|
|
209
209
|
method: 'post',
|
|
210
210
|
params: {
|
|
211
211
|
transferType: 'WITHDRAW',
|
|
@@ -247,16 +247,4 @@ export default {
|
|
|
247
247
|
withdrawCheck: () => ({ url: `payment/v2/withdrawCheck`, method: 'post' }),
|
|
248
248
|
updateUtr: ({ applyId, utr }) => ({ url: 'payment/v2/updateUtr', method: 'post', params: { applyId, utr } }),
|
|
249
249
|
uploadCommonSlip: ({ applyId, slip }) => ({ url: 'payment/v2/uploadCommonSlip', method: 'post', params: { applyId, slip } }),
|
|
250
|
-
otpAcknowledge: ({ method, requestId, code }) => ({
|
|
251
|
-
url: `/payment/v2/${method}/withdraw-otp/acknowledge`,
|
|
252
|
-
method: 'post',
|
|
253
|
-
params: { requestId, code },
|
|
254
|
-
isPublic: true,
|
|
255
|
-
}),
|
|
256
|
-
otpReset: ({ method, requestId }) => ({
|
|
257
|
-
url: `/payment/v2/${method}/withdraw-otp/reset-otp`,
|
|
258
|
-
method: 'post',
|
|
259
|
-
params: { requestId },
|
|
260
|
-
isPublic: true,
|
|
261
|
-
}),
|
|
262
250
|
}
|
package/src/machine/auth.js
CHANGED
|
@@ -101,7 +101,7 @@ export default function (request) {
|
|
|
101
101
|
invoke: {
|
|
102
102
|
src: 'fetchUserInfo',
|
|
103
103
|
onDone: {
|
|
104
|
-
target: '
|
|
104
|
+
target: 'loginSuccess',
|
|
105
105
|
actions: ['setUserInfo', 'extendToken'],
|
|
106
106
|
},
|
|
107
107
|
onError: {
|
|
@@ -109,19 +109,6 @@ export default function (request) {
|
|
|
109
109
|
},
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
|
-
otpChecking: {
|
|
113
|
-
on: {
|
|
114
|
-
OTP_VERIFIED: {
|
|
115
|
-
target: 'loginSuccess',
|
|
116
|
-
},
|
|
117
|
-
OTP_SKIP: {
|
|
118
|
-
target: 'loginSuccess',
|
|
119
|
-
},
|
|
120
|
-
LOGOUT: {
|
|
121
|
-
target: 'leaving',
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
112
|
loginSuccess: {
|
|
126
113
|
after: {
|
|
127
114
|
0: {
|
|
@@ -244,16 +244,12 @@ export default function (request) {
|
|
|
244
244
|
},
|
|
245
245
|
verify: async (context, event) => {
|
|
246
246
|
const provider = context.strategy
|
|
247
|
-
// [防呆] 資料不完整直接跳出
|
|
248
|
-
if (!provider) {
|
|
249
|
-
return
|
|
250
|
-
}
|
|
251
247
|
return await request.send(
|
|
252
248
|
otp.verification({
|
|
253
249
|
strategy: provider,
|
|
254
|
-
email: provider === 'email' ? event.data
|
|
255
|
-
countryCode: provider === 'phone' ? event.data
|
|
256
|
-
phone: provider === 'phone' ? event.data
|
|
250
|
+
email: provider === 'email' ? event.data.email : undefined,
|
|
251
|
+
countryCode: provider === 'phone' ? event.data.country_code : undefined,
|
|
252
|
+
phone: provider === 'phone' ? event.data.tel : undefined,
|
|
257
253
|
})
|
|
258
254
|
)
|
|
259
255
|
},
|
|
@@ -112,15 +112,10 @@ export default function (request) {
|
|
|
112
112
|
actions: 'setResult',
|
|
113
113
|
},
|
|
114
114
|
onError: {
|
|
115
|
-
target: '
|
|
115
|
+
target: 'loaded',
|
|
116
116
|
},
|
|
117
117
|
},
|
|
118
118
|
},
|
|
119
|
-
submitFail: {
|
|
120
|
-
after: {
|
|
121
|
-
0: { target: 'loaded' },
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
119
|
processing: {},
|
|
125
120
|
submitted: {},
|
|
126
121
|
fail: {},
|
|
@@ -82,15 +82,10 @@ export default function (request, context) {
|
|
|
82
82
|
actions: 'setResult',
|
|
83
83
|
},
|
|
84
84
|
onError: {
|
|
85
|
-
target: '
|
|
85
|
+
target: 'calculated',
|
|
86
86
|
},
|
|
87
87
|
},
|
|
88
88
|
},
|
|
89
|
-
fail: {
|
|
90
|
-
after: {
|
|
91
|
-
0: { target: 'calculated' },
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
89
|
submitted: {},
|
|
95
90
|
},
|
|
96
91
|
on: {
|
|
@@ -91,15 +91,10 @@ export default function (request) {
|
|
|
91
91
|
actions: 'setResult',
|
|
92
92
|
},
|
|
93
93
|
onError: {
|
|
94
|
-
target: '
|
|
94
|
+
target: 'loaded',
|
|
95
95
|
},
|
|
96
96
|
},
|
|
97
97
|
},
|
|
98
|
-
submitFail: {
|
|
99
|
-
after: {
|
|
100
|
-
0: { target: 'loaded' },
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
98
|
submitted: {},
|
|
104
99
|
fail: {},
|
|
105
100
|
},
|
|
@@ -79,15 +79,10 @@ export default function (request, context) {
|
|
|
79
79
|
actions: ['setResult', 'setTtl'],
|
|
80
80
|
},
|
|
81
81
|
onError: {
|
|
82
|
-
target: '
|
|
82
|
+
target: 'calculated',
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
},
|
|
86
|
-
fail: {
|
|
87
|
-
after: {
|
|
88
|
-
0: { target: 'calculated' },
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
86
|
submitted: {
|
|
92
87
|
after: {
|
|
93
88
|
1000: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import findLastIndex from 'lodash/findLastIndex.js'
|
|
3
3
|
import payment from '../../api/payment.js'
|
|
4
|
+
import user from '../../api/user.js'
|
|
4
5
|
|
|
5
6
|
export default function (request) {
|
|
6
7
|
const { appSecret } = request.config
|
|
@@ -35,8 +36,8 @@ export default function (request) {
|
|
|
35
36
|
|
|
36
37
|
// otp
|
|
37
38
|
requestId: null,
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
status: null,
|
|
40
|
+
target: null,
|
|
40
41
|
ttl: null,
|
|
41
42
|
},
|
|
42
43
|
states: {
|
|
@@ -355,27 +356,26 @@ export default function (request) {
|
|
|
355
356
|
return { paymentDetail }
|
|
356
357
|
}),
|
|
357
358
|
setOtp: assign((context, event) => {
|
|
358
|
-
const {
|
|
359
|
+
const { requestId, status, target, ttl } = event.data
|
|
359
360
|
return {
|
|
360
|
-
requestId
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
requestId,
|
|
362
|
+
status,
|
|
363
|
+
target,
|
|
363
364
|
ttl,
|
|
364
365
|
}
|
|
365
366
|
}),
|
|
366
367
|
decreaseTtl: assign((context, evnet) => {
|
|
367
368
|
const second = context.ttl
|
|
368
369
|
return {
|
|
369
|
-
ttl: Math.max(second -
|
|
370
|
+
ttl: Math.max(second - 1, 0),
|
|
370
371
|
}
|
|
371
372
|
}),
|
|
372
373
|
setVerificationData: assign((context, event) => {
|
|
373
|
-
const {
|
|
374
|
+
const { requestId, ttl, target } = event.data
|
|
374
375
|
return {
|
|
375
|
-
requestId
|
|
376
|
-
number,
|
|
377
|
-
email,
|
|
376
|
+
requestId,
|
|
378
377
|
ttl,
|
|
378
|
+
target,
|
|
379
379
|
}
|
|
380
380
|
}),
|
|
381
381
|
setAttachmentType: assign((context, event) => {
|
|
@@ -439,8 +439,7 @@ export default function (request) {
|
|
|
439
439
|
return !enableWithdraw || balance < minWithdrawAmount
|
|
440
440
|
},
|
|
441
441
|
isOtpRequired: (context, event) => {
|
|
442
|
-
|
|
443
|
-
return request_id !== undefined && (number || email)
|
|
442
|
+
return event.data?.status === 'otp-verifying'
|
|
444
443
|
},
|
|
445
444
|
isNotWithdrawMinDepositAmount: (context, event) => {
|
|
446
445
|
const { withdrawCheck } = context
|
|
@@ -510,15 +509,13 @@ export default function (request) {
|
|
|
510
509
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
511
510
|
},
|
|
512
511
|
resetOtp: async (context, event) => {
|
|
513
|
-
const { requestId } = context
|
|
514
|
-
|
|
515
|
-
return await request.send(payment.otpReset({ method: method, requestId }))
|
|
512
|
+
const { requestId, target } = context
|
|
513
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
516
514
|
},
|
|
517
515
|
acknowledge: async (context, event) => {
|
|
518
|
-
const { requestId } = context
|
|
519
|
-
const { method } = context.paymentDetail[0]
|
|
516
|
+
const { requestId, target } = context
|
|
520
517
|
const code = event.data
|
|
521
|
-
return await request.send(
|
|
518
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
522
519
|
},
|
|
523
520
|
pool: async (context, event) => {
|
|
524
521
|
const { amount } = context
|
|
@@ -23,8 +23,6 @@ export default function (request, context) {
|
|
|
23
23
|
requestId: null,
|
|
24
24
|
status: null,
|
|
25
25
|
target: null,
|
|
26
|
-
email: null,
|
|
27
|
-
number: null,
|
|
28
26
|
ttl: null,
|
|
29
27
|
},
|
|
30
28
|
states: {
|
|
@@ -119,18 +117,29 @@ export default function (request, context) {
|
|
|
119
117
|
RESET_OTP: {
|
|
120
118
|
target: 'reset',
|
|
121
119
|
},
|
|
122
|
-
BACK:
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
BACK: [
|
|
121
|
+
// {
|
|
122
|
+
// target: '#withdraw_vn2.activity.convertible',
|
|
123
|
+
// cond: 'isActivity',
|
|
124
|
+
// },
|
|
125
|
+
// {
|
|
126
|
+
// target: '#withdraw_vn2.cash.withdrawable',
|
|
127
|
+
// },
|
|
128
|
+
],
|
|
125
129
|
},
|
|
126
130
|
},
|
|
127
131
|
acknowledging: {
|
|
128
132
|
invoke: {
|
|
129
133
|
src: 'acknowledge',
|
|
130
|
-
onDone:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
onDone: [
|
|
135
|
+
// {
|
|
136
|
+
// target: '#withdraw_vn2.activity.converted',
|
|
137
|
+
// cond: 'isActivity',
|
|
138
|
+
// },
|
|
139
|
+
// {
|
|
140
|
+
// target: '#withdraw_vn2.cash.submitted',
|
|
141
|
+
// },
|
|
142
|
+
],
|
|
134
143
|
onError: {
|
|
135
144
|
target: 'idle',
|
|
136
145
|
},
|
|
@@ -194,27 +203,26 @@ export default function (request, context) {
|
|
|
194
203
|
}
|
|
195
204
|
}),
|
|
196
205
|
setOtp: assign((context, event) => {
|
|
197
|
-
const {
|
|
206
|
+
const { requestId, status, target, ttl } = event.data
|
|
198
207
|
return {
|
|
199
|
-
requestId
|
|
200
|
-
|
|
201
|
-
|
|
208
|
+
requestId,
|
|
209
|
+
status,
|
|
210
|
+
target,
|
|
202
211
|
ttl,
|
|
203
212
|
}
|
|
204
213
|
}),
|
|
205
214
|
decreaseTtl: assign((context, evnet) => {
|
|
206
215
|
const second = context.ttl
|
|
207
216
|
return {
|
|
208
|
-
ttl: Math.max(second -
|
|
217
|
+
ttl: Math.max(second - 1, 0),
|
|
209
218
|
}
|
|
210
219
|
}),
|
|
211
220
|
setVerificationData: assign((context, event) => {
|
|
212
|
-
const {
|
|
221
|
+
const { requestId, ttl, target } = event.data
|
|
213
222
|
return {
|
|
214
|
-
requestId
|
|
223
|
+
requestId,
|
|
215
224
|
ttl,
|
|
216
|
-
|
|
217
|
-
email,
|
|
225
|
+
target,
|
|
218
226
|
}
|
|
219
227
|
}),
|
|
220
228
|
},
|
|
@@ -230,7 +238,7 @@ export default function (request, context) {
|
|
|
230
238
|
return selectedUserBank && selectedAmount > 0 && currentPayment.minimum <= selectedAmount && selectedAmount <= currentPayment.maximum
|
|
231
239
|
},
|
|
232
240
|
isOtpRequired: (context, event) => {
|
|
233
|
-
return event.data?.
|
|
241
|
+
return event.data?.status === 'otp-verifying'
|
|
234
242
|
},
|
|
235
243
|
},
|
|
236
244
|
services: {
|
|
@@ -281,13 +289,13 @@ export default function (request, context) {
|
|
|
281
289
|
)
|
|
282
290
|
},
|
|
283
291
|
resetOtp: async (context, event) => {
|
|
284
|
-
const {
|
|
285
|
-
return await request.send(
|
|
292
|
+
const { requestId, target } = context
|
|
293
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
286
294
|
},
|
|
287
295
|
acknowledge: async (context, event) => {
|
|
288
|
-
const {
|
|
296
|
+
const { requestId, target } = context
|
|
289
297
|
const code = event.data
|
|
290
|
-
return await request.send(
|
|
298
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
291
299
|
},
|
|
292
300
|
},
|
|
293
301
|
}
|