@jetthai/cuora 1.1.6 → 1.1.8
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 +4 -0
- package/dist/bundle.mjs +393 -2727
- package/package.json +1 -1
- package/src/machine/deposit/crypto_button.js +34 -12
- package/src/machine/deposit/qrcode_v2.js +44 -16
- package/src/machine/withdraw_vn.js +125 -8
package/package.json
CHANGED
|
@@ -25,6 +25,8 @@ export default function (request) {
|
|
|
25
25
|
|
|
26
26
|
calculation: null,
|
|
27
27
|
result: null,
|
|
28
|
+
|
|
29
|
+
grandTotalEnable: 1
|
|
28
30
|
},
|
|
29
31
|
states: {
|
|
30
32
|
loading: {
|
|
@@ -63,10 +65,16 @@ export default function (request) {
|
|
|
63
65
|
selecting: {
|
|
64
66
|
entry: 'reset',
|
|
65
67
|
on: {
|
|
66
|
-
SELECT_AMOUNT:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
SELECT_AMOUNT: [
|
|
69
|
+
{
|
|
70
|
+
target: 'debouncing',
|
|
71
|
+
actions: 'addAmount',
|
|
72
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
73
|
+
}, {
|
|
74
|
+
target: 'debouncing',
|
|
75
|
+
actions: 'setAmount'
|
|
76
|
+
}
|
|
77
|
+
],
|
|
70
78
|
KEY_IN: {
|
|
71
79
|
target: 'debouncing',
|
|
72
80
|
actions: 'setAmount'
|
|
@@ -78,10 +86,16 @@ export default function (request) {
|
|
|
78
86
|
},
|
|
79
87
|
debouncing: {
|
|
80
88
|
on: {
|
|
81
|
-
SELECT_AMOUNT:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
SELECT_AMOUNT: [
|
|
90
|
+
{
|
|
91
|
+
target: 'debouncing',
|
|
92
|
+
actions: 'addAmount',
|
|
93
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
94
|
+
}, {
|
|
95
|
+
target: 'debouncing',
|
|
96
|
+
actions: 'setAmount'
|
|
97
|
+
}
|
|
98
|
+
],
|
|
85
99
|
KEY_IN: {
|
|
86
100
|
target: 'debouncing',
|
|
87
101
|
actions: 'setAmount',
|
|
@@ -108,10 +122,16 @@ export default function (request) {
|
|
|
108
122
|
},
|
|
109
123
|
calculated: {
|
|
110
124
|
on: {
|
|
111
|
-
SELECT_AMOUNT:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
125
|
+
SELECT_AMOUNT: [
|
|
126
|
+
{
|
|
127
|
+
target: 'debouncing',
|
|
128
|
+
actions: 'addAmount',
|
|
129
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
130
|
+
}, {
|
|
131
|
+
target: 'debouncing',
|
|
132
|
+
actions: 'setAmount'
|
|
133
|
+
}
|
|
134
|
+
],
|
|
115
135
|
KEY_IN: {
|
|
116
136
|
target: 'debouncing',
|
|
117
137
|
actions: 'setAmount',
|
|
@@ -174,6 +194,7 @@ export default function (request) {
|
|
|
174
194
|
selectedChannel: channels[0],
|
|
175
195
|
selectedCrypto: cryptos[0],
|
|
176
196
|
selectedNetwork: defaultNetworks[0],
|
|
197
|
+
grandTotalEnable: cryptos[0].grandTotalEnable,
|
|
177
198
|
currentPayment,
|
|
178
199
|
options
|
|
179
200
|
}
|
|
@@ -197,6 +218,7 @@ export default function (request) {
|
|
|
197
218
|
selectedNetwork: networks[0],
|
|
198
219
|
selectedAmount: null,
|
|
199
220
|
calculation: null,
|
|
221
|
+
grandTotalEnable: selectedCrypto.grandTotalEnable,
|
|
200
222
|
options
|
|
201
223
|
}
|
|
202
224
|
}),
|
|
@@ -20,6 +20,8 @@ export default function (request) {
|
|
|
20
20
|
currentMethod: null,
|
|
21
21
|
|
|
22
22
|
result: null,
|
|
23
|
+
|
|
24
|
+
grandTotalEnable: 1
|
|
23
25
|
},
|
|
24
26
|
states: {
|
|
25
27
|
loading: {
|
|
@@ -40,10 +42,16 @@ export default function (request) {
|
|
|
40
42
|
SELECT_QRCODE: {
|
|
41
43
|
actions: 'setQrcode',
|
|
42
44
|
},
|
|
43
|
-
SELECT_AMOUNT:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
SELECT_AMOUNT: [
|
|
46
|
+
{
|
|
47
|
+
target: 'debouncing',
|
|
48
|
+
actions: 'addAmount',
|
|
49
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
50
|
+
}, {
|
|
51
|
+
target: 'debouncing',
|
|
52
|
+
actions: 'setAmount'
|
|
53
|
+
}
|
|
54
|
+
],
|
|
47
55
|
KEY_IN: {
|
|
48
56
|
target: 'calculating',
|
|
49
57
|
actions: 'setAmount',
|
|
@@ -52,10 +60,16 @@ export default function (request) {
|
|
|
52
60
|
},
|
|
53
61
|
debouncing: {
|
|
54
62
|
on: {
|
|
55
|
-
SELECT_AMOUNT:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
SELECT_AMOUNT: [
|
|
64
|
+
{
|
|
65
|
+
target: 'debouncing',
|
|
66
|
+
actions: 'addAmount',
|
|
67
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
68
|
+
}, {
|
|
69
|
+
target: 'debouncing',
|
|
70
|
+
actions: 'setAmount'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
59
73
|
KEY_IN: {
|
|
60
74
|
target: 'debouncing',
|
|
61
75
|
actions: 'setAmount',
|
|
@@ -74,10 +88,16 @@ export default function (request) {
|
|
|
74
88
|
calculable: {
|
|
75
89
|
entry: 'clearCalculation',
|
|
76
90
|
on: {
|
|
77
|
-
SELECT_AMOUNT:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
SELECT_AMOUNT: [
|
|
92
|
+
{
|
|
93
|
+
target: 'debouncing',
|
|
94
|
+
actions: 'addAmount',
|
|
95
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
96
|
+
}, {
|
|
97
|
+
target: 'debouncing',
|
|
98
|
+
actions: 'setAmount'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
81
101
|
KEY_IN: {
|
|
82
102
|
target: 'debouncing',
|
|
83
103
|
actions: 'setAmount',
|
|
@@ -104,10 +124,16 @@ export default function (request) {
|
|
|
104
124
|
},
|
|
105
125
|
calculated: {
|
|
106
126
|
on: {
|
|
107
|
-
SELECT_AMOUNT:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
SELECT_AMOUNT: [
|
|
128
|
+
{
|
|
129
|
+
target: 'debouncing',
|
|
130
|
+
actions: 'addAmount',
|
|
131
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
132
|
+
}, {
|
|
133
|
+
target: 'debouncing',
|
|
134
|
+
actions: 'setAmount'
|
|
135
|
+
}
|
|
136
|
+
],
|
|
111
137
|
KEY_IN: {
|
|
112
138
|
target: 'debouncing',
|
|
113
139
|
actions: 'setAmount',
|
|
@@ -164,6 +190,7 @@ export default function (request) {
|
|
|
164
190
|
selectedQrcode: qrcodes[0],
|
|
165
191
|
currentMethod: qrcodes[0].method,
|
|
166
192
|
options: qrcodes[0].optional,
|
|
193
|
+
grandTotalEnable: qrcodes[0].grandTotalEnable,
|
|
167
194
|
}
|
|
168
195
|
}),
|
|
169
196
|
setQrcode: assign((context, event) => {
|
|
@@ -171,6 +198,7 @@ export default function (request) {
|
|
|
171
198
|
selectedQrcode: event.data,
|
|
172
199
|
currentMethod: event.data.method,
|
|
173
200
|
options: event.data.optional,
|
|
201
|
+
grandTotalEnable: event.data.grandTotalEnable,
|
|
174
202
|
}
|
|
175
203
|
}),
|
|
176
204
|
addAmount: assign((context, event) => {
|
|
@@ -4,8 +4,6 @@ import payment from '../api/payment.js'
|
|
|
4
4
|
import common from '../api/common.js'
|
|
5
5
|
import user from '../api/user.js'
|
|
6
6
|
|
|
7
|
-
// const findLastIndex = require('lodash/findLastIndex')
|
|
8
|
-
|
|
9
7
|
export default function (request) {
|
|
10
8
|
const { appSecret } = request.config
|
|
11
9
|
return createMachine(
|
|
@@ -34,6 +32,12 @@ export default function (request) {
|
|
|
34
32
|
|
|
35
33
|
withdrawDistance: null,
|
|
36
34
|
withdrawAmount: null,
|
|
35
|
+
|
|
36
|
+
// otp
|
|
37
|
+
requestId: null,
|
|
38
|
+
status: null,
|
|
39
|
+
target: null,
|
|
40
|
+
ttl: null,
|
|
37
41
|
},
|
|
38
42
|
states: {
|
|
39
43
|
loading: {
|
|
@@ -80,9 +84,14 @@ export default function (request) {
|
|
|
80
84
|
converting: {
|
|
81
85
|
invoke: {
|
|
82
86
|
src: 'submitWithdrawFree',
|
|
83
|
-
onDone:
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
onDone: [
|
|
88
|
+
{
|
|
89
|
+
target: '#withdraw_vn.otp',
|
|
90
|
+
actions: 'setOtp',
|
|
91
|
+
cond: 'isOtpRequired',
|
|
92
|
+
},
|
|
93
|
+
{ target: 'converted' },
|
|
94
|
+
],
|
|
86
95
|
onError: {
|
|
87
96
|
target: 'convertible',
|
|
88
97
|
},
|
|
@@ -132,9 +141,16 @@ export default function (request) {
|
|
|
132
141
|
submitting: {
|
|
133
142
|
invoke: {
|
|
134
143
|
src: 'submitWithdraw',
|
|
135
|
-
onDone:
|
|
136
|
-
|
|
137
|
-
|
|
144
|
+
onDone: [
|
|
145
|
+
{
|
|
146
|
+
target: '#withdraw_vn.otp',
|
|
147
|
+
actions: 'setOtp',
|
|
148
|
+
cond: 'isOtpRequired',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
target: 'submitted',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
138
154
|
onError: {
|
|
139
155
|
target: 'withdrawable',
|
|
140
156
|
},
|
|
@@ -148,6 +164,7 @@ export default function (request) {
|
|
|
148
164
|
invoke: {
|
|
149
165
|
src: 'fetchPaymentData',
|
|
150
166
|
onDone: {
|
|
167
|
+
target: 'inProcessing',
|
|
151
168
|
actions: 'setPaymentData',
|
|
152
169
|
},
|
|
153
170
|
onError: {
|
|
@@ -157,6 +174,71 @@ export default function (request) {
|
|
|
157
174
|
},
|
|
158
175
|
},
|
|
159
176
|
},
|
|
177
|
+
otp: {
|
|
178
|
+
type: 'parallel',
|
|
179
|
+
states: {
|
|
180
|
+
countdown: {
|
|
181
|
+
after: {
|
|
182
|
+
1000: {
|
|
183
|
+
target: 'countdown',
|
|
184
|
+
actions: 'decreaseTtl',
|
|
185
|
+
cond: (context) => context.ttl > 0,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
verification: {
|
|
190
|
+
initial: 'idle',
|
|
191
|
+
states: {
|
|
192
|
+
idle: {
|
|
193
|
+
on: {
|
|
194
|
+
ACKNOWLEDGE: {
|
|
195
|
+
target: 'acknowledging',
|
|
196
|
+
},
|
|
197
|
+
RESET_OTP: {
|
|
198
|
+
target: 'reset',
|
|
199
|
+
},
|
|
200
|
+
BACK: [
|
|
201
|
+
{
|
|
202
|
+
target: '#withdraw_vn.free.convertible',
|
|
203
|
+
cond: 'isFree',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
target: '#withdraw_vn.cash.withdrawable',
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
acknowledging: {
|
|
212
|
+
invoke: {
|
|
213
|
+
src: 'acknowledge',
|
|
214
|
+
onDone: [
|
|
215
|
+
{
|
|
216
|
+
target: '#withdraw_vn.free.converted',
|
|
217
|
+
cond: 'isFree',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
target: '#withdraw_vn.cash.submitted',
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
onError: {
|
|
224
|
+
target: 'idle',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
reset: {
|
|
229
|
+
invoke: {
|
|
230
|
+
src: 'resetOtp',
|
|
231
|
+
onDone: {
|
|
232
|
+
target: 'idle',
|
|
233
|
+
actions: 'setVerificationData',
|
|
234
|
+
},
|
|
235
|
+
onError: { target: 'idle' },
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
160
242
|
fail: {},
|
|
161
243
|
},
|
|
162
244
|
on: {
|
|
@@ -223,6 +305,29 @@ export default function (request) {
|
|
|
223
305
|
availableWithdrawAmount,
|
|
224
306
|
}
|
|
225
307
|
}),
|
|
308
|
+
setOtp: assign((context, event) => {
|
|
309
|
+
const { requestId, status, target, ttl } = event.data
|
|
310
|
+
return {
|
|
311
|
+
requestId,
|
|
312
|
+
status,
|
|
313
|
+
target,
|
|
314
|
+
ttl,
|
|
315
|
+
}
|
|
316
|
+
}),
|
|
317
|
+
decreaseTtl: assign((context, evnet) => {
|
|
318
|
+
const second = context.ttl
|
|
319
|
+
return {
|
|
320
|
+
ttl: Math.max(second - 1, 0),
|
|
321
|
+
}
|
|
322
|
+
}),
|
|
323
|
+
setVerificationData: assign((context, event) => {
|
|
324
|
+
const { requestId, ttl, target } = event.data
|
|
325
|
+
return {
|
|
326
|
+
requestId,
|
|
327
|
+
ttl,
|
|
328
|
+
target,
|
|
329
|
+
}
|
|
330
|
+
}),
|
|
226
331
|
},
|
|
227
332
|
guards: {
|
|
228
333
|
isFree: (context, event) => {
|
|
@@ -252,6 +357,9 @@ export default function (request) {
|
|
|
252
357
|
const minWithdrawAmount = paymentDetail[0]?.minimum || 0
|
|
253
358
|
return withdrawLimit !== 0 || balance < minWithdrawAmount
|
|
254
359
|
},
|
|
360
|
+
isOtpRequired: (context, event) => {
|
|
361
|
+
return event.data?.status === 'otp-verifying'
|
|
362
|
+
},
|
|
255
363
|
},
|
|
256
364
|
services: {
|
|
257
365
|
fetchInitData: async (context, event) => {
|
|
@@ -299,6 +407,15 @@ export default function (request) {
|
|
|
299
407
|
submitWithdrawFree: async (context, event) => {
|
|
300
408
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
301
409
|
},
|
|
410
|
+
resetOtp: async (context, event) => {
|
|
411
|
+
const { requestId, target } = context
|
|
412
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
413
|
+
},
|
|
414
|
+
acknowledge: async (context, event) => {
|
|
415
|
+
const { requestId, target } = context
|
|
416
|
+
const code = event.data
|
|
417
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
418
|
+
},
|
|
302
419
|
},
|
|
303
420
|
}
|
|
304
421
|
)
|