@jetthai/cuora 1.1.77-cash-1 → 1.1.77-cash-2
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
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
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.77-cash-2](https://github.com/jetthai/cuora-module/compare/v1.1.77-cash-1...v1.1.77-cash-2) (2023-04-18)
|
|
6
|
+
|
|
5
7
|
### [1.1.77-cash-1](https://github.com/jetthai/cuora-module/compare/v1.1.77-cash...v1.1.77-cash-1) (2023-04-16)
|
|
6
8
|
|
|
7
9
|
### [1.1.77-cash](https://github.com/jetthai/cuora-module/compare/v1.1.66-1...v1.1.77-cash) (2023-04-14)
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import manual_vn from './manual_vn.js'
|
|
2
2
|
import loadcard_vn from './loadcard_vn.js'
|
|
3
3
|
import qrcode_v2 from './qrcode_v2.js'
|
|
4
|
+
import qrcode_v_cash from './qrcode_v_cash.js'
|
|
4
5
|
import deposit_fc from './deposit_fc.js'
|
|
5
6
|
import crypto from './crypto.js'
|
|
6
7
|
import crypto_button from './crypto_button.js'
|
|
@@ -14,6 +15,7 @@ export default {
|
|
|
14
15
|
manual_vn,
|
|
15
16
|
loadcard_vn,
|
|
16
17
|
qrcode_v2,
|
|
18
|
+
qrcode_v_cash,
|
|
17
19
|
deposit_fc,
|
|
18
20
|
crypto,
|
|
19
21
|
crypto_button,
|
|
@@ -27,7 +27,7 @@ export default function (request) {
|
|
|
27
27
|
grandTotalEnable: 1,
|
|
28
28
|
|
|
29
29
|
// use for wallet mode 3 & 4
|
|
30
|
-
promotion:
|
|
30
|
+
promotion: null,
|
|
31
31
|
bonusPreviewData: [],
|
|
32
32
|
},
|
|
33
33
|
states: {
|
|
@@ -153,10 +153,6 @@ export default function (request) {
|
|
|
153
153
|
BACK: {
|
|
154
154
|
target: 'loaded',
|
|
155
155
|
},
|
|
156
|
-
INPUT: {
|
|
157
|
-
target: 'debouncing',
|
|
158
|
-
actions: 'setAmount',
|
|
159
|
-
},
|
|
160
156
|
},
|
|
161
157
|
},
|
|
162
158
|
debouncing: {
|
|
@@ -182,10 +178,6 @@ export default function (request) {
|
|
|
182
178
|
actions: 'setAmount',
|
|
183
179
|
},
|
|
184
180
|
],
|
|
185
|
-
INPUT: {
|
|
186
|
-
target: 'debouncing',
|
|
187
|
-
actions: 'setAmount',
|
|
188
|
-
},
|
|
189
181
|
BACK: {
|
|
190
182
|
target: 'loaded',
|
|
191
183
|
},
|
|
@@ -193,13 +185,6 @@ export default function (request) {
|
|
|
193
185
|
after: {
|
|
194
186
|
1000: {
|
|
195
187
|
target: 'calculating',
|
|
196
|
-
cond: (context, event) => {
|
|
197
|
-
if (context.selectedQrcode) {
|
|
198
|
-
return context.selectedQrcode.minimum <= context.selectedAmount && context.selectedAmount <= context.selectedQrcode.maximum
|
|
199
|
-
} else {
|
|
200
|
-
return false
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
188
|
},
|
|
204
189
|
},
|
|
205
190
|
},
|
|
@@ -292,14 +277,6 @@ export default function (request) {
|
|
|
292
277
|
target: 'debouncing',
|
|
293
278
|
actions: 'clearCalculation',
|
|
294
279
|
},
|
|
295
|
-
INPUT: {
|
|
296
|
-
target: 'debouncing',
|
|
297
|
-
actions: 'setAmount',
|
|
298
|
-
},
|
|
299
|
-
SELECT_QRCODE: {
|
|
300
|
-
target: 'debouncing',
|
|
301
|
-
actions: 'setQrcode',
|
|
302
|
-
},
|
|
303
280
|
},
|
|
304
281
|
},
|
|
305
282
|
submitting: {
|
|
@@ -351,7 +328,6 @@ export default function (request) {
|
|
|
351
328
|
setInitData: assign((context, event) => {
|
|
352
329
|
const { siteConfig, paymentDetail } = event.data
|
|
353
330
|
const qrcodes = paymentDetail.filter((element) => element.category === context.currentCategory)
|
|
354
|
-
console.log('qrcodes', qrcodes)
|
|
355
331
|
let selectedQrcode = null
|
|
356
332
|
if (siteConfig.walletMode === '4') {
|
|
357
333
|
selectedQrcode = qrcodes.find((qrcode) => parseFloat(`${qrcode.charge || 0}`) === 0)
|
|
@@ -383,7 +359,7 @@ export default function (request) {
|
|
|
383
359
|
}
|
|
384
360
|
}),
|
|
385
361
|
addAmount: assign((context, event) => {
|
|
386
|
-
return { selectedAmount:
|
|
362
|
+
return { selectedAmount: (context.selectedAmount || 0) + event.data }
|
|
387
363
|
}),
|
|
388
364
|
setAmount: assign((context, event) => {
|
|
389
365
|
return { selectedAmount: event.data }
|
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import payment from '../../api/payment.js'
|
|
3
3
|
import common from '../../api/common.js'
|
|
4
|
+
import { api } from '../../index.js'
|
|
5
|
+
|
|
6
|
+
const noBonus = {
|
|
7
|
+
promotionsNo: 'none',
|
|
8
|
+
activityTypeName: 'promotion',
|
|
9
|
+
minimumAmount: 0,
|
|
10
|
+
maximumAmount: -1,
|
|
11
|
+
turnoverLimitMultiple: 1,
|
|
12
|
+
template: 'Template_no_bonus',
|
|
13
|
+
promotionDetail: [],
|
|
14
|
+
attendEnable: true,
|
|
15
|
+
withdrawLimitDetail: [
|
|
16
|
+
{
|
|
17
|
+
greaterEqualThen: 0,
|
|
18
|
+
lessEqualThen: -1,
|
|
19
|
+
maxWithdrawAmount: -1,
|
|
20
|
+
turnoverLimitMultiple: 1,
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
limitGameDetail: [],
|
|
24
|
+
}
|
|
4
25
|
|
|
5
26
|
export default function (request) {
|
|
6
27
|
const { appSecret } = request.config
|
|
7
28
|
return createMachine(
|
|
8
29
|
{
|
|
9
|
-
id: '
|
|
30
|
+
id: 'qrcode_v_cash',
|
|
10
31
|
initial: 'loading',
|
|
11
32
|
context: {
|
|
12
33
|
siteConfig: null,
|
|
@@ -20,21 +41,19 @@ export default function (request) {
|
|
|
20
41
|
|
|
21
42
|
paymentDetail: [],
|
|
22
43
|
currentCategory: 'qrcode',
|
|
23
|
-
currentMethod: null,
|
|
24
44
|
|
|
25
45
|
result: null,
|
|
26
46
|
|
|
27
|
-
grandTotalEnable: 1,
|
|
28
|
-
|
|
29
47
|
promotion: undefined,
|
|
30
48
|
bonusPreviewData: [],
|
|
49
|
+
promotions: [noBonus],
|
|
31
50
|
},
|
|
32
51
|
states: {
|
|
33
52
|
loading: {
|
|
34
53
|
invoke: {
|
|
35
54
|
src: 'fetchInitData',
|
|
36
55
|
onDone: {
|
|
37
|
-
target: '
|
|
56
|
+
target: 'debouncing',
|
|
38
57
|
actions: 'setInitData',
|
|
39
58
|
},
|
|
40
59
|
onError: {
|
|
@@ -43,125 +62,32 @@ export default function (request) {
|
|
|
43
62
|
},
|
|
44
63
|
},
|
|
45
64
|
fail: {},
|
|
46
|
-
|
|
47
|
-
entry: 'reset',
|
|
48
|
-
on: {
|
|
49
|
-
SELECT_QRCODE: [
|
|
50
|
-
{
|
|
51
|
-
target: 'fetching',
|
|
52
|
-
actions: 'setQrcode',
|
|
53
|
-
cond: (context, event) => {
|
|
54
|
-
const { siteConfig = {}, promotion = {} } = context
|
|
55
|
-
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
56
|
-
return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
target: 'debouncing',
|
|
61
|
-
actions: ['setQrcode', 'setPromotionDefaultAmount'],
|
|
62
|
-
cond: (context, event) => context.siteConfig?.walletMode === '3' && context.promotion?.minimumAmount,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
actions: 'setQrcode',
|
|
66
|
-
},
|
|
67
|
-
],
|
|
68
|
-
SELECT_AMOUNT: [
|
|
69
|
-
{
|
|
70
|
-
target: 'pending',
|
|
71
|
-
actions: 'addAmount',
|
|
72
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
target: 'pending',
|
|
76
|
-
actions: 'setAmount',
|
|
77
|
-
cond: 'isFreeWalletMode',
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
target: 'debouncing',
|
|
81
|
-
actions: 'addAmount',
|
|
82
|
-
cond: 'isGrandTotalEnable',
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
target: 'debouncing',
|
|
86
|
-
actions: 'setAmount',
|
|
87
|
-
},
|
|
88
|
-
],
|
|
89
|
-
KEY_IN: [
|
|
90
|
-
{
|
|
91
|
-
target: 'pending',
|
|
92
|
-
actions: 'setAmount',
|
|
93
|
-
cond: 'isFreeWalletMode',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
target: 'calculating',
|
|
97
|
-
actions: 'setAmount',
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
pending: {
|
|
65
|
+
debouncing: {
|
|
103
66
|
on: {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
cond: 'isGrandTotalEnable',
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
actions: 'setAmount',
|
|
111
|
-
},
|
|
112
|
-
],
|
|
113
|
-
KEY_IN: {
|
|
114
|
-
actions: 'setAmount',
|
|
115
|
-
},
|
|
116
|
-
CONFIRM: {
|
|
117
|
-
target: 'calculating',
|
|
118
|
-
},
|
|
119
|
-
BACK: {
|
|
120
|
-
target: 'loaded',
|
|
67
|
+
SET_PROMOTION: {
|
|
68
|
+
target: 'debouncing',
|
|
69
|
+
actions: 'setPromotion',
|
|
121
70
|
},
|
|
122
|
-
|
|
71
|
+
SELECT_QRCODE: {
|
|
123
72
|
target: 'debouncing',
|
|
124
|
-
actions: '
|
|
73
|
+
actions: 'setQrcode',
|
|
125
74
|
},
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
debouncing: {
|
|
129
|
-
on: {
|
|
130
|
-
SELECT_AMOUNT: [
|
|
131
|
-
{
|
|
132
|
-
target: 'debouncing',
|
|
133
|
-
actions: 'addAmount',
|
|
134
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
target: 'debouncing',
|
|
138
|
-
actions: 'setAmount',
|
|
139
|
-
cond: 'isFreeWalletMode',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
target: 'debouncing',
|
|
143
|
-
actions: 'addAmount',
|
|
144
|
-
cond: 'isGrandTotalEnable',
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
target: 'debouncing',
|
|
148
|
-
actions: 'setAmount',
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
INPUT: {
|
|
75
|
+
SELECT_AMOUNT: {
|
|
152
76
|
target: 'debouncing',
|
|
153
77
|
actions: 'setAmount',
|
|
154
78
|
},
|
|
155
|
-
|
|
156
|
-
target: '
|
|
79
|
+
INPUT_AMOUNT: {
|
|
80
|
+
target: 'debouncing',
|
|
81
|
+
actions: 'inputAmount',
|
|
157
82
|
},
|
|
158
83
|
},
|
|
159
84
|
after: {
|
|
160
85
|
1000: {
|
|
161
86
|
target: 'calculating',
|
|
162
87
|
cond: (context, event) => {
|
|
163
|
-
|
|
164
|
-
|
|
88
|
+
const { selectedQrcode, selectedAmount } = context
|
|
89
|
+
if (selectedQrcode && selectedAmount) {
|
|
90
|
+
return selectedQrcode.minimum <= selectedAmount && selectedAmount <= selectedQrcode.maximum
|
|
165
91
|
} else {
|
|
166
92
|
return false
|
|
167
93
|
}
|
|
@@ -169,102 +95,38 @@ export default function (request) {
|
|
|
169
95
|
},
|
|
170
96
|
},
|
|
171
97
|
},
|
|
172
|
-
calculable: {
|
|
173
|
-
entry: 'clearCalculation',
|
|
174
|
-
on: {
|
|
175
|
-
SELECT_AMOUNT: [
|
|
176
|
-
{
|
|
177
|
-
target: 'pending',
|
|
178
|
-
actions: 'addAmount',
|
|
179
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
180
|
-
},
|
|
181
|
-
{
|
|
182
|
-
target: 'pending',
|
|
183
|
-
actions: 'setAmount',
|
|
184
|
-
cond: 'isFreeWalletMode',
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
target: 'debouncing',
|
|
188
|
-
actions: 'addAmount',
|
|
189
|
-
cond: 'isGrandTotalEnable',
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
target: 'debouncing',
|
|
193
|
-
actions: 'setAmount',
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
KEY_IN: {
|
|
197
|
-
target: 'calculating',
|
|
198
|
-
actions: 'setAmount',
|
|
199
|
-
},
|
|
200
|
-
BACK: {
|
|
201
|
-
target: 'loaded',
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
},
|
|
205
98
|
calculating: {
|
|
206
99
|
invoke: {
|
|
207
100
|
src: 'fetchCalculation',
|
|
208
|
-
onDone:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
cond: 'isFreeWalletMode',
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
target: 'calculated',
|
|
216
|
-
actions: 'setCalculation',
|
|
217
|
-
},
|
|
218
|
-
],
|
|
101
|
+
onDone: {
|
|
102
|
+
target: 'calculated',
|
|
103
|
+
actions: 'setCalculation',
|
|
104
|
+
},
|
|
219
105
|
onError: {
|
|
220
|
-
target: '
|
|
106
|
+
target: 'calculated',
|
|
221
107
|
},
|
|
222
108
|
},
|
|
223
109
|
},
|
|
224
110
|
calculated: {
|
|
225
111
|
on: {
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
actions: 'addAmount',
|
|
230
|
-
cond: (context, event) => context.siteConfig?.walletMode === '2' && context.grandTotalEnable === 1,
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
target: 'pending',
|
|
234
|
-
actions: 'setAmount',
|
|
235
|
-
cond: 'isFreeWalletMode',
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
target: 'debouncing',
|
|
239
|
-
actions: 'addAmount',
|
|
240
|
-
cond: 'isGrandTotalEnable',
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
target: 'debouncing',
|
|
244
|
-
actions: 'setAmount',
|
|
245
|
-
},
|
|
246
|
-
],
|
|
247
|
-
KEY_IN: {
|
|
248
|
-
target: 'calculating',
|
|
249
|
-
actions: 'setAmount',
|
|
250
|
-
},
|
|
251
|
-
CONFIRM: {
|
|
252
|
-
target: 'submitting',
|
|
253
|
-
},
|
|
254
|
-
BACK: {
|
|
255
|
-
target: 'loaded',
|
|
112
|
+
SET_PROMOTION: {
|
|
113
|
+
target: 'debouncing',
|
|
114
|
+
actions: 'setPromotion',
|
|
256
115
|
},
|
|
257
|
-
|
|
116
|
+
SELECT_QRCODE: {
|
|
258
117
|
target: 'debouncing',
|
|
259
|
-
actions: '
|
|
118
|
+
actions: 'setQrcode',
|
|
260
119
|
},
|
|
261
|
-
|
|
120
|
+
SELECT_AMOUNT: {
|
|
262
121
|
target: 'debouncing',
|
|
263
122
|
actions: 'setAmount',
|
|
264
123
|
},
|
|
265
|
-
|
|
124
|
+
INPUT_AMOUNT: {
|
|
266
125
|
target: 'debouncing',
|
|
267
|
-
actions: '
|
|
126
|
+
actions: 'inputAmount',
|
|
127
|
+
},
|
|
128
|
+
CONFIRM: {
|
|
129
|
+
target: 'submitting',
|
|
268
130
|
},
|
|
269
131
|
},
|
|
270
132
|
},
|
|
@@ -280,59 +142,32 @@ export default function (request) {
|
|
|
280
142
|
},
|
|
281
143
|
},
|
|
282
144
|
},
|
|
283
|
-
submitted: {
|
|
284
|
-
on: {
|
|
285
|
-
SELECT_QRCODE: [
|
|
286
|
-
{
|
|
287
|
-
target: 'fetching',
|
|
288
|
-
actions: 'setQrcode',
|
|
289
|
-
cond: (context, event) => {
|
|
290
|
-
const { siteConfig = {}, promotion = {} } = context
|
|
291
|
-
const { walletMode = '', bonusPreviewEnable = '0' } = siteConfig
|
|
292
|
-
return walletMode === '4' && bonusPreviewEnable === '1' && promotion.activityNo != 'none'
|
|
293
|
-
},
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
target: 'loaded',
|
|
297
|
-
actions: 'setQrcode',
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
},
|
|
301
|
-
},
|
|
302
|
-
},
|
|
303
|
-
on: {
|
|
304
|
-
SET_PROMOTION: {
|
|
305
|
-
actions: 'setPromotion',
|
|
306
|
-
},
|
|
145
|
+
submitted: {},
|
|
307
146
|
},
|
|
308
147
|
},
|
|
309
148
|
{
|
|
310
149
|
actions: {
|
|
311
|
-
reset: assign((context, event) => {
|
|
312
|
-
return {
|
|
313
|
-
selectedAmount: null,
|
|
314
|
-
calculation: null,
|
|
315
|
-
}
|
|
316
|
-
}),
|
|
317
150
|
setInitData: assign((context, event) => {
|
|
318
|
-
const { siteConfig, paymentDetail } = event.data
|
|
319
|
-
const
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
151
|
+
const { siteConfig, paymentDetail, promotions } = event.data
|
|
152
|
+
const promotion = promotions[0]
|
|
153
|
+
const qrcodes = paymentDetail
|
|
154
|
+
.filter((element) => element.category === context.currentCategory)
|
|
155
|
+
.map((qrcode) => {
|
|
156
|
+
qrcode.disabled = promotion.promotionsNo !== 'none' && qrcode.charge > 0
|
|
157
|
+
return qrcode
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
const selectedQrcode = qrcodes.find((qrcode) => !qrcode.disabled)
|
|
327
161
|
|
|
328
162
|
return {
|
|
329
163
|
siteConfig,
|
|
330
164
|
paymentDetail,
|
|
165
|
+
promotions,
|
|
166
|
+
promotion,
|
|
331
167
|
qrcodes,
|
|
332
168
|
selectedQrcode,
|
|
333
|
-
currentMethod: selectedQrcode?.method,
|
|
334
169
|
options: selectedQrcode?.optional,
|
|
335
|
-
|
|
170
|
+
selectedAmount: Math.max(promotion.minimumAmount, selectedQrcode?.minimum, 0),
|
|
336
171
|
}
|
|
337
172
|
}),
|
|
338
173
|
setBonusPreview: assign((context, event) => {
|
|
@@ -340,18 +175,41 @@ export default function (request) {
|
|
|
340
175
|
bonusPreviewData: event.data.bonus,
|
|
341
176
|
}
|
|
342
177
|
}),
|
|
343
|
-
|
|
178
|
+
setPromotion: assign((context, event) => {
|
|
179
|
+
const promotion = event.data
|
|
180
|
+
const qrcodes = context.qrcodes.map((qrcode) => {
|
|
181
|
+
qrcode.disabled = promotion.promotionsNo !== 'none' && qrcode.charge > 0
|
|
182
|
+
return qrcode
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
const selectedQrcode = qrcodes.find((qrcode) => !qrcode.disabled)
|
|
186
|
+
|
|
344
187
|
return {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
188
|
+
promotion,
|
|
189
|
+
qrcodes,
|
|
190
|
+
selectedQrcode,
|
|
191
|
+
options: selectedQrcode?.optional,
|
|
192
|
+
selectedAmount: Math.max(promotion.minimumAmount, selectedQrcode?.minimum, 0),
|
|
193
|
+
calculation: null,
|
|
349
194
|
}
|
|
350
195
|
}),
|
|
351
|
-
|
|
352
|
-
|
|
196
|
+
setQrcode: assign((context, event) => {
|
|
197
|
+
const selectedQrcode = event.data
|
|
198
|
+
return {
|
|
199
|
+
selectedQrcode,
|
|
200
|
+
options: selectedQrcode.optional,
|
|
201
|
+
selectedAmount: context.promotion.minimumAmount || 0,
|
|
202
|
+
calculation: null,
|
|
203
|
+
}
|
|
353
204
|
}),
|
|
354
205
|
setAmount: assign((context, event) => {
|
|
206
|
+
if (context.selectedQrcode?.grandTotalEnable === 1) {
|
|
207
|
+
return { selectedAmount: parseFloat(context.selectedAmount || 0) + parseFloat(event.data) }
|
|
208
|
+
} else {
|
|
209
|
+
return { selectedAmount: event.data }
|
|
210
|
+
}
|
|
211
|
+
}),
|
|
212
|
+
inputAmount: assign((context, event) => {
|
|
355
213
|
return { selectedAmount: event.data }
|
|
356
214
|
}),
|
|
357
215
|
setCalculation: assign((context, event) => {
|
|
@@ -369,59 +227,42 @@ export default function (request) {
|
|
|
369
227
|
result: event.data,
|
|
370
228
|
}
|
|
371
229
|
}),
|
|
372
|
-
setPromotion: assign((context, event) => {
|
|
373
|
-
const promotion = event.data
|
|
374
|
-
return {
|
|
375
|
-
promotion,
|
|
376
|
-
}
|
|
377
|
-
}),
|
|
378
|
-
setPromotionDefaultAmount: assign((context, event) => {
|
|
379
|
-
return {
|
|
380
|
-
selectedAmount: context.promotion.minimumAmount,
|
|
381
|
-
}
|
|
382
|
-
}),
|
|
383
|
-
},
|
|
384
|
-
guards: {
|
|
385
|
-
isFreeWalletMode: (context, event) => {
|
|
386
|
-
return context.siteConfig?.walletMode === '2'
|
|
387
|
-
},
|
|
388
|
-
isGrandTotalEnable: (context, event) => {
|
|
389
|
-
return context.grandTotalEnable === 1
|
|
390
|
-
},
|
|
391
230
|
},
|
|
231
|
+
guards: {},
|
|
392
232
|
services: {
|
|
393
233
|
fetchInitData: async (context, event) => {
|
|
394
|
-
const [{ config }, paymentDetail = []] = await Promise.all([
|
|
234
|
+
const [{ config }, paymentDetail = [], promotions] = await Promise.all([
|
|
395
235
|
request.send(common.getConfig({ appSecret })),
|
|
396
236
|
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
237
|
+
request.send(api.payment.getPromotionsList()),
|
|
397
238
|
])
|
|
398
239
|
const siteConfig = JSON.parse(window.atob(config))
|
|
399
|
-
return { siteConfig, paymentDetail }
|
|
240
|
+
return { siteConfig, paymentDetail, promotions: [noBonus, ...promotions] }
|
|
400
241
|
},
|
|
401
242
|
fetchBonusPreview: async (context, event) => {
|
|
402
|
-
const {
|
|
243
|
+
const { selectedQrcode, promotion } = context
|
|
403
244
|
return await request.send(
|
|
404
245
|
payment.getBonusPreview({
|
|
405
|
-
method:
|
|
246
|
+
method: selectedQrcode.method,
|
|
406
247
|
promotionsNo: promotion?.activityNo,
|
|
407
248
|
})
|
|
408
249
|
)
|
|
409
250
|
},
|
|
410
251
|
fetchCalculation: async (context, event) => {
|
|
411
|
-
const {
|
|
252
|
+
const { selectedQrcode, selectedAmount, promotion } = context
|
|
412
253
|
return await request.send(
|
|
413
254
|
payment.getDepositExpectedResult({
|
|
414
|
-
method:
|
|
255
|
+
method: selectedQrcode.method,
|
|
415
256
|
amount: selectedAmount,
|
|
416
257
|
promotionsNo: promotion?.activityNo,
|
|
417
258
|
})
|
|
418
259
|
)
|
|
419
260
|
},
|
|
420
261
|
submitDeposit: async (context, event) => {
|
|
421
|
-
const {
|
|
262
|
+
const { selectedQrcode, selectedAmount, promotion } = context
|
|
422
263
|
return await request.send(
|
|
423
264
|
payment.submitDepositTransaction({
|
|
424
|
-
method:
|
|
265
|
+
method: selectedQrcode.method,
|
|
425
266
|
amount: selectedAmount,
|
|
426
267
|
promotionsNo: promotion?.activityNo,
|
|
427
268
|
})
|
package/src/machine/user_info.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import user from '../api/user.js'
|
|
3
|
+
import payment from '../api/payment.js'
|
|
3
4
|
|
|
4
5
|
export default function (request) {
|
|
5
6
|
return createMachine(
|
|
@@ -8,6 +9,7 @@ export default function (request) {
|
|
|
8
9
|
initial: 'fetching',
|
|
9
10
|
context: {
|
|
10
11
|
userInfo: {},
|
|
12
|
+
bankList: [],
|
|
11
13
|
},
|
|
12
14
|
states: {
|
|
13
15
|
fetching: {
|
|
@@ -47,13 +49,17 @@ export default function (request) {
|
|
|
47
49
|
actions: {
|
|
48
50
|
setUserInfo: assign((context, event) => {
|
|
49
51
|
return {
|
|
50
|
-
userInfo: event.data,
|
|
52
|
+
userInfo: event.data.userInfo,
|
|
53
|
+
bankList: event.data.bankList,
|
|
51
54
|
}
|
|
52
55
|
}),
|
|
53
56
|
},
|
|
54
57
|
services: {
|
|
55
58
|
fetchUserInfo: async (context, event) => {
|
|
56
|
-
|
|
59
|
+
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
|
|
60
|
+
const method = paymentDetail.find((payment) => payment.category === 'manual').method
|
|
61
|
+
const [bankList, userInfo] = await Promise.all([request.send(payment.getBankList(method)), request.send(user.getUserInfo())])
|
|
62
|
+
return { bankList, userInfo }
|
|
57
63
|
},
|
|
58
64
|
updateUserInfo: async (context, event) => {
|
|
59
65
|
return await request.send(user.updateUserInfo(event.data))
|