@xuda.io/account_module 1.2.61 → 1.2.63

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.
Files changed (2) hide show
  1. package/index.js +10 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1402,6 +1402,7 @@ exports.validate_account_topup = async function (uid, items = []) {
1402
1402
  }
1403
1403
  let topup = 0;
1404
1404
  for (const item of items) {
1405
+ topup += get_prices(item);
1405
1406
  }
1406
1407
 
1407
1408
  if ((!data?.customer_obj?.default_source, { billing_problem: true, topup })) {
@@ -1425,10 +1426,18 @@ exports.validate_account_topup = async function (uid, items = []) {
1425
1426
  topup,
1426
1427
  });
1427
1428
  }
1429
+
1430
+ if (topup + (data?.balance?.account || 0) > 0) {
1431
+ throw new Error(`balance ${data?.balance?.account}`, {
1432
+ billing_problem: true,
1433
+ topup,
1434
+ });
1435
+ }
1436
+
1428
1437
  return true;
1429
1438
  };
1430
1439
 
1431
- exports.get_prices = async function (uid, item) {
1440
+ const get_prices = async function (uid, item) {
1432
1441
  let price;
1433
1442
 
1434
1443
  switch (item) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.61",
3
+ "version": "1.2.63",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {