@jetthai/cuora 1.1.46 → 1.1.47
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 +6 -0
- package/dist/bundle.mjs +21 -7
- package/package.json +1 -1
- package/src/machine/withdraw_crypto.js +20 -4
- package/src/machine/withdraw_vn.js +1 -3
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.47](https://github.com/jetthai/cuora-module/compare/v1.1.45-1...v1.1.47) (2023-02-08)
|
|
6
|
+
|
|
7
|
+
### [1.1.35-roulette](https://github.com/jetthai/cuora-module/compare/v1.1.45...v1.1.35-roulette) (2023-02-07)
|
|
8
|
+
|
|
5
9
|
### [1.1.46](https://github.com/jetthai/cuora-module/compare/v1.1.35-roulette...v1.1.46) (2023-02-07)
|
|
6
10
|
|
|
7
11
|
### [1.1.44](https://github.com/jetthai/cuora-module/compare/v1.1.43...v1.1.44) (2023-01-20)
|
|
@@ -26,6 +30,8 @@ All notable changes to this project will be documented in this file. See [standa
|
|
|
26
30
|
|
|
27
31
|
### [1.1.36](https://github.com/jetthai/cuora-module/compare/v1.1.35...v1.1.36) (2023-01-12)
|
|
28
32
|
|
|
33
|
+
### [1.1.45-1](https://github.com/jetthai/cuora-module/compare/v1.1.45...v1.1.45-1) (2023-02-08)
|
|
34
|
+
|
|
29
35
|
### [1.1.45](https://github.com/jetthai/cuora-module/compare/v1.1.44...v1.1.45) (2023-02-03)
|
|
30
36
|
|
|
31
37
|
### [1.1.44](https://github.com/jetthai/cuora-module/compare/v1.1.43...v1.1.44) (2023-01-20)
|
package/dist/bundle.mjs
CHANGED
|
@@ -14960,6 +14960,7 @@ function withdraw_vn (request) {
|
|
|
14960
14960
|
maximumWithdrawAmount: 0,
|
|
14961
14961
|
enableWithdrawAmount: 0,
|
|
14962
14962
|
enableWithdraw: false,
|
|
14963
|
+
withdrawRules: [],
|
|
14963
14964
|
|
|
14964
14965
|
amount: null,
|
|
14965
14966
|
bank: null,
|
|
@@ -14967,9 +14968,6 @@ function withdraw_vn (request) {
|
|
|
14967
14968
|
accountNumber: null,
|
|
14968
14969
|
holderName: null,
|
|
14969
14970
|
|
|
14970
|
-
withdrawDistance: null,
|
|
14971
|
-
withdrawAmount: null,
|
|
14972
|
-
|
|
14973
14971
|
// otp
|
|
14974
14972
|
requestId: null,
|
|
14975
14973
|
status: null,
|
|
@@ -15449,6 +15447,7 @@ function withdraw_crypto (request) {
|
|
|
15449
15447
|
maxWithdrawAmount: null,
|
|
15450
15448
|
availableWithdrawAmount: null,
|
|
15451
15449
|
enableWithdraw: false,
|
|
15450
|
+
withdrawRules: [],
|
|
15452
15451
|
|
|
15453
15452
|
attachmentType: null, // null | 'withdraw' | 'pool'
|
|
15454
15453
|
|
|
@@ -15771,13 +15770,28 @@ function withdraw_crypto (request) {
|
|
|
15771
15770
|
const { differAmountLimit, enableWithdraw, enableWithdrawAmount, maxWithdrawStatus, maximumWithdrawAmount, minimumWithdrawAmount } =
|
|
15772
15771
|
event.data?.withdrawRule;
|
|
15773
15772
|
|
|
15773
|
+
const withdrawRules = event.data?.withdrawRule?.rules || [];
|
|
15774
|
+
const rules = withdrawRules.filter((rule) => rule.maxWithdrawAmount > 0);
|
|
15775
|
+
|
|
15776
|
+
const { balance } = context;
|
|
15777
|
+
const lastMatchedIndex = findLastIndex_1(rules, (rule) => balance >= rule.greaterEqualThen);
|
|
15778
|
+
|
|
15779
|
+
let maxWithdrawAmount = 0;
|
|
15780
|
+
|
|
15781
|
+
if (lastMatchedIndex > -1) {
|
|
15782
|
+
rules[lastMatchedIndex].match = true;
|
|
15783
|
+
maxWithdrawAmount = rules[lastMatchedIndex].maxWithdrawAmount;
|
|
15784
|
+
} else if (rules.length > 0) {
|
|
15785
|
+
maxWithdrawAmount = rules[0].maxWithdrawAmount;
|
|
15786
|
+
} else {
|
|
15787
|
+
maxWithdrawAmount = balance;
|
|
15788
|
+
}
|
|
15789
|
+
|
|
15774
15790
|
return {
|
|
15775
|
-
|
|
15776
|
-
// availableWithdrawAmount: enableWithdrawAmount,
|
|
15777
|
-
maximumWithdrawAmount: +maximumWithdrawAmount,
|
|
15791
|
+
maxWithdrawAmount,
|
|
15778
15792
|
enableWithdrawAmount: +enableWithdrawAmount,
|
|
15779
|
-
amount: +enableWithdrawAmount,
|
|
15780
15793
|
enableWithdraw,
|
|
15794
|
+
withdrawRules,
|
|
15781
15795
|
}
|
|
15782
15796
|
|
|
15783
15797
|
// const rules = event.data.rules.filter((rule) => rule.maxWithdrawAmount > 0)
|
package/package.json
CHANGED
|
@@ -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
|
-
|
|
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,
|