@jetthai/cuora 1.1.29 → 1.1.31

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.31](https://github.com/jetthai/cuora-module/compare/v1.1.30...v1.1.31) (2023-01-09)
6
+
7
+ ### [1.1.30](https://github.com/jetthai/cuora-module/compare/v1.1.29...v1.1.30) (2023-01-09)
8
+
5
9
  ### [1.1.29](https://github.com/jetthai/cuora-module/compare/v1.1.28...v1.1.29) (2023-01-08)
6
10
 
7
11
  ### [1.1.28](https://github.com/jetthai/cuora-module/compare/v1.1.27...v1.1.28) (2023-01-06)
package/dist/bundle.mjs CHANGED
@@ -15114,12 +15114,25 @@ function withdraw_vn (request) {
15114
15114
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
15115
15115
  event.data?.withdrawRule;
15116
15116
 
15117
+ const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0);
15118
+
15119
+ const { balance } = context;
15120
+ const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
15121
+
15122
+ let maxWithdrawAmount = 0;
15123
+
15124
+ if (lastMatchedIndex > -1) {
15125
+ rules[lastMatchedIndex].match = true;
15126
+ maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
15127
+ } else if (rules.length > 0) {
15128
+ maxWithdrawAmount = rules[0].maxWithdrawAmount;
15129
+ } else {
15130
+ maxWithdrawAmount = balance;
15131
+ }
15132
+
15117
15133
  return {
15118
- // maxWithdrawAmount: maximumWithdrawAmount,
15119
- // availableWithdrawAmount: enableWithdrawAmount,
15120
- maximumWithdrawAmount: +maximumWithdrawAmount,
15134
+ maxWithdrawAmount,
15121
15135
  enableWithdrawAmount: +enableWithdrawAmount,
15122
- amount: +enableWithdrawAmount,
15123
15136
  enableWithdraw,
15124
15137
  }
15125
15138
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.1.29",
3
+ "version": "1.1.31",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -332,12 +332,25 @@ export default function (request) {
332
332
  const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
333
333
  event.data?.withdrawRule
334
334
 
335
+ const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
336
+
337
+ const { balance } = context
338
+ const lastMatchedIndex = findLastIndex(rules, (rule) => balance >= rule.greaterEqualThen)
339
+
340
+ let maxWithdrawAmount = 0
341
+
342
+ if (lastMatchedIndex > -1) {
343
+ rules[lastMatchedIndex].match = true
344
+ maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount
345
+ } else if (rules.length > 0) {
346
+ maxWithdrawAmount = rules[0].maxWithdrawAmount
347
+ } else {
348
+ maxWithdrawAmount = balance
349
+ }
350
+
335
351
  return {
336
- // maxWithdrawAmount: maximumWithdrawAmount,
337
- // availableWithdrawAmount: enableWithdrawAmount,
338
- maximumWithdrawAmount: +maximumWithdrawAmount,
352
+ maxWithdrawAmount,
339
353
  enableWithdrawAmount: +enableWithdrawAmount,
340
- amount: +enableWithdrawAmount,
341
354
  enableWithdraw,
342
355
  }
343
356
  }),