@jetthai/cuora 1.1.263 → 1.1.265
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.265](https://github.com/jetthai/cuora-module/compare/v1.1.264...v1.1.265) (2024-05-14)
|
|
6
|
+
|
|
7
|
+
### [1.1.264](https://github.com/jetthai/cuora-module/compare/v1.1.263...v1.1.264) (2024-05-11)
|
|
8
|
+
|
|
5
9
|
### [1.1.263](https://github.com/jetthai/cuora-module/compare/v1.1.262...v1.1.263) (2024-05-10)
|
|
6
10
|
|
|
7
11
|
### [1.1.262](https://github.com/jetthai/cuora-module/compare/v1.1.261...v1.1.262) (2024-05-10)
|
package/package.json
CHANGED
|
@@ -29,6 +29,7 @@ export default function (request) {
|
|
|
29
29
|
|
|
30
30
|
depositTime: null,
|
|
31
31
|
receipt: null,
|
|
32
|
+
proofOptional: false,
|
|
32
33
|
|
|
33
34
|
// use for wallet mode 4
|
|
34
35
|
promotion: null,
|
|
@@ -132,6 +133,9 @@ export default function (request) {
|
|
|
132
133
|
target: '.loaded',
|
|
133
134
|
actions: ['setAmount', 'clearCalculation'],
|
|
134
135
|
},
|
|
136
|
+
SET_PROOF_OPTIONAL: {
|
|
137
|
+
actions: 'setProofOptional',
|
|
138
|
+
},
|
|
135
139
|
CALCULATE: {
|
|
136
140
|
target: '.debouncing',
|
|
137
141
|
actions: 'clearCalculation',
|
|
@@ -242,6 +246,11 @@ export default function (request) {
|
|
|
242
246
|
result: event.data,
|
|
243
247
|
}
|
|
244
248
|
}),
|
|
249
|
+
setProofOptional: assign((context, event) => {
|
|
250
|
+
return {
|
|
251
|
+
proofOptional: event.data,
|
|
252
|
+
}
|
|
253
|
+
}),
|
|
245
254
|
setDepositTime: assign((context, event) => {
|
|
246
255
|
return {
|
|
247
256
|
depositTime: event.data,
|
|
@@ -265,8 +274,8 @@ export default function (request) {
|
|
|
265
274
|
return selectedCrypto && selectedAddress && amount && cryptoBank.minimum <= +amount && +amount <= cryptoBank.maximum
|
|
266
275
|
},
|
|
267
276
|
isSubmittable: (context, event) => {
|
|
268
|
-
const { selectedCrypto, selectedAddress, amount, depositTime, receipt } = context
|
|
269
|
-
return selectedCrypto && selectedAddress && amount && depositTime && receipt
|
|
277
|
+
const { selectedCrypto, selectedAddress, amount, depositTime, receipt, proofOptional } = context
|
|
278
|
+
return selectedCrypto && selectedAddress && amount && depositTime && (receipt || proofOptional)
|
|
270
279
|
},
|
|
271
280
|
isProcessing: (context, event) => {
|
|
272
281
|
return context.processing
|
|
@@ -11,9 +11,7 @@ export default function (request) {
|
|
|
11
11
|
currentCategory: 'cryptoQrcode',
|
|
12
12
|
currentPayment: null,
|
|
13
13
|
cryptos: [],
|
|
14
|
-
networks: [],
|
|
15
14
|
selectedCrypto: null,
|
|
16
|
-
selectedNetwork: null,
|
|
17
15
|
|
|
18
16
|
resultMap: {},
|
|
19
17
|
result: {
|
|
@@ -71,61 +69,38 @@ export default function (request) {
|
|
|
71
69
|
target: '.finding',
|
|
72
70
|
actions: 'setCrypto',
|
|
73
71
|
},
|
|
74
|
-
SET_NETWORK: {
|
|
75
|
-
target: '.finding',
|
|
76
|
-
actions: 'setNetwork',
|
|
77
|
-
},
|
|
78
72
|
},
|
|
79
73
|
},
|
|
80
74
|
{
|
|
81
75
|
actions: {
|
|
82
76
|
setInitData: assign((context, event) => {
|
|
83
77
|
const paymentDetail = event.data || []
|
|
84
|
-
const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
|
|
85
|
-
const
|
|
86
|
-
const cryptos = payments.map((payment) => ({ ...payment, label: payment.channel, value: payment.method, icon: payment.channel }))
|
|
87
|
-
const networks = currentPayment?.networkName.map((value, i) => {
|
|
78
|
+
const payments = paymentDetail.filter((item) => item.transferType === 'deposit' && item.category === context.currentCategory)
|
|
79
|
+
const cryptos = payments?.map((value, i) => {
|
|
88
80
|
return {
|
|
89
|
-
|
|
90
|
-
value,
|
|
91
|
-
|
|
81
|
+
...value,
|
|
82
|
+
label: value?.cryptoOptional[0],
|
|
83
|
+
network: value?.networkName[0],
|
|
84
|
+
icon: value?.channel,
|
|
92
85
|
}
|
|
93
86
|
})
|
|
94
|
-
|
|
95
87
|
return {
|
|
96
88
|
cryptos,
|
|
97
|
-
networks,
|
|
98
89
|
selectedCrypto: cryptos[0],
|
|
99
|
-
|
|
100
|
-
currentPayment,
|
|
90
|
+
currentPayment: cryptos[0],
|
|
101
91
|
}
|
|
102
92
|
}),
|
|
103
93
|
setCrypto: assign((context, event) => {
|
|
104
94
|
const { cryptos } = context
|
|
105
|
-
const selectedCrypto = cryptos.find((crypto) => crypto.
|
|
106
|
-
|
|
107
|
-
selectedCrypto?.networkName.map((value, i) => {
|
|
108
|
-
return {
|
|
109
|
-
label: selectedCrypto?.networkOptional?.[i],
|
|
110
|
-
value,
|
|
111
|
-
icon: value,
|
|
112
|
-
}
|
|
113
|
-
}) || []
|
|
114
|
-
return {
|
|
115
|
-
networks,
|
|
116
|
-
selectedCrypto,
|
|
117
|
-
selectedNetwork: networks[0],
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
setNetwork: assign((context, event) => {
|
|
121
|
-
return { selectedNetwork: event.data }
|
|
95
|
+
const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
|
|
96
|
+
return { selectedCrypto }
|
|
122
97
|
}),
|
|
123
98
|
setResultFromLocal: assign((context, event) => {
|
|
124
|
-
const { resultMap,
|
|
125
|
-
return { result: resultMap[
|
|
99
|
+
const { resultMap, selectedCrypto } = context
|
|
100
|
+
return { result: resultMap[selectedCrypto.network] }
|
|
126
101
|
}),
|
|
127
102
|
setResult: assign((context, event) => {
|
|
128
|
-
const { resultMap,
|
|
103
|
+
const { resultMap, selectedCrypto } = context
|
|
129
104
|
const { action, cdtime, accountNumber, currency, network, name, qrcode } = event.data
|
|
130
105
|
const result = {
|
|
131
106
|
action,
|
|
@@ -141,15 +116,15 @@ export default function (request) {
|
|
|
141
116
|
result,
|
|
142
117
|
resultMap: {
|
|
143
118
|
...resultMap,
|
|
144
|
-
[
|
|
119
|
+
[selectedCrypto.network]: result,
|
|
145
120
|
},
|
|
146
121
|
}
|
|
147
122
|
}),
|
|
148
123
|
},
|
|
149
124
|
guards: {
|
|
150
125
|
isFound: (context, event) => {
|
|
151
|
-
const { resultMap,
|
|
152
|
-
return resultMap[
|
|
126
|
+
const { resultMap, selectedCrypto } = context
|
|
127
|
+
return resultMap[selectedCrypto.network]
|
|
153
128
|
},
|
|
154
129
|
},
|
|
155
130
|
services: {
|
|
@@ -157,12 +132,12 @@ export default function (request) {
|
|
|
157
132
|
return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
|
|
158
133
|
},
|
|
159
134
|
submitDeposit: async (context, event) => {
|
|
160
|
-
const { currentPayment,
|
|
135
|
+
const { currentPayment, selectedCrypto } = context
|
|
161
136
|
return await request.send(
|
|
162
137
|
payment.submitDepositTransactionCrypto({
|
|
163
138
|
method: currentPayment.method,
|
|
164
139
|
cryptoCurrency: currentPayment.channel,
|
|
165
|
-
cryptoNetwork:
|
|
140
|
+
cryptoNetwork: selectedCrypto.network,
|
|
166
141
|
})
|
|
167
142
|
)
|
|
168
143
|
},
|
|
@@ -13,12 +13,10 @@ export default function (request) {
|
|
|
13
13
|
paymentDetails: [],
|
|
14
14
|
|
|
15
15
|
cryptos: [],
|
|
16
|
-
networks: [],
|
|
17
16
|
sourceAddress: '',
|
|
18
17
|
|
|
19
18
|
amount: null,
|
|
20
19
|
selectedCrypto: null,
|
|
21
|
-
selectedNetwork: null,
|
|
22
20
|
|
|
23
21
|
currentCategory: 'cryptoWay',
|
|
24
22
|
currentPayment: null,
|
|
@@ -105,10 +103,6 @@ export default function (request) {
|
|
|
105
103
|
target: '.loaded',
|
|
106
104
|
actions: 'setCrypto',
|
|
107
105
|
},
|
|
108
|
-
SET_NETWORK: {
|
|
109
|
-
target: '.loaded',
|
|
110
|
-
actions: 'setNetwork',
|
|
111
|
-
},
|
|
112
106
|
SET_ADDRESS: {
|
|
113
107
|
actions: 'setAddress',
|
|
114
108
|
},
|
|
@@ -128,54 +122,29 @@ export default function (request) {
|
|
|
128
122
|
{
|
|
129
123
|
actions: {
|
|
130
124
|
setPayment: assign((context, event) => {
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
value,
|
|
141
|
-
icon: value,
|
|
142
|
-
}
|
|
143
|
-
}) || []
|
|
125
|
+
const payments = event.data.filter((item) => item.category === context.currentCategory)
|
|
126
|
+
const cryptos = payments?.map((value, i) => {
|
|
127
|
+
return {
|
|
128
|
+
...value,
|
|
129
|
+
label: value?.cryptoOptional[0],
|
|
130
|
+
network: value?.networkName[0],
|
|
131
|
+
icon: value?.channel,
|
|
132
|
+
}
|
|
133
|
+
})
|
|
144
134
|
return {
|
|
145
135
|
cryptos,
|
|
146
|
-
networks: defaultNetworks,
|
|
147
136
|
selectedCrypto: cryptos[0],
|
|
148
|
-
|
|
149
|
-
currentPayment,
|
|
137
|
+
currentPayment: cryptos[0],
|
|
150
138
|
}
|
|
151
139
|
}),
|
|
152
140
|
setCrypto: assign((context, event) => {
|
|
153
|
-
const { cryptos
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
value,
|
|
160
|
-
icon: value,
|
|
161
|
-
}
|
|
162
|
-
}) || []
|
|
163
|
-
|
|
164
|
-
const properties = {
|
|
165
|
-
selectedCrypto: event.data,
|
|
166
|
-
networks,
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (!networks.includes(selectedNetwork)) {
|
|
170
|
-
properties.selectedNetwork = null
|
|
171
|
-
properties.amount = null
|
|
172
|
-
properties.calculation = null
|
|
141
|
+
const { cryptos } = context
|
|
142
|
+
const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
|
|
143
|
+
return {
|
|
144
|
+
selectedCrypto: selectedCrypto,
|
|
145
|
+
amount: null,
|
|
146
|
+
calculation: null,
|
|
173
147
|
}
|
|
174
|
-
|
|
175
|
-
return properties
|
|
176
|
-
}),
|
|
177
|
-
setNetwork: assign((context, event) => {
|
|
178
|
-
return { selectedNetwork: event.data }
|
|
179
148
|
}),
|
|
180
149
|
setAmount: assign((context, event) => {
|
|
181
150
|
return {
|
|
@@ -211,17 +180,12 @@ export default function (request) {
|
|
|
211
180
|
},
|
|
212
181
|
guards: {
|
|
213
182
|
isCalculable: (context, event) => {
|
|
214
|
-
const {
|
|
215
|
-
|
|
216
|
-
selectedNetwork,
|
|
217
|
-
amount,
|
|
218
|
-
currentPayment: { maximum, minimum },
|
|
219
|
-
} = context
|
|
220
|
-
return selectedCrypto && selectedNetwork && amount && minimum <= +amount && +amount <= maximum
|
|
183
|
+
const { selectedCrypto, amount } = context
|
|
184
|
+
return selectedCrypto && amount && selectedCrypto?.minimum <= +amount && +amount <= selectedCrypto?.maximum
|
|
221
185
|
},
|
|
222
186
|
isSubmittable: (context, event) => {
|
|
223
|
-
const { selectedCrypto,
|
|
224
|
-
return selectedCrypto &&
|
|
187
|
+
const { selectedCrypto, amount } = context
|
|
188
|
+
return selectedCrypto && amount
|
|
225
189
|
},
|
|
226
190
|
},
|
|
227
191
|
services: {
|
|
@@ -240,13 +204,13 @@ export default function (request) {
|
|
|
240
204
|
)
|
|
241
205
|
},
|
|
242
206
|
submitDeposit: async (context, event) => {
|
|
243
|
-
const { selectedCrypto,
|
|
207
|
+
const { selectedCrypto, amount } = context
|
|
244
208
|
return await request.send(
|
|
245
209
|
payment.submitDepositTransactionCrypto({
|
|
246
210
|
method: selectedCrypto.method,
|
|
247
211
|
amount: amount,
|
|
248
212
|
cryptoCurrency: selectedCrypto.channel,
|
|
249
|
-
cryptoNetwork:
|
|
213
|
+
cryptoNetwork: selectedCrypto.network,
|
|
250
214
|
})
|
|
251
215
|
)
|
|
252
216
|
},
|