@jetthai/cuora 1.0.205 → 1.0.302-dev-1
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 +4 -0
- package/.prettierignore +1 -0
- package/CHANGELOG.md +846 -0
- package/README.md +6 -0
- package/package.json +6 -9
- package/src/api/activity.js +43 -2
- package/src/api/auth.js +22 -7
- package/src/api/common.js +3 -1
- package/src/api/game.js +20 -7
- package/src/api/mailbox.js +9 -5
- package/src/api/payment.js +167 -19
- package/src/api/user.js +7 -0
- package/src/lib/fingerprint.js +9779 -0
- package/src/machine/activity/activity.js +111 -26
- package/src/machine/activity/activity_cash.js +159 -0
- package/src/machine/activity/cash_rain_activity.js +153 -0
- package/src/machine/activity/continue_deposit_activity.js +11 -2
- package/src/machine/activity/deposit_activity.js +13 -4
- package/src/machine/activity/diamond_shop_activity_cash.js +179 -0
- package/src/machine/activity/diamond_shop_activity_vn.js +54 -89
- package/src/machine/activity/fafafa_activity.js +34 -19
- package/src/machine/activity/{affiliate_invite_friends_activity.js → friend_invite_friends_activity.js} +70 -41
- package/src/machine/activity/index.js +22 -4
- package/src/machine/activity/instant_rebate_activity.js +217 -0
- package/src/machine/activity/invite_friends_activity.js +14 -14
- package/src/machine/activity/jackpot.js +74 -0
- package/src/machine/activity/otp_verified_activity.js +74 -0
- package/src/machine/activity/ranking_activity.js +11 -2
- package/src/machine/activity/roulette_activity_v2.js +90 -0
- package/src/machine/activity/sign_in_activity.js +21 -14
- package/src/machine/activity/sign_in_monthly_activity.js +65 -0
- package/src/machine/activity/specify_bets_activity.js +25 -3
- package/src/machine/activity/specify_turnover_activity.js +25 -3
- package/src/machine/activity/time_bomb_activity.js +11 -2
- package/src/machine/activity/vip_card_activity.js +140 -0
- package/src/machine/auth.js +141 -27
- package/src/machine/auth_otp_v2.js +10 -4
- package/src/machine/auth_otp_v3.js +11 -3
- package/src/machine/bank_binding.js +112 -12
- package/src/machine/bank_binding_amb.js +145 -0
- package/src/machine/common.js +113 -25
- package/src/machine/deposit/amb.js +92 -0
- package/src/machine/deposit/crypto.js +50 -29
- package/src/machine/deposit/crypto_bank.js +317 -0
- package/src/machine/deposit/crypto_bank_cash.js +287 -0
- package/src/machine/deposit/crypto_button.js +174 -39
- package/src/machine/deposit/crypto_cash.js +255 -0
- package/src/machine/deposit/crypto_qrcode.js +148 -0
- package/src/machine/deposit/crypto_qrcode_cash.js +131 -0
- package/src/machine/deposit/crypto_way.js +239 -0
- package/src/machine/deposit/crypto_way_cash.js +256 -0
- package/src/machine/deposit/deposit_fc.js +8 -5
- package/src/machine/deposit/direct.js +111 -16
- package/src/machine/deposit/direct_cash.js +217 -0
- package/src/machine/deposit/float.js +366 -0
- package/src/machine/deposit/index.js +43 -2
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/loadcard_cash.js +207 -0
- package/src/machine/deposit/loadcard_vn.js +191 -43
- package/src/machine/deposit/manual_cash.js +356 -0
- package/src/machine/deposit/manual_vn.js +182 -60
- package/src/machine/deposit/qrcode_cash.js +217 -0
- package/src/machine/deposit/qrcode_v2.js +285 -52
- package/src/machine/deposit/usdt.js +144 -0
- package/src/machine/deposit/usdt_cash.js +138 -0
- package/src/machine/deposit/vpay.js +359 -0
- package/src/machine/game_favorite_v2.js +70 -28
- package/src/machine/game_info.js +57 -0
- package/src/machine/game_search_cash.js +390 -0
- package/src/machine/game_search_v2.js +64 -24
- package/src/machine/game_v2_1.js +662 -0
- package/src/machine/honor_board_cash.js +63 -0
- package/src/machine/inbox.js +259 -34
- package/src/machine/index.js +24 -17
- package/src/machine/leaderboard.js +31 -8
- package/src/machine/navbar.js +57 -0
- package/src/machine/promotions.js +171 -0
- package/src/machine/reward.js +74 -7
- package/src/machine/reward_cash.js +219 -0
- package/src/machine/roulette_v2.js +276 -0
- package/src/machine/setting.js +5 -2
- package/src/machine/side_cash.js +110 -0
- package/src/machine/side_v2.js +33 -28
- package/src/machine/user_photo.js +65 -0
- package/src/machine/user_sign_up.js +117 -17
- package/src/machine/withdraw/index.js +23 -0
- package/src/machine/{withdraw_vn.js → withdraw/withdraw_amb.js} +146 -78
- package/src/machine/{withdraw_crypto.js → withdraw/withdraw_crypto.js} +220 -69
- package/src/machine/withdraw/withdraw_crypto2.js +540 -0
- package/src/machine/withdraw/withdraw_crypto_cash.js +319 -0
- package/src/machine/{withdraw_fc.js → withdraw/withdraw_fc.js} +2 -2
- package/src/machine/withdraw/withdraw_krway.js +207 -0
- package/src/machine/withdraw/withdraw_manual.js +595 -0
- package/src/machine/withdraw/withdraw_manual_cash.js +303 -0
- package/src/machine/withdraw/withdraw_vn.js +533 -0
- package/src/machine/withdraw/withdraw_vn2.js +548 -0
- package/src/request/request.js +10 -5
- package/src/util/constant.js +19 -1
- package/src/util/deviceToken.js +18 -8
- package/src/util/index.js +2 -1
- package/src/util/math.js +4 -0
- package/src/util/storage.js +22 -22
- package/dist/bundle.mjs +0 -18462
- package/rollup.config.js +0 -16
- package/src/machine/auth_otp.js +0 -201
- package/src/machine/deposit/qrcode_vn.js +0 -206
- package/src/machine/game.js +0 -285
- package/src/machine/game_favorite.js +0 -123
- package/src/machine/game_search.js +0 -244
- package/src/machine/game_v2.js +0 -356
|
@@ -3,7 +3,6 @@ import auth from '../api/auth.js'
|
|
|
3
3
|
import { getDeviceToken } from '../util/deviceToken.js'
|
|
4
4
|
import storage from '../util/storage.js'
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
export default function (request) {
|
|
8
7
|
const { fpToken, sentry, defaultChannel, defaultSubchannel } = request.config
|
|
9
8
|
return createMachine(
|
|
@@ -15,7 +14,7 @@ export default function (request) {
|
|
|
15
14
|
channel: null,
|
|
16
15
|
subchannel: null,
|
|
17
16
|
signUpData: {},
|
|
18
|
-
|
|
17
|
+
fc: null,
|
|
19
18
|
reCaptchaToken: null,
|
|
20
19
|
registrationData: {
|
|
21
20
|
account: null,
|
|
@@ -24,17 +23,22 @@ export default function (request) {
|
|
|
24
23
|
strategy: null,
|
|
25
24
|
uid: null,
|
|
26
25
|
},
|
|
26
|
+
deviceTokenEnable: true,
|
|
27
27
|
},
|
|
28
28
|
states: {
|
|
29
29
|
idle: {
|
|
30
30
|
on: {
|
|
31
|
+
SIGN_UP_ID: {
|
|
32
|
+
target: 'authentication',
|
|
33
|
+
actions: ['setReCaptchaToken', 'setFriendCode', 'setSignUpId'],
|
|
34
|
+
},
|
|
31
35
|
SIGN_UP_PHONE: {
|
|
32
36
|
target: 'authentication',
|
|
33
|
-
actions: ['setReCaptchaToken', '
|
|
37
|
+
actions: ['setReCaptchaToken', 'setFriendCode', 'setSignUpPhone'],
|
|
34
38
|
},
|
|
35
39
|
SIGN_UP_EMAIL: {
|
|
36
40
|
target: 'authentication',
|
|
37
|
-
actions: ['setReCaptchaToken', '
|
|
41
|
+
actions: ['setReCaptchaToken', 'setFriendCode', 'setSignUpEmail'],
|
|
38
42
|
},
|
|
39
43
|
},
|
|
40
44
|
},
|
|
@@ -52,6 +56,11 @@ export default function (request) {
|
|
|
52
56
|
},
|
|
53
57
|
authenticated: {},
|
|
54
58
|
},
|
|
59
|
+
on: {
|
|
60
|
+
SET_DEVICE_TOKEN_ENABLE: {
|
|
61
|
+
actions: 'setDeviceTokenEnable',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
55
64
|
},
|
|
56
65
|
{
|
|
57
66
|
actions: {
|
|
@@ -61,39 +70,115 @@ export default function (request) {
|
|
|
61
70
|
reCaptchaToken,
|
|
62
71
|
}
|
|
63
72
|
}),
|
|
64
|
-
|
|
65
|
-
const {
|
|
73
|
+
setFriendCode: assign((context, event) => {
|
|
74
|
+
const { fc } = event.data
|
|
75
|
+
return { fc }
|
|
76
|
+
}),
|
|
77
|
+
setSignUpId: assign((context, event) => {
|
|
78
|
+
const {
|
|
79
|
+
username,
|
|
80
|
+
nick_name,
|
|
81
|
+
password,
|
|
82
|
+
countryCode,
|
|
83
|
+
phone,
|
|
84
|
+
channel,
|
|
85
|
+
subchannel,
|
|
86
|
+
bankCode,
|
|
87
|
+
bankAccount,
|
|
88
|
+
holderName,
|
|
89
|
+
branch,
|
|
90
|
+
branchCode,
|
|
91
|
+
affiliateCode,
|
|
92
|
+
} = event.data
|
|
66
93
|
return {
|
|
67
|
-
|
|
94
|
+
signUpData: {
|
|
95
|
+
provider: 'local',
|
|
96
|
+
username,
|
|
97
|
+
nick_name,
|
|
98
|
+
password,
|
|
99
|
+
countryCode,
|
|
100
|
+
phone,
|
|
101
|
+
bankCode,
|
|
102
|
+
bankAccount,
|
|
103
|
+
holderName,
|
|
104
|
+
branch,
|
|
105
|
+
branchCode,
|
|
106
|
+
affiliateCode,
|
|
107
|
+
},
|
|
108
|
+
channel,
|
|
109
|
+
subchannel,
|
|
68
110
|
}
|
|
69
111
|
}),
|
|
70
112
|
setSignUpPhone: assign((context, event) => {
|
|
71
|
-
const {
|
|
113
|
+
const {
|
|
114
|
+
countryCode,
|
|
115
|
+
phone,
|
|
116
|
+
nick_name,
|
|
117
|
+
password,
|
|
118
|
+
channel,
|
|
119
|
+
subchannel,
|
|
120
|
+
bankCode,
|
|
121
|
+
bankAccount,
|
|
122
|
+
holderName,
|
|
123
|
+
branch,
|
|
124
|
+
branchCode,
|
|
125
|
+
affiliateCode,
|
|
126
|
+
} = event.data
|
|
72
127
|
return {
|
|
73
128
|
signUpData: {
|
|
74
129
|
provider: 'phone',
|
|
75
130
|
countryCode,
|
|
76
131
|
phone,
|
|
132
|
+
nick_name,
|
|
77
133
|
password,
|
|
134
|
+
bankCode,
|
|
135
|
+
bankAccount,
|
|
136
|
+
holderName,
|
|
137
|
+
branch,
|
|
138
|
+
branchCode,
|
|
139
|
+
affiliateCode,
|
|
78
140
|
},
|
|
79
141
|
channel,
|
|
80
142
|
subchannel,
|
|
81
143
|
}
|
|
82
144
|
}),
|
|
83
145
|
setSignUpEmail: assign((context, event) => {
|
|
84
|
-
const {
|
|
146
|
+
const {
|
|
147
|
+
email,
|
|
148
|
+
nick_name,
|
|
149
|
+
password,
|
|
150
|
+
channel,
|
|
151
|
+
subchannel,
|
|
152
|
+
bankCode,
|
|
153
|
+
bankAccount,
|
|
154
|
+
holderName,
|
|
155
|
+
branch,
|
|
156
|
+
branchCode,
|
|
157
|
+
affiliateCode,
|
|
158
|
+
countryCode,
|
|
159
|
+
phone,
|
|
160
|
+
} = event.data
|
|
85
161
|
return {
|
|
86
162
|
signUpData: {
|
|
87
163
|
provider: 'email',
|
|
88
164
|
email,
|
|
165
|
+
nick_name,
|
|
89
166
|
password,
|
|
167
|
+
bankCode,
|
|
168
|
+
bankAccount,
|
|
169
|
+
holderName,
|
|
170
|
+
branch,
|
|
171
|
+
branchCode,
|
|
172
|
+
affiliateCode,
|
|
173
|
+
countryCode,
|
|
174
|
+
phone,
|
|
90
175
|
},
|
|
91
176
|
channel,
|
|
92
177
|
subchannel,
|
|
93
178
|
}
|
|
94
179
|
}),
|
|
95
180
|
setRegistrationData: assign((context, event) => {
|
|
96
|
-
const { account, currency, site, strategy, uid } = event.data
|
|
181
|
+
const { account, currency, site, strategy, uid, channel, sub_channel } = event.data
|
|
97
182
|
return {
|
|
98
183
|
registrationData: {
|
|
99
184
|
account,
|
|
@@ -101,34 +186,49 @@ export default function (request) {
|
|
|
101
186
|
site,
|
|
102
187
|
strategy,
|
|
103
188
|
uid,
|
|
189
|
+
channel,
|
|
190
|
+
sub_channel,
|
|
104
191
|
},
|
|
105
192
|
}
|
|
106
193
|
}),
|
|
194
|
+
setDeviceTokenEnable: assign((context, event) => {
|
|
195
|
+
return {
|
|
196
|
+
deviceTokenEnable: event.data,
|
|
197
|
+
}
|
|
198
|
+
}),
|
|
107
199
|
},
|
|
108
200
|
services: {
|
|
109
201
|
authenticate: async (context, event) => {
|
|
110
|
-
const { channel, subchannel, signUpData } = context
|
|
111
|
-
const dt = await getDeviceToken({ fpToken, sentry,
|
|
202
|
+
const { channel, subchannel, signUpData, deviceTokenEnable } = context
|
|
203
|
+
const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts, enable: deviceTokenEnable })
|
|
112
204
|
|
|
113
|
-
|
|
205
|
+
const affiliateCode = storage.get('ac') || signUpData?.affiliateCode
|
|
114
206
|
const messages = {
|
|
115
207
|
url: window.location.href,
|
|
116
|
-
|
|
208
|
+
channelOrders: [
|
|
117
209
|
{ channel: storage.get('channel'), subchannel: storage.get('subchannel') },
|
|
118
210
|
{ channel: defaultChannel, subchannel: defaultSubchannel },
|
|
119
211
|
{ channel: channel, subchannel: subchannel },
|
|
120
212
|
],
|
|
213
|
+
affiliateCode,
|
|
121
214
|
}
|
|
122
215
|
sentry.captureMessage(JSON.stringify(messages))
|
|
123
216
|
|
|
217
|
+
const referralObj = {}
|
|
218
|
+
if (![undefined, 'undefined', null, 'null'].includes(affiliateCode)) {
|
|
219
|
+
referralObj.ac = affiliateCode
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
referralObj.channel = storage.get('channel') || defaultChannel || channel
|
|
223
|
+
referralObj.subchannel = storage.get('subchannel') || defaultSubchannel || subchannel
|
|
224
|
+
|
|
124
225
|
return await request.send(
|
|
125
226
|
auth.register({
|
|
126
227
|
...signUpData,
|
|
127
|
-
|
|
128
|
-
subchannel: storage.get('subchannel') || defaultSubchannel || subchannel,
|
|
228
|
+
...referralObj,
|
|
129
229
|
dt,
|
|
130
230
|
reCaptchaToken: context.reCaptchaToken,
|
|
131
|
-
|
|
231
|
+
fc: context.fc,
|
|
132
232
|
})
|
|
133
233
|
)
|
|
134
234
|
},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import withdraw_fc from './withdraw_fc.js'
|
|
2
|
+
import withdraw_vn from './withdraw_vn.js'
|
|
3
|
+
import withdraw_vn2 from './withdraw_vn2.js'
|
|
4
|
+
import withdraw_manual from './withdraw_manual.js'
|
|
5
|
+
import withdraw_crypto from './withdraw_crypto.js'
|
|
6
|
+
import withdraw_crypto2 from './withdraw_crypto2.js'
|
|
7
|
+
import withdraw_amb from './withdraw_amb.js'
|
|
8
|
+
import withdraw_krway from './withdraw_krway.js'
|
|
9
|
+
import withdraw_crypto_cash from './withdraw_crypto_cash.js'
|
|
10
|
+
import withdraw_manual_cash from './withdraw_manual_cash.js'
|
|
11
|
+
|
|
12
|
+
export default {
|
|
13
|
+
withdraw_fc,
|
|
14
|
+
withdraw_vn,
|
|
15
|
+
withdraw_vn2,
|
|
16
|
+
withdraw_manual,
|
|
17
|
+
withdraw_crypto,
|
|
18
|
+
withdraw_crypto2,
|
|
19
|
+
withdraw_amb,
|
|
20
|
+
withdraw_krway,
|
|
21
|
+
withdraw_crypto_cash,
|
|
22
|
+
withdraw_manual_cash,
|
|
23
|
+
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { assign, createMachine } from 'xstate'
|
|
2
2
|
import findLastIndex from 'lodash/findLastIndex.js'
|
|
3
|
-
import payment from '
|
|
4
|
-
import common from '
|
|
5
|
-
import user from '
|
|
6
|
-
|
|
7
|
-
// const findLastIndex = require('lodash/findLastIndex')
|
|
3
|
+
import payment from '../../api/payment.js'
|
|
4
|
+
import common from '../../api/common.js'
|
|
5
|
+
import user from '../../api/user.js'
|
|
8
6
|
|
|
9
7
|
export default function (request) {
|
|
10
8
|
const { appSecret } = request.config
|
|
11
9
|
return createMachine(
|
|
12
10
|
{
|
|
13
|
-
id: '
|
|
11
|
+
id: 'withdraw_amb',
|
|
14
12
|
initial: 'loading',
|
|
15
13
|
context: {
|
|
16
14
|
siteConfig: null,
|
|
@@ -27,13 +25,12 @@ export default function (request) {
|
|
|
27
25
|
targetWithdrawLimit: null,
|
|
28
26
|
|
|
29
27
|
amount: null,
|
|
30
|
-
bank: null,
|
|
31
|
-
branch: null,
|
|
32
|
-
accountNumber: null,
|
|
33
|
-
holderName: null,
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
// otp
|
|
30
|
+
requestId: null,
|
|
31
|
+
status: null,
|
|
32
|
+
target: null,
|
|
33
|
+
ttl: null,
|
|
37
34
|
},
|
|
38
35
|
states: {
|
|
39
36
|
loading: {
|
|
@@ -52,20 +49,20 @@ export default function (request) {
|
|
|
52
49
|
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
53
50
|
},
|
|
54
51
|
free: {
|
|
55
|
-
initial: '
|
|
52
|
+
initial: 'checking',
|
|
56
53
|
states: {
|
|
57
|
-
loading: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
},
|
|
54
|
+
// loading: {
|
|
55
|
+
// invoke: {
|
|
56
|
+
// src: 'fetchWithdrawRules',
|
|
57
|
+
// onDone: {
|
|
58
|
+
// target: 'checking',
|
|
59
|
+
// actions: 'updateWithdrawCondition',
|
|
60
|
+
// },
|
|
61
|
+
// onError: {
|
|
62
|
+
// target: 'notConvertible',
|
|
63
|
+
// },
|
|
64
|
+
// },
|
|
65
|
+
// },
|
|
69
66
|
checking: {
|
|
70
67
|
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
71
68
|
},
|
|
@@ -80,9 +77,14 @@ export default function (request) {
|
|
|
80
77
|
converting: {
|
|
81
78
|
invoke: {
|
|
82
79
|
src: 'submitWithdrawFree',
|
|
83
|
-
onDone:
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
onDone: [
|
|
81
|
+
{
|
|
82
|
+
target: '#withdraw_amb.otp',
|
|
83
|
+
actions: 'setOtp',
|
|
84
|
+
cond: 'isOtpRequired',
|
|
85
|
+
},
|
|
86
|
+
{ target: 'converted' },
|
|
87
|
+
],
|
|
86
88
|
onError: {
|
|
87
89
|
target: 'convertible',
|
|
88
90
|
},
|
|
@@ -96,7 +98,6 @@ export default function (request) {
|
|
|
96
98
|
states: {
|
|
97
99
|
checking: {
|
|
98
100
|
always: [
|
|
99
|
-
{ target: 'inProcessing', cond: 'haveProcessing' },
|
|
100
101
|
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
101
102
|
{ target: 'unbound', cond: 'isBankNotBound' },
|
|
102
103
|
{ target: 'withdrawable' },
|
|
@@ -106,35 +107,27 @@ export default function (request) {
|
|
|
106
107
|
unbound: {
|
|
107
108
|
// to bank_binding.js
|
|
108
109
|
},
|
|
109
|
-
inProcessing: {},
|
|
110
110
|
withdrawable: {
|
|
111
|
+
entry: 'setMaximumWithdrawAmount',
|
|
111
112
|
on: {
|
|
112
|
-
SET_CURRENT_BANK: {
|
|
113
|
-
actions: assign((context, event) => {
|
|
114
|
-
return {
|
|
115
|
-
bank: event.data,
|
|
116
|
-
}
|
|
117
|
-
}),
|
|
118
|
-
},
|
|
119
|
-
SET_AMOUNT: {
|
|
120
|
-
actions: assign((context, event) => {
|
|
121
|
-
return {
|
|
122
|
-
amount: event.data,
|
|
123
|
-
}
|
|
124
|
-
}),
|
|
125
|
-
},
|
|
126
113
|
SUBMIT: {
|
|
127
114
|
target: 'submitting',
|
|
128
|
-
cond: 'isSubmittable',
|
|
129
115
|
},
|
|
130
116
|
},
|
|
131
117
|
},
|
|
132
118
|
submitting: {
|
|
133
119
|
invoke: {
|
|
134
120
|
src: 'submitWithdraw',
|
|
135
|
-
onDone:
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
onDone: [
|
|
122
|
+
{
|
|
123
|
+
target: '#withdraw_amb.otp',
|
|
124
|
+
actions: 'setOtp',
|
|
125
|
+
cond: 'isOtpRequired',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
target: 'submitted',
|
|
129
|
+
},
|
|
130
|
+
],
|
|
138
131
|
onError: {
|
|
139
132
|
target: 'withdrawable',
|
|
140
133
|
},
|
|
@@ -145,13 +138,69 @@ export default function (request) {
|
|
|
145
138
|
const { applyId, balance, realAmount, charge } = event.data
|
|
146
139
|
return { applyId, balance, realAmount, charge }
|
|
147
140
|
}),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
otp: {
|
|
145
|
+
type: 'parallel',
|
|
146
|
+
states: {
|
|
147
|
+
countdown: {
|
|
148
|
+
after: {
|
|
149
|
+
1000: {
|
|
150
|
+
target: 'countdown',
|
|
151
|
+
actions: 'decreaseTtl',
|
|
152
|
+
cond: (context) => context.ttl > 0,
|
|
152
153
|
},
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
verification: {
|
|
157
|
+
initial: 'idle',
|
|
158
|
+
states: {
|
|
159
|
+
idle: {
|
|
160
|
+
on: {
|
|
161
|
+
ACKNOWLEDGE: {
|
|
162
|
+
target: 'acknowledging',
|
|
163
|
+
},
|
|
164
|
+
RESET_OTP: {
|
|
165
|
+
target: 'reset',
|
|
166
|
+
},
|
|
167
|
+
BACK: [
|
|
168
|
+
{
|
|
169
|
+
target: '#withdraw_amb.free.convertible',
|
|
170
|
+
cond: 'isFree',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
target: '#withdraw_amb.cash.withdrawable',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
acknowledging: {
|
|
179
|
+
invoke: {
|
|
180
|
+
src: 'acknowledge',
|
|
181
|
+
onDone: [
|
|
182
|
+
{
|
|
183
|
+
target: '#withdraw_amb.free.converted',
|
|
184
|
+
cond: 'isFree',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
target: '#withdraw_amb.cash.submitted',
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
onError: {
|
|
191
|
+
target: 'idle',
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
reset: {
|
|
196
|
+
invoke: {
|
|
197
|
+
src: 'resetOtp',
|
|
198
|
+
onDone: {
|
|
199
|
+
target: 'idle',
|
|
200
|
+
actions: 'setVerificationData',
|
|
201
|
+
},
|
|
202
|
+
onError: { target: 'idle' },
|
|
203
|
+
},
|
|
155
204
|
},
|
|
156
205
|
},
|
|
157
206
|
},
|
|
@@ -223,14 +272,40 @@ export default function (request) {
|
|
|
223
272
|
availableWithdrawAmount,
|
|
224
273
|
}
|
|
225
274
|
}),
|
|
275
|
+
setOtp: assign((context, event) => {
|
|
276
|
+
const { requestId, status, target, ttl } = event.data
|
|
277
|
+
return {
|
|
278
|
+
requestId,
|
|
279
|
+
status,
|
|
280
|
+
target,
|
|
281
|
+
ttl,
|
|
282
|
+
}
|
|
283
|
+
}),
|
|
284
|
+
decreaseTtl: assign((context, evnet) => {
|
|
285
|
+
const second = context.ttl
|
|
286
|
+
return {
|
|
287
|
+
ttl: Math.max(second - 1, 0),
|
|
288
|
+
}
|
|
289
|
+
}),
|
|
290
|
+
setVerificationData: assign((context, event) => {
|
|
291
|
+
const { requestId, ttl, target } = event.data
|
|
292
|
+
return {
|
|
293
|
+
requestId,
|
|
294
|
+
ttl,
|
|
295
|
+
target,
|
|
296
|
+
}
|
|
297
|
+
}),
|
|
298
|
+
setMaximumWithdrawAmount: assign((context, event) => {
|
|
299
|
+
const { balance, paymentDetail } = context
|
|
300
|
+
return {
|
|
301
|
+
amount: Math.min(balance, paymentDetail[0]?.maximum || 0),
|
|
302
|
+
}
|
|
303
|
+
}),
|
|
226
304
|
},
|
|
227
305
|
guards: {
|
|
228
306
|
isFree: (context, event) => {
|
|
229
307
|
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
230
308
|
},
|
|
231
|
-
haveProcessing: (context, event) => {
|
|
232
|
-
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
233
|
-
},
|
|
234
309
|
isWithdrawDisable: (context, event) => {
|
|
235
310
|
const { siteConfig } = context
|
|
236
311
|
const methods = siteConfig?.paymentMethods?.withdraw || []
|
|
@@ -239,10 +314,6 @@ export default function (request) {
|
|
|
239
314
|
isBankNotBound: (context, event) => {
|
|
240
315
|
return !context.bankInfo?.length
|
|
241
316
|
},
|
|
242
|
-
isSubmittable: (context, event) => {
|
|
243
|
-
const { applyerBankCode, applyerAccountNumber, branch, holderName, amount } = event.data
|
|
244
|
-
return applyerBankCode && applyerAccountNumber && branch && holderName && amount
|
|
245
|
-
},
|
|
246
317
|
isConvertible: (context, event) => {
|
|
247
318
|
const { balance, withdrawLimit } = context
|
|
248
319
|
return balance > 0 && withdrawLimit === 0
|
|
@@ -252,6 +323,9 @@ export default function (request) {
|
|
|
252
323
|
const minWithdrawAmount = paymentDetail[0]?.minimum || 0
|
|
253
324
|
return withdrawLimit !== 0 || balance < minWithdrawAmount
|
|
254
325
|
},
|
|
326
|
+
isOtpRequired: (context, event) => {
|
|
327
|
+
return event.data?.status === 'otp-verifying'
|
|
328
|
+
},
|
|
255
329
|
},
|
|
256
330
|
services: {
|
|
257
331
|
fetchInitData: async (context, event) => {
|
|
@@ -262,7 +336,7 @@ export default function (request) {
|
|
|
262
336
|
request.send(payment.getPaymentInfo()),
|
|
263
337
|
])
|
|
264
338
|
const siteConfig = JSON.parse(window.atob(config))
|
|
265
|
-
const method = paymentDetail.find((payment) => payment.category === '
|
|
339
|
+
const method = paymentDetail.find((payment) => payment.category === 'amb').method
|
|
266
340
|
const bankList = await request.send(payment.getBankList(method))
|
|
267
341
|
const newBankInfo = bankInfo.map((item) => {
|
|
268
342
|
return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
|
|
@@ -274,31 +348,25 @@ export default function (request) {
|
|
|
274
348
|
const { bonus, bankInfo } = await request.send(payment.getPaymentInfo())
|
|
275
349
|
return { bonus, bankInfo, paymentDetail }
|
|
276
350
|
},
|
|
277
|
-
updatePaymentInfo: async (context, event) => {
|
|
278
|
-
const { bank, branch, accountNumber, holderName } = context
|
|
279
|
-
return await request.send(
|
|
280
|
-
payment.updatePaymentInfo({
|
|
281
|
-
bankCode: bank.bankCode,
|
|
282
|
-
branch,
|
|
283
|
-
bankAccount: accountNumber,
|
|
284
|
-
holderName,
|
|
285
|
-
})
|
|
286
|
-
)
|
|
287
|
-
},
|
|
288
351
|
fetchWithdrawRules: async (context, event) => {
|
|
289
352
|
return await request.send(payment.getCurrentWithdrawRule())
|
|
290
353
|
},
|
|
291
354
|
submitWithdraw: async (context, event) => {
|
|
292
|
-
const { amount, applyerBankCode, applyerAccountNumber, branch, holderName } = event.data
|
|
293
355
|
const { method } = context.paymentDetail[0]
|
|
294
|
-
|
|
295
|
-
return await request.send(
|
|
296
|
-
payment.submitWithdrawTransactionVN({ method, amount, applyerBankCode, applyerAccountNumber, branch: branchTemp, holderName })
|
|
297
|
-
)
|
|
356
|
+
return await request.send(payment.submitWithdrawTransactionAmb({ method }))
|
|
298
357
|
},
|
|
299
358
|
submitWithdrawFree: async (context, event) => {
|
|
300
359
|
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
301
360
|
},
|
|
361
|
+
resetOtp: async (context, event) => {
|
|
362
|
+
const { requestId, target } = context
|
|
363
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
364
|
+
},
|
|
365
|
+
acknowledge: async (context, event) => {
|
|
366
|
+
const { requestId, target } = context
|
|
367
|
+
const code = event.data
|
|
368
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
369
|
+
},
|
|
302
370
|
},
|
|
303
371
|
}
|
|
304
372
|
)
|