@jetthai/cuora 1.1.161 → 1.1.162-bindingBank-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,12 @@
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.162-bindingBank-2](https://github.com/jetthai/cuora-module/compare/v1.1.162-bindingBank-1...v1.1.162-bindingBank-2) (2023-08-22)
6
+
7
+ ### [1.1.162-bindingBank-1](https://github.com/jetthai/cuora-module/compare/v1.1.162...v1.1.162-bindingBank-1) (2023-08-22)
8
+
9
+ ### [1.1.162](https://github.com/jetthai/cuora-module/compare/v1.1.161...v1.1.162) (2023-08-16)
10
+
5
11
  ### [1.1.161](https://github.com/jetthai/cuora-module/compare/v1.1.160...v1.1.161) (2023-08-11)
6
12
 
7
13
  ### [1.1.160](https://github.com/jetthai/cuora-module/compare/v1.1.159...v1.1.160) (2023-08-10)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.161",
3
+ "version": "1.1.162-bindingBank-2",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -27,6 +27,8 @@ export default {
27
27
  },
28
28
  }),
29
29
  getBankList: (paymentMethod) => ({ url: `payment/v2/${paymentMethod}/getBankList`, method: 'get' }),
30
+ getBindingBankList: () => ({ url: 'payment/v2/getBindingBankList', method: 'get' }),
31
+ getWithdrawBankList: () => ({ url: 'payment/v2/getWithdrawBankList', method: 'get' }),
30
32
  makeTransaction: ({ type, payload, paymentMethod }) => ({
31
33
  url: `payment/v2/${paymentMethod}/transaction`,
32
34
  method: 'post',
@@ -170,6 +170,8 @@ export default function (request) {
170
170
  return { activityList: data, promotionList }
171
171
  },
172
172
  fetchActivitiesDetail: async (context, event) => {
173
+ await new Promise((resolve) => setTimeout(resolve, 1000)) // delay 1 second
174
+
173
175
  const { activityList = [], specifyActivities = [] } = context
174
176
  const filterActivityList = activityList.filter((activity) => specifyActivities.includes(activity.activityType))
175
177
  const promiseArray = filterActivityList.map((item) => {
@@ -98,9 +98,7 @@ export default function (request) {
98
98
  },
99
99
  services: {
100
100
  fetchInitData: async (context, event) => {
101
- const paymentDetail = await request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' }))
102
- const method = paymentDetail.find((payment) => payment.category === 'manual').method
103
- const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBankList(method)), request.send(payment.getPaymentInfo())])
101
+ const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBindingBankList()), request.send(payment.getPaymentInfo())])
104
102
  return { bankList, paymentInfo }
105
103
  },
106
104
  updatePaymentInfo: async (context, event) => {
@@ -116,7 +116,7 @@ export default function (request) {
116
116
  },
117
117
  services: {
118
118
  fetchInitData: async (context, event) => {
119
- const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBankList('amb')), request.send(payment.getPaymentInfo())])
119
+ const [bankList, paymentInfo] = await Promise.all([request.send(payment.getBindingBankList()), request.send(payment.getPaymentInfo())])
120
120
  return { bankList, paymentInfo }
121
121
  },
122
122
  updatePaymentInfo: async (context, event) => {
@@ -155,7 +155,14 @@ export default function (request, context) {
155
155
  setInitData: assign((context, event) => {
156
156
  const { currentPayment, banks, paymentInfo, withdrawRule, processing } = event.data
157
157
 
158
- const userBanks = (paymentInfo?.bankInfo || []).map((bank) => {
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)
164
+
165
+ const userBanks = (withdrawBanks || []).map((bank) => {
159
166
  bank.displayText = `${bank.bankCode} ${bank.accountNumber.slice(-5)}`
160
167
  bank.imageUrl = banks.find((item) => item.bankCode === bank.bankCode)?.imageUrl
161
168
  return bank
@@ -230,7 +237,7 @@ export default function (request, context) {
230
237
  const currentPayment = context.paymentDetail.find((element) => element.category === 'manual' && element.transferType === 'withdraw')
231
238
 
232
239
  const [banks, paymentInfo, withdrawRule, orders] = await Promise.all([
233
- request.send(payment.getBankList(currentPayment.method)),
240
+ request.send(payment.getWithdrawBankList()),
234
241
  request.send(payment.getPaymentInfo()),
235
242
  request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
236
243
  request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
@@ -432,11 +432,13 @@ export default function (request) {
432
432
  request.send(payment.getCurrentWithdrawRule()),
433
433
  ])
434
434
  const siteConfig = JSON.parse(window.atob(config))
435
- const method = paymentDetail.find((payment) => payment.category === 'manual').method
436
- const bankList = await request.send(payment.getBankList(method))
437
- const newBankInfo = bankInfo.map((item) => {
438
- return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
439
- })
435
+ const bankList = await request.send(payment.getWithdrawBankList())
436
+ const newBankInfo = bankInfo
437
+ .map((item) => {
438
+ const matchedBank = bankList.find((bank) => bank.bankCode === item.bankCode)
439
+ return matchedBank ? { ...item, ...matchedBank } : null
440
+ })
441
+ .filter(Boolean)
440
442
  return { siteConfig, userInfo, paymentDetail, bonus, bankInfo: newBankInfo, bankList, withdrawRule }
441
443
  },
442
444
  fetchPaymentData: async (context, event) => {
@@ -453,11 +453,13 @@ export default function (request) {
453
453
  request.send(payment.getPaymentDetail({ transferType: 'WITHDRAW' })),
454
454
  request.send(payment.getPaymentInfo()),
455
455
  ])
456
- const method = paymentDetail.find((payment) => payment.category === 'manual').method
457
- const bankList = await request.send(payment.getBankList(method))
458
- const newBankInfo = bankInfo.map((item) => {
459
- return { ...item, ...bankList.find((bank) => bank.bankCode === item.bankCode) }
460
- })
456
+ const bankList = await request.send(payment.getWithdrawBankList())
457
+ const newBankInfo = bankInfo
458
+ .map((item) => {
459
+ const matchedBank = bankList.find((bank) => bank.bankCode === item.bankCode)
460
+ return matchedBank ? { ...item, ...matchedBank } : null
461
+ })
462
+ .filter(Boolean)
461
463
  return { paymentDetail, bonus, bankInfo: newBankInfo, bankList }
462
464
  },
463
465
  fetchPaymentData: async (context, event) => {