@jetthai/cuora 1.1.63 → 1.1.65-doubleWallet
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 +6 -0
- package/dist/bundle.mjs +678 -502
- package/package.json +1 -1
- package/src/api/payment.js +2 -0
- package/src/machine/activity/activity.js +1 -1
- package/src/machine/deposit/crypto.js +36 -19
- package/src/machine/deposit/crypto_button.js +114 -129
- package/src/machine/deposit/direct.js +69 -7
- package/src/machine/deposit/float.js +95 -27
- package/src/machine/deposit/loadcard_vn.js +99 -136
- package/src/machine/deposit/manual_vn.js +39 -7
- package/src/machine/deposit/qrcode_v2.js +136 -150
- package/src/machine/deposit/vpay.js +89 -24
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
+
import common from '../../api/common.js'
|
|
3
4
|
|
|
4
5
|
export default function (request) {
|
|
6
|
+
const { appSecret } = request.config
|
|
5
7
|
return createMachine(
|
|
6
8
|
{
|
|
7
9
|
id: 'float',
|
|
@@ -9,6 +11,7 @@ export default function (request) {
|
|
|
9
11
|
context: {
|
|
10
12
|
method: 'amb_float',
|
|
11
13
|
userAccount: {},
|
|
14
|
+
siteConfig: null,
|
|
12
15
|
amount: 0,
|
|
13
16
|
|
|
14
17
|
bankList: [],
|
|
@@ -25,6 +28,9 @@ export default function (request) {
|
|
|
25
28
|
|
|
26
29
|
grandTotalEnable: 1,
|
|
27
30
|
ttl: 120,
|
|
31
|
+
|
|
32
|
+
promotion: null,
|
|
33
|
+
bonusPreviewData: [],
|
|
28
34
|
},
|
|
29
35
|
states: {
|
|
30
36
|
loading: {
|
|
@@ -49,7 +55,10 @@ export default function (request) {
|
|
|
49
55
|
initializing: {
|
|
50
56
|
invoke: {
|
|
51
57
|
src: 'initialize',
|
|
52
|
-
onDone: {
|
|
58
|
+
onDone: {
|
|
59
|
+
target: '#float.loaded',
|
|
60
|
+
actions: 'setInitialization',
|
|
61
|
+
},
|
|
53
62
|
onError: {
|
|
54
63
|
target: '#float.unavailable',
|
|
55
64
|
},
|
|
@@ -58,22 +67,57 @@ export default function (request) {
|
|
|
58
67
|
},
|
|
59
68
|
},
|
|
60
69
|
loaded: {
|
|
70
|
+
type: 'parallel',
|
|
61
71
|
entry: 'reset',
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
states: {
|
|
73
|
+
bonusPreview: {
|
|
74
|
+
initial: 'checking',
|
|
75
|
+
states: {
|
|
76
|
+
checking: {
|
|
77
|
+
always: [
|
|
78
|
+
{
|
|
79
|
+
target: 'fetching',
|
|
80
|
+
cond: (context, event) => {
|
|
81
|
+
const { siteConfig = {}, promotion = {} } = context
|
|
82
|
+
return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{ target: 'end' },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
fetching: {
|
|
89
|
+
invoke: {
|
|
90
|
+
src: 'fetchBonusPreview',
|
|
91
|
+
onDone: {
|
|
92
|
+
target: 'end',
|
|
93
|
+
actions: 'setBonusPreview',
|
|
94
|
+
},
|
|
95
|
+
onError: {
|
|
96
|
+
target: 'end',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
end: {},
|
|
68
101
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
102
|
+
},
|
|
103
|
+
idle: {
|
|
104
|
+
on: {
|
|
105
|
+
SELECT_AMOUNT: [
|
|
106
|
+
{
|
|
107
|
+
target: '#float.debouncing',
|
|
108
|
+
actions: 'addAmount',
|
|
109
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
target: '#float.debouncing',
|
|
113
|
+
actions: 'setAmount',
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
KEY_IN: {
|
|
117
|
+
target: '#float.calculating',
|
|
118
|
+
actions: 'setAmount',
|
|
119
|
+
},
|
|
72
120
|
},
|
|
73
|
-
],
|
|
74
|
-
KEY_IN: {
|
|
75
|
-
target: 'calculating',
|
|
76
|
-
actions: 'setAmount',
|
|
77
121
|
},
|
|
78
122
|
},
|
|
79
123
|
},
|
|
@@ -197,6 +241,11 @@ export default function (request) {
|
|
|
197
241
|
accountUnbound: {},
|
|
198
242
|
unavailable: {},
|
|
199
243
|
},
|
|
244
|
+
on: {
|
|
245
|
+
SET_PROMOTION: {
|
|
246
|
+
actions: 'setPromotion',
|
|
247
|
+
},
|
|
248
|
+
},
|
|
200
249
|
},
|
|
201
250
|
{
|
|
202
251
|
actions: {
|
|
@@ -205,6 +254,17 @@ export default function (request) {
|
|
|
205
254
|
userAccount: event.data.bankInfo?.[0],
|
|
206
255
|
}
|
|
207
256
|
}),
|
|
257
|
+
setPromotion: assign((context, event) => {
|
|
258
|
+
const promotion = event.data
|
|
259
|
+
return {
|
|
260
|
+
promotion,
|
|
261
|
+
}
|
|
262
|
+
}),
|
|
263
|
+
setBonusPreview: assign((context, event) => {
|
|
264
|
+
return {
|
|
265
|
+
bonusPreviewData: event.data.bonus,
|
|
266
|
+
}
|
|
267
|
+
}),
|
|
208
268
|
setHouseBank: assign((context, event) => {
|
|
209
269
|
const { accountName, accountNumber, bankName, amount } = event.data
|
|
210
270
|
return {
|
|
@@ -215,9 +275,10 @@ export default function (request) {
|
|
|
215
275
|
}
|
|
216
276
|
}),
|
|
217
277
|
setInitialization: assign((context, event) => {
|
|
218
|
-
const { housePayment, bankList } = event.data
|
|
278
|
+
const { siteConfig, housePayment, bankList } = event.data
|
|
219
279
|
const { optional, minimum, maximum, grandTotalEnable } = housePayment
|
|
220
280
|
return {
|
|
281
|
+
siteConfig,
|
|
221
282
|
options: optional,
|
|
222
283
|
minimum,
|
|
223
284
|
maximum,
|
|
@@ -234,11 +295,6 @@ export default function (request) {
|
|
|
234
295
|
setAmount: assign((context, event) => {
|
|
235
296
|
return { amount: event.data }
|
|
236
297
|
}),
|
|
237
|
-
clear: assign((context, event) => {
|
|
238
|
-
return {
|
|
239
|
-
amount: 0,
|
|
240
|
-
}
|
|
241
|
-
}),
|
|
242
298
|
setCalculation: assign((context, event) => {
|
|
243
299
|
return {
|
|
244
300
|
calculation: event.data,
|
|
@@ -266,26 +322,38 @@ export default function (request) {
|
|
|
266
322
|
return await request.send(payment.getPaymentInfo())
|
|
267
323
|
},
|
|
268
324
|
initialize: async (context, event) => {
|
|
269
|
-
const [payments, bankList] = await Promise.all([
|
|
325
|
+
const [{ config }, payments, bankList] = await Promise.all([
|
|
326
|
+
request.send(common.getConfig({ appSecret })),
|
|
270
327
|
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
271
328
|
request.send(payment.getBankList('amb')),
|
|
272
329
|
])
|
|
273
|
-
|
|
330
|
+
const siteConfig = JSON.parse(window.atob(config))
|
|
331
|
+
return { siteConfig, housePayment: payments.find((payment) => payment.method === context.method), bankList }
|
|
332
|
+
},
|
|
333
|
+
fetchBonusPreview: async (context, event) => {
|
|
334
|
+
const { method, promotion } = context
|
|
335
|
+
return await request.send({
|
|
336
|
+
paymentMethod: method,
|
|
337
|
+
promotionsNo: promotion?.activityNo,
|
|
338
|
+
})
|
|
274
339
|
},
|
|
275
340
|
submitDeposit: async (context, event) => {
|
|
341
|
+
const { method, amount, promotion } = context
|
|
276
342
|
return await request.send(
|
|
277
343
|
payment.submitDepositTransaction({
|
|
278
|
-
method
|
|
279
|
-
amount
|
|
344
|
+
method,
|
|
345
|
+
amount,
|
|
346
|
+
promotionsNo: promotion?.activityNo,
|
|
280
347
|
})
|
|
281
348
|
)
|
|
282
349
|
},
|
|
283
350
|
fetchCalculation: async (context, event) => {
|
|
284
|
-
const {
|
|
351
|
+
const { method, amount, promotion } = context
|
|
285
352
|
return await request.send(
|
|
286
353
|
payment.getDepositExpectedResult({
|
|
287
|
-
method
|
|
288
|
-
amount
|
|
354
|
+
method,
|
|
355
|
+
amount,
|
|
356
|
+
promotionsNo: promotion?.activityNo,
|
|
289
357
|
})
|
|
290
358
|
)
|
|
291
359
|
},
|
|
@@ -25,143 +25,90 @@ export default function (request) {
|
|
|
25
25
|
currentMethod: null,
|
|
26
26
|
currentPayment: null,
|
|
27
27
|
result: null,
|
|
28
|
+
|
|
29
|
+
// use for wallet mode 4
|
|
30
|
+
promotion: null,
|
|
31
|
+
bonusPreviewData: [],
|
|
28
32
|
},
|
|
29
33
|
states: {
|
|
30
34
|
loading: {
|
|
31
35
|
invoke: {
|
|
32
36
|
src: 'fetchInitData',
|
|
33
37
|
onDone: {
|
|
34
|
-
target: '
|
|
35
|
-
actions:
|
|
38
|
+
target: 'loaded',
|
|
39
|
+
actions: 'setInitData',
|
|
36
40
|
},
|
|
37
41
|
onError: {
|
|
38
42
|
target: 'fail',
|
|
39
43
|
},
|
|
40
44
|
},
|
|
41
45
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
initial: 'loaded',
|
|
46
|
+
fail: {},
|
|
47
|
+
loaded: {
|
|
48
|
+
type: 'parallel',
|
|
49
|
+
entry: 'reset',
|
|
47
50
|
states: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
SELECT_AMOUNT: {
|
|
63
|
-
actions: 'setAmount',
|
|
64
|
-
},
|
|
65
|
-
CONFIRM: {
|
|
66
|
-
target: 'debouncing',
|
|
67
|
-
},
|
|
68
|
-
BACK: {
|
|
69
|
-
target: 'loaded',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
debouncing: {
|
|
74
|
-
on: {
|
|
75
|
-
SELECT_AMOUNT: {
|
|
76
|
-
target: 'debouncing',
|
|
77
|
-
actions: 'setAmount',
|
|
78
|
-
},
|
|
79
|
-
BACK: {
|
|
80
|
-
target: 'loaded',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
after: {
|
|
84
|
-
1000: {
|
|
85
|
-
target: 'calculating',
|
|
51
|
+
bonusPreview: {
|
|
52
|
+
initial: 'checking',
|
|
53
|
+
states: {
|
|
54
|
+
checking: {
|
|
55
|
+
always: [
|
|
56
|
+
{
|
|
57
|
+
target: 'fetching',
|
|
58
|
+
cond: (context, event) => {
|
|
59
|
+
const { siteConfig = {}, promotion = {} } = context
|
|
60
|
+
return siteConfig.bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{ target: 'end' },
|
|
64
|
+
],
|
|
86
65
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
BACK: {
|
|
100
|
-
target: 'loaded',
|
|
66
|
+
fetching: {
|
|
67
|
+
invoke: {
|
|
68
|
+
src: 'fetchBonusPreview',
|
|
69
|
+
onDone: {
|
|
70
|
+
target: 'end',
|
|
71
|
+
actions: 'setBonusPreview',
|
|
72
|
+
},
|
|
73
|
+
onError: {
|
|
74
|
+
target: 'end',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
101
77
|
},
|
|
78
|
+
end: {},
|
|
102
79
|
},
|
|
103
80
|
},
|
|
104
|
-
|
|
105
|
-
invoke: {
|
|
106
|
-
src: 'fetchCalculation',
|
|
107
|
-
onDone: {
|
|
108
|
-
target: 'submitting',
|
|
109
|
-
actions: 'setCalculation',
|
|
110
|
-
},
|
|
111
|
-
onError: {
|
|
112
|
-
target: 'calculable',
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
cardInfo: {
|
|
81
|
+
idle: {
|
|
117
82
|
on: {
|
|
118
|
-
INPUT_CARD_NUMBER: {
|
|
119
|
-
actions: 'setCardNumber',
|
|
120
|
-
},
|
|
121
|
-
INPUT_SERIAL_NUMBER: {
|
|
122
|
-
actions: 'setSerialNumber',
|
|
123
|
-
},
|
|
124
|
-
SUBMIT: {
|
|
125
|
-
target: 'submitting',
|
|
126
|
-
cond: 'isSubmittable',
|
|
127
|
-
},
|
|
128
83
|
SELECT_CARD: {
|
|
129
|
-
target: 'loaded',
|
|
130
84
|
actions: 'setCard',
|
|
131
85
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
submitted: {
|
|
147
|
-
on: {
|
|
148
|
-
BACK: {
|
|
149
|
-
target: 'loaded',
|
|
150
|
-
},
|
|
86
|
+
SELECT_AMOUNT: [
|
|
87
|
+
{
|
|
88
|
+
target: '#loadcard.pending',
|
|
89
|
+
actions: 'setAmount',
|
|
90
|
+
cond: 'isFreeWalletMode',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
target: '#loadcard.debouncing',
|
|
94
|
+
actions: 'setAmount',
|
|
95
|
+
},
|
|
96
|
+
],
|
|
151
97
|
},
|
|
152
98
|
},
|
|
153
99
|
},
|
|
154
100
|
},
|
|
155
|
-
|
|
156
|
-
entry: 'reset',
|
|
101
|
+
pending: {
|
|
157
102
|
on: {
|
|
158
|
-
SELECT_CARD: {
|
|
159
|
-
actions: 'setCard',
|
|
160
|
-
},
|
|
161
103
|
SELECT_AMOUNT: {
|
|
162
|
-
target: 'debouncing',
|
|
163
104
|
actions: 'setAmount',
|
|
164
105
|
},
|
|
106
|
+
CONFIRM: {
|
|
107
|
+
target: 'calculating',
|
|
108
|
+
},
|
|
109
|
+
BACK: {
|
|
110
|
+
target: 'loaded',
|
|
111
|
+
},
|
|
165
112
|
},
|
|
166
113
|
},
|
|
167
114
|
debouncing: {
|
|
@@ -171,7 +118,7 @@ export default function (request) {
|
|
|
171
118
|
actions: 'setAmount',
|
|
172
119
|
},
|
|
173
120
|
BACK: {
|
|
174
|
-
target: '
|
|
121
|
+
target: 'loaded',
|
|
175
122
|
},
|
|
176
123
|
},
|
|
177
124
|
after: {
|
|
@@ -180,22 +127,6 @@ export default function (request) {
|
|
|
180
127
|
},
|
|
181
128
|
},
|
|
182
129
|
},
|
|
183
|
-
fail: {},
|
|
184
|
-
calculable: {
|
|
185
|
-
entry: 'clearCalculation',
|
|
186
|
-
on: {
|
|
187
|
-
SELECT_AMOUNT: {
|
|
188
|
-
target: 'debouncing',
|
|
189
|
-
actions: 'setAmount',
|
|
190
|
-
},
|
|
191
|
-
CALCULATE: {
|
|
192
|
-
target: 'debouncing',
|
|
193
|
-
},
|
|
194
|
-
BACK: {
|
|
195
|
-
target: 'defaultMode',
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
130
|
calculating: {
|
|
200
131
|
invoke: {
|
|
201
132
|
src: 'fetchCalculation',
|
|
@@ -208,6 +139,18 @@ export default function (request) {
|
|
|
208
139
|
},
|
|
209
140
|
},
|
|
210
141
|
},
|
|
142
|
+
calculable: {
|
|
143
|
+
entry: 'clearCalculation',
|
|
144
|
+
on: {
|
|
145
|
+
SELECT_AMOUNT: {
|
|
146
|
+
target: 'debouncing',
|
|
147
|
+
actions: 'setAmount',
|
|
148
|
+
},
|
|
149
|
+
BACK: {
|
|
150
|
+
target: 'loaded',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
211
154
|
calculated: {
|
|
212
155
|
on: {
|
|
213
156
|
SELECT_AMOUNT: {
|
|
@@ -224,7 +167,7 @@ export default function (request) {
|
|
|
224
167
|
},
|
|
225
168
|
],
|
|
226
169
|
BACK: {
|
|
227
|
-
target: '
|
|
170
|
+
target: 'loaded',
|
|
228
171
|
},
|
|
229
172
|
CLEAR_CALCULATION: {
|
|
230
173
|
target: 'debouncing',
|
|
@@ -245,7 +188,7 @@ export default function (request) {
|
|
|
245
188
|
cond: 'isSubmittable',
|
|
246
189
|
},
|
|
247
190
|
SELECT_CARD: {
|
|
248
|
-
target: '
|
|
191
|
+
target: 'loaded',
|
|
249
192
|
actions: 'setCard',
|
|
250
193
|
},
|
|
251
194
|
},
|
|
@@ -258,18 +201,23 @@ export default function (request) {
|
|
|
258
201
|
actions: 'setResult',
|
|
259
202
|
},
|
|
260
203
|
onError: {
|
|
261
|
-
target: '
|
|
204
|
+
target: 'loaded',
|
|
262
205
|
},
|
|
263
206
|
},
|
|
264
207
|
},
|
|
265
208
|
submitted: {
|
|
266
209
|
on: {
|
|
267
210
|
BACK: {
|
|
268
|
-
target: '
|
|
211
|
+
target: 'loaded',
|
|
269
212
|
},
|
|
270
213
|
},
|
|
271
214
|
},
|
|
272
215
|
},
|
|
216
|
+
on: {
|
|
217
|
+
SET_PROMOTION: {
|
|
218
|
+
actions: 'setPromotion',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
273
221
|
},
|
|
274
222
|
{
|
|
275
223
|
actions: {
|
|
@@ -282,9 +230,10 @@ export default function (request) {
|
|
|
282
230
|
}
|
|
283
231
|
}),
|
|
284
232
|
setInitData: assign((context, event) => {
|
|
285
|
-
const { paymentDetail } = event.data
|
|
233
|
+
const { siteConfig, paymentDetail } = event.data
|
|
286
234
|
const cards = paymentDetail.filter((element) => element.category === context.currentCategory)
|
|
287
235
|
return {
|
|
236
|
+
siteConfig,
|
|
288
237
|
paymentDetail,
|
|
289
238
|
cards,
|
|
290
239
|
selectedCard: cards[0],
|
|
@@ -292,10 +241,9 @@ export default function (request) {
|
|
|
292
241
|
options: cards[0].optional,
|
|
293
242
|
}
|
|
294
243
|
}),
|
|
295
|
-
|
|
296
|
-
const { siteConfig } = event.data
|
|
244
|
+
setBonusPreview: assign((context, event) => {
|
|
297
245
|
return {
|
|
298
|
-
|
|
246
|
+
bonusPreviewData: event.data.bonus,
|
|
299
247
|
}
|
|
300
248
|
}),
|
|
301
249
|
setCard: assign((context, event) => {
|
|
@@ -333,9 +281,15 @@ export default function (request) {
|
|
|
333
281
|
result: event.data,
|
|
334
282
|
}
|
|
335
283
|
}),
|
|
284
|
+
setPromotion: assign((context, event) => {
|
|
285
|
+
const promotion = event.data
|
|
286
|
+
return {
|
|
287
|
+
promotion,
|
|
288
|
+
}
|
|
289
|
+
}),
|
|
336
290
|
},
|
|
337
291
|
guards: {
|
|
338
|
-
|
|
292
|
+
isFreeWalletMode: (context, event) => {
|
|
339
293
|
return context.siteConfig?.walletMode === '2'
|
|
340
294
|
},
|
|
341
295
|
isSubmittable: (context, event) => {
|
|
@@ -356,17 +310,25 @@ export default function (request) {
|
|
|
356
310
|
const siteConfig = JSON.parse(window.atob(config))
|
|
357
311
|
return { siteConfig, paymentDetail }
|
|
358
312
|
},
|
|
313
|
+
fetchBonusPreview: async (context, event) => {
|
|
314
|
+
const { currentMethod, promotion } = context
|
|
315
|
+
return await request.send({
|
|
316
|
+
paymentMethod: currentMethod,
|
|
317
|
+
promotionsNo: promotion?.activityNo,
|
|
318
|
+
})
|
|
319
|
+
},
|
|
359
320
|
fetchCalculation: async (context, event) => {
|
|
360
|
-
const { currentMethod, selectedAmount } = context
|
|
321
|
+
const { currentMethod, selectedAmount, promotion } = context
|
|
361
322
|
return await request.send(
|
|
362
323
|
payment.getDepositExpectedResult({
|
|
363
324
|
method: currentMethod,
|
|
364
325
|
amount: selectedAmount,
|
|
326
|
+
promotionsNo: promotion?.activityNo,
|
|
365
327
|
})
|
|
366
328
|
)
|
|
367
329
|
},
|
|
368
330
|
submitDeposit: async (context, event) => {
|
|
369
|
-
const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber } = context
|
|
331
|
+
const { currentMethod, selectedCard, selectedAmount, cardNumber, serialNumber, promotion } = context
|
|
370
332
|
return await request.send(
|
|
371
333
|
payment.submitDepositTransactionLoadcard({
|
|
372
334
|
method: currentMethod,
|
|
@@ -374,6 +336,7 @@ export default function (request) {
|
|
|
374
336
|
card_type: selectedCard.channel_id,
|
|
375
337
|
card_code: cardNumber,
|
|
376
338
|
card_seri: serialNumber,
|
|
339
|
+
promotionsNo: promotion?.activityNo,
|
|
377
340
|
})
|
|
378
341
|
)
|
|
379
342
|
},
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
|
+
import common from '../../api/common.js'
|
|
3
4
|
|
|
4
5
|
export default function (request) {
|
|
6
|
+
const { appSecret } = request.config
|
|
5
7
|
return createMachine(
|
|
6
8
|
{
|
|
7
9
|
id: 'manual',
|
|
8
10
|
initial: 'loading',
|
|
9
11
|
context: {
|
|
10
|
-
|
|
12
|
+
siteConfig: null,
|
|
13
|
+
paymentDetail: [],
|
|
11
14
|
|
|
12
15
|
houseBanks: [],
|
|
13
16
|
playerBanks: [],
|
|
@@ -73,6 +76,10 @@ export default function (request) {
|
|
|
73
76
|
states: {
|
|
74
77
|
promotion: {
|
|
75
78
|
always: [
|
|
79
|
+
{
|
|
80
|
+
target: 'idle',
|
|
81
|
+
cond: 'isDoubleWalletMode',
|
|
82
|
+
},
|
|
76
83
|
{
|
|
77
84
|
target: 'calculating',
|
|
78
85
|
actions: 'setPromotionDefaultAmount',
|
|
@@ -117,11 +124,29 @@ export default function (request) {
|
|
|
117
124
|
actions: 'clearCalculation',
|
|
118
125
|
},
|
|
119
126
|
TRANSACT: {
|
|
120
|
-
target: '
|
|
127
|
+
target: 'checking',
|
|
121
128
|
cond: 'isCalculated',
|
|
122
129
|
},
|
|
123
130
|
},
|
|
124
131
|
},
|
|
132
|
+
checking: {
|
|
133
|
+
always: [
|
|
134
|
+
{
|
|
135
|
+
target: 'pending',
|
|
136
|
+
cond: (context, event) => context.siteConfig?.walletMode === '4' && !!context.calculation,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
target: '#manual.step2',
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
},
|
|
143
|
+
pending: {
|
|
144
|
+
on: {
|
|
145
|
+
CONFIRM: {
|
|
146
|
+
target: '#manual.step2',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
125
150
|
step2: {
|
|
126
151
|
initial: 'idle',
|
|
127
152
|
states: {
|
|
@@ -204,15 +229,16 @@ export default function (request) {
|
|
|
204
229
|
{
|
|
205
230
|
actions: {
|
|
206
231
|
setInitData: assign((context, event) => {
|
|
207
|
-
const { paymentInfo,
|
|
232
|
+
const { siteConfig, paymentInfo, paymentDetail } = event.data
|
|
208
233
|
const bankInfoList = paymentInfo?.bankInfo || []
|
|
209
|
-
const currentPayment =
|
|
234
|
+
const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory)
|
|
210
235
|
const houseBanks = currentPayment.banks.map((item) => {
|
|
211
236
|
item.bankCode = item.bankName
|
|
212
237
|
return item
|
|
213
238
|
})
|
|
214
239
|
return {
|
|
215
|
-
|
|
240
|
+
siteConfig,
|
|
241
|
+
paymentDetail,
|
|
216
242
|
currentPayment,
|
|
217
243
|
method: currentPayment.method,
|
|
218
244
|
houseBanks,
|
|
@@ -313,6 +339,9 @@ export default function (request) {
|
|
|
313
339
|
}),
|
|
314
340
|
},
|
|
315
341
|
guards: {
|
|
342
|
+
isDoubleWalletMode: (context, event) => {
|
|
343
|
+
return context.siteConfig?.walletMode === '4'
|
|
344
|
+
},
|
|
316
345
|
isCalculable: (context, event) => {
|
|
317
346
|
const {
|
|
318
347
|
amount,
|
|
@@ -336,13 +365,16 @@ export default function (request) {
|
|
|
336
365
|
},
|
|
337
366
|
services: {
|
|
338
367
|
fetchInitData: async (context, event) => {
|
|
339
|
-
const [paymentInfo,
|
|
368
|
+
const [{ config }, paymentInfo, paymentDetail] = await Promise.all([
|
|
369
|
+
request.send(common.getConfig({ appSecret })),
|
|
340
370
|
request.send(payment.getPaymentInfo()),
|
|
341
371
|
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
342
372
|
])
|
|
373
|
+
const siteConfig = JSON.parse(window.atob(config))
|
|
343
374
|
return {
|
|
375
|
+
siteConfig,
|
|
344
376
|
paymentInfo,
|
|
345
|
-
|
|
377
|
+
paymentDetail,
|
|
346
378
|
}
|
|
347
379
|
},
|
|
348
380
|
fetchBanksList: async (context, event) => {
|