@jetthai/cuora 1.1.44 → 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,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.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
+
5
9
  ### [1.1.44](https://github.com/jetthai/cuora-module/compare/v1.1.43...v1.1.44) (2023-01-20)
6
10
 
7
11
  ### [1.1.43](https://github.com/jetthai/cuora-module/compare/v1.1.42...v1.1.43) (2023-01-20)
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.44",
3
+ "version": "1.1.45-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -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,