@jetthai/cuora 1.1.333-dev-8 → 1.1.333
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 -12
- package/package.json +2 -3
- package/src/api/auth.js +2 -2
- package/src/api/common.js +0 -1
- package/src/api/game.js +0 -2
- package/src/lib/{fingerprint_v3_11_5.js → fingerprint_v3_11_2.js} +2480 -4656
- package/src/machine/auth.js +0 -16
- package/src/machine/deposit/index.js +0 -4
- package/src/machine/error.js +0 -10
- package/src/machine/index.js +0 -2
- package/src/machine/withdraw/withdraw_krway.js +20 -22
- package/src/machine/withdraw/withdraw_manual.js +22 -22
- package/src/machine/withdraw/withdraw_vn.js +20 -22
- package/src/machine/withdraw/withdraw_vn2.js +20 -22
- package/src/request/config.js +1 -16
- package/src/request/request.js +1 -0
- package/src/util/deviceToken.js +2 -1
- package/src/machine/deposit/virtual_bank_cash.js +0 -201
- package/src/machine/deposit/virtual_bank_vn.js +0 -289
- package/src/machine/websocket.js +0 -352
package/src/machine/auth.js
CHANGED
|
@@ -33,7 +33,6 @@ export default function (request) {
|
|
|
33
33
|
email: null,
|
|
34
34
|
username: null,
|
|
35
35
|
password: null,
|
|
36
|
-
additionalUserInfo: null,
|
|
37
36
|
},
|
|
38
37
|
countryAbbr: null,
|
|
39
38
|
userInfo: {},
|
|
@@ -272,10 +271,6 @@ export default function (request) {
|
|
|
272
271
|
LOGIN_APP: {
|
|
273
272
|
target: '.authenticationApp',
|
|
274
273
|
},
|
|
275
|
-
LOGIN_TELEGRAM: {
|
|
276
|
-
target: '.authentication',
|
|
277
|
-
actions: 'setLoginTelegram',
|
|
278
|
-
},
|
|
279
274
|
SET_PLAY: {
|
|
280
275
|
actions: 'setPlay',
|
|
281
276
|
},
|
|
@@ -358,17 +353,6 @@ export default function (request) {
|
|
|
358
353
|
},
|
|
359
354
|
}
|
|
360
355
|
}),
|
|
361
|
-
setLoginTelegram: assign((context, event) => {
|
|
362
|
-
const { loginType, additionalUserInfo, isSignature } = event.data
|
|
363
|
-
return {
|
|
364
|
-
loginData: {
|
|
365
|
-
provider: 'telegram',
|
|
366
|
-
loginType,
|
|
367
|
-
additionalUserInfo,
|
|
368
|
-
isSignature,
|
|
369
|
-
},
|
|
370
|
-
}
|
|
371
|
-
}),
|
|
372
356
|
fetchToken: assign((context, event) => {
|
|
373
357
|
const token = storage.get(tokenKey)
|
|
374
358
|
return {
|
|
@@ -22,8 +22,6 @@ import crypto_way from './crypto_way.js'
|
|
|
22
22
|
import crypto_bank_cash from './crypto_bank_cash.js'
|
|
23
23
|
import crypto_qrcode_cash from './crypto_qrcode_cash.js'
|
|
24
24
|
import crypto_way_cash from './crypto_way_cash.js'
|
|
25
|
-
import virtual_bank_vn from './virtual_bank_vn.js'
|
|
26
|
-
import virtual_bank_cash from './virtual_bank_cash.js'
|
|
27
25
|
|
|
28
26
|
export default {
|
|
29
27
|
manual_vn,
|
|
@@ -50,6 +48,4 @@ export default {
|
|
|
50
48
|
crypto_bank_cash,
|
|
51
49
|
crypto_qrcode_cash,
|
|
52
50
|
crypto_way_cash,
|
|
53
|
-
virtual_bank_vn,
|
|
54
|
-
virtual_bank_cash,
|
|
55
51
|
}
|
package/src/machine/error.js
CHANGED
|
@@ -26,16 +26,12 @@ export default function () {
|
|
|
26
26
|
{ target: 'logout', cond: 'isLogout' },
|
|
27
27
|
{ target: 'deposit', cond: 'isNoBalance' },
|
|
28
28
|
{ target: 'unfinishedGame', cond: 'isUnfinishedGame', actions: 'setUnfinishedGame' },
|
|
29
|
-
{ target: 'freeGameSettle', cond: 'isFreeGameSettle' },
|
|
30
|
-
{ target: 'freeGameGiveUp', cond: 'isFreeGameGiveUp' },
|
|
31
29
|
// { target: 'hall' },
|
|
32
30
|
],
|
|
33
31
|
},
|
|
34
32
|
logout: {},
|
|
35
33
|
deposit: {},
|
|
36
34
|
unfinishedGame: {},
|
|
37
|
-
freeGameSettle: {},
|
|
38
|
-
freeGameGiveUp: {},
|
|
39
35
|
// hall: {},
|
|
40
36
|
},
|
|
41
37
|
},
|
|
@@ -69,12 +65,6 @@ export default function () {
|
|
|
69
65
|
isUnfinishedGame: (context, event) => {
|
|
70
66
|
return context.error.extend?.includes?.('unfinished_')
|
|
71
67
|
},
|
|
72
|
-
isFreeGameSettle: (context, event) => {
|
|
73
|
-
return context.error.code === 'ERR_G124'
|
|
74
|
-
},
|
|
75
|
-
isFreeGameGiveUp: (context, event) => {
|
|
76
|
-
return context.error.code === 'ERR_G125'
|
|
77
|
-
},
|
|
78
68
|
},
|
|
79
69
|
services: {},
|
|
80
70
|
}
|
package/src/machine/index.js
CHANGED
|
@@ -38,7 +38,6 @@ import honor_board_cash from './honor_board_cash.js'
|
|
|
38
38
|
import honor_board from './honor_board.js'
|
|
39
39
|
import user_photo from './user_photo.js'
|
|
40
40
|
import navbar from './navbar.js'
|
|
41
|
-
import websocket from './websocket.js'
|
|
42
41
|
|
|
43
42
|
export default {
|
|
44
43
|
...activity,
|
|
@@ -81,5 +80,4 @@ export default {
|
|
|
81
80
|
user_photo,
|
|
82
81
|
navbar,
|
|
83
82
|
...withdraw,
|
|
84
|
-
websocket,
|
|
85
83
|
}
|
|
@@ -58,35 +58,39 @@ export default function (request) {
|
|
|
58
58
|
src: 'withdrawCheck',
|
|
59
59
|
onDone: [
|
|
60
60
|
{
|
|
61
|
-
target: '
|
|
61
|
+
target: 'notWithdrawMinDepositAmount',
|
|
62
|
+
cond: 'isNotWithdrawMinDepositAmount',
|
|
62
63
|
actions: assign((context, event) => {
|
|
63
64
|
return {
|
|
64
65
|
withdrawCheck: event.data,
|
|
65
66
|
}
|
|
66
67
|
}),
|
|
67
68
|
},
|
|
69
|
+
{
|
|
70
|
+
target: 'passWithdrawCooldownTime',
|
|
71
|
+
cond: 'isPassWithdrawCooldownTime',
|
|
72
|
+
actions: assign((context, event) => {
|
|
73
|
+
return {
|
|
74
|
+
withdrawCheck: event.data,
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
target: 'notWithdrawable',
|
|
80
|
+
cond: 'isNotWithdrawable',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
target: 'withdrawable',
|
|
84
|
+
},
|
|
68
85
|
],
|
|
69
86
|
onError: {
|
|
70
87
|
target: '#withdraw_krway.fail',
|
|
71
88
|
},
|
|
72
89
|
},
|
|
73
90
|
},
|
|
74
|
-
checkingWithdrawStatus: {
|
|
75
|
-
always: [
|
|
76
|
-
// 提款最低存款金額
|
|
77
|
-
{ target: 'notWithdrawMinDepositAmount', cond: 'isNotWithdrawMinDepositAmount' },
|
|
78
|
-
// 提款冷卻時間
|
|
79
|
-
{ target: 'passWithdrawCooldownTime', cond: 'isPassWithdrawCooldownTime' },
|
|
80
|
-
// 提款服務時間
|
|
81
|
-
{ target: 'withdrawServiceTime', cond: 'isNotWIthdrawServiceTime' },
|
|
82
|
-
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
83
|
-
{ target: 'withdrawable' },
|
|
84
|
-
],
|
|
85
|
-
},
|
|
86
91
|
notWithdrawMinDepositAmount: {},
|
|
87
92
|
passWithdrawCooldownTime: {},
|
|
88
93
|
inProcessing: {},
|
|
89
|
-
withdrawServiceTime: {},
|
|
90
94
|
notWithdrawable: {},
|
|
91
95
|
withdrawable: {
|
|
92
96
|
on: {
|
|
@@ -176,16 +180,10 @@ export default function (request) {
|
|
|
176
180
|
return !enableWithdraw || balance < minWithdrawAmount
|
|
177
181
|
},
|
|
178
182
|
isNotWithdrawMinDepositAmount: (context, event) => {
|
|
179
|
-
|
|
180
|
-
return !withdrawCheck?.passDepositeLimit
|
|
183
|
+
return !event.data?.passDepositeLimit
|
|
181
184
|
},
|
|
182
185
|
isPassWithdrawCooldownTime: (context, event) => {
|
|
183
|
-
|
|
184
|
-
return !withdrawCheck?.passWithdrawCooldownTime
|
|
185
|
-
},
|
|
186
|
-
isNotWIthdrawServiceTime: (context, event) => {
|
|
187
|
-
const { withdrawCheck } = context
|
|
188
|
-
return !withdrawCheck?.withdrawInServiceTime
|
|
186
|
+
return !event.data?.passWithdrawCooldownTime
|
|
189
187
|
},
|
|
190
188
|
},
|
|
191
189
|
services: {
|
|
@@ -168,35 +168,41 @@ export default function (request) {
|
|
|
168
168
|
invoke: {
|
|
169
169
|
src: 'withdrawCheck',
|
|
170
170
|
onDone: [
|
|
171
|
+
// 提款最低存款金額
|
|
171
172
|
{
|
|
172
|
-
target: '
|
|
173
|
+
target: 'notWithdrawMinDepositAmount',
|
|
174
|
+
cond: 'isNotWithdrawMinDepositAmount',
|
|
173
175
|
actions: assign((context, event) => {
|
|
174
176
|
return {
|
|
175
177
|
withdrawCheck: event.data,
|
|
176
178
|
}
|
|
177
179
|
}),
|
|
178
180
|
},
|
|
181
|
+
// 提款冷卻時間
|
|
182
|
+
{
|
|
183
|
+
target: 'passWithdrawCooldownTime',
|
|
184
|
+
cond: 'isPassWithdrawCooldownTime',
|
|
185
|
+
actions: assign((context, event) => {
|
|
186
|
+
return {
|
|
187
|
+
withdrawCheck: event.data,
|
|
188
|
+
}
|
|
189
|
+
}),
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
target: 'notWithdrawable',
|
|
193
|
+
cond: 'isNotWithdrawable',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
target: 'withdrawable',
|
|
197
|
+
},
|
|
179
198
|
],
|
|
180
199
|
onError: {
|
|
181
200
|
target: '#withdraw_manual.fail',
|
|
182
201
|
},
|
|
183
202
|
},
|
|
184
203
|
},
|
|
185
|
-
checkingWithdrawStatus: {
|
|
186
|
-
always: [
|
|
187
|
-
// 提款最低存款金額
|
|
188
|
-
{ target: 'notWithdrawMinDepositAmount', cond: 'isNotWithdrawMinDepositAmount' },
|
|
189
|
-
// 提款冷卻時間
|
|
190
|
-
{ target: 'passWithdrawCooldownTime', cond: 'isPassWithdrawCooldownTime' },
|
|
191
|
-
// 提款服務時間
|
|
192
|
-
{ target: 'withdrawServiceTime', cond: 'isNotWIthdrawServiceTime' },
|
|
193
|
-
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
194
|
-
{ target: 'withdrawable' },
|
|
195
|
-
],
|
|
196
|
-
},
|
|
197
204
|
notWithdrawMinDepositAmount: {},
|
|
198
205
|
passWithdrawCooldownTime: {},
|
|
199
|
-
withdrawServiceTime: {},
|
|
200
206
|
notWithdrawable: {},
|
|
201
207
|
unbound: {
|
|
202
208
|
// to bank_binding.js
|
|
@@ -519,16 +525,10 @@ export default function (request) {
|
|
|
519
525
|
return event.data?.status === 'otp-verifying'
|
|
520
526
|
},
|
|
521
527
|
isNotWithdrawMinDepositAmount: (context, event) => {
|
|
522
|
-
|
|
523
|
-
return !withdrawCheck?.passDepositeLimit
|
|
528
|
+
return !event.data?.passDepositeLimit
|
|
524
529
|
},
|
|
525
530
|
isPassWithdrawCooldownTime: (context, event) => {
|
|
526
|
-
|
|
527
|
-
return !withdrawCheck?.passWithdrawCooldownTime
|
|
528
|
-
},
|
|
529
|
-
isNotWIthdrawServiceTime: (context, event) => {
|
|
530
|
-
const { withdrawCheck } = context
|
|
531
|
-
return !withdrawCheck?.withdrawInServiceTime
|
|
531
|
+
return !event.data?.passWithdrawCooldownTime
|
|
532
532
|
},
|
|
533
533
|
},
|
|
534
534
|
services: {
|
|
@@ -142,34 +142,38 @@ export default function (request) {
|
|
|
142
142
|
src: 'withdrawCheck',
|
|
143
143
|
onDone: [
|
|
144
144
|
{
|
|
145
|
-
target: '
|
|
145
|
+
target: 'notWithdrawMinDepositAmount',
|
|
146
|
+
cond: 'isNotWithdrawMinDepositAmount',
|
|
146
147
|
actions: assign((context, event) => {
|
|
147
148
|
return {
|
|
148
149
|
withdrawCheck: event.data,
|
|
149
150
|
}
|
|
150
151
|
}),
|
|
151
152
|
},
|
|
153
|
+
{
|
|
154
|
+
target: 'passWithdrawCooldownTime',
|
|
155
|
+
cond: 'isPassWithdrawCooldownTime',
|
|
156
|
+
actions: assign((context, event) => {
|
|
157
|
+
return {
|
|
158
|
+
withdrawCheck: event.data,
|
|
159
|
+
}
|
|
160
|
+
}),
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
target: 'notWithdrawable',
|
|
164
|
+
cond: 'isNotWithdrawable',
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
target: 'withdrawable',
|
|
168
|
+
},
|
|
152
169
|
],
|
|
153
170
|
onError: {
|
|
154
171
|
target: '#withdraw_vn.fail',
|
|
155
172
|
},
|
|
156
173
|
},
|
|
157
174
|
},
|
|
158
|
-
checkingWithdrawStatus: {
|
|
159
|
-
always: [
|
|
160
|
-
// 提款最低存款金額
|
|
161
|
-
{ target: 'notWithdrawMinDepositAmount', cond: 'isNotWithdrawMinDepositAmount' },
|
|
162
|
-
// 提款冷卻時間
|
|
163
|
-
{ target: 'passWithdrawCooldownTime', cond: 'isPassWithdrawCooldownTime' },
|
|
164
|
-
// 提款服務時間
|
|
165
|
-
{ target: 'withdrawServiceTime', cond: 'isNotWIthdrawServiceTime' },
|
|
166
|
-
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
167
|
-
{ target: 'withdrawable' },
|
|
168
|
-
],
|
|
169
|
-
},
|
|
170
175
|
notWithdrawMinDepositAmount: {},
|
|
171
176
|
passWithdrawCooldownTime: {},
|
|
172
|
-
withdrawServiceTime: {},
|
|
173
177
|
notWithdrawable: {},
|
|
174
178
|
unbound: {
|
|
175
179
|
// to bank_binding.js
|
|
@@ -455,16 +459,10 @@ export default function (request) {
|
|
|
455
459
|
},
|
|
456
460
|
isNewWalletMode: (context, event) => context.siteConfig.walletMode > 0,
|
|
457
461
|
isNotWithdrawMinDepositAmount: (context, event) => {
|
|
458
|
-
|
|
459
|
-
return !withdrawCheck?.passDepositeLimit
|
|
462
|
+
return !event.data?.passDepositeLimit
|
|
460
463
|
},
|
|
461
464
|
isPassWithdrawCooldownTime: (context, event) => {
|
|
462
|
-
|
|
463
|
-
return !withdrawCheck?.passWithdrawCooldownTime
|
|
464
|
-
},
|
|
465
|
-
isNotWIthdrawServiceTime: (context, event) => {
|
|
466
|
-
const { withdrawCheck } = context
|
|
467
|
-
return !withdrawCheck?.withdrawInServiceTime
|
|
465
|
+
return !event.data?.passWithdrawCooldownTime
|
|
468
466
|
},
|
|
469
467
|
},
|
|
470
468
|
services: {
|
|
@@ -170,34 +170,38 @@ export default function (request) {
|
|
|
170
170
|
src: 'withdrawCheck',
|
|
171
171
|
onDone: [
|
|
172
172
|
{
|
|
173
|
-
target: '
|
|
173
|
+
target: 'notWithdrawMinDepositAmount',
|
|
174
|
+
cond: 'isNotWithdrawMinDepositAmount',
|
|
174
175
|
actions: assign((context, event) => {
|
|
175
176
|
return {
|
|
176
177
|
withdrawCheck: event.data,
|
|
177
178
|
}
|
|
178
179
|
}),
|
|
179
180
|
},
|
|
181
|
+
{
|
|
182
|
+
target: 'passWithdrawCooldownTime',
|
|
183
|
+
cond: 'isPassWithdrawCooldownTime',
|
|
184
|
+
actions: assign((context, event) => {
|
|
185
|
+
return {
|
|
186
|
+
withdrawCheck: event.data,
|
|
187
|
+
}
|
|
188
|
+
}),
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
target: 'notWithdrawable',
|
|
192
|
+
cond: 'isNotWithdrawable',
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
target: 'withdrawable',
|
|
196
|
+
},
|
|
180
197
|
],
|
|
181
198
|
onError: {
|
|
182
199
|
target: '#withdraw_vn2.fail',
|
|
183
200
|
},
|
|
184
201
|
},
|
|
185
202
|
},
|
|
186
|
-
checkingWithdrawStatus: {
|
|
187
|
-
always: [
|
|
188
|
-
// 提款最低存款金額
|
|
189
|
-
{ target: 'notWithdrawMinDepositAmount', cond: 'isNotWithdrawMinDepositAmount' },
|
|
190
|
-
// 提款冷卻時間
|
|
191
|
-
{ target: 'passWithdrawCooldownTime', cond: 'isPassWithdrawCooldownTime' },
|
|
192
|
-
// 提款服務時間
|
|
193
|
-
{ target: 'withdrawServiceTime', cond: 'isNotWIthdrawServiceTime' },
|
|
194
|
-
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
195
|
-
{ target: 'withdrawable' },
|
|
196
|
-
],
|
|
197
|
-
},
|
|
198
203
|
notWithdrawMinDepositAmount: {},
|
|
199
204
|
passWithdrawCooldownTime: {},
|
|
200
|
-
withdrawServiceTime: {},
|
|
201
205
|
notWithdrawable: {},
|
|
202
206
|
unbound: {
|
|
203
207
|
// to bank_binding.js
|
|
@@ -480,16 +484,10 @@ export default function (request) {
|
|
|
480
484
|
return event.data?.status === 'otp-verifying'
|
|
481
485
|
},
|
|
482
486
|
isNotWithdrawMinDepositAmount: (context, event) => {
|
|
483
|
-
|
|
484
|
-
return !withdrawCheck?.passDepositeLimit
|
|
487
|
+
return !event.data?.passDepositeLimit
|
|
485
488
|
},
|
|
486
489
|
isPassWithdrawCooldownTime: (context, event) => {
|
|
487
|
-
|
|
488
|
-
return !withdrawCheck?.passWithdrawCooldownTime
|
|
489
|
-
},
|
|
490
|
-
isNotWIthdrawServiceTime: (context, event) => {
|
|
491
|
-
const { withdrawCheck } = context
|
|
492
|
-
return !withdrawCheck?.withdrawInServiceTime
|
|
490
|
+
return !event.data?.passWithdrawCooldownTime
|
|
493
491
|
},
|
|
494
492
|
},
|
|
495
493
|
services: {
|
package/src/request/config.js
CHANGED
|
@@ -3,20 +3,7 @@ import urljoin from 'url-join'
|
|
|
3
3
|
// const urljoin = require('url-join')
|
|
4
4
|
|
|
5
5
|
export default class Config {
|
|
6
|
-
constructor({
|
|
7
|
-
apiURL,
|
|
8
|
-
apiVersion,
|
|
9
|
-
clientId,
|
|
10
|
-
appSecret,
|
|
11
|
-
platform,
|
|
12
|
-
version,
|
|
13
|
-
fpToken,
|
|
14
|
-
sentry,
|
|
15
|
-
defaultChannel,
|
|
16
|
-
defaultSubchannel,
|
|
17
|
-
socketURL,
|
|
18
|
-
bucketName,
|
|
19
|
-
}) {
|
|
6
|
+
constructor({ apiURL, apiVersion, clientId, appSecret, platform, version, fpToken, sentry, defaultChannel, defaultSubchannel }) {
|
|
20
7
|
this.apiURL = apiURL
|
|
21
8
|
this.apiVersion = apiVersion
|
|
22
9
|
this.clientId = clientId
|
|
@@ -28,8 +15,6 @@ export default class Config {
|
|
|
28
15
|
this.sentry = sentry
|
|
29
16
|
this.defaultChannel = defaultChannel
|
|
30
17
|
this.defaultSubchannel = defaultSubchannel
|
|
31
|
-
this.socketURL = socketURL
|
|
32
|
-
this.bucketName = bucketName
|
|
33
18
|
}
|
|
34
19
|
|
|
35
20
|
setApiURL(url) {
|
package/src/request/request.js
CHANGED
package/src/util/deviceToken.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import uniqBy from 'lodash/uniqBy'
|
|
2
|
-
import { load, defaultEndpoint } from '../lib/
|
|
2
|
+
import { load, defaultEndpoint } from '../lib/fingerprint_v3_11_2.js'
|
|
3
3
|
|
|
4
4
|
const reg = /fnapi\d*/
|
|
5
5
|
|
|
@@ -23,6 +23,7 @@ const getDeviceToken = async ({ fpToken, sentry, hosts, enable = true }) => {
|
|
|
23
23
|
throw new Error('[Device Token] No token from FingerprintJS.')
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
console.log('[Device Token]', `${dt} from ${endpoints}`)
|
|
26
27
|
sentry?.setTag('dt', dt)
|
|
27
28
|
} catch (error) {
|
|
28
29
|
console.error('[Device Token]', `${dt} from ${endpoints}`, error)
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { assign, createMachine } from 'xstate'
|
|
2
|
-
import payment from '@jetthai/cuora/src/api/payment.js'
|
|
3
|
-
import { max } from '@jetthai/cuora/src/util/index.js'
|
|
4
|
-
|
|
5
|
-
export default function (request, context) {
|
|
6
|
-
const { appSecret } = request.config
|
|
7
|
-
const { paymentDetail = [], promotion, selectedAmount, siteConfig = {} } = context || {}
|
|
8
|
-
|
|
9
|
-
return createMachine(
|
|
10
|
-
{
|
|
11
|
-
id: 'virtual_bank_cash',
|
|
12
|
-
initial: 'loading',
|
|
13
|
-
context: {
|
|
14
|
-
siteConfig,
|
|
15
|
-
paymentDetail,
|
|
16
|
-
promotion,
|
|
17
|
-
selectedAmount,
|
|
18
|
-
|
|
19
|
-
bindingPaymentList: {},
|
|
20
|
-
bindingPaymentInfo: {},
|
|
21
|
-
virtualBanks: {},
|
|
22
|
-
|
|
23
|
-
depositTime: null,
|
|
24
|
-
|
|
25
|
-
currentCategory: 'virtualBank',
|
|
26
|
-
method: null,
|
|
27
|
-
currentPayment: null,
|
|
28
|
-
currentApplyerBank: null,
|
|
29
|
-
|
|
30
|
-
calculation: null,
|
|
31
|
-
processing: null,
|
|
32
|
-
},
|
|
33
|
-
states: {
|
|
34
|
-
loading: {
|
|
35
|
-
invoke: {
|
|
36
|
-
src: 'fetchInitData',
|
|
37
|
-
onDone: {
|
|
38
|
-
target: 'checking',
|
|
39
|
-
actions: 'setInitData',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
checking: {
|
|
44
|
-
always: [
|
|
45
|
-
{
|
|
46
|
-
target: 'submitted',
|
|
47
|
-
cond: 'isProcessing',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
target: 'debouncing',
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
},
|
|
54
|
-
loaded: {},
|
|
55
|
-
debouncing: {
|
|
56
|
-
entry: 'clearCalculation',
|
|
57
|
-
after: {
|
|
58
|
-
1000: [{ target: 'calculating', cond: 'isCalculable' }, { target: 'loaded' }],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
calculating: {
|
|
62
|
-
invoke: {
|
|
63
|
-
src: 'fetchCalculation',
|
|
64
|
-
onDone: {
|
|
65
|
-
target: 'calculated',
|
|
66
|
-
actions: 'setCalculation',
|
|
67
|
-
},
|
|
68
|
-
onError: {
|
|
69
|
-
target: 'loaded',
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
calculated: {
|
|
74
|
-
on: {
|
|
75
|
-
SET_DEPOSIT_TIME: {
|
|
76
|
-
actions: 'setDepositTime',
|
|
77
|
-
},
|
|
78
|
-
SUBMIT: {
|
|
79
|
-
target: 'submitting',
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
submitting: {
|
|
84
|
-
invoke: {
|
|
85
|
-
src: 'submitDeposit',
|
|
86
|
-
onDone: {
|
|
87
|
-
target: 'submitted',
|
|
88
|
-
actions: 'setProcessing',
|
|
89
|
-
},
|
|
90
|
-
onError: {
|
|
91
|
-
target: 'loaded',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
submitted: {},
|
|
96
|
-
},
|
|
97
|
-
on: {
|
|
98
|
-
SET_PROMOTION: {
|
|
99
|
-
target: 'debouncing',
|
|
100
|
-
actions: 'setPromotion',
|
|
101
|
-
internal: false,
|
|
102
|
-
},
|
|
103
|
-
INPUT_AMOUNT: {
|
|
104
|
-
target: 'debouncing',
|
|
105
|
-
actions: 'inputAmount',
|
|
106
|
-
internal: false,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
actions: {
|
|
112
|
-
setInitData: assign((context, event) => {
|
|
113
|
-
const { currentPayment } = event.data
|
|
114
|
-
|
|
115
|
-
const processing = currentPayment?.processing?.[0]
|
|
116
|
-
|
|
117
|
-
const virtualBanks = currentPayment?.virtualBanks?.[0]
|
|
118
|
-
|
|
119
|
-
return {
|
|
120
|
-
currentPayment,
|
|
121
|
-
method: currentPayment.method,
|
|
122
|
-
processing,
|
|
123
|
-
selectedAmount: max(promotion?.minimumAmount, currentPayment?.minimum, selectedAmount, 0),
|
|
124
|
-
virtualBanks,
|
|
125
|
-
}
|
|
126
|
-
}),
|
|
127
|
-
inputAmount: assign((context, event) => {
|
|
128
|
-
return { selectedAmount: event.data }
|
|
129
|
-
}),
|
|
130
|
-
setCalculation: assign((context, event) => {
|
|
131
|
-
return {
|
|
132
|
-
calculation: event.data,
|
|
133
|
-
}
|
|
134
|
-
}),
|
|
135
|
-
setProcessing: assign((context, event) => {
|
|
136
|
-
return {
|
|
137
|
-
processing: event.data,
|
|
138
|
-
}
|
|
139
|
-
}),
|
|
140
|
-
clearCalculation: assign((context, event) => {
|
|
141
|
-
return {
|
|
142
|
-
calculation: null,
|
|
143
|
-
}
|
|
144
|
-
}),
|
|
145
|
-
setDepositTime: assign((context, event) => {
|
|
146
|
-
return {
|
|
147
|
-
depositTime: event.data,
|
|
148
|
-
}
|
|
149
|
-
}),
|
|
150
|
-
setPromotion: assign((context, event) => {
|
|
151
|
-
return {
|
|
152
|
-
promotion: event.data,
|
|
153
|
-
}
|
|
154
|
-
}),
|
|
155
|
-
},
|
|
156
|
-
guards: {
|
|
157
|
-
isCalculable: (context, event) => {
|
|
158
|
-
const {
|
|
159
|
-
selectedAmount,
|
|
160
|
-
currentPayment: { maximum, minimum },
|
|
161
|
-
} = context
|
|
162
|
-
return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
|
|
163
|
-
},
|
|
164
|
-
isProcessing: (context, event) => {
|
|
165
|
-
return context.processing
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
services: {
|
|
169
|
-
fetchInitData: async (context, event) => {
|
|
170
|
-
const { paymentDetail = [] } = context
|
|
171
|
-
const currentPayment = paymentDetail.find((element) => element.category === context.currentCategory && element.transferType === 'deposit')
|
|
172
|
-
|
|
173
|
-
return {
|
|
174
|
-
currentPayment,
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
fetchCalculation: async (context, event) => {
|
|
178
|
-
const { method, selectedAmount, promotion } = context
|
|
179
|
-
return await request.send(
|
|
180
|
-
payment.getDepositExpectedResult({
|
|
181
|
-
method,
|
|
182
|
-
amount: selectedAmount,
|
|
183
|
-
promotionsNo: promotion?.promotionsNo,
|
|
184
|
-
})
|
|
185
|
-
)
|
|
186
|
-
},
|
|
187
|
-
submitDeposit: async (context, event) => {
|
|
188
|
-
const { method, selectedAmount, depositTime, promotion } = context
|
|
189
|
-
return await request.send(
|
|
190
|
-
payment.submitDepositTransactionBank({
|
|
191
|
-
method,
|
|
192
|
-
amount: selectedAmount,
|
|
193
|
-
depositTime,
|
|
194
|
-
promotionsNo: promotion?.promotionsNo,
|
|
195
|
-
})
|
|
196
|
-
)
|
|
197
|
-
},
|
|
198
|
-
},
|
|
199
|
-
}
|
|
200
|
-
)
|
|
201
|
-
}
|