@jetthai/cuora 1.1.266 → 1.1.268
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
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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.268](https://github.com/jetthai/cuora-module/compare/v1.1.267...v1.1.268) (2024-05-15)
|
|
6
|
+
|
|
7
|
+
### [1.1.267](https://github.com/jetthai/cuora-module/compare/v1.1.266...v1.1.267) (2024-05-14)
|
|
8
|
+
|
|
5
9
|
### [1.1.266](https://github.com/jetthai/cuora-module/compare/v1.1.265...v1.1.266) (2024-05-14)
|
|
6
10
|
|
|
7
11
|
### [1.1.265](https://github.com/jetthai/cuora-module/compare/v1.1.264...v1.1.265) (2024-05-14)
|
package/package.json
CHANGED
package/src/api/payment.js
CHANGED
|
@@ -10,6 +10,7 @@ export default {
|
|
|
10
10
|
getTransactionHistoryOptions: () => ({ url: 'payment/v2/category/options', method: 'get' }),
|
|
11
11
|
// getPaymentInfo: () => ({ url: `payment/paymentInfo`, method: 'get' }),
|
|
12
12
|
getPaymentInfo: () => ({ url: `payment/v2/paymentInfo`, method: 'get' }),
|
|
13
|
+
getBindingPaymentInfo: () => ({ url: `payment/getBindingPaymentInfo`, method: 'get' }),
|
|
13
14
|
updatePaymentInfo: ({
|
|
14
15
|
bankCode,
|
|
15
16
|
branch,
|
|
@@ -23,6 +24,11 @@ export default {
|
|
|
23
24
|
bonus,
|
|
24
25
|
paymentProvider,
|
|
25
26
|
pixType,
|
|
27
|
+
bindingType,
|
|
28
|
+
cryptoCurrency,
|
|
29
|
+
cryptoNetwork,
|
|
30
|
+
cryptoAddress,
|
|
31
|
+
walletCode,
|
|
26
32
|
}) => ({
|
|
27
33
|
url: 'payment/v2/updatePaymentInfo',
|
|
28
34
|
method: 'post',
|
|
@@ -39,10 +45,16 @@ export default {
|
|
|
39
45
|
bonus,
|
|
40
46
|
paymentProvider,
|
|
41
47
|
pixType,
|
|
48
|
+
bindingType,
|
|
49
|
+
cryptoCurrency,
|
|
50
|
+
cryptoNetwork,
|
|
51
|
+
cryptoAddress,
|
|
52
|
+
walletCode,
|
|
42
53
|
},
|
|
43
54
|
}),
|
|
44
55
|
getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
|
|
45
56
|
getBindingBankList: ({ appSecret }) => ({ url: 'payment/v2/getBindingBankList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
57
|
+
getBindingPaymentList: ({ appSecret }) => ({ url: 'payment/getBindingPaymentList', method: 'get', params: { appSecret }, isPublic: true }),
|
|
46
58
|
getWithdrawBankList: () => ({ url: 'payment/v2/getWithdrawBankList', method: 'get' }),
|
|
47
59
|
makeTransaction: ({ type, payload, paymentMethod }) => ({
|
|
48
60
|
url: `payment/v2/${paymentMethod}/transaction`,
|
|
@@ -11,7 +11,17 @@ export default function (request) {
|
|
|
11
11
|
context: {
|
|
12
12
|
hasAnyAccount: false,
|
|
13
13
|
bankList: [],
|
|
14
|
+
paymentList: {
|
|
15
|
+
bankList: [],
|
|
16
|
+
cryptoList: [],
|
|
17
|
+
ewalletList: [],
|
|
18
|
+
},
|
|
19
|
+
bindingType: 'BANK',
|
|
14
20
|
bank: null,
|
|
21
|
+
crypto: null,
|
|
22
|
+
network: null,
|
|
23
|
+
cryptoAddress: null,
|
|
24
|
+
walletCode: null,
|
|
15
25
|
branch: null,
|
|
16
26
|
branchCode: null,
|
|
17
27
|
accountNumber: null,
|
|
@@ -33,6 +43,13 @@ export default function (request) {
|
|
|
33
43
|
},
|
|
34
44
|
idle: {
|
|
35
45
|
on: {
|
|
46
|
+
SET_BIND_TYPE: {
|
|
47
|
+
actions: assign((context, event) => {
|
|
48
|
+
return {
|
|
49
|
+
bindingType: event.data,
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
36
53
|
SET_BANK_CODE: {
|
|
37
54
|
actions: assign((context, event) => {
|
|
38
55
|
return {
|
|
@@ -40,6 +57,34 @@ export default function (request) {
|
|
|
40
57
|
}
|
|
41
58
|
}),
|
|
42
59
|
},
|
|
60
|
+
SET_CRYPTO_CODE: {
|
|
61
|
+
actions: assign((context, event) => {
|
|
62
|
+
return {
|
|
63
|
+
crypto: event.data,
|
|
64
|
+
}
|
|
65
|
+
}),
|
|
66
|
+
},
|
|
67
|
+
SET_NETWORK_CODE: {
|
|
68
|
+
actions: assign((context, event) => {
|
|
69
|
+
return {
|
|
70
|
+
network: event.data,
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
},
|
|
74
|
+
SET_CRYPTO_ADDRESS: {
|
|
75
|
+
actions: assign((context, event) => {
|
|
76
|
+
return {
|
|
77
|
+
cryptoAddress: event.data,
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
},
|
|
81
|
+
SET_WALLET_CODE: {
|
|
82
|
+
actions: assign((context, event) => {
|
|
83
|
+
return {
|
|
84
|
+
walletCode: event.data,
|
|
85
|
+
}
|
|
86
|
+
}),
|
|
87
|
+
},
|
|
43
88
|
SET_BRANCH: {
|
|
44
89
|
actions: assign((context, event) => {
|
|
45
90
|
return {
|
|
@@ -110,6 +155,16 @@ export default function (request) {
|
|
|
110
155
|
},
|
|
111
156
|
guards: {
|
|
112
157
|
isBindable: (context, event) => {
|
|
158
|
+
const { bindingType } = context
|
|
159
|
+
|
|
160
|
+
if (bindingType === 'CRYPTO') {
|
|
161
|
+
const { crypto, network, cryptoAddress, holderName } = context
|
|
162
|
+
return crypto && network && cryptoAddress && holderName
|
|
163
|
+
}
|
|
164
|
+
if (bindingType === 'EWALLET') {
|
|
165
|
+
const { walletCode, accountNumber, holderName } = context
|
|
166
|
+
return walletCode?.bankCode && accountNumber && holderName
|
|
167
|
+
}
|
|
113
168
|
const { bank, accountNumber, branch, holderName } = context
|
|
114
169
|
return bank.bankCode && accountNumber && branch && holderName
|
|
115
170
|
},
|
|
@@ -118,15 +173,21 @@ export default function (request) {
|
|
|
118
173
|
fetchInitData: async (context, event) => {
|
|
119
174
|
const [bankList, paymentInfo] = await Promise.all([
|
|
120
175
|
request.send(payment.getBindingBankList({ appSecret })),
|
|
176
|
+
request.send(payment.getBindingPaymentList({ appSecret })),
|
|
121
177
|
request.send(payment.getPaymentInfo()),
|
|
122
178
|
])
|
|
123
179
|
return { bankList, paymentInfo }
|
|
124
180
|
},
|
|
125
181
|
updatePaymentInfo: async (context, event) => {
|
|
126
|
-
const { bank, branch, branchCode, accountNumber, holderName, pixType } = context
|
|
182
|
+
const { bindingType, bank, crypto, network, cryptoAddress, walletCode, branch, branchCode, accountNumber, holderName, pixType } = context
|
|
127
183
|
return await request.send(
|
|
128
184
|
payment.updatePaymentInfo({
|
|
129
|
-
|
|
185
|
+
bindingType,
|
|
186
|
+
bankCode: bank?.bankCode || '',
|
|
187
|
+
cryptoCurrency: crypto?.symbol || '',
|
|
188
|
+
cryptoNetwork: network?.label || '',
|
|
189
|
+
cryptoAddress: cryptoAddress,
|
|
190
|
+
walletCode: walletCode?.bankCode || '',
|
|
130
191
|
branch: branch === 'BLANK' ? '' : branch, // 'BLANK'會置換成空值
|
|
131
192
|
branchCode,
|
|
132
193
|
bankAccount: accountNumber,
|
|
@@ -243,10 +243,8 @@ export default function (request, context) {
|
|
|
243
243
|
},
|
|
244
244
|
isSubmittable: (context, event) => {
|
|
245
245
|
const { selectedCrypto, selectedAddress, selectedAmount, depositTime, receipt, calculation, siteConfig } = context
|
|
246
|
-
const { bankDepositProofIsOptional = '
|
|
247
|
-
return (
|
|
248
|
-
selectedCrypto && selectedAddress && selectedAmount && depositTime && calculation && (receipt || !(bankDepositProofIsOptional === '1'))
|
|
249
|
-
)
|
|
246
|
+
const { bankDepositProofIsOptional = '1' } = siteConfig
|
|
247
|
+
return selectedCrypto && selectedAddress && selectedAmount && depositTime && calculation && (receipt || bankDepositProofIsOptional === '0')
|
|
250
248
|
},
|
|
251
249
|
},
|
|
252
250
|
services: {
|