@jetthai/cuora 1.1.17 → 1.1.19

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.19](https://github.com/jetthai/cuora-module/compare/v1.1.18...v1.1.19) (2022-12-29)
6
+
7
+ ### [1.1.18](https://github.com/jetthai/cuora-module/compare/v1.1.17...v1.1.18) (2022-12-28)
8
+
5
9
  ### [1.1.17](https://github.com/jetthai/cuora-module/compare/v1.1.16...v1.1.17) (2022-12-28)
6
10
 
7
11
  ### [1.1.16](https://github.com/jetthai/cuora-module/compare/v1.1.13-4...v1.1.16) (2022-12-28)
package/dist/bundle.mjs CHANGED
@@ -3856,6 +3856,8 @@ var payment = {
3856
3856
  method: 'post',
3857
3857
  params: { promotionsNo, amount },
3858
3858
  }),
3859
+ giveUp: () => ({ url: 'payment/v2/bankWallet/promotion/giveUp', method: 'post' }),
3860
+ restore: ({ amount }) => ({ url: 'payment/v2/bankWallet/restore', method: 'post', params: { amount } }),
3859
3861
  };
3860
3862
 
3861
3863
  var user = {
@@ -14134,7 +14136,6 @@ function bank_binding_amb (request) {
14134
14136
  on: {
14135
14137
  SET_BANK_CODE: {
14136
14138
  actions: assign((context, event) => {
14137
- console.log(event.data);
14138
14139
  return {
14139
14140
  bank: event.data,
14140
14141
  }
@@ -14780,6 +14781,9 @@ function withdraw_vn (request) {
14780
14781
  bankList: [],
14781
14782
  withdrawLimit: null,
14782
14783
  targetWithdrawLimit: null,
14784
+ attachmentType: null, // 'withdraw' or 'pool'
14785
+ maximumWithdrawAmount: 0,
14786
+ enableWithdrawAmount: 0,
14783
14787
 
14784
14788
  amount: null,
14785
14789
  bank: null,
@@ -14830,17 +14834,67 @@ function withdraw_vn (request) {
14830
14834
  checking: {
14831
14835
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
14832
14836
  },
14833
- notConvertible: {},
14837
+ notConvertible: {
14838
+ on: {
14839
+ GIVE_UP: {
14840
+ target: 'givingUp',
14841
+ },
14842
+ },
14843
+ },
14844
+ givingUp: {
14845
+ invoke: {
14846
+ src: 'giveUp',
14847
+ onDone: {
14848
+ target: 'gaveUp',
14849
+ },
14850
+ onError: {
14851
+ target: 'convertible',
14852
+ },
14853
+ },
14854
+ },
14855
+ gaveUp: {},
14834
14856
  convertible: {
14835
14857
  on: {
14836
14858
  SUBMIT: {
14837
14859
  target: 'converting',
14838
14860
  },
14861
+ ATTACH: {
14862
+ target: 'attachment',
14863
+ actions: 'setAttachmentType',
14864
+ },
14865
+ },
14866
+ },
14867
+ attachment: {
14868
+ on: {
14869
+ SET_ATTACHMENT_TYPE: {
14870
+ actions: 'setAttachmentType',
14871
+ },
14872
+ SET_CURRENT_BANK: {
14873
+ actions: assign((context, event) => {
14874
+ return {
14875
+ bank: event.data,
14876
+ }
14877
+ }),
14878
+ },
14879
+ SET_AMOUNT: {
14880
+ actions: assign((context, event) => {
14881
+ return {
14882
+ amount: event.data,
14883
+ }
14884
+ }),
14885
+ },
14886
+ SUBMIT: {
14887
+ target: 'converting',
14888
+ cond: (context, event) => {
14889
+ const { enableWithdrawAmount, amount } = context;
14890
+ return +enableWithdrawAmount >= +amount
14891
+ },
14892
+ },
14839
14893
  },
14840
14894
  },
14841
14895
  converting: {
14842
14896
  invoke: {
14843
- src: 'submitWithdrawFree',
14897
+ src: 'convertFreeCredit',
14844
14898
  onDone: [
14845
14899
  {
14846
14900
  target: '#withdraw_vn.otp',
@@ -14854,7 +14908,22 @@ function withdraw_vn (request) {
14854
14908
  },
14855
14909
  },
14856
14910
  },
14857
- converted: {},
14911
+ converted: {
14912
+ always: [
14913
+ { target: '#withdraw_vn.cash.submitting', cond: 'shouldGoToWithdraw' },
14914
+ { target: 'pooling', cond: 'shouldGoToPool' },
14915
+ ],
14916
+ },
14917
+ pooling: {
14918
+ invoke: {
14919
+ src: 'pool',
14920
+ onDone: { target: 'pooled' },
14921
+ onError: {
14922
+ target: 'pooled',
14923
+ },
14924
+ },
14925
+ },
14926
+ pooled: {},
14858
14927
  },
14859
14928
  },
14860
14929
  cash: {
@@ -15010,6 +15079,7 @@ function withdraw_vn (request) {
15010
15079
  return {
15011
15080
  paymentDetail: event.data.paymentDetail,
15012
15081
  bankInfo: event.data.bankInfo,
15082
+ bank: event.data.bankInfo[0],
15013
15083
  bonus: event.data.bonus,
15014
15084
  bankList: event.data.bankList,
15015
15085
  }
@@ -15036,30 +15106,15 @@ function withdraw_vn (request) {
15036
15106
  }
15037
15107
  }),
15038
15108
  updateWithdrawCondition: assign((context, event) => {
15039
- const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0);
15040
-
15041
- const { balance, withdrawLimit } = context;
15042
- const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
15043
-
15044
- let maxWithdrawAmount = 0,
15045
- availableWithdrawAmount = 0;
15046
-
15047
- if (lastMatchedIndex > -1) {
15048
- rules[lastMatchedIndex].match = true;
15049
- maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
15050
-
15051
- if (withdrawLimit === 0) {
15052
- availableWithdrawAmount = Math.min(balance, maxWithdrawAmount);
15053
- }
15054
- } else if (rules.length > 0) {
15055
- maxWithdrawAmount = rules[0].maxWithdrawAmount;
15056
- } else {
15057
- maxWithdrawAmount = balance;
15058
- }
15109
+ const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
15110
+ event.data;
15059
15111
 
15060
15112
  return {
15061
- maxWithdrawAmount,
15062
- availableWithdrawAmount,
15113
+ // maxWithdrawAmount: maximumWithdrawAmount,
15114
+ // availableWithdrawAmount: enableWithdrawAmount,
15115
+ maximumWithdrawAmount,
15116
+ enableWithdrawAmount,
15117
+ amount: +enableWithdrawAmount,
15063
15118
  }
15064
15119
  }),
15065
15120
  setOtp: assign((context, event) => {
@@ -15085,11 +15140,22 @@ function withdraw_vn (request) {
15085
15140
  target,
15086
15141
  }
15087
15142
  }),
15143
+ setAttachmentType: assign((context, event) => {
15144
+ return {
15145
+ attachmentType: event.data,
15146
+ }
15147
+ }),
15088
15148
  },
15089
15149
  guards: {
15090
15150
  isFree: (context, event) => {
15091
15151
  return context.userInfo?.withdraw_rule !== 'DEFAULT'
15092
15152
  },
15153
+ shouldGoToWithdraw: (context, event) => {
15154
+ return context.attachmentType === 'withdraw'
15155
+ },
15156
+ shouldGoToPool: (context, event) => {
15157
+ return context.attachmentType === 'pool'
15158
+ },
15093
15159
  haveProcessing: (context, event) => {
15094
15160
  return (context.paymentDetail?.[0]?.processing || []).length > 0
15095
15161
  },
@@ -15102,8 +15168,8 @@ function withdraw_vn (request) {
15102
15168
  return !context.bankInfo?.length
15103
15169
  },
15104
15170
  isSubmittable: (context, event) => {
15105
- const { applyerBankCode, applyerAccountNumber, branch, holderName, amount } = event.data;
15106
- return applyerBankCode && applyerAccountNumber && branch && holderName && amount
15171
+ const { bank, amount } = context;
15172
+ return bank && amount
15107
15173
  },
15108
15174
  isConvertible: (context, event) => {
15109
15175
  const { balance, withdrawLimit } = context;
@@ -15154,14 +15220,21 @@ function withdraw_vn (request) {
15154
15220
  return await request.send(payment.getCurrentWithdrawRule())
15155
15221
  },
15156
15222
  submitWithdraw: async (context, event) => {
15157
- const { amount, applyerBankCode, applyerAccountNumber, branch, holderName } = event.data;
15223
+ const { bank, amount } = context;
15158
15224
  const { method } = context.paymentDetail[0];
15159
- const branchTemp = branch === 'BLANK' ? '' : branch;
15225
+ const branchTemp = bank.bankCode === 'GCASH' ? '' : bank.branch;
15160
15226
  return await request.send(
15161
- payment.submitWithdrawTransactionVN({ method, amount, applyerBankCode, applyerAccountNumber, branch: branchTemp, holderName })
15227
+ payment.submitWithdrawTransactionVN({
15228
+ method,
15229
+ amount,
15230
+ applyerBankCode: bank.bankCode,
15231
+ applyerAccountNumber: bank.accountNumber,
15232
+ branch: branchTemp,
15233
+ holderName: bank.holderName,
15234
+ })
15162
15235
  )
15163
15236
  },
15164
- submitWithdrawFree: async (context, event) => {
15237
+ convertFreeCredit: async (context, event) => {
15165
15238
  return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
15166
15239
  },
15167
15240
  resetOtp: async (context, event) => {
@@ -15173,6 +15246,13 @@ function withdraw_vn (request) {
15173
15246
  const code = event.data;
15174
15247
  return await request.send(user.otpAcknowledge({ requestId, target, code }))
15175
15248
  },
15249
+ pool: async (context, event) => {
15250
+ const { amount } = context;
15251
+ return await request.send(payment.restore({ amount }))
15252
+ },
15253
+ giveUp: async (context, event) => {
15254
+ return await request.send(payment.giveUp())
15255
+ },
15176
15256
  },
15177
15257
  }
15178
15258
  )
@@ -15678,20 +15758,20 @@ function withdraw_amb (request) {
15678
15758
  always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
15679
15759
  },
15680
15760
  free: {
15681
- initial: 'loading',
15761
+ initial: 'checking',
15682
15762
  states: {
15683
- loading: {
15684
- invoke: {
15685
- src: 'fetchWithdrawRules',
15686
- onDone: {
15687
- target: 'checking',
15688
- actions: 'updateWithdrawCondition',
15689
- },
15690
- onError: {
15691
- target: 'notConvertible',
15692
- },
15693
- },
15694
- },
15763
+ // loading: {
15764
+ // invoke: {
15765
+ // src: 'fetchWithdrawRules',
15766
+ // onDone: {
15767
+ // target: 'checking',
15768
+ // actions: 'updateWithdrawCondition',
15769
+ // },
15770
+ // onError: {
15771
+ // target: 'notConvertible',
15772
+ // },
15773
+ // },
15774
+ // },
15695
15775
  checking: {
15696
15776
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
15697
15777
  },
@@ -20190,7 +20270,14 @@ function promotions (request) {
20190
20270
  minimumAmount: 0,
20191
20271
  turnoverLimitMultiple: 1,
20192
20272
  promotionDetail: [],
20193
- withdrawLimitDetail: [],
20273
+ withdrawLimitDetail: [
20274
+ {
20275
+ greaterEqualThen: 0,
20276
+ lessEqualThen: -1,
20277
+ maxWithdrawAmount: -1,
20278
+ turnoverLimitMultiple: 1,
20279
+ },
20280
+ ],
20194
20281
  limitGameDetail: [],
20195
20282
  },
20196
20283
  turnoverLimitStatus: '',
@@ -20270,10 +20357,9 @@ function promotions (request) {
20270
20357
  {
20271
20358
  actions: {
20272
20359
  setInitData: assign((context, event) => {
20273
- const { promotionsList } = event.data;
20274
20360
  const { noBonus } = context;
20275
20361
  return {
20276
- promotionsList,
20362
+ promotionsList: event.data,
20277
20363
  selectedPromo: noBonus,
20278
20364
  }
20279
20365
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.17",
3
+ "version": "1.1.19",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -125,4 +125,6 @@ export default {
125
125
  method: 'post',
126
126
  params: { promotionsNo, amount },
127
127
  }),
128
+ giveUp: () => ({ url: 'payment/v2/bankWallet/promotion/giveUp', method: 'post' }),
129
+ restore: ({ amount }) => ({ url: 'payment/v2/bankWallet/restore', method: 'post', params: { amount } }),
128
130
  }
@@ -34,7 +34,6 @@ export default function (request) {
34
34
  on: {
35
35
  SET_BANK_CODE: {
36
36
  actions: assign((context, event) => {
37
- console.log(event.data)
38
37
  return {
39
38
  bank: event.data,
40
39
  }
@@ -20,7 +20,14 @@ export default function (request) {
20
20
  minimumAmount: 0,
21
21
  turnoverLimitMultiple: 1,
22
22
  promotionDetail: [],
23
- withdrawLimitDetail: [],
23
+ withdrawLimitDetail: [
24
+ {
25
+ greaterEqualThen: 0,
26
+ lessEqualThen: -1,
27
+ maxWithdrawAmount: -1,
28
+ turnoverLimitMultiple: 1,
29
+ },
30
+ ],
24
31
  limitGameDetail: [],
25
32
  },
26
33
  turnoverLimitStatus: '',
@@ -100,10 +107,9 @@ export default function (request) {
100
107
  {
101
108
  actions: {
102
109
  setInitData: assign((context, event) => {
103
- const { promotionsList } = event.data
104
110
  const { noBonus } = context
105
111
  return {
106
- promotionsList,
112
+ promotionsList: event.data,
107
113
  selectedPromo: noBonus,
108
114
  }
109
115
  }),
@@ -49,20 +49,20 @@ export default function (request) {
49
49
  always: [{ target: 'free', cond: 'isFree' }, { target: 'cash' }],
50
50
  },
51
51
  free: {
52
- initial: 'loading',
52
+ initial: 'checking',
53
53
  states: {
54
- loading: {
55
- invoke: {
56
- src: 'fetchWithdrawRules',
57
- onDone: {
58
- target: 'checking',
59
- actions: 'updateWithdrawCondition',
60
- },
61
- onError: {
62
- target: 'notConvertible',
63
- },
64
- },
65
- },
54
+ // loading: {
55
+ // invoke: {
56
+ // src: 'fetchWithdrawRules',
57
+ // onDone: {
58
+ // target: 'checking',
59
+ // actions: 'updateWithdrawCondition',
60
+ // },
61
+ // onError: {
62
+ // target: 'notConvertible',
63
+ // },
64
+ // },
65
+ // },
66
66
  checking: {
67
67
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
68
68
  },
@@ -23,6 +23,9 @@ export default function (request) {
23
23
  bankList: [],
24
24
  withdrawLimit: null,
25
25
  targetWithdrawLimit: null,
26
+ attachmentType: null, // 'withdraw' or 'pool'
27
+ maximumWithdrawAmount: 0,
28
+ enableWithdrawAmount: 0,
26
29
 
27
30
  amount: null,
28
31
  bank: null,
@@ -73,17 +76,67 @@ export default function (request) {
73
76
  checking: {
74
77
  always: [{ target: 'convertible', cond: 'isConvertible' }, { target: 'notConvertible' }],
75
78
  },
76
- notConvertible: {},
79
+ notConvertible: {
80
+ on: {
81
+ GIVE_UP: {
82
+ target: 'givingUp',
83
+ },
84
+ },
85
+ },
86
+ givingUp: {
87
+ invoke: {
88
+ src: 'giveUp',
89
+ onDone: {
90
+ target: 'gaveUp',
91
+ },
92
+ onError: {
93
+ target: 'convertible',
94
+ },
95
+ },
96
+ },
97
+ gaveUp: {},
77
98
  convertible: {
78
99
  on: {
79
100
  SUBMIT: {
80
101
  target: 'converting',
81
102
  },
103
+ ATTACH: {
104
+ target: 'attachment',
105
+ actions: 'setAttachmentType',
106
+ },
107
+ },
108
+ },
109
+ attachment: {
110
+ on: {
111
+ SET_ATTACHMENT_TYPE: {
112
+ actions: 'setAttachmentType',
113
+ },
114
+ SET_CURRENT_BANK: {
115
+ actions: assign((context, event) => {
116
+ return {
117
+ bank: event.data,
118
+ }
119
+ }),
120
+ },
121
+ SET_AMOUNT: {
122
+ actions: assign((context, event) => {
123
+ return {
124
+ amount: event.data,
125
+ }
126
+ }),
127
+ },
128
+ SUBMIT: {
129
+ target: 'converting',
130
+ cond: (context, event) => {
131
+ const { enableWithdrawAmount, amount } = context
132
+ return +enableWithdrawAmount >= +amount
133
+ },
134
+ },
82
135
  },
83
136
  },
84
137
  converting: {
85
138
  invoke: {
86
- src: 'submitWithdrawFree',
139
+ src: 'convertFreeCredit',
87
140
  onDone: [
88
141
  {
89
142
  target: '#withdraw_vn.otp',
@@ -97,7 +150,22 @@ export default function (request) {
97
150
  },
98
151
  },
99
152
  },
100
- converted: {},
153
+ converted: {
154
+ always: [
155
+ { target: '#withdraw_vn.cash.submitting', cond: 'shouldGoToWithdraw' },
156
+ { target: 'pooling', cond: 'shouldGoToPool' },
157
+ ],
158
+ },
159
+ pooling: {
160
+ invoke: {
161
+ src: 'pool',
162
+ onDone: { target: 'pooled' },
163
+ onError: {
164
+ target: 'pooled',
165
+ },
166
+ },
167
+ },
168
+ pooled: {},
101
169
  },
102
170
  },
103
171
  cash: {
@@ -253,6 +321,7 @@ export default function (request) {
253
321
  return {
254
322
  paymentDetail: event.data.paymentDetail,
255
323
  bankInfo: event.data.bankInfo,
324
+ bank: event.data.bankInfo[0],
256
325
  bonus: event.data.bonus,
257
326
  bankList: event.data.bankList,
258
327
  }
@@ -279,30 +348,15 @@ export default function (request) {
279
348
  }
280
349
  }),
281
350
  updateWithdrawCondition: assign((context, event) => {
282
- const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
283
-
284
- const { balance, withdrawLimit } = context
285
- const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
286
-
287
- let maxWithdrawAmount = 0,
288
- availableWithdrawAmount = 0
289
-
290
- if (lastMatchedIndex > -1) {
291
- rules[lastMatchedIndex].match = true
292
- maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
293
-
294
- if (withdrawLimit === 0) {
295
- availableWithdrawAmount = Math.min(balance, maxWithdrawAmount)
296
- }
297
- } else if (rules.length > 0) {
298
- maxWithdrawAmount = rules[0].maxWithdrawAmount
299
- } else {
300
- maxWithdrawAmount = balance
301
- }
351
+ const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
352
+ event.data
302
353
 
303
354
  return {
304
- maxWithdrawAmount,
305
- availableWithdrawAmount,
355
+ // maxWithdrawAmount: maximumWithdrawAmount,
356
+ // availableWithdrawAmount: enableWithdrawAmount,
357
+ maximumWithdrawAmount,
358
+ enableWithdrawAmount,
359
+ amount: +enableWithdrawAmount,
306
360
  }
307
361
  }),
308
362
  setOtp: assign((context, event) => {
@@ -328,11 +382,22 @@ export default function (request) {
328
382
  target,
329
383
  }
330
384
  }),
385
+ setAttachmentType: assign((context, event) => {
386
+ return {
387
+ attachmentType: event.data,
388
+ }
389
+ }),
331
390
  },
332
391
  guards: {
333
392
  isFree: (context, event) => {
334
393
  return context.userInfo?.withdraw_rule !== 'DEFAULT'
335
394
  },
395
+ shouldGoToWithdraw: (context, event) => {
396
+ return context.attachmentType === 'withdraw'
397
+ },
398
+ shouldGoToPool: (context, event) => {
399
+ return context.attachmentType === 'pool'
400
+ },
336
401
  haveProcessing: (context, event) => {
337
402
  return (context.paymentDetail?.[0]?.processing || []).length > 0
338
403
  },
@@ -345,8 +410,8 @@ export default function (request) {
345
410
  return !context.bankInfo?.length
346
411
  },
347
412
  isSubmittable: (context, event) => {
348
- const { applyerBankCode, applyerAccountNumber, branch, holderName, amount } = event.data
349
- return applyerBankCode && applyerAccountNumber && branch && holderName && amount
413
+ const { bank, amount } = context
414
+ return bank && amount
350
415
  },
351
416
  isConvertible: (context, event) => {
352
417
  const { balance, withdrawLimit } = context
@@ -397,14 +462,21 @@ export default function (request) {
397
462
  return await request.send(payment.getCurrentWithdrawRule())
398
463
  },
399
464
  submitWithdraw: async (context, event) => {
400
- const { amount, applyerBankCode, applyerAccountNumber, branch, holderName } = event.data
465
+ const { bank, amount } = context
401
466
  const { method } = context.paymentDetail[0]
402
- const branchTemp = branch === 'BLANK' ? '' : branch
467
+ const branchTemp = bank.bankCode === 'GCASH' ? '' : bank.branch
403
468
  return await request.send(
404
- payment.submitWithdrawTransactionVN({ method, amount, applyerBankCode, applyerAccountNumber, branch: branchTemp, holderName })
469
+ payment.submitWithdrawTransactionVN({
470
+ method,
471
+ amount,
472
+ applyerBankCode: bank.bankCode,
473
+ applyerAccountNumber: bank.accountNumber,
474
+ branch: branchTemp,
475
+ holderName: bank.holderName,
476
+ })
405
477
  )
406
478
  },
407
- submitWithdrawFree: async (context, event) => {
479
+ convertFreeCredit: async (context, event) => {
408
480
  return await request.send(payment.convertFreeCredit({ exchangeType: 1 }))
409
481
  },
410
482
  resetOtp: async (context, event) => {
@@ -416,6 +488,13 @@ export default function (request) {
416
488
  const code = event.data
417
489
  return await request.send(user.otpAcknowledge({ requestId, target, code }))
418
490
  },
491
+ pool: async (context, event) => {
492
+ const { amount } = context
493
+ return await request.send(payment.restore({ amount }))
494
+ },
495
+ giveUp: async (context, event) => {
496
+ return await request.send(payment.giveUp())
497
+ },
419
498
  },
420
499
  }
421
500
  )