@jetthai/cuora 1.1.190-bigwin → 1.1.190-krw
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 +15 -9
- package/package.json +1 -1
- package/src/api/auth.js +1 -0
- package/src/api/mailbox.js +9 -5
- package/src/api/payment.js +1 -1
- package/src/machine/auth.js +28 -4
- package/src/machine/bank_binding.js +6 -1
- package/src/machine/bank_binding_amb.js +6 -1
- package/src/machine/deposit/index.js +2 -0
- package/src/machine/deposit/krway.js +151 -0
- package/src/machine/deposit/manual_cash.js +49 -6
- package/src/machine/deposit/manual_vn.js +46 -4
- package/src/machine/game_v2_1.js +2 -2
- package/src/machine/inbox.js +149 -33
- package/src/machine/user_sign_up.js +55 -7
- package/src/machine/withdraw/index.js +2 -0
- package/src/machine/withdraw/withdraw_krway.js +177 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,23 +2,29 @@
|
|
|
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.190-
|
|
5
|
+
### [1.1.190-krw](https://github.com/jetthai/cuora-module/compare/v1.1.192...v1.1.190-krw) (2023-10-18)
|
|
6
6
|
|
|
7
|
-
### [1.1.
|
|
7
|
+
### [1.1.182-krw-10](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-9...v1.1.182-krw-10) (2023-10-04)
|
|
8
8
|
|
|
9
|
-
### [1.1.
|
|
9
|
+
### [1.1.182-krw-9](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-8...v1.1.182-krw-9) (2023-10-03)
|
|
10
10
|
|
|
11
|
-
### [1.1.
|
|
11
|
+
### [1.1.182-krw-8](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-7...v1.1.182-krw-8) (2023-09-28)
|
|
12
12
|
|
|
13
|
-
### [1.1.
|
|
13
|
+
### [1.1.182-krw-7](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-6...v1.1.182-krw-7) (2023-09-28)
|
|
14
14
|
|
|
15
|
-
### [1.1.
|
|
15
|
+
### [1.1.182-krw-6](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-5...v1.1.182-krw-6) (2023-09-28)
|
|
16
16
|
|
|
17
|
-
### [1.1.
|
|
17
|
+
### [1.1.182-krw-5](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-4...v1.1.182-krw-5) (2023-09-27)
|
|
18
18
|
|
|
19
|
-
### [1.1.
|
|
19
|
+
### [1.1.182-krw-4](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-3...v1.1.182-krw-4) (2023-09-27)
|
|
20
20
|
|
|
21
|
-
### [1.1.
|
|
21
|
+
### [1.1.182-krw-3](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-2...v1.1.182-krw-3) (2023-09-27)
|
|
22
|
+
|
|
23
|
+
### [1.1.182-krw-2](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw-1...v1.1.182-krw-2) (2023-09-27)
|
|
24
|
+
|
|
25
|
+
### [1.1.182-krw-1](https://github.com/jetthai/cuora-module/compare/v1.1.182-krw...v1.1.182-krw-1) (2023-09-27)
|
|
26
|
+
|
|
27
|
+
### [1.1.182-krw](https://github.com/jetthai/cuora-module/compare/v1.1.182...v1.1.182-krw) (2023-09-26)
|
|
22
28
|
|
|
23
29
|
### [1.1.182](https://github.com/jetthai/cuora-module/compare/v1.1.181...v1.1.182) (2023-09-21)
|
|
24
30
|
|
package/package.json
CHANGED
package/src/api/auth.js
CHANGED
package/src/api/mailbox.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
getMessageTypes: () => ({ url: 'mailbox/getMessageTypes', method: 'get' }),
|
|
3
|
-
getMessageList: ({ type, limit = 10, page }) => ({
|
|
3
|
+
getMessageList: ({ type, limit = 10, page, category }) => ({
|
|
4
4
|
url: 'mailbox/getMessageList?include=cl',
|
|
5
5
|
method: 'post',
|
|
6
|
-
params: { type, limit, page },
|
|
6
|
+
params: { type, limit, page, category },
|
|
7
7
|
}),
|
|
8
|
-
updateMessage: ({ groupId, isRead }) => ({
|
|
8
|
+
updateMessage: ({ groupId, isRead, isDelete }) => ({
|
|
9
9
|
url: 'mailbox/updateMessage',
|
|
10
10
|
method: 'post',
|
|
11
|
-
params: { groupId, isRead },
|
|
11
|
+
params: { groupId, isRead, isDelete },
|
|
12
|
+
}),
|
|
13
|
+
sendMessage: ({ type, category, from, to, title, content }) => ({
|
|
14
|
+
url: 'mailbox/sendMessage',
|
|
15
|
+
method: 'post',
|
|
16
|
+
params: { type, category, from, to, title, content },
|
|
12
17
|
}),
|
|
13
|
-
sendMessage: () => ({ url: 'mailbox/sendMessage', method: 'post' }),
|
|
14
18
|
getMessage: ({ groupId, limit = 10, pageIdx }) => ({
|
|
15
19
|
url: 'mailbox/getMessage',
|
|
16
20
|
method: 'post',
|
package/src/api/payment.js
CHANGED
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
},
|
|
41
41
|
}),
|
|
42
42
|
getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
|
|
43
|
-
getBindingBankList: () => ({ url: 'payment/v2/getBindingBankList', method: 'get' }),
|
|
43
|
+
getBindingBankList: ({ appSecret }) => ({ url: 'payment/v2/getBindingBankList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
44
44
|
getWithdrawBankList: () => ({ url: 'payment/v2/getWithdrawBankList', method: 'get' }),
|
|
45
45
|
makeTransaction: ({ type, payload, paymentMethod }) => ({
|
|
46
46
|
url: `payment/v2/${paymentMethod}/transaction`,
|
package/src/machine/auth.js
CHANGED
|
@@ -14,6 +14,7 @@ export default function (request) {
|
|
|
14
14
|
const phoneCountryCode = 'phone_countrycode'
|
|
15
15
|
const accountPhoneKey = 'account_phone'
|
|
16
16
|
const accountEmailKey = 'account_email'
|
|
17
|
+
const accountUsernameKey = 'account_username'
|
|
17
18
|
|
|
18
19
|
return createMachine(
|
|
19
20
|
{
|
|
@@ -210,6 +211,10 @@ export default function (request) {
|
|
|
210
211
|
LOGIN_GUEST: {
|
|
211
212
|
target: '.authenticationGuest',
|
|
212
213
|
},
|
|
214
|
+
LOGIN_ID: {
|
|
215
|
+
target: '.authentication',
|
|
216
|
+
actions: ['setReCaptchaToken', 'setLoginId'],
|
|
217
|
+
},
|
|
213
218
|
LOGIN_PHONE: {
|
|
214
219
|
target: '.authentication',
|
|
215
220
|
actions: ['setReCaptchaToken', 'setLoginPhone'],
|
|
@@ -264,6 +269,16 @@ export default function (request) {
|
|
|
264
269
|
reCaptchaToken,
|
|
265
270
|
}
|
|
266
271
|
}),
|
|
272
|
+
setLoginId: assign((context, event) => {
|
|
273
|
+
const { username, password } = event.data
|
|
274
|
+
return {
|
|
275
|
+
loginData: {
|
|
276
|
+
provider: 'local',
|
|
277
|
+
username,
|
|
278
|
+
password,
|
|
279
|
+
},
|
|
280
|
+
}
|
|
281
|
+
}),
|
|
267
282
|
setLoginPhone: assign((context, event) => {
|
|
268
283
|
const { countryCode, countryAbbr, phone, password } = event.data
|
|
269
284
|
return {
|
|
@@ -316,22 +331,31 @@ export default function (request) {
|
|
|
316
331
|
}
|
|
317
332
|
}),
|
|
318
333
|
setAccount: assign((context, event) => {
|
|
319
|
-
if (context.loginData.
|
|
334
|
+
if (context.loginData.username) {
|
|
335
|
+
storage.remove(accountEmailKey)
|
|
336
|
+
storage.remove(accountPhoneKey)
|
|
337
|
+
storage.set(accountUsernameKey, `${context.loginData.username}`, {
|
|
338
|
+
path: '/',
|
|
339
|
+
maxAge: 60 * 60 * 24 * 31,
|
|
340
|
+
})
|
|
341
|
+
} else if (context.loginData.phone) {
|
|
320
342
|
storage.remove(accountEmailKey)
|
|
343
|
+
storage.remove(accountUsernameKey)
|
|
321
344
|
storage.set(accountPhoneKey, `${context.loginData.phone}`, {
|
|
322
345
|
path: '/',
|
|
323
|
-
maxAge: 60 * 60 * 24 *
|
|
346
|
+
maxAge: 60 * 60 * 24 * 31,
|
|
324
347
|
})
|
|
325
348
|
storage.set(phoneCountryCode, `${context.countryAbbr}_${context.loginData.countryCode}`, {
|
|
326
349
|
path: '/',
|
|
327
|
-
maxAge: 60 * 60 * 24 *
|
|
350
|
+
maxAge: 60 * 60 * 24 * 31,
|
|
328
351
|
})
|
|
329
352
|
} else if (context.loginData.email) {
|
|
330
353
|
storage.remove(accountPhoneKey)
|
|
331
354
|
storage.remove(phoneCountryCode)
|
|
355
|
+
storage.remove(accountUsernameKey)
|
|
332
356
|
storage.set(accountEmailKey, context.loginData.email, {
|
|
333
357
|
path: '/',
|
|
334
|
-
maxAge: 60 * 60 * 24 *
|
|
358
|
+
maxAge: 60 * 60 * 24 * 31,
|
|
335
359
|
})
|
|
336
360
|
}
|
|
337
361
|
}),
|
|
@@ -2,6 +2,8 @@ import { assign, createMachine } from 'xstate'
|
|
|
2
2
|
import payment from '../api/payment.js'
|
|
3
3
|
|
|
4
4
|
export default function (request) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
|
|
5
7
|
return createMachine(
|
|
6
8
|
{
|
|
7
9
|
id: 'bank_binding',
|
|
@@ -106,7 +108,10 @@ export default function (request) {
|
|
|
106
108
|
},
|
|
107
109
|
services: {
|
|
108
110
|
fetchInitData: async (context, event) => {
|
|
109
|
-
const [bankList, paymentInfo] = await Promise.all([
|
|
111
|
+
const [bankList, paymentInfo] = await Promise.all([
|
|
112
|
+
request.send(payment.getBindingBankList({ appSecret })),
|
|
113
|
+
request.send(payment.getPaymentInfo()),
|
|
114
|
+
])
|
|
110
115
|
return { bankList, paymentInfo }
|
|
111
116
|
},
|
|
112
117
|
updatePaymentInfo: async (context, event) => {
|
|
@@ -2,6 +2,8 @@ import { assign, createMachine } from 'xstate'
|
|
|
2
2
|
import payment from '../api/payment.js'
|
|
3
3
|
|
|
4
4
|
export default function (request) {
|
|
5
|
+
const { appSecret } = request.config
|
|
6
|
+
|
|
5
7
|
return createMachine(
|
|
6
8
|
{
|
|
7
9
|
id: 'bank_binding_amb',
|
|
@@ -116,7 +118,10 @@ export default function (request) {
|
|
|
116
118
|
},
|
|
117
119
|
services: {
|
|
118
120
|
fetchInitData: async (context, event) => {
|
|
119
|
-
const [bankList, paymentInfo] = await Promise.all([
|
|
121
|
+
const [bankList, paymentInfo] = await Promise.all([
|
|
122
|
+
request.send(payment.getBindingBankList({ appSecret })),
|
|
123
|
+
request.send(payment.getPaymentInfo()),
|
|
124
|
+
])
|
|
120
125
|
return { bankList, paymentInfo }
|
|
121
126
|
},
|
|
122
127
|
updatePaymentInfo: async (context, event) => {
|
|
@@ -8,6 +8,7 @@ import direct from './direct.js'
|
|
|
8
8
|
import amb from './amb.js'
|
|
9
9
|
import float from './float.js'
|
|
10
10
|
import vpay from './vpay.js'
|
|
11
|
+
import krway from './krway.js'
|
|
11
12
|
import usdt from './usdt.js'
|
|
12
13
|
import manual_cash from './manual_cash.js'
|
|
13
14
|
import qrcode_cash from './qrcode_cash.js'
|
|
@@ -34,6 +35,7 @@ export default {
|
|
|
34
35
|
float,
|
|
35
36
|
vpay,
|
|
36
37
|
usdt,
|
|
38
|
+
krway,
|
|
37
39
|
manual_cash,
|
|
38
40
|
qrcode_cash,
|
|
39
41
|
usdt_cash,
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
import mailbox from '../../api/mailbox.js'
|
|
4
|
+
|
|
5
|
+
export default function (request) {
|
|
6
|
+
return createMachine(
|
|
7
|
+
{
|
|
8
|
+
id: 'krway',
|
|
9
|
+
initial: 'loading',
|
|
10
|
+
context: {
|
|
11
|
+
currentCategory: 'krway',
|
|
12
|
+
paymentDetail: [],
|
|
13
|
+
currentPayment: null,
|
|
14
|
+
options: [],
|
|
15
|
+
amount: null,
|
|
16
|
+
processing: null,
|
|
17
|
+
},
|
|
18
|
+
states: {
|
|
19
|
+
loading: {
|
|
20
|
+
invoke: {
|
|
21
|
+
src: 'fetchPaymentDetail',
|
|
22
|
+
onDone: {
|
|
23
|
+
target: 'checking',
|
|
24
|
+
actions: 'setPaymentDetail',
|
|
25
|
+
},
|
|
26
|
+
onError: {
|
|
27
|
+
target: 'fail',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
checking: {
|
|
32
|
+
always: [
|
|
33
|
+
{
|
|
34
|
+
target: 'processing',
|
|
35
|
+
cond: 'isProcessing',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
target: 'idle',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
processing: {},
|
|
43
|
+
idle: {},
|
|
44
|
+
inquiring: {
|
|
45
|
+
invoke: {
|
|
46
|
+
src: 'accountInquiry',
|
|
47
|
+
onDone: {
|
|
48
|
+
target: 'inquired',
|
|
49
|
+
},
|
|
50
|
+
onError: {
|
|
51
|
+
target: 'idle',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
inquired: {
|
|
56
|
+
after: {
|
|
57
|
+
0: {
|
|
58
|
+
target: 'idle',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
submitting: {
|
|
63
|
+
invoke: {
|
|
64
|
+
src: 'submitDeposit',
|
|
65
|
+
onDone: {
|
|
66
|
+
target: 'submitted',
|
|
67
|
+
actions: 'setProcessing',
|
|
68
|
+
},
|
|
69
|
+
onError: {
|
|
70
|
+
target: 'fail',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
submitted: {},
|
|
75
|
+
fail: {},
|
|
76
|
+
},
|
|
77
|
+
on: {
|
|
78
|
+
INQUIRY_ACCOUNT: {
|
|
79
|
+
target: 'inquiring',
|
|
80
|
+
},
|
|
81
|
+
ADD_AMOUNT: {
|
|
82
|
+
actions: 'addAmount',
|
|
83
|
+
},
|
|
84
|
+
SET_AMOUNT: {
|
|
85
|
+
actions: 'setAmount',
|
|
86
|
+
},
|
|
87
|
+
CLEAR_AMOUNT: {
|
|
88
|
+
actions: 'clearAmount',
|
|
89
|
+
},
|
|
90
|
+
SUBMIT: {
|
|
91
|
+
target: 'submitting',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
actions: {
|
|
97
|
+
setPaymentDetail: assign((context, event) => {
|
|
98
|
+
const paymentDetail = event.data
|
|
99
|
+
const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
|
|
100
|
+
const currentPayment = payments[0]
|
|
101
|
+
const options = currentPayment.optional || []
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
currentPayment,
|
|
105
|
+
options,
|
|
106
|
+
processing: currentPayment.processing?.[0],
|
|
107
|
+
}
|
|
108
|
+
}),
|
|
109
|
+
addAmount: assign((context, event) => {
|
|
110
|
+
return {
|
|
111
|
+
amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
setAmount: assign((context, event) => {
|
|
115
|
+
return { amount: parseFloat(`${event.data}`) }
|
|
116
|
+
}),
|
|
117
|
+
clearAmount: assign((context, event) => {
|
|
118
|
+
return { amount: null }
|
|
119
|
+
}),
|
|
120
|
+
setProcessing: assign((context, event) => {
|
|
121
|
+
return {
|
|
122
|
+
processing: event.data,
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
},
|
|
126
|
+
guards: {
|
|
127
|
+
isProcessing: (context, event) => {
|
|
128
|
+
return context.processing
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
services: {
|
|
132
|
+
fetchPaymentDetail: async (context, event) => {
|
|
133
|
+
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
134
|
+
},
|
|
135
|
+
accountInquiry: async (context, event) => {
|
|
136
|
+
const { from, title, content } = event.data
|
|
137
|
+
return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
|
|
138
|
+
},
|
|
139
|
+
submitDeposit: async (context, event) => {
|
|
140
|
+
const { currentPayment, amount } = context
|
|
141
|
+
return await request.send(
|
|
142
|
+
payment.submitDepositTransaction({
|
|
143
|
+
method: currentPayment.method,
|
|
144
|
+
amount,
|
|
145
|
+
})
|
|
146
|
+
)
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
}
|
|
@@ -4,13 +4,14 @@ import common from '../../api/common.js'
|
|
|
4
4
|
import { max } from '../../util/index.js'
|
|
5
5
|
|
|
6
6
|
export default function (request, context) {
|
|
7
|
-
const { paymentDetail = [], promotion, selectedAmount } = context || {}
|
|
7
|
+
const { paymentDetail = [], promotion, selectedAmount, siteConfig = {} } = context || {}
|
|
8
8
|
|
|
9
9
|
return createMachine(
|
|
10
10
|
{
|
|
11
11
|
id: 'manual_cash',
|
|
12
12
|
initial: 'loading',
|
|
13
13
|
context: {
|
|
14
|
+
siteConfig,
|
|
14
15
|
paymentDetail,
|
|
15
16
|
promotion,
|
|
16
17
|
selectedAmount,
|
|
@@ -23,6 +24,8 @@ export default function (request, context) {
|
|
|
23
24
|
selectedUserBank: null,
|
|
24
25
|
userAccountNumber: null,
|
|
25
26
|
userAccountName: null,
|
|
27
|
+
userAccountBranchName: null,
|
|
28
|
+
userAccountBranchCode: null,
|
|
26
29
|
depositTime: null,
|
|
27
30
|
receipt: null,
|
|
28
31
|
|
|
@@ -79,6 +82,12 @@ export default function (request, context) {
|
|
|
79
82
|
SELECT_USER_BANK: {
|
|
80
83
|
actions: 'setUserBank',
|
|
81
84
|
},
|
|
85
|
+
INPUT_USER_ACCOUNT_BRANCH_NAME: {
|
|
86
|
+
actions: 'setUserAccountBranchName',
|
|
87
|
+
},
|
|
88
|
+
INPUT_USER_ACCOUNT_BRANCH_CODE: {
|
|
89
|
+
actions: 'setUserAccountBranchCode',
|
|
90
|
+
},
|
|
82
91
|
INPUT_USER_ACCOUNT_NUMBER: {
|
|
83
92
|
actions: 'setUserAccountNumber',
|
|
84
93
|
},
|
|
@@ -168,6 +177,8 @@ export default function (request, context) {
|
|
|
168
177
|
selectedUserBank: userBanks[0],
|
|
169
178
|
userAccountNumber: userBanks[0].accountNumber,
|
|
170
179
|
userAccountName: userBanks[0].holderName,
|
|
180
|
+
userAccountBranchName: userBanks[0].branch,
|
|
181
|
+
userAccountBranchCode: userBanks[0].branchCode,
|
|
171
182
|
}
|
|
172
183
|
}),
|
|
173
184
|
setHouseBank: assign((context, event) => {
|
|
@@ -194,11 +205,23 @@ export default function (request, context) {
|
|
|
194
205
|
}
|
|
195
206
|
}),
|
|
196
207
|
setUserBank: assign((context, event) => {
|
|
197
|
-
const { accountNumber, holderName } = event.data
|
|
208
|
+
const { accountNumber, holderName, branch, branchCode } = event.data
|
|
198
209
|
return {
|
|
199
210
|
selectedUserBank: event.data,
|
|
200
211
|
userAccountNumber: accountNumber,
|
|
201
212
|
userAccountName: holderName,
|
|
213
|
+
userAccountBranchName: branch,
|
|
214
|
+
userAccountBranchCode: branchCode,
|
|
215
|
+
}
|
|
216
|
+
}),
|
|
217
|
+
setUserAccountBranchName: assign((context, event) => {
|
|
218
|
+
return {
|
|
219
|
+
userAccountBranchName: event.data,
|
|
220
|
+
}
|
|
221
|
+
}),
|
|
222
|
+
setUserAccountBranchCode: assign((context, event) => {
|
|
223
|
+
return {
|
|
224
|
+
userAccountBranchCode: event.data,
|
|
202
225
|
}
|
|
203
226
|
}),
|
|
204
227
|
setUserAccountNumber: assign((context, event) => {
|
|
@@ -244,8 +267,15 @@ export default function (request, context) {
|
|
|
244
267
|
return context.calculation
|
|
245
268
|
},
|
|
246
269
|
isSubmittable: (context, event) => {
|
|
247
|
-
const { selectedAmount, userAccountNumber, userAccountName, depositTime, receipt } = context
|
|
248
|
-
|
|
270
|
+
const { selectedAmount, userAccountNumber, userAccountName, userAccountBranchCode, depositTime, receipt } = context
|
|
271
|
+
const { branchCodeEnable = '0' } = context.siteConfig
|
|
272
|
+
const defaultCheck = selectedAmount && userAccountNumber && userAccountName && depositTime && receipt
|
|
273
|
+
|
|
274
|
+
if (branchCodeEnable === '1') {
|
|
275
|
+
return defaultCheck && userAccountBranchCode
|
|
276
|
+
} else {
|
|
277
|
+
return defaultCheck
|
|
278
|
+
}
|
|
249
279
|
},
|
|
250
280
|
isProcessing: (context, event) => {
|
|
251
281
|
return context.processing
|
|
@@ -284,8 +314,19 @@ export default function (request, context) {
|
|
|
284
314
|
)
|
|
285
315
|
},
|
|
286
316
|
submitDeposit: async (context, event) => {
|
|
287
|
-
const {
|
|
288
|
-
|
|
317
|
+
const {
|
|
318
|
+
method,
|
|
319
|
+
selectedAmount,
|
|
320
|
+
selectedHouseBank,
|
|
321
|
+
selectedUserBank,
|
|
322
|
+
userAccountNumber,
|
|
323
|
+
userAccountName,
|
|
324
|
+
userAccountBranchName,
|
|
325
|
+
userAccountBranchCode,
|
|
326
|
+
depositTime,
|
|
327
|
+
receipt,
|
|
328
|
+
promotion,
|
|
329
|
+
} = context
|
|
289
330
|
return await request.send(
|
|
290
331
|
payment.submitDepositTransactionBank({
|
|
291
332
|
method,
|
|
@@ -295,6 +336,8 @@ export default function (request, context) {
|
|
|
295
336
|
applyerBankCode: selectedUserBank.bankCode,
|
|
296
337
|
applyerAccountNumber: userAccountNumber,
|
|
297
338
|
applyerHolderName: userAccountName,
|
|
339
|
+
applyerBranchName: userAccountBranchName,
|
|
340
|
+
applyerBranchCode: userAccountBranchCode,
|
|
298
341
|
depositTime,
|
|
299
342
|
receipt,
|
|
300
343
|
promotionsNo: promotion?.promotionsNo,
|
|
@@ -21,6 +21,8 @@ export default function (request) {
|
|
|
21
21
|
selectedUserBank: null,
|
|
22
22
|
userAccountNumber: null,
|
|
23
23
|
userAccountName: null,
|
|
24
|
+
userAccountBranchName: null,
|
|
25
|
+
userAccountBranchCode: null,
|
|
24
26
|
depositTime: null,
|
|
25
27
|
receipt: null,
|
|
26
28
|
|
|
@@ -200,6 +202,12 @@ export default function (request) {
|
|
|
200
202
|
SELECT_USER_BANK: {
|
|
201
203
|
actions: 'setUserBank',
|
|
202
204
|
},
|
|
205
|
+
INPUT_USER_ACCOUNT_BRANCH_NAME: {
|
|
206
|
+
actions: 'setUserAccountBranchName',
|
|
207
|
+
},
|
|
208
|
+
INPUT_USER_ACCOUNT_BRANCH_CODE: {
|
|
209
|
+
actions: 'setUserAccountBranchCode',
|
|
210
|
+
},
|
|
203
211
|
INPUT_USER_ACCOUNT_NUMBER: {
|
|
204
212
|
actions: 'setUserAccountNumber',
|
|
205
213
|
},
|
|
@@ -278,6 +286,8 @@ export default function (request) {
|
|
|
278
286
|
selectedUserBank: userBanks[0],
|
|
279
287
|
userAccountNumber: userBanks[0].accountNumber,
|
|
280
288
|
userAccountName: userBanks[0].holderName,
|
|
289
|
+
userAccountBranchName: userBanks[0].branch,
|
|
290
|
+
userAccountBranchCode: userBanks[0].branchCode,
|
|
281
291
|
}
|
|
282
292
|
}),
|
|
283
293
|
setHouseBank: assign((context, event) => {
|
|
@@ -306,11 +316,23 @@ export default function (request) {
|
|
|
306
316
|
}
|
|
307
317
|
}),
|
|
308
318
|
setUserBank: assign((context, event) => {
|
|
309
|
-
const { accountNumber, holderName } = event.data
|
|
319
|
+
const { accountNumber, holderName, branch, branchCode } = event.data
|
|
310
320
|
return {
|
|
311
321
|
selectedUserBank: event.data,
|
|
312
322
|
userAccountNumber: accountNumber,
|
|
313
323
|
userAccountName: holderName,
|
|
324
|
+
userAccountBranchName: branch,
|
|
325
|
+
userAccountBranchCode: branchCode,
|
|
326
|
+
}
|
|
327
|
+
}),
|
|
328
|
+
setUserAccountBranchName: assign((context, event) => {
|
|
329
|
+
return {
|
|
330
|
+
userAccountBranchName: event.data,
|
|
331
|
+
}
|
|
332
|
+
}),
|
|
333
|
+
setUserAccountBranchCode: assign((context, event) => {
|
|
334
|
+
return {
|
|
335
|
+
userAccountBranchCode: event.data,
|
|
314
336
|
}
|
|
315
337
|
}),
|
|
316
338
|
setUserAccountNumber: assign((context, event) => {
|
|
@@ -359,8 +381,14 @@ export default function (request) {
|
|
|
359
381
|
return context.calculation
|
|
360
382
|
},
|
|
361
383
|
isSubmittable: (context, event) => {
|
|
362
|
-
const { amount, userAccountNumber, userAccountName, depositTime, receipt } = context
|
|
363
|
-
|
|
384
|
+
const { amount, userAccountNumber, userAccountName, userAccountBranchCode, depositTime, receipt } = context
|
|
385
|
+
const { branchCodeEnable = '0' } = context.siteConfig
|
|
386
|
+
const defaultCheck = amount && userAccountNumber && userAccountName && depositTime && receipt
|
|
387
|
+
if (branchCodeEnable === '1') {
|
|
388
|
+
return defaultCheck && userAccountBranchCode
|
|
389
|
+
} else {
|
|
390
|
+
return defaultCheck
|
|
391
|
+
}
|
|
364
392
|
},
|
|
365
393
|
isProcessing: (context, event) => {
|
|
366
394
|
return context.processing
|
|
@@ -398,7 +426,19 @@ export default function (request) {
|
|
|
398
426
|
)
|
|
399
427
|
},
|
|
400
428
|
submitDeposit: async (context, event) => {
|
|
401
|
-
const {
|
|
429
|
+
const {
|
|
430
|
+
method,
|
|
431
|
+
amount,
|
|
432
|
+
selectedHouseBank,
|
|
433
|
+
selectedUserBank,
|
|
434
|
+
userAccountNumber,
|
|
435
|
+
userAccountName,
|
|
436
|
+
userAccountBranchName,
|
|
437
|
+
userAccountBranchCode,
|
|
438
|
+
depositTime,
|
|
439
|
+
receipt,
|
|
440
|
+
promotion,
|
|
441
|
+
} = context
|
|
402
442
|
return await request.send(
|
|
403
443
|
payment.submitDepositTransactionBank({
|
|
404
444
|
method,
|
|
@@ -408,6 +448,8 @@ export default function (request) {
|
|
|
408
448
|
applyerBankCode: selectedUserBank.bankCode,
|
|
409
449
|
applyerAccountNumber: userAccountNumber,
|
|
410
450
|
applyerHolderName: userAccountName,
|
|
451
|
+
applyerBranchName: userAccountBranchName,
|
|
452
|
+
applyerBranchCode: userAccountBranchCode,
|
|
411
453
|
depositTime,
|
|
412
454
|
receipt,
|
|
413
455
|
promotionsNo: promotion?.activityNo,
|
package/src/machine/game_v2_1.js
CHANGED
|
@@ -143,11 +143,11 @@ export default function (request) {
|
|
|
143
143
|
src: 'disconnectGame',
|
|
144
144
|
onDone: {
|
|
145
145
|
target: 'idle',
|
|
146
|
-
actions: 'setGameURL',
|
|
146
|
+
// actions: 'setGameURL',
|
|
147
147
|
},
|
|
148
148
|
onError: {
|
|
149
149
|
target: 'idle',
|
|
150
|
-
actions: 'setGameURL',
|
|
150
|
+
// actions: 'setGameURL',
|
|
151
151
|
},
|
|
152
152
|
},
|
|
153
153
|
},
|
package/src/machine/inbox.js
CHANGED
|
@@ -3,13 +3,25 @@ import mailbox from '../api/mailbox.js'
|
|
|
3
3
|
import activity from '../api/activity.js'
|
|
4
4
|
|
|
5
5
|
const messageState = {
|
|
6
|
-
// always: [{ actions: 'showUnread', cond: 'isShowUnread' }],
|
|
7
6
|
initial: 'idle',
|
|
8
7
|
states: {
|
|
9
8
|
idle: {
|
|
10
9
|
initial: 'hidden',
|
|
11
10
|
states: {
|
|
12
11
|
hidden: {},
|
|
12
|
+
delecting: {
|
|
13
|
+
invoke: {
|
|
14
|
+
src: 'deleteMessages',
|
|
15
|
+
onDone: {
|
|
16
|
+
target: 'delected',
|
|
17
|
+
actions: 'removeMessage',
|
|
18
|
+
},
|
|
19
|
+
onError: {
|
|
20
|
+
target: 'hidden',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
delected: {},
|
|
13
25
|
shown: {
|
|
14
26
|
on: {
|
|
15
27
|
HIDE_MESSAGE: {
|
|
@@ -21,6 +33,20 @@ const messageState = {
|
|
|
21
33
|
},
|
|
22
34
|
on: {
|
|
23
35
|
SHOW_MESSAGE: [
|
|
36
|
+
{
|
|
37
|
+
target: 'fetchingCustomerMessage',
|
|
38
|
+
actions: ['showMessage', 'setMessageIsRead'],
|
|
39
|
+
cond: (context, event) => {
|
|
40
|
+
const { isRead } = event.data
|
|
41
|
+
const { currentTab } = context
|
|
42
|
+
return currentTab === 'CUSTOMER' && isRead
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
target: 'updating',
|
|
47
|
+
actions: ['showMessage', 'setMessageIsRead'],
|
|
48
|
+
cond: 'isCustomer',
|
|
49
|
+
},
|
|
24
50
|
{
|
|
25
51
|
target: '.shown',
|
|
26
52
|
actions: 'showMessage',
|
|
@@ -31,19 +57,35 @@ const messageState = {
|
|
|
31
57
|
actions: ['showMessage', 'setMessageIsRead'],
|
|
32
58
|
},
|
|
33
59
|
],
|
|
60
|
+
SELECT_MESSAGES: {
|
|
61
|
+
actions: ['selectMessages', 'setDelectMessages'],
|
|
62
|
+
},
|
|
63
|
+
DELETE_MESSAGES: {
|
|
64
|
+
target: '.delecting',
|
|
65
|
+
},
|
|
34
66
|
},
|
|
35
67
|
},
|
|
36
|
-
|
|
68
|
+
fetchingCustomerMessage: {
|
|
37
69
|
invoke: {
|
|
38
|
-
src: '
|
|
70
|
+
src: 'getMessage',
|
|
39
71
|
onDone: {
|
|
40
72
|
target: 'idle.shown',
|
|
73
|
+
actions: 'setCustomerMessage',
|
|
41
74
|
},
|
|
42
75
|
onError: {
|
|
43
76
|
target: 'idle.shown',
|
|
44
77
|
},
|
|
45
78
|
},
|
|
46
79
|
},
|
|
80
|
+
updating: {
|
|
81
|
+
invoke: {
|
|
82
|
+
src: 'updateMessageIsRead',
|
|
83
|
+
onDone: [{ target: 'fetchingCustomerMessage', cond: 'isCustomer' }, { target: 'idle.shown' }],
|
|
84
|
+
onError: {
|
|
85
|
+
target: 'idle.shown',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
47
89
|
},
|
|
48
90
|
}
|
|
49
91
|
|
|
@@ -59,7 +101,8 @@ export default function (request) {
|
|
|
59
101
|
currentTab: null,
|
|
60
102
|
inbox: {},
|
|
61
103
|
messageDetail: null,
|
|
62
|
-
|
|
104
|
+
hasCustomer: false,
|
|
105
|
+
selectedDeleteMessages: null,
|
|
63
106
|
},
|
|
64
107
|
states: {
|
|
65
108
|
loading: {
|
|
@@ -105,15 +148,42 @@ export default function (request) {
|
|
|
105
148
|
},
|
|
106
149
|
},
|
|
107
150
|
},
|
|
151
|
+
inquiring: {
|
|
152
|
+
invoke: {
|
|
153
|
+
src: 'accountInquiry',
|
|
154
|
+
onDone: {
|
|
155
|
+
target: 'inquired',
|
|
156
|
+
},
|
|
157
|
+
onError: {
|
|
158
|
+
target: 'failed',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
inquired: {
|
|
163
|
+
after: {
|
|
164
|
+
0: {
|
|
165
|
+
target: 'reloadMessages',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
reloadMessages: {
|
|
170
|
+
invoke: {
|
|
171
|
+
src: 'reFetchMessages',
|
|
172
|
+
onDone: {
|
|
173
|
+
target: 'more',
|
|
174
|
+
actions: 'setInbox',
|
|
175
|
+
},
|
|
176
|
+
onError: {
|
|
177
|
+
target: 'end',
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
},
|
|
108
181
|
end: {
|
|
109
182
|
...messageState,
|
|
110
183
|
},
|
|
111
184
|
failed: {},
|
|
112
185
|
},
|
|
113
186
|
on: {
|
|
114
|
-
// SHOW_SYSTEM_MESSAGE: {
|
|
115
|
-
// actions: 'showSystemMessage',
|
|
116
|
-
// },
|
|
117
187
|
SET_TAB: {
|
|
118
188
|
target: '.checking',
|
|
119
189
|
actions: ['setCurrentTab', 'hideMessage'],
|
|
@@ -126,6 +196,17 @@ export default function (request) {
|
|
|
126
196
|
target: '.loading',
|
|
127
197
|
actions: 'reset',
|
|
128
198
|
},
|
|
199
|
+
INQUIRY_ACCOUNT: {
|
|
200
|
+
target: '.inquiring',
|
|
201
|
+
actions: assign((context, event) => {
|
|
202
|
+
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
203
|
+
inbox[currentTab].page = -1
|
|
204
|
+
return {
|
|
205
|
+
inbox,
|
|
206
|
+
messageDetail: null,
|
|
207
|
+
}
|
|
208
|
+
}),
|
|
209
|
+
},
|
|
129
210
|
},
|
|
130
211
|
},
|
|
131
212
|
{
|
|
@@ -145,14 +226,13 @@ export default function (request) {
|
|
|
145
226
|
isRead: (context, event) => {
|
|
146
227
|
return event.data.isRead
|
|
147
228
|
},
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
229
|
+
isCustomer: (context, event) => {
|
|
230
|
+
return context.currentTab === 'CUSTOMER'
|
|
231
|
+
},
|
|
151
232
|
},
|
|
152
233
|
actions: {
|
|
153
234
|
reset: assign((context, event) => {
|
|
154
235
|
return {
|
|
155
|
-
tabs: [],
|
|
156
236
|
currentTab: null,
|
|
157
237
|
inbox: {},
|
|
158
238
|
messageDetail: null,
|
|
@@ -173,6 +253,29 @@ export default function (request) {
|
|
|
173
253
|
currentTab: event.data,
|
|
174
254
|
}
|
|
175
255
|
}),
|
|
256
|
+
selectMessages: assign((context, event) => {
|
|
257
|
+
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
258
|
+
const data = inbox[currentTab].data.map((item) => {
|
|
259
|
+
if (item.groupId === event.data.groupId) {
|
|
260
|
+
item.isSelected = !item.isSelected
|
|
261
|
+
}
|
|
262
|
+
return item
|
|
263
|
+
})
|
|
264
|
+
inbox[currentTab].data = data
|
|
265
|
+
return { inbox }
|
|
266
|
+
}),
|
|
267
|
+
setDelectMessages: assign((context, event) => {
|
|
268
|
+
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
269
|
+
const selectedMessages = inbox[currentTab].data?.filter((item) => item.isSelected)
|
|
270
|
+
const groupIdsArray = selectedMessages?.map((item) => item.groupId)
|
|
271
|
+
const groupIds = groupIdsArray?.join(',')
|
|
272
|
+
return { selectedDeleteMessages: groupIds }
|
|
273
|
+
}),
|
|
274
|
+
setCustomerMessage: assign((context, event) => {
|
|
275
|
+
return {
|
|
276
|
+
messageDetail: event.data.data,
|
|
277
|
+
}
|
|
278
|
+
}),
|
|
176
279
|
showMessage: assign((context, event) => {
|
|
177
280
|
return {
|
|
178
281
|
messageDetail: event.data,
|
|
@@ -183,19 +286,18 @@ export default function (request) {
|
|
|
183
286
|
messageDetail: null,
|
|
184
287
|
}
|
|
185
288
|
}),
|
|
289
|
+
removeMessage: assign((context, event) => {
|
|
290
|
+
const groupIds = event.data
|
|
291
|
+
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
292
|
+
const data = inbox[currentTab].data.filter((item) => !groupIds.find((groupId) => groupId === item.groupId))
|
|
293
|
+
inbox[currentTab].data = data
|
|
294
|
+
return { inbox }
|
|
295
|
+
}),
|
|
186
296
|
setInbox: assign((context, event) => {
|
|
187
297
|
return {
|
|
188
298
|
inbox: event.data,
|
|
189
299
|
}
|
|
190
300
|
}),
|
|
191
|
-
// showUnread: assign((context, event) => {
|
|
192
|
-
// const { currentTab, inbox } = context
|
|
193
|
-
// const messageDetail = inbox[currentTab]?.data.find((item) => !item.isRead)
|
|
194
|
-
// return {
|
|
195
|
-
// messageDetail,
|
|
196
|
-
// isShowUnread: false,
|
|
197
|
-
// }
|
|
198
|
-
// }),
|
|
199
301
|
setMessageIsRead: assign((context, event) => {
|
|
200
302
|
const { inbox, currentTab } = JSON.parse(JSON.stringify(context))
|
|
201
303
|
const data = inbox[currentTab].data.map((item) => {
|
|
@@ -207,12 +309,6 @@ export default function (request) {
|
|
|
207
309
|
inbox[currentTab].data = data
|
|
208
310
|
return { inbox }
|
|
209
311
|
}),
|
|
210
|
-
// showSystemMessage: assign((context, event) => {
|
|
211
|
-
// return {
|
|
212
|
-
// currentTab: 'SYSTEM',
|
|
213
|
-
// isShowUnread: true,
|
|
214
|
-
// }
|
|
215
|
-
// }),
|
|
216
312
|
},
|
|
217
313
|
services: {
|
|
218
314
|
fetchTabs: async (context, event) => {
|
|
@@ -221,24 +317,44 @@ export default function (request) {
|
|
|
221
317
|
return tabs
|
|
222
318
|
},
|
|
223
319
|
fetchMessages: async (context, event) => {
|
|
224
|
-
const { isRewardListEnable, currentTab, inbox } = JSON.parse(JSON.stringify(context))
|
|
320
|
+
const { isRewardListEnable, currentTab, inbox, hasCustomer } = JSON.parse(JSON.stringify(context))
|
|
225
321
|
if (isRewardListEnable && (currentTab === 'REWARD' || currentTab === 'DIAMOND')) {
|
|
226
322
|
const { data } = await request.send(activity.getRewardList({ count: 30, appSecret }))
|
|
227
323
|
inbox[currentTab] = { data, page: 0, totalPage: 1 }
|
|
228
324
|
} else {
|
|
229
325
|
const { page = -1 } = inbox[currentTab] || {}
|
|
230
|
-
const
|
|
231
|
-
const
|
|
326
|
+
const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: page + 1 }))
|
|
327
|
+
const formattedData = data?.map((item) => ({ ...item, isSelected: false }))
|
|
232
328
|
const currentData = inbox[currentTab]?.data || []
|
|
233
|
-
inbox[currentTab] = { data: currentData.concat(
|
|
329
|
+
inbox[currentTab] = { data: currentData.concat(formattedData), ...rest }
|
|
234
330
|
}
|
|
235
331
|
return inbox
|
|
236
332
|
},
|
|
333
|
+
reFetchMessages: async (context, event) => {
|
|
334
|
+
const { currentTab, inbox } = JSON.parse(JSON.stringify(context))
|
|
335
|
+
const { data, ...rest } = await request.send(mailbox.getMessageList({ type: currentTab, page: 0 }))
|
|
336
|
+
let formattedData = []
|
|
337
|
+
formattedData = data?.map((item) => ({ ...item, isSelected: false }))
|
|
338
|
+
inbox[currentTab] = { data: formattedData, ...rest }
|
|
339
|
+
return inbox
|
|
340
|
+
},
|
|
237
341
|
updateMessageIsRead: async (context, event) => {
|
|
238
|
-
const {
|
|
239
|
-
request.send(mailbox.updateMessage({ groupId:
|
|
240
|
-
|
|
241
|
-
|
|
342
|
+
const { messageDetail } = context
|
|
343
|
+
request.send(mailbox.updateMessage({ groupId: messageDetail.groupId, isRead: true }))
|
|
344
|
+
return true
|
|
345
|
+
},
|
|
346
|
+
deleteMessages: async (context, event) => {
|
|
347
|
+
const { selectedDeleteMessages } = context
|
|
348
|
+
const { groupId = '' } = await request.send(mailbox.updateMessage({ groupId: selectedDeleteMessages, isDelete: true }))
|
|
349
|
+
return groupId.split(',')
|
|
350
|
+
},
|
|
351
|
+
accountInquiry: async (context, event) => {
|
|
352
|
+
const { from, title, content } = event.data
|
|
353
|
+
return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
|
|
354
|
+
},
|
|
355
|
+
getMessage: async (context, event) => {
|
|
356
|
+
const { messageDetail } = context
|
|
357
|
+
return await request.send(mailbox.getMessage({ groupId: messageDetail.groupId }))
|
|
242
358
|
},
|
|
243
359
|
},
|
|
244
360
|
}
|
|
@@ -28,13 +28,17 @@ export default function (request) {
|
|
|
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
|
},
|
|
@@ -66,32 +70,76 @@ export default function (request) {
|
|
|
66
70
|
reCaptchaToken,
|
|
67
71
|
}
|
|
68
72
|
}),
|
|
69
|
-
|
|
73
|
+
setFriendCode: assign((context, event) => {
|
|
70
74
|
const { fc } = event.data
|
|
75
|
+
return { fc }
|
|
76
|
+
}),
|
|
77
|
+
setSignUpId: assign((context, event) => {
|
|
78
|
+
const {
|
|
79
|
+
username,
|
|
80
|
+
password,
|
|
81
|
+
countryCode,
|
|
82
|
+
phone,
|
|
83
|
+
channel,
|
|
84
|
+
subchannel,
|
|
85
|
+
bankCode,
|
|
86
|
+
bankAccount,
|
|
87
|
+
holderName,
|
|
88
|
+
branch,
|
|
89
|
+
branchCode,
|
|
90
|
+
affiliateCode,
|
|
91
|
+
} = event.data
|
|
71
92
|
return {
|
|
72
|
-
|
|
93
|
+
signUpData: {
|
|
94
|
+
provider: 'local',
|
|
95
|
+
username,
|
|
96
|
+
password,
|
|
97
|
+
countryCode,
|
|
98
|
+
phone,
|
|
99
|
+
bankCode,
|
|
100
|
+
bankAccount,
|
|
101
|
+
holderName,
|
|
102
|
+
branch,
|
|
103
|
+
branchCode,
|
|
104
|
+
affiliateCode,
|
|
105
|
+
},
|
|
106
|
+
channel,
|
|
107
|
+
subchannel,
|
|
73
108
|
}
|
|
74
109
|
}),
|
|
75
110
|
setSignUpPhone: assign((context, event) => {
|
|
76
|
-
const { countryCode, phone, password, channel, subchannel } =
|
|
111
|
+
const { countryCode, phone, password, channel, subchannel, bankCode, bankAccount, holderName, branch, branchCode, affiliateCode } =
|
|
112
|
+
event.data
|
|
77
113
|
return {
|
|
78
114
|
signUpData: {
|
|
79
115
|
provider: 'phone',
|
|
80
116
|
countryCode,
|
|
81
117
|
phone,
|
|
82
118
|
password,
|
|
119
|
+
bankCode,
|
|
120
|
+
bankAccount,
|
|
121
|
+
holderName,
|
|
122
|
+
branch,
|
|
123
|
+
branchCode,
|
|
124
|
+
affiliateCode,
|
|
83
125
|
},
|
|
84
126
|
channel,
|
|
85
127
|
subchannel,
|
|
86
128
|
}
|
|
87
129
|
}),
|
|
88
130
|
setSignUpEmail: assign((context, event) => {
|
|
89
|
-
const { email, password, channel, subchannel } = event.data
|
|
131
|
+
const { email, password, channel, subchannel, bankCode, bankAccount, holderName, branch, branchCode, affiliateCode } = event.data
|
|
90
132
|
return {
|
|
91
133
|
signUpData: {
|
|
92
134
|
provider: 'email',
|
|
93
135
|
email,
|
|
94
136
|
password,
|
|
137
|
+
bankCode,
|
|
138
|
+
bankAccount,
|
|
139
|
+
holderName,
|
|
140
|
+
branch,
|
|
141
|
+
branchCode,
|
|
142
|
+
affiliateCode,
|
|
95
143
|
},
|
|
96
144
|
channel,
|
|
97
145
|
subchannel,
|
|
@@ -122,7 +170,7 @@ export default function (request) {
|
|
|
122
170
|
const { channel, subchannel, signUpData, deviceTokenEnable } = context
|
|
123
171
|
const dt = await getDeviceToken({ fpToken, sentry, hosts: request.hosts, enable: deviceTokenEnable })
|
|
124
172
|
|
|
125
|
-
const affiliateCode = storage.get('ac')
|
|
173
|
+
const affiliateCode = storage.get('ac') || signUpData?.affiliateCode
|
|
126
174
|
const messages = {
|
|
127
175
|
url: window.location.href,
|
|
128
176
|
channelOrders: [
|
|
@@ -4,6 +4,7 @@ import withdraw_vn2 from './withdraw_vn2.js'
|
|
|
4
4
|
import withdraw_crypto from './withdraw_crypto.js'
|
|
5
5
|
import withdraw_crypto2 from './withdraw_crypto2.js'
|
|
6
6
|
import withdraw_amb from './withdraw_amb.js'
|
|
7
|
+
import withdraw_krway from './withdraw_krway.js'
|
|
7
8
|
import withdraw_crypto_cash from './withdraw_crypto_cash.js'
|
|
8
9
|
import withdraw_manual_cash from './withdraw_manual_cash.js'
|
|
9
10
|
|
|
@@ -14,6 +15,7 @@ export default {
|
|
|
14
15
|
withdraw_crypto,
|
|
15
16
|
withdraw_crypto2,
|
|
16
17
|
withdraw_amb,
|
|
18
|
+
withdraw_krway,
|
|
17
19
|
withdraw_crypto_cash,
|
|
18
20
|
withdraw_manual_cash,
|
|
19
21
|
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import findLastIndex from 'lodash/findLastIndex.js'
|
|
3
|
+
import payment from '../../api/payment.js'
|
|
4
|
+
import user from '../../api/user.js'
|
|
5
|
+
|
|
6
|
+
export default function (request) {
|
|
7
|
+
const { appSecret } = request.config
|
|
8
|
+
return createMachine(
|
|
9
|
+
{
|
|
10
|
+
id: 'withdraw_krway',
|
|
11
|
+
initial: 'loading',
|
|
12
|
+
context: {
|
|
13
|
+
userInfo: {},
|
|
14
|
+
paymentDetail: {},
|
|
15
|
+
minimum: 0,
|
|
16
|
+
maximum: 0,
|
|
17
|
+
options: [],
|
|
18
|
+
amount: 0,
|
|
19
|
+
bankInfo: [],
|
|
20
|
+
bank: null,
|
|
21
|
+
enableWithdraw: false,
|
|
22
|
+
applyId: '',
|
|
23
|
+
balance: 0,
|
|
24
|
+
realAmount: 0,
|
|
25
|
+
charge: 0,
|
|
26
|
+
},
|
|
27
|
+
states: {
|
|
28
|
+
loading: {
|
|
29
|
+
invoke: {
|
|
30
|
+
src: 'fetchPaymentDetail',
|
|
31
|
+
onDone: {
|
|
32
|
+
target: 'fetching',
|
|
33
|
+
actions: 'setPaymentData',
|
|
34
|
+
},
|
|
35
|
+
onError: {
|
|
36
|
+
target: 'fail',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
fetching: {
|
|
41
|
+
invoke: {
|
|
42
|
+
src: 'fetchWithdrawRules',
|
|
43
|
+
onDone: {
|
|
44
|
+
target: 'checking',
|
|
45
|
+
actions: 'updateWithdrawCondition',
|
|
46
|
+
},
|
|
47
|
+
onError: {
|
|
48
|
+
target: 'fail',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
checking: {
|
|
53
|
+
always: [
|
|
54
|
+
{ target: 'inProcessing', cond: 'haveProcessing' },
|
|
55
|
+
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
56
|
+
{ target: 'withdrawable' },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
inProcessing: {},
|
|
60
|
+
notWithdrawable: {},
|
|
61
|
+
withdrawable: {
|
|
62
|
+
on: {
|
|
63
|
+
ADD_AMOUNT: {
|
|
64
|
+
actions: 'addAmount',
|
|
65
|
+
},
|
|
66
|
+
SET_AMOUNT: {
|
|
67
|
+
actions: 'setAmount',
|
|
68
|
+
},
|
|
69
|
+
CLEAR_AMOUNT: {
|
|
70
|
+
actions: 'clearAmount',
|
|
71
|
+
},
|
|
72
|
+
SUBMIT: {
|
|
73
|
+
target: 'submitting',
|
|
74
|
+
cond: 'isSubmittable',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
submitting: {
|
|
79
|
+
invoke: {
|
|
80
|
+
src: 'submitWithdraw',
|
|
81
|
+
onDone: {
|
|
82
|
+
target: 'submitted',
|
|
83
|
+
actions: 'setResult',
|
|
84
|
+
},
|
|
85
|
+
onError: {
|
|
86
|
+
target: 'withdrawable',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
submitted: {
|
|
91
|
+
invoke: {
|
|
92
|
+
src: 'fetchPaymentDetail',
|
|
93
|
+
onDone: {
|
|
94
|
+
target: 'inProcessing',
|
|
95
|
+
actions: 'setPaymentData',
|
|
96
|
+
},
|
|
97
|
+
onError: {
|
|
98
|
+
target: 'fail',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
fail: {},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
actions: {
|
|
107
|
+
setPaymentData: assign((context, event) => {
|
|
108
|
+
const { paymentDetail, bankInfo } = event.data
|
|
109
|
+
const { minimum, maximum, optional } = paymentDetail?.[0] || {}
|
|
110
|
+
return { paymentDetail, bank: bankInfo[0], minimum, maximum, options: optional }
|
|
111
|
+
}),
|
|
112
|
+
updateWithdrawCondition: assign((context, event) => {
|
|
113
|
+
const { enableWithdraw, balance } = event.data
|
|
114
|
+
return {
|
|
115
|
+
balance,
|
|
116
|
+
enableWithdraw,
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
addAmount: assign((context, event) => {
|
|
120
|
+
return {
|
|
121
|
+
amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
setAmount: assign((context, event) => {
|
|
125
|
+
return { amount: parseFloat(`${event.data}`) }
|
|
126
|
+
}),
|
|
127
|
+
clearAmount: assign((context, event) => {
|
|
128
|
+
return { amount: null }
|
|
129
|
+
}),
|
|
130
|
+
setResult: assign((context, event) => {
|
|
131
|
+
const { applyId, balance, realAmount, charge } = event.data
|
|
132
|
+
return { applyId, balance, realAmount, charge }
|
|
133
|
+
}),
|
|
134
|
+
},
|
|
135
|
+
guards: {
|
|
136
|
+
haveProcessing: (context, event) => {
|
|
137
|
+
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
138
|
+
},
|
|
139
|
+
isSubmittable: (context, event) => {
|
|
140
|
+
const { amount } = context
|
|
141
|
+
return parseFloat(`${amount}`) > 0
|
|
142
|
+
},
|
|
143
|
+
isNotWithdrawable: (context, event) => {
|
|
144
|
+
const { balance, enableWithdraw, paymentDetail } = context
|
|
145
|
+
const minWithdrawAmount = paymentDetail[0]?.minimum || 0
|
|
146
|
+
return !enableWithdraw || balance < minWithdrawAmount
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
services: {
|
|
150
|
+
fetchPaymentDetail: async (context, event) => {
|
|
151
|
+
const [paymentDetail = [], { bankInfo }] = await Promise.all([
|
|
152
|
+
request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
|
|
153
|
+
request.send(payment.getPaymentInfo()),
|
|
154
|
+
])
|
|
155
|
+
return { paymentDetail, bankInfo }
|
|
156
|
+
},
|
|
157
|
+
fetchWithdrawRules: async (context, event) => {
|
|
158
|
+
return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' }))
|
|
159
|
+
},
|
|
160
|
+
submitWithdraw: async (context, event) => {
|
|
161
|
+
const { paymentDetail, amount, bank } = context
|
|
162
|
+
const { method } = paymentDetail[0]
|
|
163
|
+
return await request.send(
|
|
164
|
+
payment.submitWithdrawTransactionVN({
|
|
165
|
+
method,
|
|
166
|
+
amount,
|
|
167
|
+
applyerBankCode: bank.bankCode,
|
|
168
|
+
applyerAccountNumber: bank.accountNumber,
|
|
169
|
+
branch: bank.branch,
|
|
170
|
+
holderName: bank.holderName,
|
|
171
|
+
})
|
|
172
|
+
)
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
}
|