@jetthai/cuora 1.1.272-jackpot-1 → 1.1.272-jackpot-2

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.272-jackpot-2](https://github.com/jetthai/cuora-module/compare/v1.1.273-withdraw-4...v1.1.272-jackpot-2) (2024-05-29)
6
+
7
+ ### [1.1.272-jackpot-1](https://github.com/jetthai/cuora-module/compare/v1.1.272...v1.1.272-jackpot-1) (2024-05-23)
8
+
5
9
  ### [1.1.272-jackpot-1](https://github.com/jetthai/cuora-module/compare/v1.1.272...v1.1.272-jackpot-1) (2024-05-23)
6
10
 
7
11
  ### [1.1.272](https://github.com/jetthai/cuora-module/compare/v1.1.270...v1.1.272) (2024-05-21)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.272-jackpot-1",
3
+ "version": "1.1.272-jackpot-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -93,6 +93,11 @@ export default {
93
93
  method: 'post',
94
94
  params: { transferType: 'DEPOSIT', amount, cryptoCurrency, promotionsNo },
95
95
  }),
96
+ getCryptoWithdrawExpectedResult: ({ method, amount, cryptoCurrency, promotionsNo }) => ({
97
+ url: `payment/v2/${method}/crypto/expected/result`,
98
+ method: 'post',
99
+ params: { transferType: 'WITHDRAW', amount, cryptoCurrency, promotionsNo },
100
+ }),
96
101
  getWithdrawExpectedResult: ({ method, amount, cryptoNetwork }) => ({
97
102
  url: `payment/v2/${method}/expected/result`,
98
103
  method: 'post',
@@ -158,12 +163,12 @@ export default {
158
163
  method: 'post',
159
164
  params: { transferType: 'DEPOSIT', amount, promotionsNo },
160
165
  }),
161
- submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress }) => ({
166
+ submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName }) => ({
162
167
  url: `payment/v2/${method}/transaction`,
163
168
  method: 'post',
164
- params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress },
169
+ params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName },
165
170
  }),
166
- submitWithdrawTransactionVN: ({ method, amount, applyerBankCode, applyerAccountNumber, branch, holderName }) => ({
171
+ submitWithdrawTransactionVN: ({ method, amount, applyerBankCode, applyerAccountNumber, branch, applyerHolderName }) => ({
167
172
  url: `payment/v2/${method}/transaction`,
168
173
  method: 'post',
169
174
  params: {
@@ -172,7 +177,7 @@ export default {
172
177
  applyerBankCode,
173
178
  applyerAccountNumber,
174
179
  branch,
175
- holderName,
180
+ applyerHolderName,
176
181
  },
177
182
  }),
178
183
  submitWithdrawTransactionAmb: ({ method, amount }) => ({
@@ -50,6 +50,9 @@ export default function (request, context) {
50
50
  SUBMIT: {
51
51
  target: 'submitting',
52
52
  },
53
+ SUBMIT_CRYPTO: {
54
+ target: 'submitting_crypto',
55
+ },
53
56
  },
54
57
  },
55
58
  submitting: {
@@ -71,6 +74,25 @@ export default function (request, context) {
71
74
  },
72
75
  },
73
76
  },
77
+ submitting_crypto: {
78
+ invoke: {
79
+ src: 'submitWithdrawCrypto',
80
+ onDone: [
81
+ {
82
+ target: 'otp',
83
+ actions: 'setOtp',
84
+ cond: 'isOtpRequired',
85
+ },
86
+ {
87
+ target: 'submitted',
88
+ actions: 'setProcessing',
89
+ },
90
+ ],
91
+ onError: {
92
+ target: 'calculated',
93
+ },
94
+ },
95
+ },
74
96
  submitted: {},
75
97
  otp: {
76
98
  type: 'parallel',
@@ -155,18 +177,20 @@ export default function (request, context) {
155
177
  setInitData: assign((context, event) => {
156
178
  const { currentPayment, banks, paymentInfo, withdrawRule, processing } = event.data
157
179
 
158
- const withdrawBanks = (paymentInfo?.bankInfo || [])
159
- .map((item) => {
160
- const matchedBank = banks.find((bank) => bank.bankCode === item.bankCode)
161
- return matchedBank ? { ...item, ...matchedBank } : null
162
- })
163
- .filter(Boolean)
180
+ // const withdrawBanks = (paymentInfo?.bankInfo || [])
181
+ // .map((item) => {
182
+ // const matchedBank = banks.find((bank) => bank.bankCode === item.bankCode)
183
+ // return matchedBank ? { ...item, ...matchedBank } : null
184
+ // })
185
+ // .filter(Boolean)
186
+
187
+ // const userBanks = (paymentInfo.bankList || []).map((bank) => {
188
+ // bank.displayText = `${bank.bankCode} - ${bank.accountNumber}`
189
+ // bank.imageUrl = banks.find((item) => item.bankCode === bank.bankCode)?.imageUrl
190
+ // return bank
191
+ // })
164
192
 
165
- const userBanks = (withdrawBanks || []).map((bank) => {
166
- bank.displayText = `${bank.bankCode} - ${bank.accountNumber}`
167
- bank.imageUrl = banks.find((item) => item.bankCode === bank.bankCode)?.imageUrl
168
- return bank
169
- })
193
+ const userBanks = [...paymentInfo.bankList, ...paymentInfo.cryptoList, ...paymentInfo.ewalletList]
170
194
 
171
195
  return {
172
196
  currentPayment,
@@ -238,7 +262,8 @@ export default function (request, context) {
238
262
 
239
263
  const [banks, paymentInfo, withdrawRule, orders] = await Promise.all([
240
264
  request.send(payment.getWithdrawBankList()),
241
- request.send(payment.getPaymentInfo()),
265
+ // request.send(payment.getPaymentInfo()),
266
+ request.send(payment.getBindingPaymentInfo()),
242
267
  request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
243
268
  request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
244
269
  ])
@@ -261,7 +286,21 @@ export default function (request, context) {
261
286
  applyerBankCode: selectedUserBank.bankCode,
262
287
  applyerAccountNumber: selectedUserBank.accountNumber,
263
288
  branch: branchTemp,
264
- holderName: selectedUserBank.holderName,
289
+ applyerHolderName: selectedUserBank.holderName,
290
+ })
291
+ )
292
+ },
293
+ submitWithdrawCrypto: async (context, event) => {
294
+ const { currentPayment, selectedUserBank, selectedAmount } = context
295
+ const branchTemp = ['GCASH', 'PAYM', 'PIX'].includes(selectedUserBank.bankCode) ? '' : selectedUserBank.branch
296
+ return await request.send(
297
+ payment.submitWithdrawTransactionCrypto({
298
+ method: currentPayment.method,
299
+ amount: selectedAmount,
300
+ cryptoCurrency: selectedUserBank.cryptoCurrency,
301
+ cryptoNetwork: selectedUserBank.cryptoNetwork,
302
+ targetAddress: selectedUserBank.cryptoAddress,
303
+ applyerHolderName: selectedUserBank.holderName,
265
304
  })
266
305
  )
267
306
  },