@jetthai/cuora 1.1.65-doubleWallet-2 → 1.1.65
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 -6
- package/dist/bundle.mjs +533 -701
- package/package.json +1 -1
- package/src/api/payment.js +0 -2
- package/src/machine/activity/activity.js +1 -1
- package/src/machine/deposit/crypto.js +19 -36
- package/src/machine/deposit/crypto_button.js +126 -103
- package/src/machine/deposit/direct.js +7 -69
- package/src/machine/deposit/float.js +27 -94
- package/src/machine/deposit/loadcard_vn.js +146 -114
- package/src/machine/deposit/manual_vn.js +7 -39
- package/src/machine/deposit/qrcode_v2.js +171 -155
- package/src/machine/deposit/vpay.js +26 -89
- package/src/machine/promotions.js +1 -1
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
-
import common from '../../api/common.js'
|
|
4
3
|
|
|
5
4
|
export default function (request) {
|
|
6
|
-
const { appSecret } = request.config
|
|
7
5
|
return createMachine(
|
|
8
6
|
{
|
|
9
7
|
id: 'vpay',
|
|
@@ -11,7 +9,6 @@ export default function (request) {
|
|
|
11
9
|
context: {
|
|
12
10
|
method: 'vpay',
|
|
13
11
|
userAccount: {},
|
|
14
|
-
siteConfig: null,
|
|
15
12
|
amount: 0,
|
|
16
13
|
|
|
17
14
|
bankList: [],
|
|
@@ -26,9 +23,6 @@ export default function (request) {
|
|
|
26
23
|
calculatedAmount: 0,
|
|
27
24
|
|
|
28
25
|
grandTotalEnable: 1,
|
|
29
|
-
|
|
30
|
-
promotion: null,
|
|
31
|
-
bonusPreviewData: [],
|
|
32
26
|
},
|
|
33
27
|
states: {
|
|
34
28
|
loading: {
|
|
@@ -59,7 +53,7 @@ export default function (request) {
|
|
|
59
53
|
actions: ['setInitialization', 'setPreviousOrder'],
|
|
60
54
|
cond: 'hasPreviousOrder',
|
|
61
55
|
},
|
|
62
|
-
{ target: '#vpay.
|
|
56
|
+
{ target: '#vpay.loaded', actions: 'setInitialization' },
|
|
63
57
|
],
|
|
64
58
|
onError: {
|
|
65
59
|
target: '#vpay.unavailable',
|
|
@@ -68,31 +62,6 @@ export default function (request) {
|
|
|
68
62
|
},
|
|
69
63
|
},
|
|
70
64
|
},
|
|
71
|
-
checking: {
|
|
72
|
-
always: [
|
|
73
|
-
{
|
|
74
|
-
target: 'fetching',
|
|
75
|
-
cond: (context, event) => {
|
|
76
|
-
const { siteConfig = {}, promotion = {} } = context
|
|
77
|
-
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
78
|
-
return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{ target: 'loaded' },
|
|
82
|
-
],
|
|
83
|
-
},
|
|
84
|
-
fetching: {
|
|
85
|
-
invoke: {
|
|
86
|
-
src: 'fetchBonusPreview',
|
|
87
|
-
onDone: {
|
|
88
|
-
target: 'loaded',
|
|
89
|
-
actions: 'setBonusPreview',
|
|
90
|
-
},
|
|
91
|
-
onError: {
|
|
92
|
-
target: 'loaded',
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
65
|
loaded: {
|
|
97
66
|
entry: 'reset',
|
|
98
67
|
on: {
|
|
@@ -100,7 +69,7 @@ export default function (request) {
|
|
|
100
69
|
{
|
|
101
70
|
target: 'debouncing',
|
|
102
71
|
actions: 'addAmount',
|
|
103
|
-
cond:
|
|
72
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
104
73
|
},
|
|
105
74
|
{
|
|
106
75
|
target: 'debouncing',
|
|
@@ -111,10 +80,6 @@ export default function (request) {
|
|
|
111
80
|
target: 'calculating',
|
|
112
81
|
actions: 'setAmount',
|
|
113
82
|
},
|
|
114
|
-
CLEAR_CALCULATION: {
|
|
115
|
-
target: 'debouncing',
|
|
116
|
-
actions: 'clearCalculation',
|
|
117
|
-
},
|
|
118
83
|
},
|
|
119
84
|
},
|
|
120
85
|
debouncing: {
|
|
@@ -123,7 +88,7 @@ export default function (request) {
|
|
|
123
88
|
{
|
|
124
89
|
target: 'debouncing',
|
|
125
90
|
actions: 'addAmount',
|
|
126
|
-
cond:
|
|
91
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
127
92
|
},
|
|
128
93
|
{
|
|
129
94
|
target: 'debouncing',
|
|
@@ -134,6 +99,9 @@ export default function (request) {
|
|
|
134
99
|
target: 'debouncing',
|
|
135
100
|
actions: 'setAmount',
|
|
136
101
|
},
|
|
102
|
+
BACK: {
|
|
103
|
+
target: 'loaded',
|
|
104
|
+
},
|
|
137
105
|
},
|
|
138
106
|
after: {
|
|
139
107
|
1000: {
|
|
@@ -148,7 +116,7 @@ export default function (request) {
|
|
|
148
116
|
{
|
|
149
117
|
target: 'debouncing',
|
|
150
118
|
actions: 'addAmount',
|
|
151
|
-
cond:
|
|
119
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
152
120
|
},
|
|
153
121
|
{
|
|
154
122
|
target: 'debouncing',
|
|
@@ -159,12 +127,11 @@ export default function (request) {
|
|
|
159
127
|
target: 'debouncing',
|
|
160
128
|
actions: 'setAmount',
|
|
161
129
|
},
|
|
162
|
-
|
|
130
|
+
CALCULATE: {
|
|
163
131
|
target: 'debouncing',
|
|
164
|
-
actions: 'clearCalculation',
|
|
165
132
|
},
|
|
166
|
-
|
|
167
|
-
|
|
133
|
+
BACK: {
|
|
134
|
+
target: 'loaded',
|
|
168
135
|
},
|
|
169
136
|
},
|
|
170
137
|
},
|
|
@@ -186,7 +153,7 @@ export default function (request) {
|
|
|
186
153
|
{
|
|
187
154
|
target: 'debouncing',
|
|
188
155
|
actions: 'addAmount',
|
|
189
|
-
cond:
|
|
156
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
190
157
|
},
|
|
191
158
|
{
|
|
192
159
|
target: 'debouncing',
|
|
@@ -200,22 +167,19 @@ export default function (request) {
|
|
|
200
167
|
CONFIRM: {
|
|
201
168
|
target: 'submitting',
|
|
202
169
|
},
|
|
170
|
+
BACK: {
|
|
171
|
+
target: 'loaded',
|
|
172
|
+
},
|
|
203
173
|
CLEAR_CALCULATION: {
|
|
204
174
|
target: 'debouncing',
|
|
205
175
|
actions: 'clearCalculation',
|
|
206
176
|
},
|
|
207
|
-
CLEAR: {
|
|
208
|
-
actions: 'setAmount',
|
|
209
|
-
},
|
|
210
177
|
},
|
|
211
178
|
},
|
|
212
179
|
submitting: {
|
|
213
180
|
invoke: {
|
|
214
181
|
src: 'submitDeposit',
|
|
215
|
-
onDone: {
|
|
216
|
-
target: 'submitted',
|
|
217
|
-
actions: 'setOrder',
|
|
218
|
-
},
|
|
182
|
+
onDone: { target: 'submitted', actions: 'setOrder' },
|
|
219
183
|
onError: {
|
|
220
184
|
target: 'calculated',
|
|
221
185
|
},
|
|
@@ -225,11 +189,6 @@ export default function (request) {
|
|
|
225
189
|
accountUnbound: {},
|
|
226
190
|
unavailable: {},
|
|
227
191
|
},
|
|
228
|
-
on: {
|
|
229
|
-
SET_PROMOTION: {
|
|
230
|
-
actions: 'setPromotion',
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
192
|
},
|
|
234
193
|
{
|
|
235
194
|
actions: {
|
|
@@ -238,11 +197,6 @@ export default function (request) {
|
|
|
238
197
|
userAccount: event.data.bankInfo?.[0],
|
|
239
198
|
}
|
|
240
199
|
}),
|
|
241
|
-
setBonusPreview: assign((context, event) => {
|
|
242
|
-
return {
|
|
243
|
-
bonusPreviewData: event.data.bonus,
|
|
244
|
-
}
|
|
245
|
-
}),
|
|
246
200
|
setOrder: assign((context, event) => {
|
|
247
201
|
const { amount, qrcode, vpayId } = event.data
|
|
248
202
|
return {
|
|
@@ -260,10 +214,9 @@ export default function (request) {
|
|
|
260
214
|
}
|
|
261
215
|
}),
|
|
262
216
|
setInitialization: assign((context, event) => {
|
|
263
|
-
const {
|
|
217
|
+
const { housePayment, bankList } = event.data
|
|
264
218
|
const { optional, minimum, maximum, grandTotalEnable } = housePayment
|
|
265
219
|
return {
|
|
266
|
-
siteConfig,
|
|
267
220
|
options: optional,
|
|
268
221
|
minimum,
|
|
269
222
|
maximum,
|
|
@@ -271,12 +224,6 @@ export default function (request) {
|
|
|
271
224
|
grandTotalEnable,
|
|
272
225
|
}
|
|
273
226
|
}),
|
|
274
|
-
setPromotion: assign((context, event) => {
|
|
275
|
-
const promotion = event.data
|
|
276
|
-
return {
|
|
277
|
-
promotion,
|
|
278
|
-
}
|
|
279
|
-
}),
|
|
280
227
|
addAmount: assign((context, event) => {
|
|
281
228
|
const { amount, maximum } = context
|
|
282
229
|
return {
|
|
@@ -286,6 +233,11 @@ export default function (request) {
|
|
|
286
233
|
setAmount: assign((context, event) => {
|
|
287
234
|
return { amount: event.data }
|
|
288
235
|
}),
|
|
236
|
+
clear: assign((context, event) => {
|
|
237
|
+
return {
|
|
238
|
+
amount: 0,
|
|
239
|
+
}
|
|
240
|
+
}),
|
|
289
241
|
setCalculation: assign((context, event) => {
|
|
290
242
|
return {
|
|
291
243
|
calculation: event.data,
|
|
@@ -304,48 +256,33 @@ export default function (request) {
|
|
|
304
256
|
hasPreviousOrder: (context, event) => {
|
|
305
257
|
return event.data.order?.qrcode
|
|
306
258
|
},
|
|
307
|
-
isGrandTotalEnable: (context, event) => {
|
|
308
|
-
return context.grandTotalEnable === 1
|
|
309
|
-
},
|
|
310
259
|
},
|
|
311
260
|
services: {
|
|
312
261
|
fetchPaymentInfo: async (context, event) => {
|
|
313
262
|
return await request.send(payment.getPaymentInfo())
|
|
314
263
|
},
|
|
315
264
|
initialize: async (context, event) => {
|
|
316
|
-
const [
|
|
317
|
-
request.send(common.getConfig({ appSecret })),
|
|
265
|
+
const [payments, bankList, order] = await Promise.all([
|
|
318
266
|
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
319
267
|
request.send(payment.getBankList('amb')),
|
|
320
268
|
request.send(payment.checkTransaction(context.method)),
|
|
321
269
|
])
|
|
322
|
-
|
|
323
|
-
return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
|
|
324
|
-
},
|
|
325
|
-
fetchBonusPreview: async (context, event) => {
|
|
326
|
-
const { method, promotion } = context
|
|
327
|
-
return await request.send({
|
|
328
|
-
paymentMethod: method,
|
|
329
|
-
promotionsNo: promotion?.activityNo,
|
|
330
|
-
})
|
|
270
|
+
return { housePayment: payments.find((payment) => payment.method === context.method), bankList, order }
|
|
331
271
|
},
|
|
332
272
|
submitDeposit: async (context, event) => {
|
|
333
|
-
const { method, amount
|
|
273
|
+
const { method, amount } = context
|
|
334
274
|
return await request.send(
|
|
335
275
|
payment.submitDepositTransaction({
|
|
336
276
|
method,
|
|
337
277
|
amount,
|
|
338
|
-
promotionsNo: promotion?.activityNo,
|
|
339
278
|
})
|
|
340
279
|
)
|
|
341
280
|
},
|
|
342
281
|
fetchCalculation: async (context, event) => {
|
|
343
|
-
const { method, amount, promotion } = context
|
|
344
282
|
return await request.send(
|
|
345
283
|
payment.getDepositExpectedResult({
|
|
346
|
-
method,
|
|
347
|
-
amount,
|
|
348
|
-
promotionsNo: promotion?.activityNo,
|
|
284
|
+
method: context.method,
|
|
285
|
+
amount: context.amount,
|
|
349
286
|
})
|
|
350
287
|
)
|
|
351
288
|
},
|