@jetthai/cuora 1.1.9-bc88 → 1.1.9-bc88-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/CHANGELOG.md +2 -0
- package/package.json +1 -1
- package/src/api/payment.js +23 -3
- package/src/machine/deposit/amb.js +42 -45
- package/src/machine/deposit/float.js +66 -62
- package/src/machine/deposit/index.js +15 -1
- package/src/machine/deposit/vpay.js +141 -0
- package/src/machine/index.js +2 -0
- package/src/machine/withdraw_amb.js +424 -0
- package/src/machine/withdraw_crypto.js +37 -25
- package/src/machine/withdraw_fc.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.9-bc88-1](https://github.com/jetthai/cuora-module/compare/v1.1.9-bc88...v1.1.9-bc88-1) (2022-12-14)
|
|
6
|
+
|
|
5
7
|
### [1.1.9-bc88](https://github.com/jetthai/cuora-module/compare/v1.1.9...v1.1.9-bc88) (2022-12-13)
|
|
6
8
|
|
|
7
9
|
### [1.1.9](https://github.com/jetthai/cuora-module/compare/v1.1.5-1...v1.1.9) (2022-12-07)
|
package/package.json
CHANGED
package/src/api/payment.js
CHANGED
|
@@ -2,14 +2,29 @@ export default {
|
|
|
2
2
|
// getPaymentHistory: () => ({ url: 'payment/history', method: 'post' }),
|
|
3
3
|
getPaymentHistory: (returnDays) => ({ url: 'payment/v2/history', method: 'post', params: { returnDays } }),
|
|
4
4
|
getSpotMarket: () => ({ url: 'payment/spotmarket', method: 'get' }),
|
|
5
|
-
getTransactionHistory: (payload) => ({
|
|
5
|
+
getTransactionHistory: (payload) => ({
|
|
6
|
+
url: 'payment/v2/transactionHistory',
|
|
7
|
+
method: 'post',
|
|
8
|
+
params: { ...payload },
|
|
9
|
+
}),
|
|
6
10
|
getTransactionHistoryOptions: () => ({ url: 'payment/v2/category/options', method: 'get' }),
|
|
7
11
|
// getPaymentInfo: () => ({ url: `payment/paymentInfo`, method: 'get' }),
|
|
8
12
|
getPaymentInfo: () => ({ url: `payment/v2/paymentInfo`, method: 'get' }),
|
|
9
13
|
updatePaymentInfo: ({ bankCode, branch, holderName, bankAccount, firstNameTh, lastNameTh, firstNameEn, lastNameEn, bonus, paymentProvider }) => ({
|
|
10
14
|
url: 'payment/v2/updatePaymentInfo',
|
|
11
15
|
method: 'post',
|
|
12
|
-
params: {
|
|
16
|
+
params: {
|
|
17
|
+
bankCode,
|
|
18
|
+
branch,
|
|
19
|
+
holderName,
|
|
20
|
+
bankAccount,
|
|
21
|
+
firstNameTh,
|
|
22
|
+
lastNameTh,
|
|
23
|
+
firstNameEn,
|
|
24
|
+
lastNameEn,
|
|
25
|
+
bonus,
|
|
26
|
+
paymentProvider,
|
|
27
|
+
},
|
|
13
28
|
}),
|
|
14
29
|
getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
|
|
15
30
|
makeTransaction: ({ type, payload, paymentMethod }) => ({
|
|
@@ -84,7 +99,7 @@ export default {
|
|
|
84
99
|
method: 'post',
|
|
85
100
|
params: { transferType: 'DEPOSIT', amount },
|
|
86
101
|
}),
|
|
87
|
-
|
|
102
|
+
submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress }) => ({
|
|
88
103
|
url: `payment/v2/${method}/transaction`,
|
|
89
104
|
method: 'post',
|
|
90
105
|
params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress },
|
|
@@ -94,4 +109,9 @@ export default {
|
|
|
94
109
|
method: 'post',
|
|
95
110
|
params: { transferType: 'WITHDRAW', amount, applyerBankCode, applyerAccountNumber, branch, holderName },
|
|
96
111
|
}),
|
|
112
|
+
submitWithdrawTransactionAmb: ({ method, amount }) => ({
|
|
113
|
+
url: `payment/v2/${method}/transaction`,
|
|
114
|
+
method: 'post',
|
|
115
|
+
params: { transferType: 'WITHDRAW', amount },
|
|
116
|
+
}),
|
|
97
117
|
}
|
|
@@ -7,7 +7,8 @@ export default function (request) {
|
|
|
7
7
|
id: 'amb',
|
|
8
8
|
initial: 'loading',
|
|
9
9
|
context: {
|
|
10
|
-
|
|
10
|
+
bankList: [],
|
|
11
|
+
userAccount: {},
|
|
11
12
|
houseAccountName: null,
|
|
12
13
|
houseAccountNumber: null,
|
|
13
14
|
houseBankName: null,
|
|
@@ -15,64 +16,59 @@ export default function (request) {
|
|
|
15
16
|
},
|
|
16
17
|
states: {
|
|
17
18
|
loading: {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
initial: 'checkingUserAccount',
|
|
20
|
+
states: {
|
|
21
|
+
checkingUserAccount: {
|
|
22
|
+
invoke: {
|
|
23
|
+
src: 'fetchPaymentInfo',
|
|
24
|
+
onDone: [
|
|
25
|
+
{
|
|
26
|
+
target: 'initializing',
|
|
27
|
+
actions: 'setUserAccount',
|
|
28
|
+
cond: 'hasUserAccount',
|
|
29
|
+
},
|
|
30
|
+
{ target: '#amb.accountUnbound' },
|
|
31
|
+
],
|
|
32
|
+
onError: {
|
|
33
|
+
target: '#amb.unavailable',
|
|
34
|
+
},
|
|
25
35
|
},
|
|
26
|
-
{ target: 'accountUnbound' },
|
|
27
|
-
],
|
|
28
|
-
onError: {
|
|
29
|
-
target: 'unavailable',
|
|
30
36
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
initializing: {
|
|
38
|
+
invoke: {
|
|
39
|
+
src: 'initialize',
|
|
40
|
+
onDone: { target: '#amb.finish', actions: 'setInitialization' },
|
|
41
|
+
onError: {
|
|
42
|
+
target: '#amb.unavailable',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
39
45
|
},
|
|
40
46
|
},
|
|
41
47
|
},
|
|
42
|
-
|
|
43
|
-
invoke: {
|
|
44
|
-
src: 'fetchBanksList',
|
|
45
|
-
onDone: { target: 'end', actions: 'setBankList' },
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
end: {},
|
|
48
|
+
finish: {},
|
|
49
49
|
accountUnbound: {},
|
|
50
50
|
unavailable: {},
|
|
51
51
|
},
|
|
52
52
|
},
|
|
53
53
|
{
|
|
54
54
|
actions: {
|
|
55
|
-
|
|
55
|
+
setUserAccount: assign((context, event) => {
|
|
56
56
|
return {
|
|
57
|
-
|
|
57
|
+
userAccount: event.data.bankInfo?.[0],
|
|
58
58
|
}
|
|
59
59
|
}),
|
|
60
|
-
|
|
61
|
-
const {
|
|
60
|
+
setInitialization: assign((context, event) => {
|
|
61
|
+
const { houseAccount, bankList } = event.data
|
|
62
62
|
return {
|
|
63
|
-
houseAccountName: accountName,
|
|
64
|
-
houseAccountNumber: accountNumber,
|
|
65
|
-
houseBankName: bankName,
|
|
66
|
-
|
|
67
|
-
}),
|
|
68
|
-
setBankList: assign((context, event) => {
|
|
69
|
-
return {
|
|
70
|
-
bankList: event.data,
|
|
63
|
+
houseAccountName: houseAccount.accountName,
|
|
64
|
+
houseAccountNumber: houseAccount.accountNumber,
|
|
65
|
+
houseBankName: houseAccount.bankName,
|
|
66
|
+
bankList,
|
|
71
67
|
}
|
|
72
68
|
}),
|
|
73
69
|
},
|
|
74
70
|
guards: {
|
|
75
|
-
|
|
71
|
+
hasUserAccount: (context, event) => {
|
|
76
72
|
return event.data.bankInfo?.[0]
|
|
77
73
|
},
|
|
78
74
|
},
|
|
@@ -80,12 +76,13 @@ export default function (request) {
|
|
|
80
76
|
fetchPaymentInfo: async (context, event) => {
|
|
81
77
|
return await request.send(payment.getPaymentInfo())
|
|
82
78
|
},
|
|
83
|
-
|
|
79
|
+
initialize: async (context, event) => {
|
|
84
80
|
const { method } = context
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
81
|
+
const [houseAccount, bankList] = await Promise.all([
|
|
82
|
+
request.send(payment.submitDepositTransaction({ method })),
|
|
83
|
+
request.send(payment.getBankList(method)),
|
|
84
|
+
])
|
|
85
|
+
return { houseAccount, bankList }
|
|
89
86
|
},
|
|
90
87
|
},
|
|
91
88
|
}
|
|
@@ -4,16 +4,14 @@ import payment from '../../api/payment.js'
|
|
|
4
4
|
export default function (request) {
|
|
5
5
|
return createMachine(
|
|
6
6
|
{
|
|
7
|
-
id: '
|
|
8
|
-
initial: '
|
|
7
|
+
id: 'float',
|
|
8
|
+
initial: 'loading',
|
|
9
9
|
context: {
|
|
10
10
|
method: 'amb_float',
|
|
11
|
-
|
|
12
|
-
bankCode: null,
|
|
13
|
-
accountNumber: null,
|
|
14
|
-
},
|
|
11
|
+
userAccount: {},
|
|
15
12
|
amount: 0,
|
|
16
13
|
|
|
14
|
+
bankList: [],
|
|
17
15
|
options: [],
|
|
18
16
|
minimum: 0,
|
|
19
17
|
maximum: 0,
|
|
@@ -22,42 +20,37 @@ export default function (request) {
|
|
|
22
20
|
houseAccountNumber: null,
|
|
23
21
|
houseBankName: null,
|
|
24
22
|
calculatedAmount: 0,
|
|
23
|
+
|
|
24
|
+
ttl: 120,
|
|
25
25
|
},
|
|
26
26
|
states: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
loading: {
|
|
28
|
+
initial: 'checkingUserAccount',
|
|
29
|
+
states: {
|
|
30
|
+
checkingUserAccount: {
|
|
31
|
+
invoke: {
|
|
32
|
+
src: 'fetchPaymentInfo',
|
|
33
|
+
onDone: [
|
|
34
|
+
{
|
|
35
|
+
target: 'initializing',
|
|
36
|
+
actions: 'setUserAccount',
|
|
37
|
+
cond: 'hasUserAccount',
|
|
38
|
+
},
|
|
39
|
+
{ target: '#float.accountUnbound' },
|
|
40
|
+
],
|
|
41
|
+
onError: {
|
|
42
|
+
target: '#float.unavailable',
|
|
43
|
+
},
|
|
35
44
|
},
|
|
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
45
|
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
onDone: { target: 'submittable', actions: 'setBankList' },
|
|
59
|
-
onError: {
|
|
60
|
-
target: 'unavailable',
|
|
46
|
+
initializing: {
|
|
47
|
+
invoke: {
|
|
48
|
+
src: 'initialize',
|
|
49
|
+
onDone: { target: '#float.submittable', actions: 'setInitialization' },
|
|
50
|
+
onError: {
|
|
51
|
+
target: '#float.unavailable',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
61
54
|
},
|
|
62
55
|
},
|
|
63
56
|
},
|
|
@@ -77,29 +70,30 @@ export default function (request) {
|
|
|
77
70
|
submitting: {
|
|
78
71
|
invoke: {
|
|
79
72
|
src: 'submitDeposit',
|
|
80
|
-
onDone: { target: '
|
|
73
|
+
onDone: { target: 'countdown', actions: 'setHouseBank' },
|
|
81
74
|
onError: {
|
|
82
|
-
target: '
|
|
75
|
+
target: 'submittable',
|
|
83
76
|
},
|
|
84
77
|
},
|
|
85
78
|
},
|
|
86
|
-
|
|
79
|
+
countdown: {
|
|
80
|
+
after: {
|
|
81
|
+
1000: {
|
|
82
|
+
target: 'countdown',
|
|
83
|
+
actions: 'decreaseTtl',
|
|
84
|
+
cond: (context) => context.ttl > 0,
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
accountUnbound: {},
|
|
87
89
|
unavailable: {},
|
|
88
90
|
},
|
|
89
91
|
},
|
|
90
92
|
{
|
|
91
93
|
actions: {
|
|
92
|
-
|
|
93
|
-
return {
|
|
94
|
-
userBank: event.data.bankInfo?.[0],
|
|
95
|
-
}
|
|
96
|
-
}),
|
|
97
|
-
setHousePayment: assign((context, event) => {
|
|
98
|
-
const { optional, minimum, maximum } = event.data
|
|
94
|
+
setUserAccount: assign((context, event) => {
|
|
99
95
|
return {
|
|
100
|
-
|
|
101
|
-
minimum,
|
|
102
|
-
maximum,
|
|
96
|
+
userAccount: event.data.bankInfo?.[0],
|
|
103
97
|
}
|
|
104
98
|
}),
|
|
105
99
|
setHouseBank: assign((context, event) => {
|
|
@@ -111,9 +105,14 @@ export default function (request) {
|
|
|
111
105
|
calculatedAmount: amount,
|
|
112
106
|
}
|
|
113
107
|
}),
|
|
114
|
-
|
|
108
|
+
setInitialization: assign((context, event) => {
|
|
109
|
+
const { housePayment, bankList } = event.data
|
|
110
|
+
const { optional, minimum, maximum } = housePayment
|
|
115
111
|
return {
|
|
116
|
-
|
|
112
|
+
options: optional,
|
|
113
|
+
minimum,
|
|
114
|
+
maximum,
|
|
115
|
+
bankList,
|
|
117
116
|
}
|
|
118
117
|
}),
|
|
119
118
|
add: assign((context, event) => {
|
|
@@ -127,23 +126,28 @@ export default function (request) {
|
|
|
127
126
|
amount: 0,
|
|
128
127
|
}
|
|
129
128
|
}),
|
|
129
|
+
decreaseTtl: assign((context, evnet) => {
|
|
130
|
+
const ms = context.ttl
|
|
131
|
+
return {
|
|
132
|
+
ttl: Math.max(ms - 1, 0),
|
|
133
|
+
}
|
|
134
|
+
}),
|
|
130
135
|
},
|
|
131
136
|
guards: {
|
|
132
|
-
|
|
137
|
+
hasUserAccount: (context, event) => {
|
|
133
138
|
return event.data.bankInfo?.[0]
|
|
134
139
|
},
|
|
135
140
|
},
|
|
136
141
|
services: {
|
|
137
|
-
|
|
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
|
+
fetchPaymentInfo: async (context, event) => {
|
|
142
143
|
return await request.send(payment.getPaymentInfo())
|
|
143
144
|
},
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
|
|
145
|
+
initialize: async (context, event) => {
|
|
146
|
+
const [payments, bankList] = await Promise.all([
|
|
147
|
+
request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' })),
|
|
148
|
+
request.send(payment.getBankList('amb')),
|
|
149
|
+
])
|
|
150
|
+
return { housePayment: payments.find((payment) => payment.method === context.method), bankList }
|
|
147
151
|
},
|
|
148
152
|
submitDeposit: async (context, event) => {
|
|
149
153
|
return await request.send(payment.submitDepositTransaction({ method: 'amb', amount: context.amount }))
|
|
@@ -7,5 +7,19 @@ import crypto from './crypto.js'
|
|
|
7
7
|
import crypto_button from './crypto_button.js'
|
|
8
8
|
import direct from './direct.js'
|
|
9
9
|
import amb from './amb.js'
|
|
10
|
+
import float from './float.js'
|
|
11
|
+
import vpay from './vpay.js'
|
|
10
12
|
|
|
11
|
-
export default {
|
|
13
|
+
export default {
|
|
14
|
+
manual_vn,
|
|
15
|
+
loadcard_vn,
|
|
16
|
+
qrcode_vn,
|
|
17
|
+
qrcode_v2,
|
|
18
|
+
deposit_fc,
|
|
19
|
+
crypto,
|
|
20
|
+
crypto_button,
|
|
21
|
+
direct,
|
|
22
|
+
amb,
|
|
23
|
+
float,
|
|
24
|
+
vpay,
|
|
25
|
+
}
|
|
@@ -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: 'vpay',
|
|
8
|
+
initial: 'loading',
|
|
9
|
+
context: {
|
|
10
|
+
method: 'vpay',
|
|
11
|
+
userAccount: {},
|
|
12
|
+
amount: 0,
|
|
13
|
+
|
|
14
|
+
options: [],
|
|
15
|
+
minimum: 0,
|
|
16
|
+
maximum: 0,
|
|
17
|
+
|
|
18
|
+
qrcode: null,
|
|
19
|
+
vpayId: null,
|
|
20
|
+
calculatedAmount: 0,
|
|
21
|
+
},
|
|
22
|
+
states: {
|
|
23
|
+
loading: {
|
|
24
|
+
initial: 'checkingUserAccount',
|
|
25
|
+
states: {
|
|
26
|
+
checkingUserAccount: {
|
|
27
|
+
invoke: {
|
|
28
|
+
src: 'fetchPaymentInfo',
|
|
29
|
+
onDone: [
|
|
30
|
+
{
|
|
31
|
+
target: 'initializing',
|
|
32
|
+
actions: 'setUserAccount',
|
|
33
|
+
cond: 'hasUserAccount',
|
|
34
|
+
},
|
|
35
|
+
{ target: '#vpay.accountUnbound' },
|
|
36
|
+
],
|
|
37
|
+
onError: {
|
|
38
|
+
target: '#vpay.unavailable',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
initializing: {
|
|
43
|
+
invoke: {
|
|
44
|
+
src: 'initialize',
|
|
45
|
+
onDone: { target: '#vpay.submittable', actions: 'setInitialization' },
|
|
46
|
+
onError: {
|
|
47
|
+
target: '#vpay.unavailable',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
submittable: {
|
|
54
|
+
on: {
|
|
55
|
+
ADD: {
|
|
56
|
+
actions: 'add',
|
|
57
|
+
},
|
|
58
|
+
CLEAR: {
|
|
59
|
+
actions: 'clear',
|
|
60
|
+
},
|
|
61
|
+
SUBMIT: {
|
|
62
|
+
target: 'submitting',
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
submitting: {
|
|
67
|
+
invoke: {
|
|
68
|
+
src: 'submitDeposit',
|
|
69
|
+
onDone: { target: 'submitted', actions: 'setQrcode' },
|
|
70
|
+
onError: {
|
|
71
|
+
target: 'submittable',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
submitted: {},
|
|
76
|
+
accountUnbound: {},
|
|
77
|
+
unavailable: {},
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
actions: {
|
|
82
|
+
setUserAccount: assign((context, event) => {
|
|
83
|
+
return {
|
|
84
|
+
userAccount: event.data.bankInfo?.[0],
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
setQrcode: assign((context, event) => {
|
|
88
|
+
const { amount, qrcode, vpayId } = event.data
|
|
89
|
+
return {
|
|
90
|
+
qrcode,
|
|
91
|
+
vpayId,
|
|
92
|
+
calculatedAmount: amount,
|
|
93
|
+
}
|
|
94
|
+
}),
|
|
95
|
+
setInitialization: assign((context, event) => {
|
|
96
|
+
const { housePayment } = event.data
|
|
97
|
+
const { optional, minimum, maximum } = housePayment
|
|
98
|
+
return {
|
|
99
|
+
options: optional,
|
|
100
|
+
minimum,
|
|
101
|
+
maximum,
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
add: assign((context, event) => {
|
|
105
|
+
const { amount, maximum } = context
|
|
106
|
+
return {
|
|
107
|
+
amount: Math.min(amount + event.data, maximum),
|
|
108
|
+
}
|
|
109
|
+
}),
|
|
110
|
+
clear: assign((context, event) => {
|
|
111
|
+
return {
|
|
112
|
+
amount: 0,
|
|
113
|
+
}
|
|
114
|
+
}),
|
|
115
|
+
},
|
|
116
|
+
guards: {
|
|
117
|
+
hasUserAccount: (context, event) => {
|
|
118
|
+
return event.data.bankInfo?.[0]
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
services: {
|
|
122
|
+
fetchPaymentInfo: async (context, event) => {
|
|
123
|
+
return await request.send(payment.getPaymentInfo())
|
|
124
|
+
},
|
|
125
|
+
initialize: async (context, event) => {
|
|
126
|
+
const payments = await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
127
|
+
return { housePayment: payments.find((payment) => payment.method === context.method) }
|
|
128
|
+
},
|
|
129
|
+
submitDeposit: async (context, event) => {
|
|
130
|
+
const { method, amount } = context
|
|
131
|
+
return await request.send(
|
|
132
|
+
payment.submitDepositTransaction({
|
|
133
|
+
method,
|
|
134
|
+
amount,
|
|
135
|
+
})
|
|
136
|
+
)
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
}
|
package/src/machine/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import bank_binding_amb from './bank_binding_amb.js'
|
|
|
26
26
|
import withdraw_fc from './withdraw_fc.js'
|
|
27
27
|
import withdraw_vn from './withdraw_vn.js'
|
|
28
28
|
import withdraw_crypto from './withdraw_crypto.js'
|
|
29
|
+
import withdraw_amb from './withdraw_amb.js'
|
|
29
30
|
import deposit from './deposit/index.js'
|
|
30
31
|
import bonus from './bonus.js'
|
|
31
32
|
import leaderboard from './leaderboard.js'
|
|
@@ -63,6 +64,7 @@ export default {
|
|
|
63
64
|
withdraw_fc,
|
|
64
65
|
withdraw_vn,
|
|
65
66
|
withdraw_crypto,
|
|
67
|
+
withdraw_amb,
|
|
66
68
|
...deposit,
|
|
67
69
|
bonus,
|
|
68
70
|
leaderboard,
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { assign, createMachine } from 'xstate'
|
|
2
|
+
import findLastIndex from 'lodash/findLastIndex.js'
|
|
3
|
+
import payment from '../api/payment.js'
|
|
4
|
+
import common from '../api/common.js'
|
|
5
|
+
import user from '../api/user.js'
|
|
6
|
+
|
|
7
|
+
export default function (request) {
|
|
8
|
+
const { appSecret } = request.config
|
|
9
|
+
return createMachine(
|
|
10
|
+
{
|
|
11
|
+
id: 'withdraw_amb',
|
|
12
|
+
initial: 'loading',
|
|
13
|
+
context: {
|
|
14
|
+
siteConfig: null,
|
|
15
|
+
userInfo: null,
|
|
16
|
+
balance: null,
|
|
17
|
+
charge: null,
|
|
18
|
+
realAmount: null,
|
|
19
|
+
applyId: null,
|
|
20
|
+
methods: [],
|
|
21
|
+
paymentDetail: [],
|
|
22
|
+
bankInfo: [],
|
|
23
|
+
bankList: [],
|
|
24
|
+
withdrawLimit: null,
|
|
25
|
+
targetWithdrawLimit: null,
|
|
26
|
+
|
|
27
|
+
amount: null,
|
|
28
|
+
bank: null,
|
|
29
|
+
branch: null,
|
|
30
|
+
accountNumber: null,
|
|
31
|
+
holderName: null,
|
|
32
|
+
|
|
33
|
+
withdrawDistance: null,
|
|
34
|
+
withdrawAmount: null,
|
|
35
|
+
|
|
36
|
+
// otp
|
|
37
|
+
requestId: null,
|
|
38
|
+
status: null,
|
|
39
|
+
target: null,
|
|
40
|
+
ttl: null,
|
|
41
|
+
},
|
|
42
|
+
states: {
|
|
43
|
+
loading: {
|
|
44
|
+
invoke: {
|
|
45
|
+
src: 'fetchInitData',
|
|
46
|
+
onDone: {
|
|
47
|
+
target: 'mode',
|
|
48
|
+
actions: ['setInitData', 'preset'],
|
|
49
|
+
},
|
|
50
|
+
onError: {
|
|
51
|
+
target: 'fail',
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
mode: {
|
|
56
|
+
always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
|
|
57
|
+
},
|
|
58
|
+
free: {
|
|
59
|
+
initial: 'loading',
|
|
60
|
+
states: {
|
|
61
|
+
loading: {
|
|
62
|
+
invoke: {
|
|
63
|
+
src: 'fetchWithdrawRules',
|
|
64
|
+
onDone: {
|
|
65
|
+
target: 'checking',
|
|
66
|
+
actions: 'updateWithdrawCondition',
|
|
67
|
+
},
|
|
68
|
+
onError: {
|
|
69
|
+
target: 'notConvertible',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
checking: {
|
|
74
|
+
always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
|
|
75
|
+
},
|
|
76
|
+
notConvertible: {},
|
|
77
|
+
convertible: {
|
|
78
|
+
on: {
|
|
79
|
+
SUBMIT: {
|
|
80
|
+
target: 'converting',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
converting: {
|
|
85
|
+
invoke: {
|
|
86
|
+
src: 'submitWithdrawFree',
|
|
87
|
+
onDone: [
|
|
88
|
+
{
|
|
89
|
+
target: '#withdraw_amb.otp',
|
|
90
|
+
actions: 'setOtp',
|
|
91
|
+
cond: 'isOtpRequired',
|
|
92
|
+
},
|
|
93
|
+
{ target: 'converted' },
|
|
94
|
+
],
|
|
95
|
+
onError: {
|
|
96
|
+
target: 'convertible',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
converted: {},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
cash: {
|
|
104
|
+
initial: 'checking',
|
|
105
|
+
states: {
|
|
106
|
+
checking: {
|
|
107
|
+
always: [
|
|
108
|
+
{ target: 'inProcessing', cond: 'haveProcessing' },
|
|
109
|
+
{ target: 'notWithdrawable', cond: 'isNotWithdrawable' },
|
|
110
|
+
{ target: 'unbound', cond: 'isBankNotBound' },
|
|
111
|
+
{ target: 'withdrawable' },
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
notWithdrawable: {},
|
|
115
|
+
unbound: {
|
|
116
|
+
// to bank_binding.js
|
|
117
|
+
},
|
|
118
|
+
inProcessing: {},
|
|
119
|
+
withdrawable: {
|
|
120
|
+
on: {
|
|
121
|
+
SET_CURRENT_BANK: {
|
|
122
|
+
actions: assign((context, event) => {
|
|
123
|
+
return {
|
|
124
|
+
bank: event.data,
|
|
125
|
+
}
|
|
126
|
+
}),
|
|
127
|
+
},
|
|
128
|
+
SET_AMOUNT: {
|
|
129
|
+
actions: assign((context, event) => {
|
|
130
|
+
return {
|
|
131
|
+
amount: event.data,
|
|
132
|
+
}
|
|
133
|
+
}),
|
|
134
|
+
},
|
|
135
|
+
SUBMIT: {
|
|
136
|
+
target: 'submitting',
|
|
137
|
+
cond: 'isSubmittable',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
submitting: {
|
|
142
|
+
invoke: {
|
|
143
|
+
src: 'submitWithdraw',
|
|
144
|
+
onDone: [
|
|
145
|
+
{
|
|
146
|
+
target: '#withdraw_amb.otp',
|
|
147
|
+
actions: 'setOtp',
|
|
148
|
+
cond: 'isOtpRequired',
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
target: 'submitted',
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
onError: {
|
|
155
|
+
target: 'withdrawable',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
submitted: {
|
|
160
|
+
entry: assign((context, event) => {
|
|
161
|
+
const { applyId, balance, realAmount, charge } = event.data
|
|
162
|
+
return { applyId, balance, realAmount, charge }
|
|
163
|
+
}),
|
|
164
|
+
invoke: {
|
|
165
|
+
src: 'fetchPaymentData',
|
|
166
|
+
onDone: {
|
|
167
|
+
target: 'inProcessing',
|
|
168
|
+
actions: 'setPaymentData',
|
|
169
|
+
},
|
|
170
|
+
onError: {
|
|
171
|
+
target: '#withdraw_amb.fail',
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
otp: {
|
|
178
|
+
type: 'parallel',
|
|
179
|
+
states: {
|
|
180
|
+
countdown: {
|
|
181
|
+
after: {
|
|
182
|
+
1000: {
|
|
183
|
+
target: 'countdown',
|
|
184
|
+
actions: 'decreaseTtl',
|
|
185
|
+
cond: (context) => context.ttl > 0,
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
verification: {
|
|
190
|
+
initial: 'idle',
|
|
191
|
+
states: {
|
|
192
|
+
idle: {
|
|
193
|
+
on: {
|
|
194
|
+
ACKNOWLEDGE: {
|
|
195
|
+
target: 'acknowledging',
|
|
196
|
+
},
|
|
197
|
+
RESET_OTP: {
|
|
198
|
+
target: 'reset',
|
|
199
|
+
},
|
|
200
|
+
BACK: [
|
|
201
|
+
{
|
|
202
|
+
target: '#withdraw_amb.free.convertible',
|
|
203
|
+
cond: 'isFree',
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
target: '#withdraw_amb.cash.withdrawable',
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
acknowledging: {
|
|
212
|
+
invoke: {
|
|
213
|
+
src: 'acknowledge',
|
|
214
|
+
onDone: [
|
|
215
|
+
{
|
|
216
|
+
target: '#withdraw_amb.free.converted',
|
|
217
|
+
cond: 'isFree',
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
target: '#withdraw_amb.cash.submitted',
|
|
221
|
+
},
|
|
222
|
+
],
|
|
223
|
+
onError: {
|
|
224
|
+
target: 'idle',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
reset: {
|
|
229
|
+
invoke: {
|
|
230
|
+
src: 'resetOtp',
|
|
231
|
+
onDone: {
|
|
232
|
+
target: 'idle',
|
|
233
|
+
actions: 'setVerificationData',
|
|
234
|
+
},
|
|
235
|
+
onError: { target: 'idle' },
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
fail: {},
|
|
243
|
+
},
|
|
244
|
+
on: {
|
|
245
|
+
REFRESH: {
|
|
246
|
+
target: 'loading',
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
actions: {
|
|
252
|
+
setInitData: assign((context, event) => {
|
|
253
|
+
return {
|
|
254
|
+
paymentDetail: event.data.paymentDetail,
|
|
255
|
+
bankInfo: event.data.bankInfo,
|
|
256
|
+
bonus: event.data.bonus,
|
|
257
|
+
bankList: event.data.bankList,
|
|
258
|
+
}
|
|
259
|
+
}),
|
|
260
|
+
setPaymentData: assign((context, event) => {
|
|
261
|
+
return {
|
|
262
|
+
bankInfo: event.data.bankInfo,
|
|
263
|
+
bonus: event.data.bonus,
|
|
264
|
+
paymentDetail: event.data.paymentDetail,
|
|
265
|
+
}
|
|
266
|
+
}),
|
|
267
|
+
preset: assign((context, event) => {
|
|
268
|
+
const { userInfo, siteConfig } = event.data
|
|
269
|
+
const { withdraw_limit, target_withdraw_limit } = userInfo || {}
|
|
270
|
+
const balance = parseFloat(userInfo?.balance)
|
|
271
|
+
const methods = siteConfig?.paymentMethods?.withdraw || []
|
|
272
|
+
return {
|
|
273
|
+
withdrawLimit: Math.abs(withdraw_limit),
|
|
274
|
+
targetWithdrawLimit: Math.abs(target_withdraw_limit),
|
|
275
|
+
methods,
|
|
276
|
+
balance,
|
|
277
|
+
siteConfig,
|
|
278
|
+
userInfo,
|
|
279
|
+
}
|
|
280
|
+
}),
|
|
281
|
+
updateWithdrawCondition: assign((context, event) => {
|
|
282
|
+
const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
|
|
283
|
+
|
|
284
|
+
const { balance, withdrawLimit } = context
|
|
285
|
+
const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
|
|
286
|
+
|
|
287
|
+
let maxWithdrawAmount = 0,
|
|
288
|
+
availableWithdrawAmount = 0
|
|
289
|
+
|
|
290
|
+
if (lastMatchedIndex > -1) {
|
|
291
|
+
rules[lastMatchedIndex].match = true
|
|
292
|
+
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
|
|
293
|
+
|
|
294
|
+
if (withdrawLimit === 0) {
|
|
295
|
+
availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
|
|
296
|
+
}
|
|
297
|
+
} else if (rules.length > 0) {
|
|
298
|
+
maxWithdrawAmount = rules[0].maxWithdrawAmount
|
|
299
|
+
} else {
|
|
300
|
+
maxWithdrawAmount = balance
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return {
|
|
304
|
+
maxWithdrawAmount,
|
|
305
|
+
availableWithdrawAmount,
|
|
306
|
+
}
|
|
307
|
+
}),
|
|
308
|
+
setOtp: assign((context, event) => {
|
|
309
|
+
const { requestId, status, target, ttl } = event.data
|
|
310
|
+
return {
|
|
311
|
+
requestId,
|
|
312
|
+
status,
|
|
313
|
+
target,
|
|
314
|
+
ttl,
|
|
315
|
+
}
|
|
316
|
+
}),
|
|
317
|
+
decreaseTtl: assign((context, evnet) => {
|
|
318
|
+
const second = context.ttl
|
|
319
|
+
return {
|
|
320
|
+
ttl: Math.max(second - 1, 0),
|
|
321
|
+
}
|
|
322
|
+
}),
|
|
323
|
+
setVerificationData: assign((context, event) => {
|
|
324
|
+
const { requestId, ttl, target } = event.data
|
|
325
|
+
return {
|
|
326
|
+
requestId,
|
|
327
|
+
ttl,
|
|
328
|
+
target,
|
|
329
|
+
}
|
|
330
|
+
}),
|
|
331
|
+
},
|
|
332
|
+
guards: {
|
|
333
|
+
isFree: (context, event) => {
|
|
334
|
+
return context.userInfo?.withdraw_rule !== 'DEFAULT'
|
|
335
|
+
},
|
|
336
|
+
haveProcessing: (context, event) => {
|
|
337
|
+
return (context.paymentDetail?.[0]?.processing || []).length > 0
|
|
338
|
+
},
|
|
339
|
+
isWithdrawDisable: (context, event) => {
|
|
340
|
+
const { siteConfig } = context
|
|
341
|
+
const methods = siteConfig?.paymentMethods?.withdraw || []
|
|
342
|
+
return methods.length === 0
|
|
343
|
+
},
|
|
344
|
+
isBankNotBound: (context, event) => {
|
|
345
|
+
return !context.bankInfo?.length
|
|
346
|
+
},
|
|
347
|
+
isSubmittable: (context, event) => {
|
|
348
|
+
const { applyerBankCode, applyerAccountNumber, branch, holderName, amount } = event.data
|
|
349
|
+
return applyerBankCode && applyerAccountNumber && branch && holderName && amount
|
|
350
|
+
},
|
|
351
|
+
isConvertible: (context, event) => {
|
|
352
|
+
const { balance, withdrawLimit } = context
|
|
353
|
+
return balance > 0 && withdrawLimit === 0
|
|
354
|
+
},
|
|
355
|
+
isNotWithdrawable: (context, event) => {
|
|
356
|
+
const { balance, withdrawLimit, paymentDetail } = context
|
|
357
|
+
const minWithdrawAmount = paymentDetail[0]?.minimum || 0
|
|
358
|
+
return withdrawLimit !== 0 || balance < minWithdrawAmount
|
|
359
|
+
},
|
|
360
|
+
isOtpRequired: (context, event) => {
|
|
361
|
+
return event.data?.status === 'otp-verifying'
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
services: {
|
|
365
|
+
fetchInitData: async (context, event) => {
|
|
366
|
+
const [{ config }, userInfo, paymentDetail = [], { bonus, bankInfo }] = await Promise.all([
|
|
367
|
+
request.send(common.getConfig({ appSecret })),
|
|
368
|
+
request.send(user.getUserInfo()),
|
|
369
|
+
request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
|
|
370
|
+
request.send(payment.getPaymentInfo()),
|
|
371
|
+
])
|
|
372
|
+
const siteConfig = JSON.parse(window.atob(config))
|
|
373
|
+
const method = paymentDetail.find((payment) => payment.category === 'amb').method
|
|
374
|
+
const bankList = await request.send(payment.getBankList(method))
|
|
375
|
+
const newBankInfo = bankInfo.map((item) => {
|
|
376
|
+
return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
|
|
377
|
+
})
|
|
378
|
+
return { siteConfig, userInfo, paymentDetail, bonus, bankInfo: newBankInfo, bankList }
|
|
379
|
+
},
|
|
380
|
+
fetchPaymentData: async (context, event) => {
|
|
381
|
+
const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
|
|
382
|
+
const { bonus, bankInfo } = await request.send(payment.getPaymentInfo())
|
|
383
|
+
return { bonus, bankInfo, paymentDetail }
|
|
384
|
+
},
|
|
385
|
+
updatePaymentInfo: async (context, event) => {
|
|
386
|
+
const { bank, branch, accountNumber, holderName } = context
|
|
387
|
+
return await request.send(
|
|
388
|
+
payment.updatePaymentInfo({
|
|
389
|
+
bankCode: bank.bankCode,
|
|
390
|
+
branch,
|
|
391
|
+
bankAccount: accountNumber,
|
|
392
|
+
holderName,
|
|
393
|
+
})
|
|
394
|
+
)
|
|
395
|
+
},
|
|
396
|
+
fetchWithdrawRules: async (context, event) => {
|
|
397
|
+
return await request.send(payment.getCurrentWithdrawRule())
|
|
398
|
+
},
|
|
399
|
+
submitWithdraw: async (context, event) => {
|
|
400
|
+
const { amount } = event.data
|
|
401
|
+
const { method } = context.paymentDetail[0]
|
|
402
|
+
return await request.send(
|
|
403
|
+
payment.submitWithdrawTransactionAmb({
|
|
404
|
+
method,
|
|
405
|
+
amount,
|
|
406
|
+
})
|
|
407
|
+
)
|
|
408
|
+
},
|
|
409
|
+
submitWithdrawFree: async (context, event) => {
|
|
410
|
+
return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
|
|
411
|
+
},
|
|
412
|
+
resetOtp: async (context, event) => {
|
|
413
|
+
const { requestId, target } = context
|
|
414
|
+
return await request.send(user.otpReset({ requestId, target }))
|
|
415
|
+
},
|
|
416
|
+
acknowledge: async (context, event) => {
|
|
417
|
+
const { requestId, target } = context
|
|
418
|
+
const code = event.data
|
|
419
|
+
return await request.send(user.otpAcknowledge({ requestId, target, code }))
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
}
|
|
423
|
+
)
|
|
424
|
+
}
|
|
@@ -84,13 +84,16 @@ export default function (request) {
|
|
|
84
84
|
converting: {
|
|
85
85
|
invoke: {
|
|
86
86
|
src: 'submitWithdrawFree',
|
|
87
|
-
onDone: [
|
|
87
|
+
onDone: [
|
|
88
|
+
{
|
|
88
89
|
target: '#withdraw_crypto.otp',
|
|
89
90
|
actions: 'setOtp',
|
|
90
|
-
cond: 'isOtpRequired'
|
|
91
|
-
},
|
|
91
|
+
cond: 'isOtpRequired',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
92
94
|
target: 'converted',
|
|
93
|
-
}
|
|
95
|
+
},
|
|
96
|
+
],
|
|
94
97
|
onError: {
|
|
95
98
|
target: 'convertible',
|
|
96
99
|
},
|
|
@@ -158,13 +161,16 @@ export default function (request) {
|
|
|
158
161
|
submitting: {
|
|
159
162
|
invoke: {
|
|
160
163
|
src: 'submitWithdraw',
|
|
161
|
-
onDone: [
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
164
|
+
onDone: [
|
|
165
|
+
{
|
|
166
|
+
target: '#withdraw_crypto.otp',
|
|
167
|
+
actions: 'setOtp',
|
|
168
|
+
cond: 'isOtpRequired',
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
target: 'submitted',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
168
174
|
onError: {
|
|
169
175
|
target: 'withdrawable',
|
|
170
176
|
},
|
|
@@ -196,23 +202,29 @@ export default function (request) {
|
|
|
196
202
|
RESET_OTP: {
|
|
197
203
|
target: 'reset',
|
|
198
204
|
},
|
|
199
|
-
BACK: [
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
BACK: [
|
|
206
|
+
{
|
|
207
|
+
target: '#withdraw_crypto.free.convertible',
|
|
208
|
+
cond: 'isFree',
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
target: '#withdraw_crypto.cash.submittable',
|
|
212
|
+
},
|
|
213
|
+
],
|
|
205
214
|
},
|
|
206
215
|
},
|
|
207
216
|
acknowledging: {
|
|
208
217
|
invoke: {
|
|
209
218
|
src: 'acknowledge',
|
|
210
|
-
onDone: [
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
219
|
+
onDone: [
|
|
220
|
+
{
|
|
221
|
+
target: '#withdraw_crypto.free.converted',
|
|
222
|
+
cond: 'isFree',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
target: '#withdraw_crypto.cash.submitted',
|
|
226
|
+
},
|
|
227
|
+
],
|
|
216
228
|
onError: {
|
|
217
229
|
target: 'idle',
|
|
218
230
|
},
|
|
@@ -389,7 +401,7 @@ export default function (request) {
|
|
|
389
401
|
},
|
|
390
402
|
isOtpRequired: (context, event) => {
|
|
391
403
|
return event.data?.status === 'otp-verifying'
|
|
392
|
-
}
|
|
404
|
+
},
|
|
393
405
|
},
|
|
394
406
|
services: {
|
|
395
407
|
fetchInitData: async (context, event) => {
|
|
@@ -411,7 +423,7 @@ export default function (request) {
|
|
|
411
423
|
submitWithdraw: async (context, event) => {
|
|
412
424
|
const { crypto, selectedNetwork, address, amount } = context
|
|
413
425
|
return await request.send(
|
|
414
|
-
api.
|
|
426
|
+
api.submitWithdrawTransactionCrypto({
|
|
415
427
|
method: crypto.method,
|
|
416
428
|
amount,
|
|
417
429
|
cryptoCurrency: crypto.channel,
|
|
@@ -215,7 +215,7 @@ export default function (request) {
|
|
|
215
215
|
const { crypto, currentNetwork, currentAddress, withdrawAmount } = context
|
|
216
216
|
const method = crypto.method
|
|
217
217
|
return await request.send(
|
|
218
|
-
api.
|
|
218
|
+
api.submitWithdrawTransactionCrypto({
|
|
219
219
|
method,
|
|
220
220
|
amount: withdrawAmount,
|
|
221
221
|
cryptoCurrency: crypto.channel,
|