@jetthai/cuora 1.1.43 → 1.1.45-1

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.45-1](https://github.com/jetthai/cuora-module/compare/v1.1.45...v1.1.45-1) (2023-02-08)
6
+
7
+ ### [1.1.45](https://github.com/jetthai/cuora-module/compare/v1.1.44...v1.1.45) (2023-02-03)
8
+
9
+ ### [1.1.44](https://github.com/jetthai/cuora-module/compare/v1.1.43...v1.1.44) (2023-01-20)
10
+
5
11
  ### [1.1.43](https://github.com/jetthai/cuora-module/compare/v1.1.42...v1.1.43) (2023-01-20)
6
12
 
7
13
  ### [1.1.42](https://github.com/jetthai/cuora-module/compare/v1.1.41...v1.1.42) (2023-01-19)
package/dist/bundle.mjs CHANGED
@@ -13750,7 +13750,7 @@ function user_sign_up (request) {
13750
13750
  }
13751
13751
  }),
13752
13752
  setRegistrationData: assign((context, event) => {
13753
- const { account, currency, site, strategy, uid } = event.data;
13753
+ const { account, currency, site, strategy, uid, channel, sub_channel } = event.data;
13754
13754
  return {
13755
13755
  registrationData: {
13756
13756
  account,
@@ -13758,6 +13758,8 @@ function user_sign_up (request) {
13758
13758
  site,
13759
13759
  strategy,
13760
13760
  uid,
13761
+ channel,
13762
+ sub_channel,
13761
13763
  },
13762
13764
  }
13763
13765
  }),
@@ -14829,6 +14831,7 @@ function withdraw_vn (request) {
14829
14831
  maximumWithdrawAmount: 0,
14830
14832
  enableWithdrawAmount: 0,
14831
14833
  enableWithdraw: false,
14834
+ withdrawRules: [],
14832
14835
 
14833
14836
  amount: null,
14834
14837
  bank: null,
@@ -14836,9 +14839,6 @@ function withdraw_vn (request) {
14836
14839
  accountNumber: null,
14837
14840
  holderName: null,
14838
14841
 
14839
- withdrawDistance: null,
14840
- withdrawAmount: null,
14841
-
14842
14842
  // otp
14843
14843
  requestId: null,
14844
14844
  status: null,
@@ -15318,6 +15318,7 @@ function withdraw_crypto (request) {
15318
15318
  maxWithdrawAmount: null,
15319
15319
  availableWithdrawAmount: null,
15320
15320
  enableWithdraw: false,
15321
+ withdrawRules: [],
15321
15322
 
15322
15323
  attachmentType: null, // null | 'withdraw' | 'pool'
15323
15324
 
@@ -15640,13 +15641,28 @@ function withdraw_crypto (request) {
15640
15641
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
15641
15642
  event.data?.withdrawRule;
15642
15643
 
15644
+ const withdrawRules = event.data?.withdrawRule?.rules || [];
15645
+ const rules = withdrawRules.filter((rule) => rule.maxWithdrawAmount > 0);
15646
+
15647
+ const { balance } = context;
15648
+ const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
15649
+
15650
+ let maxWithdrawAmount = 0;
15651
+
15652
+ if (lastMatchedIndex > -1) {
15653
+ rules[lastMatchedIndex].match = true;
15654
+ maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
15655
+ } else if (rules.length > 0) {
15656
+ maxWithdrawAmount = rules[0].maxWithdrawAmount;
15657
+ } else {
15658
+ maxWithdrawAmount = balance;
15659
+ }
15660
+
15643
15661
  return {
15644
- // maxWithdrawAmount: maximumWithdrawAmount,
15645
- // availableWithdrawAmount: enableWithdrawAmount,
15646
- maximumWithdrawAmount: +maximumWithdrawAmount,
15662
+ maxWithdrawAmount,
15647
15663
  enableWithdrawAmount: +enableWithdrawAmount,
15648
- amount: +enableWithdrawAmount,
15649
15664
  enableWithdraw,
15665
+ withdrawRules,
15650
15666
  }
15651
15667
 
15652
15668
  // const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
@@ -16558,7 +16574,7 @@ function manual_vn (request) {
16558
16574
  payment.getDepositExpectedResult({
16559
16575
  method,
16560
16576
  amount,
16561
- promotionsNo: promotion.activityNo,
16577
+ promotionsNo: promotion?.activityNo,
16562
16578
  })
16563
16579
  )
16564
16580
  },
@@ -16575,7 +16591,7 @@ function manual_vn (request) {
16575
16591
  applyerHolderName: userAccountName,
16576
16592
  depositTime,
16577
16593
  receipt,
16578
- promotionsNo: promotion.activityNo,
16594
+ promotionsNo: promotion?.activityNo,
16579
16595
  })
16580
16596
  )
16581
16597
  },
@@ -17391,7 +17407,7 @@ function qrcode_v2 (request) {
17391
17407
  payment.getDepositExpectedResult({
17392
17408
  method: currentMethod,
17393
17409
  amount: selectedAmount,
17394
- promotionsNo: promotion.activityNo,
17410
+ promotionsNo: promotion?.activityNo,
17395
17411
  })
17396
17412
  )
17397
17413
  },
@@ -17401,7 +17417,7 @@ function qrcode_v2 (request) {
17401
17417
  payment.submitDepositTransaction({
17402
17418
  method: currentMethod,
17403
17419
  amount: selectedAmount,
17404
- promotionsNo: promotion.activityNo,
17420
+ promotionsNo: promotion?.activityNo,
17405
17421
  })
17406
17422
  )
17407
17423
  },
@@ -18947,7 +18963,7 @@ function direct (request) {
18947
18963
  payment.getDepositExpectedResult({
18948
18964
  method: currentMethod,
18949
18965
  amount,
18950
- promotionsNo: promotion.activityNo,
18966
+ promotionsNo: promotion?.activityNo,
18951
18967
  })
18952
18968
  )
18953
18969
  },
@@ -18958,7 +18974,7 @@ function direct (request) {
18958
18974
  method: currentMethod,
18959
18975
  amount,
18960
18976
  applyerBankCode: selectedBank.bankCode,
18961
- promotionsNo: promotion.activityNo,
18977
+ promotionsNo: promotion?.activityNo,
18962
18978
  })
18963
18979
  )
18964
18980
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.43",
3
+ "version": "1.1.45-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -225,7 +225,7 @@ export default function (request) {
225
225
  payment.getDepositExpectedResult({
226
226
  method: currentMethod,
227
227
  amount,
228
- promotionsNo: promotion.activityNo,
228
+ promotionsNo: promotion?.activityNo,
229
229
  })
230
230
  )
231
231
  },
@@ -236,7 +236,7 @@ export default function (request) {
236
236
  method: currentMethod,
237
237
  amount,
238
238
  applyerBankCode: selectedBank.bankCode,
239
- promotionsNo: promotion.activityNo,
239
+ promotionsNo: promotion?.activityNo,
240
240
  })
241
241
  )
242
242
  },
@@ -355,7 +355,7 @@ export default function (request) {
355
355
  payment.getDepositExpectedResult({
356
356
  method,
357
357
  amount,
358
- promotionsNo: promotion.activityNo,
358
+ promotionsNo: promotion?.activityNo,
359
359
  })
360
360
  )
361
361
  },
@@ -372,7 +372,7 @@ export default function (request) {
372
372
  applyerHolderName: userAccountName,
373
373
  depositTime,
374
374
  receipt,
375
- promotionsNo: promotion.activityNo,
375
+ promotionsNo: promotion?.activityNo,
376
376
  })
377
377
  )
378
378
  },
@@ -430,7 +430,7 @@ export default function (request) {
430
430
  payment.getDepositExpectedResult({
431
431
  method: currentMethod,
432
432
  amount: selectedAmount,
433
- promotionsNo: promotion.activityNo,
433
+ promotionsNo: promotion?.activityNo,
434
434
  })
435
435
  )
436
436
  },
@@ -440,7 +440,7 @@ export default function (request) {
440
440
  payment.submitDepositTransaction({
441
441
  method: currentMethod,
442
442
  amount: selectedAmount,
443
- promotionsNo: promotion.activityNo,
443
+ promotionsNo: promotion?.activityNo,
444
444
  })
445
445
  )
446
446
  },
@@ -92,7 +92,7 @@ export default function (request) {
92
92
  }
93
93
  }),
94
94
  setRegistrationData: assign((context, event) => {
95
- const { account, currency, site, strategy, uid } = event.data
95
+ const { account, currency, site, strategy, uid, channel, sub_channel } = event.data
96
96
  return {
97
97
  registrationData: {
98
98
  account,
@@ -100,6 +100,8 @@ export default function (request) {
100
100
  site,
101
101
  strategy,
102
102
  uid,
103
+ channel,
104
+ sub_channel,
103
105
  },
104
106
  }
105
107
  }),
@@ -25,6 +25,7 @@ export default function (request) {
25
25
  maxWithdrawAmount: null,
26
26
  availableWithdrawAmount: null,
27
27
  enableWithdraw: false,
28
+ withdrawRules: [],
28
29
 
29
30
  attachmentType: null, // null | 'withdraw' | 'pool'
30
31
 
@@ -347,13 +348,28 @@ export default function (request) {
347
348
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
348
349
  event.data?.withdrawRule
349
350
 
351
+ const withdrawRules = event.data?.withdrawRule?.rules || []
352
+ const rules = withdrawRules.filter((rule) => rule.maxWithdrawAmount > 0)
353
+
354
+ const { balance } = context
355
+ const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
356
+
357
+ let maxWithdrawAmount = 0
358
+
359
+ if (lastMatchedIndex > -1) {
360
+ rules[lastMatchedIndex].match = true
361
+ maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
362
+ } else if (rules.length > 0) {
363
+ maxWithdrawAmount = rules[0].maxWithdrawAmount
364
+ } else {
365
+ maxWithdrawAmount = balance
366
+ }
367
+
350
368
  return {
351
- // maxWithdrawAmount: maximumWithdrawAmount,
352
- // availableWithdrawAmount: enableWithdrawAmount,
353
- maximumWithdrawAmount: +maximumWithdrawAmount,
369
+ maxWithdrawAmount,
354
370
  enableWithdrawAmount: +enableWithdrawAmount,
355
- amount: +enableWithdrawAmount,
356
371
  enableWithdraw,
372
+ withdrawRules,
357
373
  }
358
374
 
359
375
  // const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
@@ -27,6 +27,7 @@ export default function (request) {
27
27
  maximumWithdrawAmount: 0,
28
28
  enableWithdrawAmount: 0,
29
29
  enableWithdraw: false,
30
+ withdrawRules: [],
30
31
 
31
32
  amount: null,
32
33
  bank: null,
@@ -34,9 +35,6 @@ export default function (request) {
34
35
  accountNumber: null,
35
36
  holderName: null,
36
37
 
37
- withdrawDistance: null,
38
- withdrawAmount: null,
39
-
40
38
  // otp
41
39
  requestId: null,
42
40
  status: null,