@jetthai/cuora 1.1.101 → 1.1.103

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.103](https://github.com/jetthai/cuora-module/compare/v1.1.102...v1.1.103) (2023-05-23)
6
+
7
+ ### [1.1.102](https://github.com/jetthai/cuora-module/compare/v1.1.101...v1.1.102) (2023-05-23)
8
+
5
9
  ### [1.1.101](https://github.com/jetthai/cuora-module/compare/v1.1.100...v1.1.101) (2023-05-22)
6
10
 
7
11
  ### [1.1.100](https://github.com/jetthai/cuora-module/compare/v1.1.99...v1.1.100) (2023-05-22)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.101",
3
+ "version": "1.1.103",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -146,4 +146,5 @@ export default {
146
146
  method: 'post',
147
147
  params: { promotionsNo },
148
148
  }),
149
+ getPendingOrder: ({ transferType }) => ({ url: 'payment/v2/pendingOrder', method: 'post', params: { transferType } }),
149
150
  }
@@ -43,9 +43,8 @@ export default function (request, context) {
43
43
  },
44
44
  },
45
45
  loaded: {
46
- always: [{ target: 'limitDepositedUser', cond: 'isDepositedUser' }, { target: 'awardable', cond: 'isAwardable' }, { target: 'awarded' }],
46
+ always: [{ target: 'awardable', cond: 'isAwardable' }, { target: 'awarded' }],
47
47
  },
48
- limitDepositedUser: {},
49
48
  awardable: {
50
49
  entry: 'setDuration',
51
50
  on: {
@@ -139,10 +138,6 @@ export default function (request, context) {
139
138
  }),
140
139
  },
141
140
  guards: {
142
- isDepositedUser: (context, event) => {
143
- const { userType = 0, receiveStatus = 0 } = context.activityDetail
144
- return userType === 1 && receiveStatus === 0
145
- },
146
141
  isAwardable: (context, event) => {
147
142
  return context.activityDetail?.receiveStatus === 2
148
143
  },
@@ -129,7 +129,7 @@ export default function (request, context) {
129
129
  {
130
130
  actions: {
131
131
  setInitData: assign((context, event) => {
132
- const { currentPayment, banks, paymentInfo } = event.data
132
+ const { currentPayment, banks, paymentInfo, processing } = event.data
133
133
  const playerBanks = paymentInfo?.bankInfo || []
134
134
 
135
135
  const houseBanks = currentPayment.banks.map((bank) => {
@@ -149,7 +149,7 @@ export default function (request, context) {
149
149
  return {
150
150
  currentPayment,
151
151
  method: currentPayment.method,
152
- processing: currentPayment.processing?.[0],
152
+ processing,
153
153
  houseBanks,
154
154
  selectedHouseBank: houseBanks[0],
155
155
  userBanks,
@@ -248,15 +248,17 @@ export default function (request, context) {
248
248
  (element) => element.category === context.currentCategory && element.transferType === 'deposit'
249
249
  )
250
250
 
251
- const [banks, paymentInfo] = await Promise.all([
251
+ const [banks, paymentInfo, orders] = await Promise.all([
252
252
  request.send(payment.getBankList(currentPayment.method)),
253
253
  request.send(payment.getPaymentInfo()),
254
+ request.send(payment.getPendingOrder({ transferType: 'DEPOSIT' })),
254
255
  ])
255
256
 
256
257
  return {
257
258
  currentPayment,
258
259
  banks,
259
260
  paymentInfo,
261
+ processing: orders[0],
260
262
  }
261
263
  },
262
264
  fetchCalculation: async (context, event) => {
@@ -29,10 +29,10 @@ export default function (request, context) {
29
29
  states: {
30
30
  loading: {
31
31
  invoke: {
32
- src: 'fetchWithdrawRule',
32
+ src: 'fetchInitData',
33
33
  onDone: {
34
34
  target: 'checking',
35
- actions: ['setWithdrawRule', 'setInitData'],
35
+ actions: 'setInitData',
36
36
  },
37
37
  onError: {
38
38
  target: 'loaded',
@@ -169,6 +169,7 @@ export default function (request, context) {
169
169
  {
170
170
  actions: {
171
171
  setInitData: assign((context, event) => {
172
+ const { withdrawRule, processing } = event.data
172
173
  const { paymentDetail } = context
173
174
  const selectedCrypto = paymentDetail.find((item) => item.transferType === 'withdraw' && item.category === 'crypto')
174
175
  const networks = (selectedCrypto?.networkName || []).map((value, i) => {
@@ -179,18 +180,12 @@ export default function (request, context) {
179
180
  }
180
181
  })
181
182
 
182
- console.log('paymentDetail', selectedCrypto.processing)
183
-
184
183
  return {
184
+ withdrawRule,
185
185
  selectedCrypto,
186
186
  networks,
187
187
  selectedNetwork: networks[0],
188
- processing: selectedCrypto.processing?.[0],
189
- }
190
- }),
191
- setWithdrawRule: assign((context, event) => {
192
- return {
193
- withdrawRule: event.data,
188
+ processing,
194
189
  }
195
190
  }),
196
191
  setNetwork: assign((context, event) => {
@@ -272,6 +267,17 @@ export default function (request, context) {
272
267
  },
273
268
  },
274
269
  services: {
270
+ fetchInitData: async (context, event) => {
271
+ const [withdrawRule, orders] = await Promise.all([
272
+ request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
273
+ request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
274
+ ])
275
+
276
+ return {
277
+ withdrawRule,
278
+ processing: orders[0],
279
+ }
280
+ },
275
281
  fetchWithdrawRule: async (context, event) => {
276
282
  return await request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' }))
277
283
  },
@@ -139,6 +139,7 @@ export default function (request, context) {
139
139
  },
140
140
  },
141
141
  on: {
142
+ REFRESH: { target: 'loading', internal: false, cond: 'hasNoBank' },
142
143
  SET_AMOUNT: {
143
144
  target: 'debouncing',
144
145
  actions: 'setAmount',
@@ -152,7 +153,7 @@ export default function (request, context) {
152
153
  {
153
154
  actions: {
154
155
  setInitData: assign((context, event) => {
155
- const { currentPayment, banks, paymentInfo, withdrawRule } = event.data
156
+ const { currentPayment, banks, paymentInfo, withdrawRule, processing } = event.data
156
157
 
157
158
  const userBanks = (paymentInfo?.bankInfo || []).map((bank) => {
158
159
  bank.displayText = `${bank.bankCode} ${bank.accountNumber.slice(-5)}`
@@ -162,7 +163,7 @@ export default function (request, context) {
162
163
 
163
164
  return {
164
165
  currentPayment,
165
- processing: currentPayment.processing?.[0],
166
+ processing,
166
167
  banks,
167
168
  paymentInfo,
168
169
  withdrawRule,
@@ -210,6 +211,9 @@ export default function (request, context) {
210
211
  }),
211
212
  },
212
213
  guards: {
214
+ hasNoBank: (context, event) => {
215
+ return !context.userBanks.length
216
+ },
213
217
  isProcessing: (context, event) => {
214
218
  return context.processing
215
219
  },
@@ -225,10 +229,11 @@ export default function (request, context) {
225
229
  fetchInitData: async (context, event) => {
226
230
  const currentPayment = context.paymentDetail.find((element) => element.category === 'manual' && element.transferType === 'withdraw')
227
231
 
228
- const [banks, paymentInfo, withdrawRule] = await Promise.all([
232
+ const [banks, paymentInfo, withdrawRule, orders] = await Promise.all([
229
233
  request.send(payment.getBankList(currentPayment.method)),
230
234
  request.send(payment.getPaymentInfo()),
231
235
  request.send(payment.getDoubleWalletWithdrawRule({ walletType: 'CASH' })),
236
+ request.send(payment.getPendingOrder({ transferType: 'WITHDRAW' })),
232
237
  ])
233
238
 
234
239
  return {
@@ -236,6 +241,7 @@ export default function (request, context) {
236
241
  banks,
237
242
  paymentInfo,
238
243
  withdrawRule,
244
+ processing: orders[0],
239
245
  }
240
246
  },
241
247
  submitWithdraw: async (context, event) => {