@jetthai/cuora 1.1.127 → 1.1.128-dev-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.
Files changed (70) hide show
  1. package/CHANGELOG.md +426 -0
  2. package/package.json +1 -1
  3. package/src/api/activity.js +28 -0
  4. package/src/api/auth.js +6 -0
  5. package/src/api/common.js +2 -1
  6. package/src/api/game.js +5 -4
  7. package/src/api/mailbox.js +9 -5
  8. package/src/api/payment.js +103 -8
  9. package/src/api/user.js +2 -0
  10. package/src/machine/activity/activity.js +56 -16
  11. package/src/machine/activity/activity_cash.js +78 -14
  12. package/src/machine/activity/cash_rain_activity.js +153 -0
  13. package/src/machine/activity/diamond_shop_activity_cash.js +57 -92
  14. package/src/machine/activity/diamond_shop_activity_vn.js +54 -89
  15. package/src/machine/activity/fafafa_activity.js +8 -1
  16. package/src/machine/activity/friend_invite_friends_activity.js +3 -1
  17. package/src/machine/activity/index.js +6 -0
  18. package/src/machine/activity/instant_rebate_activity.js +214 -0
  19. package/src/machine/activity/roulette_activity_v2.js +11 -2
  20. package/src/machine/activity/sign_in_activity.js +20 -13
  21. package/src/machine/activity/vip_card_activity.js +140 -0
  22. package/src/machine/auth.js +54 -5
  23. package/src/machine/bank_binding.js +112 -12
  24. package/src/machine/bank_binding_amb.js +6 -1
  25. package/src/machine/common.js +92 -24
  26. package/src/machine/deposit/amb.js +5 -3
  27. package/src/machine/deposit/crypto.js +14 -10
  28. package/src/machine/deposit/crypto_bank.js +317 -0
  29. package/src/machine/deposit/crypto_bank_cash.js +280 -0
  30. package/src/machine/deposit/crypto_button.js +9 -5
  31. package/src/machine/deposit/crypto_cash.js +2 -5
  32. package/src/machine/deposit/crypto_qrcode.js +147 -0
  33. package/src/machine/deposit/crypto_qrcode_cash.js +131 -0
  34. package/src/machine/deposit/crypto_way.js +220 -0
  35. package/src/machine/deposit/crypto_way_cash.js +242 -0
  36. package/src/machine/deposit/direct.js +2 -11
  37. package/src/machine/deposit/direct_cash.js +6 -26
  38. package/src/machine/deposit/float.js +5 -3
  39. package/src/machine/deposit/index.js +14 -0
  40. package/src/machine/deposit/krway.js +151 -0
  41. package/src/machine/deposit/loadcard_cash.js +6 -27
  42. package/src/machine/deposit/loadcard_vn.js +2 -10
  43. package/src/machine/deposit/manual_cash.js +89 -38
  44. package/src/machine/deposit/manual_vn.js +104 -48
  45. package/src/machine/deposit/qrcode_cash.js +12 -23
  46. package/src/machine/deposit/qrcode_v2.js +3 -8
  47. package/src/machine/deposit/usdt_cash.js +0 -2
  48. package/src/machine/deposit/vpay.js +5 -3
  49. package/src/machine/game_info.js +57 -0
  50. package/src/machine/game_search_cash.js +137 -12
  51. package/src/machine/game_search_v2.js +4 -4
  52. package/src/machine/game_v2_1.js +131 -7
  53. package/src/machine/honor_board_cash.js +63 -0
  54. package/src/machine/inbox.js +259 -34
  55. package/src/machine/index.js +6 -0
  56. package/src/machine/leaderboard.js +31 -8
  57. package/src/machine/reward_cash.js +1 -1
  58. package/src/machine/side_v2.js +1 -1
  59. package/src/machine/user_photo.js +65 -0
  60. package/src/machine/user_sign_up.js +71 -7
  61. package/src/machine/withdraw/index.js +6 -0
  62. package/src/machine/withdraw/withdraw_crypto.js +1 -66
  63. package/src/machine/withdraw/withdraw_crypto2.js +540 -0
  64. package/src/machine/withdraw/withdraw_krway.js +207 -0
  65. package/src/machine/withdraw/withdraw_manual.js +595 -0
  66. package/src/machine/withdraw/withdraw_manual_cash.js +44 -14
  67. package/src/machine/withdraw/withdraw_vn.js +42 -7
  68. package/src/machine/withdraw/withdraw_vn2.js +64 -37
  69. package/src/util/constant.js +18 -0
  70. package/src/util/deviceToken.js +2 -2
@@ -0,0 +1,242 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import payment from '@jetthai/cuora/src/api/payment.js'
3
+ import { max } from '../../util/index.js'
4
+
5
+ export default function (request, context) {
6
+ const { paymentDetail = [], promotion, selectedAmount } = context || {}
7
+ return createMachine(
8
+ {
9
+ id: 'crypto_way_cash',
10
+ initial: 'loading',
11
+ context: {
12
+ paymentDetail,
13
+ promotion,
14
+ selectedAmount,
15
+
16
+ cryptos: [],
17
+ sourceAddress: '',
18
+ options: [],
19
+
20
+ selectedCrypto: null,
21
+
22
+ currentCategory: 'cryptoWay',
23
+
24
+ calculation: null,
25
+ result: null,
26
+ ttl: 0,
27
+ },
28
+ states: {
29
+ loading: {
30
+ always: [
31
+ {
32
+ target: 'debouncing',
33
+ actions: 'setInitData',
34
+ },
35
+ ],
36
+ },
37
+ loaded: {},
38
+ debouncing: {
39
+ entry: 'clearCalculation',
40
+ after: {
41
+ 1000: [
42
+ {
43
+ target: 'calculating',
44
+ cond: 'isCalculable',
45
+ },
46
+ {
47
+ target: 'loaded',
48
+ },
49
+ ],
50
+ },
51
+ },
52
+ calculating: {
53
+ invoke: {
54
+ src: 'fetchCalculation',
55
+ onDone: {
56
+ target: 'calculated',
57
+ actions: 'setCalculation',
58
+ },
59
+ onError: {
60
+ target: 'calculated',
61
+ },
62
+ },
63
+ },
64
+ calculated: {
65
+ on: {
66
+ SUBMIT: [
67
+ {
68
+ target: 'submitting',
69
+ cond: 'isSubmittable',
70
+ },
71
+ ],
72
+ },
73
+ },
74
+ submitting: {
75
+ invoke: {
76
+ src: 'submitDeposit',
77
+ onDone: {
78
+ target: 'submitted',
79
+ actions: ['setResult', 'setTtl'],
80
+ },
81
+ onError: {
82
+ target: 'calculated',
83
+ },
84
+ },
85
+ },
86
+ submitted: {
87
+ after: {
88
+ 1000: {
89
+ target: 'submitted',
90
+ actions: 'decreaseTtl',
91
+ cond: (context) => context.ttl > 0,
92
+ },
93
+ },
94
+ },
95
+ },
96
+ on: {
97
+ SET_PROMOTION: {
98
+ target: '.debouncing',
99
+ actions: 'setPromotion',
100
+ internal: false,
101
+ },
102
+ SET_CRYPTO: {
103
+ target: '.debouncing',
104
+ actions: 'setCrypto',
105
+ internal: false,
106
+ },
107
+ SET_ADDRESS: {
108
+ actions: 'setAddress',
109
+ internal: false,
110
+ },
111
+ SET_AMOUNT: {
112
+ target: '.debouncing',
113
+ actions: 'setAmount',
114
+ internal: false,
115
+ },
116
+ INPUT_AMOUNT: {
117
+ target: '.debouncing',
118
+ actions: 'inputAmount',
119
+ internal: false,
120
+ },
121
+ },
122
+ },
123
+ {
124
+ actions: {
125
+ setInitData: assign((context, event) => {
126
+ const { paymentDetail } = context
127
+ const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
128
+ const cryptos = payments.map((payment) => ({
129
+ ...payment,
130
+ label: payment.cryptoOptional?.[0],
131
+ network: payment.networkName?.[0],
132
+ value: payment.method,
133
+ icon: payment.channel,
134
+ }))
135
+
136
+ return {
137
+ cryptos,
138
+ selectedCrypto: cryptos[0],
139
+ options: cryptos[0].optional,
140
+ }
141
+ }),
142
+ setCrypto: assign((context, event) => {
143
+ const { cryptos } = context
144
+ const selectedCrypto = cryptos.find((crypto) => crypto.label === event.data.label)
145
+ return {
146
+ selectedCrypto: selectedCrypto,
147
+ selectedAmount: null,
148
+ calculation: null,
149
+ options: selectedCrypto.optional,
150
+ }
151
+ }),
152
+ setAmount: assign((context, event) => {
153
+ // 現金網可自由填額度,grandTotalEnable 欄位感覺不再需要?
154
+ if (context.selectedCrypto?.grandTotalEnable === 1) {
155
+ return { selectedAmount: parseFloat(context.selectedAmount || 0) + parseFloat(event.data) }
156
+ } else {
157
+ return { selectedAmount: event.data }
158
+ }
159
+ }),
160
+ inputAmount: assign((context, event) => {
161
+ return { selectedAmount: event.data }
162
+ }),
163
+ setAddress: assign((context, event) => {
164
+ return {
165
+ sourceAddress: event.data,
166
+ }
167
+ }),
168
+ setCalculation: assign((context, event) => {
169
+ return {
170
+ calculation: event.data,
171
+ }
172
+ }),
173
+ clearCalculation: assign((context, event) => {
174
+ return {
175
+ calculation: null,
176
+ }
177
+ }),
178
+ setResult: assign((context, event) => {
179
+ return {
180
+ result: event.data,
181
+ }
182
+ }),
183
+ setPromotion: assign((context, event) => {
184
+ const { selectedCrypto, selectedAmount } = context
185
+ const promotion = event.data
186
+ return {
187
+ promotion,
188
+ selectedAmount: max(promotion.minimumAmount, selectedCrypto.minimum, selectedAmount, 0),
189
+ calculation: null,
190
+ }
191
+ }),
192
+ setTtl: assign((context, event) => {
193
+ const { cdtime } = event.data
194
+ return {
195
+ ttl: cdtime,
196
+ }
197
+ }),
198
+ decreaseTtl: assign((context, evnet) => {
199
+ return {
200
+ ttl: Math.max(context.ttl - 1000, 0),
201
+ }
202
+ }),
203
+ },
204
+ guards: {
205
+ isCalculable: (context, event) => {
206
+ const { selectedCrypto, selectedAmount } = context
207
+ return selectedCrypto && selectedAmount && selectedCrypto.minimum <= +selectedAmount && +selectedAmount <= selectedCrypto.maximum
208
+ },
209
+ isSubmittable: (context, event) => {
210
+ const { selectedCrypto, selectedAmount, calculation } = context
211
+ return selectedCrypto && selectedAmount && calculation
212
+ },
213
+ },
214
+ services: {
215
+ fetchCalculation: async (context, event) => {
216
+ const { selectedCrypto, selectedAmount, promotion } = context
217
+ return await request.send(
218
+ payment.getCryptoDepositExpectedResult({
219
+ method: selectedCrypto.method,
220
+ amount: selectedAmount,
221
+ cryptoCurrency: selectedCrypto.channel,
222
+ promotionsNo: promotion?.promotionsNo,
223
+ })
224
+ )
225
+ },
226
+ submitDeposit: async (context, event) => {
227
+ const { selectedCrypto, selectedAmount, sourceAddress, promotion } = context
228
+ return await request.send(
229
+ payment.submitDepositTransactionCrypto({
230
+ method: selectedCrypto.method,
231
+ amount: selectedAmount,
232
+ cryptoCurrency: selectedCrypto.channel,
233
+ cryptoNetwork: selectedCrypto.network,
234
+ sourceAddress: sourceAddress,
235
+ promotionsNo: promotion?.promotionsNo,
236
+ })
237
+ )
238
+ },
239
+ },
240
+ }
241
+ )
242
+ }
@@ -182,19 +182,13 @@ export default function (request) {
182
182
  amount: null,
183
183
  selectedBank: banks[0],
184
184
  calculation: null,
185
+ result: null,
185
186
  }
186
187
  }),
187
188
  setInitData: assign((context, event) => {
188
189
  const { siteConfig, paymentDetail } = event.data
189
190
  const directs = paymentDetail.filter((element) => element.category === context.currentCategory)
190
- let currentDirect = null
191
- let currentMethod = null
192
- if (siteConfig.walletMode === '4') {
193
- currentDirect = directs.find((direct) => parseFloat(`${direct.charge || 0}`) === 0)
194
- } else {
195
- currentDirect = directs[0]
196
- }
197
-
191
+ const currentDirect = directs[0]
198
192
  return {
199
193
  siteConfig,
200
194
  paymentDetail,
@@ -205,7 +199,6 @@ export default function (request) {
205
199
  }),
206
200
  setBanks: assign((context, event) => {
207
201
  const banks = event.data
208
-
209
202
  return {
210
203
  banks,
211
204
  selectedBank: banks[0],
@@ -262,7 +255,6 @@ export default function (request) {
262
255
  amount,
263
256
  currentDirect: { maximum, minimum },
264
257
  } = context
265
-
266
258
  return amount && minimum <= +amount && +amount <= maximum
267
259
  },
268
260
  isSubmittable: (context, event) => {
@@ -289,7 +281,6 @@ export default function (request) {
289
281
  },
290
282
  fetchCalculation: async (context, event) => {
291
283
  const { currentMethod, amount, promotion } = context
292
-
293
284
  return await request.send(
294
285
  payment.getDepositExpectedResult({
295
286
  method: currentMethod,
@@ -76,7 +76,7 @@ export default function (request, context) {
76
76
  actions: 'setResult',
77
77
  },
78
78
  onError: {
79
- target: 'calculated',
79
+ target: 'loaded',
80
80
  },
81
81
  },
82
82
  },
@@ -90,7 +90,7 @@ export default function (request, context) {
90
90
  internal: false,
91
91
  },
92
92
  SELECT_DIRECT: {
93
- target: '.debouncing',
93
+ target: '.loading',
94
94
  actions: 'setDirect',
95
95
  internal: false,
96
96
  },
@@ -107,24 +107,10 @@ export default function (request, context) {
107
107
  },
108
108
  {
109
109
  actions: {
110
- reset: assign((context, event) => {
111
- const { userBanks } = context
112
- return {
113
- selectedAmount: null,
114
- selectedUserBank: userBanks[0],
115
- calculation: null,
116
- }
117
- }),
118
110
  setInitData: assign((context, event) => {
119
111
  const { paymentDetail, selectedAmount, promotion } = context
120
- const directs = paymentDetail
121
- .filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
122
- .map((direct) => {
123
- direct.disabled = promotion?.promotionsNo !== 'none' && direct.charge > 0
124
- return direct
125
- })
126
- const selectedDirect = context.selectedDirect || directs.find((direct) => !direct.disabled)
127
-
112
+ const directs = paymentDetail.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
113
+ const selectedDirect = context.selectedDirect || directs[0]
128
114
  return {
129
115
  directs,
130
116
  selectedDirect,
@@ -184,7 +170,6 @@ export default function (request, context) {
184
170
  selectedAmount,
185
171
  selectedDirect: { maximum, minimum },
186
172
  } = context
187
-
188
173
  return selectedAmount && minimum <= +selectedAmount && +selectedAmount <= maximum
189
174
  },
190
175
  isSubmittable: (context, event) => {
@@ -193,10 +178,6 @@ export default function (request, context) {
193
178
  },
194
179
  },
195
180
  services: {
196
- fetchInitData: async (context, event) => {
197
- const [paymentDetail = []] = await Promise.all([request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))])
198
- return { paymentDetail }
199
- },
200
181
  fetchBanksList: async (context, event) => {
201
182
  const { selectedDirect, bankMap } = context
202
183
  const method = selectedDirect?.method
@@ -211,12 +192,11 @@ export default function (request, context) {
211
192
  },
212
193
  fetchCalculation: async (context, event) => {
213
194
  const { selectedDirect, selectedAmount, promotion } = context
214
-
215
195
  return await request.send(
216
196
  payment.getDepositExpectedResult({
217
197
  method: selectedDirect.method,
218
198
  amount: selectedAmount,
219
- promotionsNo: promotion?.activityNo,
199
+ promotionsNo: promotion?.promotionsNo,
220
200
  })
221
201
  )
222
202
  },
@@ -227,7 +207,7 @@ export default function (request, context) {
227
207
  method: selectedDirect.method,
228
208
  amount: selectedAmount,
229
209
  applyerBankCode: selectedUserBank.bankCode,
230
- promotionsNo: promotion?.activityNo,
210
+ promotionsNo: promotion?.promotionsNo,
231
211
  })
232
212
  )
233
213
  },
@@ -245,7 +245,7 @@ export default function (request) {
245
245
  actions: {
246
246
  setUserAccount: assign((context, event) => {
247
247
  return {
248
- userAccount: event.data.bankInfo?.[0],
248
+ userAccount: event.data?.[0],
249
249
  }
250
250
  }),
251
251
  setPromotion: assign((context, event) => {
@@ -310,7 +310,7 @@ export default function (request) {
310
310
  },
311
311
  guards: {
312
312
  hasUserAccount: (context, event) => {
313
- return event.data.bankInfo?.[0]
313
+ return event.data?.[0]
314
314
  },
315
315
  isGrandTotalEnable: (context, event) => {
316
316
  return context.grandTotalEnable === 1
@@ -318,7 +318,9 @@ export default function (request) {
318
318
  },
319
319
  services: {
320
320
  fetchPaymentInfo: async (context, event) => {
321
- return await request.send(payment.getPaymentInfo())
321
+ const { bankInfo } = await request.send(payment.getPaymentInfo())
322
+ const filterArray = bankInfo?.filter((item) => item.bindingType !== 'CRYPTO' && item.bindingType !== 'EWALLET')
323
+ return filterArray || []
322
324
  },
323
325
  initialize: async (context, event) => {
324
326
  const [{ config }, payments, bankList] = await Promise.all([
@@ -8,6 +8,7 @@ import direct from './direct.js'
8
8
  import amb from './amb.js'
9
9
  import float from './float.js'
10
10
  import vpay from './vpay.js'
11
+ import krway from './krway.js'
11
12
  import usdt from './usdt.js'
12
13
  import manual_cash from './manual_cash.js'
13
14
  import qrcode_cash from './qrcode_cash.js'
@@ -15,6 +16,12 @@ import usdt_cash from './usdt_cash.js'
15
16
  import crypto_cash from './crypto_cash.js'
16
17
  import direct_cash from './direct_cash.js'
17
18
  import loadcard_cash from './loadcard_cash.js'
19
+ import crypto_bank from './crypto_bank.js'
20
+ import crypto_qrcode from './crypto_qrcode.js'
21
+ import crypto_way from './crypto_way.js'
22
+ import crypto_bank_cash from './crypto_bank_cash.js'
23
+ import crypto_qrcode_cash from './crypto_qrcode_cash.js'
24
+ import crypto_way_cash from './crypto_way_cash.js'
18
25
 
19
26
  export default {
20
27
  manual_vn,
@@ -28,10 +35,17 @@ export default {
28
35
  float,
29
36
  vpay,
30
37
  usdt,
38
+ krway,
31
39
  manual_cash,
32
40
  qrcode_cash,
33
41
  usdt_cash,
34
42
  crypto_cash,
35
43
  direct_cash,
36
44
  loadcard_cash,
45
+ crypto_bank,
46
+ crypto_qrcode,
47
+ crypto_way,
48
+ crypto_bank_cash,
49
+ crypto_qrcode_cash,
50
+ crypto_way_cash,
37
51
  }
@@ -0,0 +1,151 @@
1
+ import { assign, createMachine } from 'xstate'
2
+ import payment from '../../api/payment.js'
3
+ import mailbox from '../../api/mailbox.js'
4
+
5
+ export default function (request) {
6
+ return createMachine(
7
+ {
8
+ id: 'krway',
9
+ initial: 'loading',
10
+ context: {
11
+ currentCategory: 'krway',
12
+ paymentDetail: [],
13
+ currentPayment: null,
14
+ options: [],
15
+ amount: null,
16
+ processing: null,
17
+ },
18
+ states: {
19
+ loading: {
20
+ invoke: {
21
+ src: 'fetchPaymentDetail',
22
+ onDone: {
23
+ target: 'checking',
24
+ actions: 'setPaymentDetail',
25
+ },
26
+ onError: {
27
+ target: 'fail',
28
+ },
29
+ },
30
+ },
31
+ checking: {
32
+ always: [
33
+ {
34
+ target: 'processing',
35
+ cond: 'isProcessing',
36
+ },
37
+ {
38
+ target: 'idle',
39
+ },
40
+ ],
41
+ },
42
+ processing: {},
43
+ idle: {},
44
+ inquiring: {
45
+ invoke: {
46
+ src: 'accountInquiry',
47
+ onDone: {
48
+ target: 'inquired',
49
+ },
50
+ onError: {
51
+ target: 'idle',
52
+ },
53
+ },
54
+ },
55
+ inquired: {
56
+ after: {
57
+ 0: {
58
+ target: 'idle',
59
+ },
60
+ },
61
+ },
62
+ submitting: {
63
+ invoke: {
64
+ src: 'submitDeposit',
65
+ onDone: {
66
+ target: 'submitted',
67
+ actions: 'setProcessing',
68
+ },
69
+ onError: {
70
+ target: 'fail',
71
+ },
72
+ },
73
+ },
74
+ submitted: {},
75
+ fail: {},
76
+ },
77
+ on: {
78
+ INQUIRY_ACCOUNT: {
79
+ target: 'inquiring',
80
+ },
81
+ ADD_AMOUNT: {
82
+ actions: 'addAmount',
83
+ },
84
+ SET_AMOUNT: {
85
+ actions: 'setAmount',
86
+ },
87
+ CLEAR_AMOUNT: {
88
+ actions: 'clearAmount',
89
+ },
90
+ SUBMIT: {
91
+ target: 'submitting',
92
+ },
93
+ },
94
+ },
95
+ {
96
+ actions: {
97
+ setPaymentDetail: assign((context, event) => {
98
+ const paymentDetail = event.data
99
+ const payments = paymentDetail.filter((item) => item.category === context.currentCategory)
100
+ const currentPayment = payments[0]
101
+ const options = currentPayment.optional || []
102
+
103
+ return {
104
+ currentPayment,
105
+ options,
106
+ processing: currentPayment.processing?.[0],
107
+ }
108
+ }),
109
+ addAmount: assign((context, event) => {
110
+ return {
111
+ amount: parseFloat(`${context.amount || 0}`) + parseFloat(`${event.data}`),
112
+ }
113
+ }),
114
+ setAmount: assign((context, event) => {
115
+ return { amount: parseFloat(`${event.data}`) }
116
+ }),
117
+ clearAmount: assign((context, event) => {
118
+ return { amount: null }
119
+ }),
120
+ setProcessing: assign((context, event) => {
121
+ return {
122
+ processing: event.data,
123
+ }
124
+ }),
125
+ },
126
+ guards: {
127
+ isProcessing: (context, event) => {
128
+ return context.processing
129
+ },
130
+ },
131
+ services: {
132
+ fetchPaymentDetail: async (context, event) => {
133
+ return await request.send(payment.getPaymentDetail({ transferType: 'DEPOSIT' }))
134
+ },
135
+ accountInquiry: async (context, event) => {
136
+ const { from, title, content } = event.data
137
+ return await request.send(mailbox.sendMessage({ type: 'CUSTOMER', category: 'DEPOSIT', from, to: 'SYSTEM', title, content }))
138
+ },
139
+ submitDeposit: async (context, event) => {
140
+ const { currentPayment, amount } = context
141
+ return await request.send(
142
+ payment.submitDepositTransaction({
143
+ method: currentPayment.method,
144
+ amount,
145
+ })
146
+ )
147
+ },
148
+ },
149
+ }
150
+ )
151
+ }
@@ -85,7 +85,7 @@ export default function (request, context) {
85
85
  actions: 'setResult',
86
86
  },
87
87
  onError: {
88
- target: 'calculated',
88
+ target: 'loaded',
89
89
  },
90
90
  },
91
91
  },
@@ -113,15 +113,8 @@ export default function (request, context) {
113
113
  actions: {
114
114
  setInitData: assign((context, event) => {
115
115
  const { paymentDetail, selectedAmount, promotion } = context
116
- const loadcards = paymentDetail
117
- .filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
118
- .map((item) => {
119
- item.disabled = promotion?.promotionsNo !== 'none' && item.charge > 0
120
- return item
121
- })
122
-
123
- const selectedLoadcard = loadcards.find((item) => !item.disabled)
124
-
116
+ const loadcards = paymentDetail.filter((element) => element.category === context.currentCategory && element.transferType === 'deposit')
117
+ const selectedLoadcard = loadcards[0]
125
118
  return {
126
119
  paymentDetail,
127
120
  loadcards,
@@ -133,13 +126,8 @@ export default function (request, context) {
133
126
  setPromotion: assign((context, event) => {
134
127
  const { selectedAmount } = context
135
128
  const promotion = event.data
136
- const loadcards = context.loadcards.map((item) => {
137
- item.disabled = promotion.promotionsNo !== 'none' && item.charge > 0
138
- return item
139
- })
140
-
141
- const selectedLoadcard = loadcards.find((item) => !item.disabled)
142
-
129
+ const loadcards = context.loadcards
130
+ const selectedLoadcard = loadcards[0]
143
131
  return {
144
132
  promotion,
145
133
  loadcards,
@@ -188,16 +176,7 @@ export default function (request, context) {
188
176
  }
189
177
  }),
190
178
  },
191
- guards: {
192
- isSubmittable: (context, event) => {
193
- const { cardNumber, serialNumber } = context
194
- return cardNumber && serialNumber
195
- },
196
- jumpLinkEnable: (context, event) => {
197
- const { selectedCard } = context
198
- return selectedCard.jumpLinkEnable === 1
199
- },
200
- },
179
+ guards: {},
201
180
  services: {
202
181
  fetchCalculation: async (context, event) => {
203
182
  const { selectedLoadcard, selectedAmount, promotion } = context
@@ -261,18 +261,13 @@ export default function (request) {
261
261
  cardNumber: null,
262
262
  serialNumber: null,
263
263
  calculation: null,
264
+ result: null,
264
265
  }
265
266
  }),
266
267
  setInitData: assign((context, event) => {
267
268
  const { siteConfig, paymentDetail } = event.data
268
269
  const cards = paymentDetail.filter((element) => element.category === context.currentCategory)
269
- let selectedCard = null
270
- if (siteConfig.walletMode === '4') {
271
- selectedCard = cards.find((card) => parseFloat(`${card.charge || 0}`) === 0)
272
- } else {
273
- selectedCard = cards[0]
274
- }
275
-
270
+ const selectedCard = cards[0]
276
271
  return {
277
272
  siteConfig,
278
273
  paymentDetail,
@@ -333,9 +328,6 @@ export default function (request) {
333
328
  isFreeWalletMode: (context, event) => {
334
329
  return context.siteConfig?.walletMode === '2'
335
330
  },
336
- isDoubleWalletMode: (context, event) => {
337
- return context.siteConfig?.walletMode === '4'
338
- },
339
331
  isSubmittable: (context, event) => {
340
332
  const { cardNumber, serialNumber } = context
341
333
  return cardNumber && serialNumber