@jetthai/cuora 1.1.7 → 1.1.9-bc88
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 +14 -0
- package/dist/bundle.mjs +2567 -111
- package/package.json +1 -1
- package/src/api/payment.js +2 -2
- package/src/machine/activity/affiliate_invite_friends_activity.js +2 -2
- package/src/machine/bank_binding_amb.js +141 -0
- package/src/machine/deposit/amb.js +93 -0
- package/src/machine/deposit/crypto.js +1 -1
- package/src/machine/deposit/crypto_button.js +35 -13
- package/src/machine/deposit/deposit_fc.js +8 -5
- package/src/machine/deposit/float.js +154 -0
- package/src/machine/deposit/index.js +2 -1
- package/src/machine/deposit/qrcode_v2.js +45 -17
- package/src/machine/deposit/qrcode_vn.js +1 -1
- package/src/machine/deposit/vpay.js +0 -0
- package/src/machine/index.js +2 -0
package/package.json
CHANGED
package/src/api/payment.js
CHANGED
|
@@ -44,7 +44,7 @@ export default {
|
|
|
44
44
|
method: 'post',
|
|
45
45
|
params: { transferType: 'WITHDRAW', amount, cryptoNetwork },
|
|
46
46
|
}),
|
|
47
|
-
|
|
47
|
+
submitDepositTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, sourceAddress }) => ({
|
|
48
48
|
url: `payment/v2/${method}/transaction`,
|
|
49
49
|
method: 'post',
|
|
50
50
|
params: { transferType: 'DEPOSIT', amount, cryptoCurrency, cryptoNetwork, sourceAddress },
|
|
@@ -79,7 +79,7 @@ export default {
|
|
|
79
79
|
receipt,
|
|
80
80
|
},
|
|
81
81
|
}),
|
|
82
|
-
|
|
82
|
+
submitDepositTransaction: ({ method, amount }) => ({
|
|
83
83
|
url: `payment/v2/${method}/transaction`,
|
|
84
84
|
method: 'post',
|
|
85
85
|
params: { transferType: 'DEPOSIT', amount },
|
|
@@ -79,7 +79,7 @@ export default function (request) {
|
|
|
79
79
|
target: 'awarding',
|
|
80
80
|
},
|
|
81
81
|
onError: {
|
|
82
|
-
target: '
|
|
82
|
+
target: 'idle',
|
|
83
83
|
},
|
|
84
84
|
},
|
|
85
85
|
},
|
|
@@ -90,7 +90,7 @@ export default function (request) {
|
|
|
90
90
|
target: 'bound',
|
|
91
91
|
},
|
|
92
92
|
onError: {
|
|
93
|
-
target: '
|
|
93
|
+
target: 'idle',
|
|
94
94
|
},
|
|
95
95
|
},
|
|
96
96
|
},
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../api/payment.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'bank_binding_amb',
|
|
8
|
+
initial: 'fetching',
|
|
9
|
+
context: {
|
|
10
|
+
hasAnyAccount: false,
|
|
11
|
+
bankList: [],
|
|
12
|
+
bank: null,
|
|
13
|
+
// bonus: 0,
|
|
14
|
+
bankAccount: null,
|
|
15
|
+
firstNameTh: null,
|
|
16
|
+
lastNameTh: null,
|
|
17
|
+
firstNameEn: null,
|
|
18
|
+
lastNameEn: null,
|
|
19
|
+
},
|
|
20
|
+
states: {
|
|
21
|
+
fetching: {
|
|
22
|
+
invoke: {
|
|
23
|
+
src: 'fetchInitData',
|
|
24
|
+
onDone: {
|
|
25
|
+
target: 'idle',
|
|
26
|
+
actions: 'setBanks',
|
|
27
|
+
},
|
|
28
|
+
onError: {
|
|
29
|
+
target: 'idle',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
idle: {
|
|
34
|
+
on: {
|
|
35
|
+
SET_BANK_CODE: {
|
|
36
|
+
actions: assign((context, event) => {
|
|
37
|
+
console.log(event.data)
|
|
38
|
+
return {
|
|
39
|
+
bank: event.data,
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
SET_BANK_ACCOUNT: {
|
|
44
|
+
actions: assign((context, event) => {
|
|
45
|
+
return {
|
|
46
|
+
bankAccount: event.data,
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
},
|
|
50
|
+
SET_FIRST_NAME_TH: {
|
|
51
|
+
actions: assign((context, event) => {
|
|
52
|
+
return {
|
|
53
|
+
firstNameTh: event.data,
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
SET_LAST_NAME_TH: {
|
|
58
|
+
actions: assign((context, event) => {
|
|
59
|
+
return {
|
|
60
|
+
lastNameTh: event.data,
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
SET_FIRST_NAME_EN: {
|
|
65
|
+
actions: assign((context, event) => {
|
|
66
|
+
return {
|
|
67
|
+
firstNameEn: event.data,
|
|
68
|
+
}
|
|
69
|
+
}),
|
|
70
|
+
},
|
|
71
|
+
SET_LAST_NAME_EN: {
|
|
72
|
+
actions: assign((context, event) => {
|
|
73
|
+
return {
|
|
74
|
+
lastNameEn: event.data,
|
|
75
|
+
}
|
|
76
|
+
}),
|
|
77
|
+
},
|
|
78
|
+
BIND_BANK: {
|
|
79
|
+
target: 'binding',
|
|
80
|
+
cond: 'isBindable',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
binding: {
|
|
85
|
+
invoke: {
|
|
86
|
+
src: 'updatePaymentInfo',
|
|
87
|
+
onDone: {
|
|
88
|
+
target: 'bound',
|
|
89
|
+
},
|
|
90
|
+
onError: {
|
|
91
|
+
target: 'idle',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
bound: {},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
actions: {
|
|
100
|
+
setBanks: assign((context, event) => {
|
|
101
|
+
const { bankList = [], paymentInfo = {} } = event.data
|
|
102
|
+
const { bankInfo = [] } = paymentInfo
|
|
103
|
+
return {
|
|
104
|
+
hasAnyAccount: bankInfo.length > 0,
|
|
105
|
+
holderName: bankInfo[0]?.holderName,
|
|
106
|
+
bankList,
|
|
107
|
+
bank: bankList[0],
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
110
|
+
},
|
|
111
|
+
guards: {
|
|
112
|
+
isBindable: (context, event) => {
|
|
113
|
+
const { bank, bankAccount, firstNameTh, lastNameTh, firstNameEn, lastNameEn } = context
|
|
114
|
+
|
|
115
|
+
return bank.bankCode && bankAccount && firstNameTh && lastNameTh && firstNameEn && lastNameEn
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
services: {
|
|
119
|
+
fetchInitData: async (context, event) => {
|
|
120
|
+
const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBankList('amb')), request.send(payment.getPaymentInfo())])
|
|
121
|
+
return { bankList, paymentInfo }
|
|
122
|
+
},
|
|
123
|
+
updatePaymentInfo: async (context, event) => {
|
|
124
|
+
const { bonus, bank, bankAccount, firstNameTh, lastNameTh, firstNameEn, lastNameEn } = context
|
|
125
|
+
return await request.send(
|
|
126
|
+
payment.updatePaymentInfo({
|
|
127
|
+
paymentProvider: 'amb',
|
|
128
|
+
// bonus,
|
|
129
|
+
bankCode: bank.bankCode,
|
|
130
|
+
bankAccount,
|
|
131
|
+
firstNameTh,
|
|
132
|
+
lastNameTh,
|
|
133
|
+
firstNameEn,
|
|
134
|
+
lastNameEn,
|
|
135
|
+
})
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'amb',
|
|
8
|
+
initial: 'loading',
|
|
9
|
+
context: {
|
|
10
|
+
userBank: null,
|
|
11
|
+
houseAccountName: null,
|
|
12
|
+
houseAccountNumber: null,
|
|
13
|
+
houseBankName: null,
|
|
14
|
+
method: 'amb',
|
|
15
|
+
},
|
|
16
|
+
states: {
|
|
17
|
+
loading: {
|
|
18
|
+
invoke: {
|
|
19
|
+
src: 'fetchPaymentInfo',
|
|
20
|
+
onDone: [
|
|
21
|
+
{
|
|
22
|
+
target: 'fetchingHouseBank',
|
|
23
|
+
actions: 'setUserBank',
|
|
24
|
+
cond: 'hasUserBank',
|
|
25
|
+
},
|
|
26
|
+
{ target: 'accountUnbound' },
|
|
27
|
+
],
|
|
28
|
+
onError: {
|
|
29
|
+
target: 'unavailable',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
fetchingHouseBank: {
|
|
34
|
+
invoke: {
|
|
35
|
+
src: 'submitDeposit',
|
|
36
|
+
onDone: { target: 'fetchingBankList', actions: 'setHouseBank' },
|
|
37
|
+
onError: {
|
|
38
|
+
target: 'unavailable',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
fetchingBankList: {
|
|
43
|
+
invoke: {
|
|
44
|
+
src: 'fetchBanksList',
|
|
45
|
+
onDone: { target: 'end', actions: 'setBankList' },
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
end: {},
|
|
49
|
+
accountUnbound: {},
|
|
50
|
+
unavailable: {},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
actions: {
|
|
55
|
+
setUserBank: assign((context, event) => {
|
|
56
|
+
return {
|
|
57
|
+
userBank: event.data.bankInfo?.[0],
|
|
58
|
+
}
|
|
59
|
+
}),
|
|
60
|
+
setHouseBank: assign((context, event) => {
|
|
61
|
+
const { accountName, accountNumber, bankName } = event.data
|
|
62
|
+
return {
|
|
63
|
+
houseAccountName: accountName,
|
|
64
|
+
houseAccountNumber: accountNumber,
|
|
65
|
+
houseBankName: bankName,
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
setBankList: assign((context, event) => {
|
|
69
|
+
return {
|
|
70
|
+
bankList: event.data,
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
guards: {
|
|
75
|
+
hasUserBank: (context, event) => {
|
|
76
|
+
return event.data.bankInfo?.[0]
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
services: {
|
|
80
|
+
fetchPaymentInfo: async (context, event) => {
|
|
81
|
+
return await request.send(payment.getPaymentInfo())
|
|
82
|
+
},
|
|
83
|
+
fetchBanksList: async (context, event) => {
|
|
84
|
+
const { method } = context
|
|
85
|
+
return await request.send(payment.getBankList(method))
|
|
86
|
+
},
|
|
87
|
+
submitDeposit: async (context, event) => {
|
|
88
|
+
return await request.send(payment.submitDepositTransaction({ method: context.method }))
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
}
|
|
@@ -252,7 +252,7 @@ export default function (request) {
|
|
|
252
252
|
submitDeposit: async (context, event) => {
|
|
253
253
|
const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context
|
|
254
254
|
return await request.send(
|
|
255
|
-
payment.
|
|
255
|
+
payment.submitDepositTransactionCrypto({
|
|
256
256
|
method: selectedCrypto.method,
|
|
257
257
|
amount: calculation.actualAmount,
|
|
258
258
|
cryptoCurrency: selectedCrypto.channel,
|
|
@@ -25,6 +25,8 @@ export default function (request) {
|
|
|
25
25
|
|
|
26
26
|
calculation: null,
|
|
27
27
|
result: null,
|
|
28
|
+
|
|
29
|
+
grandTotalEnable: 1
|
|
28
30
|
},
|
|
29
31
|
states: {
|
|
30
32
|
loading: {
|
|
@@ -63,10 +65,16 @@ export default function (request) {
|
|
|
63
65
|
selecting: {
|
|
64
66
|
entry: 'reset',
|
|
65
67
|
on: {
|
|
66
|
-
SELECT_AMOUNT:
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
SELECT_AMOUNT: [
|
|
69
|
+
{
|
|
70
|
+
target: 'debouncing',
|
|
71
|
+
actions: 'addAmount',
|
|
72
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
73
|
+
}, {
|
|
74
|
+
target: 'debouncing',
|
|
75
|
+
actions: 'setAmount'
|
|
76
|
+
}
|
|
77
|
+
],
|
|
70
78
|
KEY_IN: {
|
|
71
79
|
target: 'debouncing',
|
|
72
80
|
actions: 'setAmount'
|
|
@@ -78,10 +86,16 @@ export default function (request) {
|
|
|
78
86
|
},
|
|
79
87
|
debouncing: {
|
|
80
88
|
on: {
|
|
81
|
-
SELECT_AMOUNT:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
89
|
+
SELECT_AMOUNT: [
|
|
90
|
+
{
|
|
91
|
+
target: 'debouncing',
|
|
92
|
+
actions: 'addAmount',
|
|
93
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
94
|
+
}, {
|
|
95
|
+
target: 'debouncing',
|
|
96
|
+
actions: 'setAmount'
|
|
97
|
+
}
|
|
98
|
+
],
|
|
85
99
|
KEY_IN: {
|
|
86
100
|
target: 'debouncing',
|
|
87
101
|
actions: 'setAmount',
|
|
@@ -108,10 +122,16 @@ export default function (request) {
|
|
|
108
122
|
},
|
|
109
123
|
calculated: {
|
|
110
124
|
on: {
|
|
111
|
-
SELECT_AMOUNT:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
125
|
+
SELECT_AMOUNT: [
|
|
126
|
+
{
|
|
127
|
+
target: 'debouncing',
|
|
128
|
+
actions: 'addAmount',
|
|
129
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
130
|
+
}, {
|
|
131
|
+
target: 'debouncing',
|
|
132
|
+
actions: 'setAmount'
|
|
133
|
+
}
|
|
134
|
+
],
|
|
115
135
|
KEY_IN: {
|
|
116
136
|
target: 'debouncing',
|
|
117
137
|
actions: 'setAmount',
|
|
@@ -174,6 +194,7 @@ export default function (request) {
|
|
|
174
194
|
selectedChannel: channels[0],
|
|
175
195
|
selectedCrypto: cryptos[0],
|
|
176
196
|
selectedNetwork: defaultNetworks[0],
|
|
197
|
+
grandTotalEnable: cryptos[0].grandTotalEnable,
|
|
177
198
|
currentPayment,
|
|
178
199
|
options
|
|
179
200
|
}
|
|
@@ -197,6 +218,7 @@ export default function (request) {
|
|
|
197
218
|
selectedNetwork: networks[0],
|
|
198
219
|
selectedAmount: null,
|
|
199
220
|
calculation: null,
|
|
221
|
+
grandTotalEnable: selectedCrypto.grandTotalEnable,
|
|
200
222
|
options
|
|
201
223
|
}
|
|
202
224
|
}),
|
|
@@ -282,7 +304,7 @@ export default function (request) {
|
|
|
282
304
|
submitDeposit: async (context, event) => {
|
|
283
305
|
const { selectedCrypto, selectedNetwork, calculation, sourceAddress } = context
|
|
284
306
|
return await request.send(
|
|
285
|
-
payment.
|
|
307
|
+
payment.submitDepositTransactionCrypto({
|
|
286
308
|
method: selectedCrypto.method,
|
|
287
309
|
amount: calculation.actualAmount,
|
|
288
310
|
cryptoCurrency: selectedCrypto.channel,
|
|
@@ -59,9 +59,7 @@ export default function (request) {
|
|
|
59
59
|
},
|
|
60
60
|
checking: {
|
|
61
61
|
entry: 'clearCalculatedResult',
|
|
62
|
-
always: [
|
|
63
|
-
{ target: 'debouncing', cond: 'isCalculable' },
|
|
64
|
-
{ target: 'loaded'}]
|
|
62
|
+
always: [{ target: 'debouncing', cond: 'isCalculable' }, { target: 'loaded' }],
|
|
65
63
|
},
|
|
66
64
|
debouncing: {
|
|
67
65
|
after: {
|
|
@@ -132,7 +130,12 @@ export default function (request) {
|
|
|
132
130
|
actions: {
|
|
133
131
|
setCryptos: assign((context, event) => {
|
|
134
132
|
return {
|
|
135
|
-
cryptos: event.data.map((crypto) => ({
|
|
133
|
+
cryptos: event.data.map((crypto) => ({
|
|
134
|
+
...crypto,
|
|
135
|
+
label: crypto.channel,
|
|
136
|
+
value: crypto.method,
|
|
137
|
+
icon: crypto.channel,
|
|
138
|
+
})),
|
|
136
139
|
}
|
|
137
140
|
}),
|
|
138
141
|
setCrypto: assign((context, event) => {
|
|
@@ -238,7 +241,7 @@ export default function (request) {
|
|
|
238
241
|
submitDeposit: async (context, event) => {
|
|
239
242
|
const { currentCrypto, currentNetwork, calculatedResult } = context
|
|
240
243
|
return await request.send(
|
|
241
|
-
payment.
|
|
244
|
+
payment.submitDepositTransactionCrypto({
|
|
242
245
|
method: currentCrypto.method,
|
|
243
246
|
amount: calculatedResult.actualAmount,
|
|
244
247
|
cryptoCurrency: currentCrypto.channel,
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import payment from '../../api/payment.js'
|
|
3
|
+
|
|
4
|
+
export default function (request) {
|
|
5
|
+
return createMachine(
|
|
6
|
+
{
|
|
7
|
+
id: 'amb',
|
|
8
|
+
initial: 'fetchingUserPayment',
|
|
9
|
+
context: {
|
|
10
|
+
method: 'amb_float',
|
|
11
|
+
userBank: {
|
|
12
|
+
bankCode: null,
|
|
13
|
+
accountNumber: null,
|
|
14
|
+
},
|
|
15
|
+
amount: 0,
|
|
16
|
+
|
|
17
|
+
options: [],
|
|
18
|
+
minimum: 0,
|
|
19
|
+
maximum: 0,
|
|
20
|
+
|
|
21
|
+
houseAccountName: null,
|
|
22
|
+
houseAccountNumber: null,
|
|
23
|
+
houseBankName: null,
|
|
24
|
+
calculatedAmount: 0,
|
|
25
|
+
},
|
|
26
|
+
states: {
|
|
27
|
+
fetchingUserPayment: {
|
|
28
|
+
invoke: {
|
|
29
|
+
src: 'fetchUserPayment',
|
|
30
|
+
onDone: [
|
|
31
|
+
{
|
|
32
|
+
target: 'fetchingHousePayment',
|
|
33
|
+
actions: 'setUserBank',
|
|
34
|
+
cond: 'hasUserBank',
|
|
35
|
+
},
|
|
36
|
+
{ target: 'unavailable' },
|
|
37
|
+
],
|
|
38
|
+
onError: {
|
|
39
|
+
target: 'unavailable',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
fetchingHousePayment: {
|
|
44
|
+
invoke: {
|
|
45
|
+
src: 'fetchHousePayment',
|
|
46
|
+
onDone: {
|
|
47
|
+
target: 'fetchingBankList',
|
|
48
|
+
actions: 'setHousePayment',
|
|
49
|
+
},
|
|
50
|
+
onError: {
|
|
51
|
+
target: 'unavailable',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
fetchingBankList: {
|
|
56
|
+
invoke: {
|
|
57
|
+
src: 'fetchBanksList',
|
|
58
|
+
onDone: { target: 'submittable', actions: 'setBankList' },
|
|
59
|
+
onError: {
|
|
60
|
+
target: 'unavailable',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
submittable: {
|
|
65
|
+
on: {
|
|
66
|
+
ADD: {
|
|
67
|
+
actions: 'add',
|
|
68
|
+
},
|
|
69
|
+
CLEAR: {
|
|
70
|
+
actions: 'clear',
|
|
71
|
+
},
|
|
72
|
+
SUBMIT: {
|
|
73
|
+
target: 'submitting',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
submitting: {
|
|
78
|
+
invoke: {
|
|
79
|
+
src: 'submitDeposit',
|
|
80
|
+
onDone: { target: 'submitted', actions: 'setHouseBank' },
|
|
81
|
+
onError: {
|
|
82
|
+
target: 'unavailable',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
submitted: {},
|
|
87
|
+
unavailable: {},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
actions: {
|
|
92
|
+
setUserBank: assign((context, event) => {
|
|
93
|
+
return {
|
|
94
|
+
userBank: event.data.bankInfo?.[0],
|
|
95
|
+
}
|
|
96
|
+
}),
|
|
97
|
+
setHousePayment: assign((context, event) => {
|
|
98
|
+
const { optional, minimum, maximum } = event.data
|
|
99
|
+
return {
|
|
100
|
+
options: optional,
|
|
101
|
+
minimum,
|
|
102
|
+
maximum,
|
|
103
|
+
}
|
|
104
|
+
}),
|
|
105
|
+
setHouseBank: assign((context, event) => {
|
|
106
|
+
const { accountName, accountNumber, bankName, amount } = event.data
|
|
107
|
+
return {
|
|
108
|
+
houseAccountName: accountName,
|
|
109
|
+
houseAccountNumber: accountNumber,
|
|
110
|
+
houseBankName: bankName,
|
|
111
|
+
calculatedAmount: amount,
|
|
112
|
+
}
|
|
113
|
+
}),
|
|
114
|
+
setBankList: assign((context, event) => {
|
|
115
|
+
return {
|
|
116
|
+
bankList: event.data,
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
add: assign((context, event) => {
|
|
120
|
+
const { amount, maximum } = context
|
|
121
|
+
return {
|
|
122
|
+
amount: Math.min(amount + event.data, maximum),
|
|
123
|
+
}
|
|
124
|
+
}),
|
|
125
|
+
clear: assign((context, event) => {
|
|
126
|
+
return {
|
|
127
|
+
amount: 0,
|
|
128
|
+
}
|
|
129
|
+
}),
|
|
130
|
+
},
|
|
131
|
+
guards: {
|
|
132
|
+
hasUserBank: (context, event) => {
|
|
133
|
+
return event.data.bankInfo?.[0]
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
services: {
|
|
137
|
+
fetchHousePayment: async (context, event) => {
|
|
138
|
+
const payments = await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
139
|
+
return payments.find((payment) => payment.method === context.method)
|
|
140
|
+
},
|
|
141
|
+
fetchUserPayment: async (context, event) => {
|
|
142
|
+
return await request.send(payment.getPaymentInfo())
|
|
143
|
+
},
|
|
144
|
+
fetchBanksList: async (context, event) => {
|
|
145
|
+
const { method } = context
|
|
146
|
+
return await request.send(payment.getBankList(method))
|
|
147
|
+
},
|
|
148
|
+
submitDeposit: async (context, event) => {
|
|
149
|
+
return await request.send(payment.submitDepositTransaction({ method: 'amb', amount: context.amount }))
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
}
|
|
@@ -6,5 +6,6 @@ import deposit_fc from './deposit_fc.js'
|
|
|
6
6
|
import crypto from './crypto.js'
|
|
7
7
|
import crypto_button from './crypto_button.js'
|
|
8
8
|
import direct from './direct.js'
|
|
9
|
+
import amb from './amb.js'
|
|
9
10
|
|
|
10
|
-
export default { manual_vn, loadcard_vn, qrcode_vn, qrcode_v2, deposit_fc, crypto, crypto_button, direct }
|
|
11
|
+
export default { manual_vn, loadcard_vn, qrcode_vn, qrcode_v2, deposit_fc, crypto, crypto_button, direct, amb }
|
|
@@ -20,6 +20,8 @@ export default function (request) {
|
|
|
20
20
|
currentMethod: null,
|
|
21
21
|
|
|
22
22
|
result: null,
|
|
23
|
+
|
|
24
|
+
grandTotalEnable: 1
|
|
23
25
|
},
|
|
24
26
|
states: {
|
|
25
27
|
loading: {
|
|
@@ -40,10 +42,16 @@ export default function (request) {
|
|
|
40
42
|
SELECT_QRCODE: {
|
|
41
43
|
actions: 'setQrcode',
|
|
42
44
|
},
|
|
43
|
-
SELECT_AMOUNT:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
SELECT_AMOUNT: [
|
|
46
|
+
{
|
|
47
|
+
target: 'debouncing',
|
|
48
|
+
actions: 'addAmount',
|
|
49
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
50
|
+
}, {
|
|
51
|
+
target: 'debouncing',
|
|
52
|
+
actions: 'setAmount'
|
|
53
|
+
}
|
|
54
|
+
],
|
|
47
55
|
KEY_IN: {
|
|
48
56
|
target: 'calculating',
|
|
49
57
|
actions: 'setAmount',
|
|
@@ -52,10 +60,16 @@ export default function (request) {
|
|
|
52
60
|
},
|
|
53
61
|
debouncing: {
|
|
54
62
|
on: {
|
|
55
|
-
SELECT_AMOUNT:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
SELECT_AMOUNT: [
|
|
64
|
+
{
|
|
65
|
+
target: 'debouncing',
|
|
66
|
+
actions: 'addAmount',
|
|
67
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
68
|
+
}, {
|
|
69
|
+
target: 'debouncing',
|
|
70
|
+
actions: 'setAmount'
|
|
71
|
+
}
|
|
72
|
+
],
|
|
59
73
|
KEY_IN: {
|
|
60
74
|
target: 'debouncing',
|
|
61
75
|
actions: 'setAmount',
|
|
@@ -74,10 +88,16 @@ export default function (request) {
|
|
|
74
88
|
calculable: {
|
|
75
89
|
entry: 'clearCalculation',
|
|
76
90
|
on: {
|
|
77
|
-
SELECT_AMOUNT:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
91
|
+
SELECT_AMOUNT: [
|
|
92
|
+
{
|
|
93
|
+
target: 'debouncing',
|
|
94
|
+
actions: 'addAmount',
|
|
95
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
96
|
+
}, {
|
|
97
|
+
target: 'debouncing',
|
|
98
|
+
actions: 'setAmount'
|
|
99
|
+
}
|
|
100
|
+
],
|
|
81
101
|
KEY_IN: {
|
|
82
102
|
target: 'debouncing',
|
|
83
103
|
actions: 'setAmount',
|
|
@@ -104,10 +124,16 @@ export default function (request) {
|
|
|
104
124
|
},
|
|
105
125
|
calculated: {
|
|
106
126
|
on: {
|
|
107
|
-
SELECT_AMOUNT:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
SELECT_AMOUNT: [
|
|
128
|
+
{
|
|
129
|
+
target: 'debouncing',
|
|
130
|
+
actions: 'addAmount',
|
|
131
|
+
cond: (context, event) => context.grandTotalEnable === 1,
|
|
132
|
+
}, {
|
|
133
|
+
target: 'debouncing',
|
|
134
|
+
actions: 'setAmount'
|
|
135
|
+
}
|
|
136
|
+
],
|
|
111
137
|
KEY_IN: {
|
|
112
138
|
target: 'debouncing',
|
|
113
139
|
actions: 'setAmount',
|
|
@@ -164,6 +190,7 @@ export default function (request) {
|
|
|
164
190
|
selectedQrcode: qrcodes[0],
|
|
165
191
|
currentMethod: qrcodes[0].method,
|
|
166
192
|
options: qrcodes[0].optional,
|
|
193
|
+
grandTotalEnable: qrcodes[0].grandTotalEnable,
|
|
167
194
|
}
|
|
168
195
|
}),
|
|
169
196
|
setQrcode: assign((context, event) => {
|
|
@@ -171,6 +198,7 @@ export default function (request) {
|
|
|
171
198
|
selectedQrcode: event.data,
|
|
172
199
|
currentMethod: event.data.method,
|
|
173
200
|
options: event.data.optional,
|
|
201
|
+
grandTotalEnable: event.data.grandTotalEnable,
|
|
174
202
|
}
|
|
175
203
|
}),
|
|
176
204
|
addAmount: assign((context, event) => {
|
|
@@ -211,7 +239,7 @@ export default function (request) {
|
|
|
211
239
|
submitDeposit: async (context, event) => {
|
|
212
240
|
const { currentMethod, selectedAmount } = context
|
|
213
241
|
return await request.send(
|
|
214
|
-
payment.
|
|
242
|
+
payment.submitDepositTransaction({
|
|
215
243
|
method: currentMethod,
|
|
216
244
|
amount: selectedAmount,
|
|
217
245
|
})
|