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