@jetthai/cuora 1.1.418 → 1.1.420

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.420](https://github.com/jetthai/cuora-module/compare/v1.1.419...v1.1.420) (2026-03-10)
6
+
7
+ ### [1.1.419](https://github.com/jetthai/cuora-module/compare/v1.1.418...v1.1.419) (2026-03-09)
8
+
5
9
  ### [1.1.418](https://github.com/jetthai/cuora-module/compare/v1.1.417...v1.1.418) (2026-03-06)
6
10
 
7
11
  ### [1.1.417](https://github.com/jetthai/cuora-module/compare/v1.1.416...v1.1.417) (2026-03-06)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.418",
3
+ "version": "1.1.420",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -7,7 +7,7 @@ export default {
7
7
  params: { ...payload },
8
8
  }),
9
9
  getTransactionHistoryOptions: () => ({ url: 'payment/v2/category/options', method: 'get' }),
10
- getPaymentInfo: () => ({ url: `payment/v2/paymentInfo`, method: 'get' }),
10
+ getPaymentInfo: () => ({ url: `payment/v2/paymentInfo`, method: 'get' }), // 棄用
11
11
  getBindingPaymentInfo: () => ({ url: `payment/v2/getBindingPaymentInfo`, method: 'get' }),
12
12
  updatePaymentInfo: ({
13
13
  bankCode,
@@ -176,12 +176,12 @@ export default {
176
176
  params: { transferType: 'DEPOSIT', amount, promotionsNo },
177
177
  }),
178
178
  submitWithdrawTransactionCrypto: ({ method, amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName }) => ({
179
- url: `payment/v2/${method}/transaction`,
179
+ url: `/payment/v2/${method}/withdraw-otp/verify`,
180
180
  method: 'post',
181
181
  params: { transferType: 'WITHDRAW', amount, cryptoCurrency, cryptoNetwork, targetAddress, applyerHolderName },
182
182
  }),
183
183
  submitWithdrawTransactionVN: ({ method, amount, applyerBankCode, applyerAccountNumber, applyerIfscCode, branch, applyerHolderName }) => ({
184
- url: `payment/v2/${method}/transaction`,
184
+ url: `/payment/v2/${method}/withdraw-otp/verify`,
185
185
  method: 'post',
186
186
  params: {
187
187
  transferType: 'WITHDRAW',
@@ -205,7 +205,7 @@ export default {
205
205
  cryptoNetwork,
206
206
  targetAddress,
207
207
  }) => ({
208
- url: `payment/v2/${method}/transaction`,
208
+ url: `payment/v2/${method}/withdraw-otp/verify`,
209
209
  method: 'post',
210
210
  params: {
211
211
  transferType: 'WITHDRAW',
@@ -247,4 +247,16 @@ export default {
247
247
  withdrawCheck: () => ({ url: `payment/v2/withdrawCheck`, method: 'post' }),
248
248
  updateUtr: ({ applyId, utr }) => ({ url: 'payment/v2/updateUtr', method: 'post', params: { applyId, utr } }),
249
249
  uploadCommonSlip: ({ applyId, slip }) => ({ url: 'payment/v2/uploadCommonSlip', method: 'post', params: { applyId, slip } }),
250
+ otpAcknowledge: ({ method, requestId, code }) => ({
251
+ url: `/payment/v2/${method}/withdraw-otp/acknowledge`,
252
+ method: 'post',
253
+ params: { requestId, code },
254
+ isPublic: true,
255
+ }),
256
+ otpReset: ({ method, requestId }) => ({
257
+ url: `/payment/v2/${method}/withdraw-otp/reset-otp`,
258
+ method: 'post',
259
+ params: { requestId },
260
+ isPublic: true,
261
+ }),
250
262
  }
@@ -231,7 +231,7 @@ export default function (request) {
231
231
  fetchInitData: async (context, event) => {
232
232
  const [paymentList, paymentInfo] = await Promise.all([
233
233
  request.send(payment.getBindingPaymentList({ appSecret })),
234
- request.send(payment.getPaymentInfo()),
234
+ // request.send(payment.getPaymentInfo()),
235
235
  ])
236
236
  return { paymentList, paymentInfo }
237
237
  },
@@ -258,7 +258,7 @@ export default function (request) {
258
258
  ifscCode,
259
259
  bankCode: bank?.bankCode || '',
260
260
  cryptoCurrency: crypto?.symbol || '',
261
- cryptoNetwork: network?.label || '',
261
+ cryptoNetwork: network?.networkCode,
262
262
  cryptoAddress: cryptoAddress,
263
263
  walletCode: walletCode?.bankCode || '',
264
264
  branch: branch === 'BLANK' ? '' : branch, // 'BLANK'會置換成空值
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine } from 'xstate'
2
3
  import payment from '../api/payment.js'
3
4
 
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine, send } from 'xstate'
2
3
  import payment from '../api/payment.js'
3
4
 
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine } from 'xstate'
2
3
  import payment from '../../api/payment.js'
3
4
 
@@ -286,7 +286,7 @@ export default function (request, context) {
286
286
  method: selectedCrypto.value,
287
287
  amount: selectedAmount,
288
288
  cryptoCurrency: selectedCrypto.symbol,
289
- cryptoNetwork: selectedCrypto.network,
289
+ cryptoNetwork: selectedCrypto.networkCode,
290
290
  sourceAddress: selectedCrypto.address,
291
291
  promotionsNo: promotion?.promotionsNo,
292
292
  depositTime,
@@ -132,10 +132,11 @@ export default function (request, context) {
132
132
  const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
133
133
  const cryptos = payments.map((payment) => ({
134
134
  ...payment,
135
- label: payment.cryptoOptional?.[0],
136
- network: payment.networkName?.[0],
135
+ label: `${payment?.currency} - ${payment.networks?.[0]?.networkDisplayName}`,
136
+ // network: payment.networkName?.[0], // 改由 networkCode 取代
137
137
  value: payment.method,
138
138
  icon: payment.channel,
139
+ networkCode: payment.networks?.[0]?.networkCode,
139
140
  }))
140
141
 
141
142
  return {
@@ -245,7 +246,7 @@ export default function (request, context) {
245
246
  method: selectedCrypto.method,
246
247
  amount: selectedAmount,
247
248
  cryptoCurrency: selectedCrypto.channel,
248
- cryptoNetwork: selectedCrypto.network,
249
+ cryptoNetwork: selectedCrypto.networkCode,
249
250
  sourceAddress: sourceAddress,
250
251
  promotionsNo: promotion?.promotionsNo,
251
252
  })
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine } from 'xstate'
2
3
  import toNumber from 'lodash/toNumber.js'
3
4
  import payment from '../../api/payment.js'
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine } from 'xstate'
2
3
  import payment from '../../api/payment.js'
3
4
  import common from '../../api/common.js'
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine } from 'xstate'
2
3
  import payment from '../../api/payment.js'
3
4
  import common from '../../api/common.js'
@@ -1,3 +1,4 @@
1
+ // 棄用
1
2
  import { assign, createMachine } from 'xstate'
2
3
  import findLastIndex from 'lodash/findLastIndex.js'
3
4
  import payment from '../../api/payment.js'
@@ -1,7 +1,6 @@
1
1
  import { assign, createMachine } from 'xstate'
2
2
  import findLastIndex from 'lodash/findLastIndex.js'
3
3
  import payment from '../../api/payment.js'
4
- import user from '../../api/user.js'
5
4
 
6
5
  export default function (request) {
7
6
  const { appSecret } = request.config
@@ -36,8 +35,8 @@ export default function (request) {
36
35
 
37
36
  // otp
38
37
  requestId: null,
39
- status: null,
40
- target: null,
38
+ number: null,
39
+ email: null,
41
40
  ttl: null,
42
41
  },
43
42
  states: {
@@ -356,26 +355,27 @@ export default function (request) {
356
355
  return { paymentDetail }
357
356
  }),
358
357
  setOtp: assign((context, event) => {
359
- const { requestId, status, target, ttl } = event.data
358
+ const { request_id, number, email, ttl } = event.data
360
359
  return {
361
- requestId,
362
- status,
363
- target,
360
+ requestId: request_id,
361
+ number,
362
+ email,
364
363
  ttl,
365
364
  }
366
365
  }),
367
366
  decreaseTtl: assign((context, evnet) => {
368
367
  const second = context.ttl
369
368
  return {
370
- ttl: Math.max(second - 1, 0),
369
+ ttl: Math.max(second - 1000, 0),
371
370
  }
372
371
  }),
373
372
  setVerificationData: assign((context, event) => {
374
- const { requestId, ttl, target } = event.data
373
+ const { request_id, number, email, ttl } = event.data
375
374
  return {
376
- requestId,
375
+ requestId: request_id,
376
+ number,
377
+ email,
377
378
  ttl,
378
- target,
379
379
  }
380
380
  }),
381
381
  setAttachmentType: assign((context, event) => {
@@ -439,7 +439,8 @@ export default function (request) {
439
439
  return !enableWithdraw || balance < minWithdrawAmount
440
440
  },
441
441
  isOtpRequired: (context, event) => {
442
- return event.data?.status === 'otp-verifying'
442
+ const { request_id, number, email } = event.data || {}
443
+ return request_id !== undefined && (number || email)
443
444
  },
444
445
  isNotWithdrawMinDepositAmount: (context, event) => {
445
446
  const { withdrawCheck } = context
@@ -509,13 +510,15 @@ export default function (request) {
509
510
  return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
510
511
  },
511
512
  resetOtp: async (context, event) => {
512
- const { requestId, target } = context
513
- return await request.send(user.otpReset({ requestId, target }))
513
+ const { requestId } = context
514
+ const { method } = context.paymentDetail[0]
515
+ return await request.send(payment.otpReset({ method: method, requestId }))
514
516
  },
515
517
  acknowledge: async (context, event) => {
516
- const { requestId, target } = context
518
+ const { requestId } = context
519
+ const { method } = context.paymentDetail[0]
517
520
  const code = event.data
518
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
521
+ return await request.send(payment.otpAcknowledge({ method: method, requestId, code }))
519
522
  },
520
523
  pool: async (context, event) => {
521
524
  const { amount } = context
@@ -23,6 +23,8 @@ export default function (request, context) {
23
23
  requestId: null,
24
24
  status: null,
25
25
  target: null,
26
+ email: null,
27
+ number: null,
26
28
  ttl: null,
27
29
  },
28
30
  states: {
@@ -117,29 +119,18 @@ export default function (request, context) {
117
119
  RESET_OTP: {
118
120
  target: 'reset',
119
121
  },
120
- BACK: [
121
- // {
122
- // target: '#withdraw_vn2.activity.convertible',
123
- // cond: 'isActivity',
124
- // },
125
- // {
126
- // target: '#withdraw_vn2.cash.withdrawable',
127
- // },
128
- ],
122
+ BACK: {
123
+ target: '#withdraw_manual_cash.calculated',
124
+ },
129
125
  },
130
126
  },
131
127
  acknowledging: {
132
128
  invoke: {
133
129
  src: 'acknowledge',
134
- onDone: [
135
- // {
136
- // target: '#withdraw_vn2.activity.converted',
137
- // cond: 'isActivity',
138
- // },
139
- // {
140
- // target: '#withdraw_vn2.cash.submitted',
141
- // },
142
- ],
130
+ onDone: {
131
+ target: '#withdraw_manual_cash.submitted',
132
+ actions: 'setProcessing',
133
+ },
143
134
  onError: {
144
135
  target: 'idle',
145
136
  },
@@ -203,26 +194,27 @@ export default function (request, context) {
203
194
  }
204
195
  }),
205
196
  setOtp: assign((context, event) => {
206
- const { requestId, status, target, ttl } = event.data
197
+ const { request_id, email, number, ttl } = event.data
207
198
  return {
208
- requestId,
209
- status,
210
- target,
199
+ requestId: request_id,
200
+ email,
201
+ number,
211
202
  ttl,
212
203
  }
213
204
  }),
214
205
  decreaseTtl: assign((context, evnet) => {
215
206
  const second = context.ttl
216
207
  return {
217
- ttl: Math.max(second - 1, 0),
208
+ ttl: Math.max(second - 1000, 0),
218
209
  }
219
210
  }),
220
211
  setVerificationData: assign((context, event) => {
221
- const { requestId, ttl, target } = event.data
212
+ const { request_id, ttl, number, email } = event.data
222
213
  return {
223
- requestId,
214
+ requestId: request_id,
224
215
  ttl,
225
- target,
216
+ number,
217
+ email,
226
218
  }
227
219
  }),
228
220
  },
@@ -238,7 +230,7 @@ export default function (request, context) {
238
230
  return selectedUserBank && selectedAmount > 0 && currentPayment.minimum <= selectedAmount && selectedAmount <= currentPayment.maximum
239
231
  },
240
232
  isOtpRequired: (context, event) => {
241
- return event.data?.status === 'otp-verifying'
233
+ return event.data?.request_id !== undefined
242
234
  },
243
235
  },
244
236
  services: {
@@ -282,20 +274,20 @@ export default function (request, context) {
282
274
  method: currentPayment.method,
283
275
  amount: selectedAmount,
284
276
  cryptoCurrency: selectedUserBank.cryptoCurrency,
285
- cryptoNetwork: selectedUserBank.cryptoNetwork,
277
+ cryptoNetwork: selectedUserBank.networkCode,
286
278
  targetAddress: selectedUserBank.cryptoAddress,
287
279
  applyerHolderName: selectedUserBank.holderName,
288
280
  })
289
281
  )
290
282
  },
291
283
  resetOtp: async (context, event) => {
292
- const { requestId, target } = context
293
- return await request.send(user.otpReset({ requestId, target }))
284
+ const { currentPayment, requestId } = context
285
+ return await request.send(payment.otpReset({ method: currentPayment.method, requestId }))
294
286
  },
295
287
  acknowledge: async (context, event) => {
296
- const { requestId, target } = context
288
+ const { currentPayment, requestId } = context
297
289
  const code = event.data
298
- return await request.send(user.otpAcknowledge({ requestId, target, code }))
290
+ return await request.send(payment.otpAcknowledge({ method: currentPayment.method, requestId, code }))
299
291
  },
300
292
  },
301
293
  }