@xuda.io/account_module 1.2.85 → 1.2.86

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 +34 -34
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1435,46 +1435,46 @@ exports.validate_account_topup = async function (uid, items = []) {
1435
1435
  return true;
1436
1436
  };
1437
1437
 
1438
- exports.validate_account_topup2 = async function (uid, items = []) {
1439
- const stripe_module = require(`${module_path}/stripe_module`);
1438
+ // exports.validate_account_topup2 = async function (uid, items = []) {
1439
+ // const stripe_module = require(`${module_path}/stripe_module`);
1440
1440
 
1441
- const { code, data } = await stripe_module.get_billing_metrics({ uid });
1442
- if (code < 0) {
1443
- throw new Error(data);
1444
- }
1445
- let topup = 0;
1446
- for (const item of items) {
1447
- topup += get_prices(item);
1448
- }
1441
+ // const { code, data } = await stripe_module.get_billing_metrics({ uid });
1442
+ // if (code < 0) {
1443
+ // throw new Error(data);
1444
+ // }
1445
+ // let topup = 0;
1446
+ // for (const item of items) {
1447
+ // topup += get_prices(item);
1448
+ // }
1449
1449
 
1450
- if ((!data?.customer_obj?.default_source, { billing_problem: true, topup })) {
1451
- throw new Error("no card on file");
1452
- }
1453
- if (data?.balance?.past_due) {
1454
- let err = new Error(`past_due ${data?.balance?.past_due}`);
1455
- err.billing_problem = true;
1456
- err.topup = topup;
1457
- throw err;
1458
- }
1450
+ // if ((!data?.customer_obj?.default_source, { billing_problem: true, topup })) {
1451
+ // throw new Error("no card on file");
1452
+ // }
1453
+ // if (data?.balance?.past_due) {
1454
+ // let err = new Error(`past_due ${data?.balance?.past_due}`);
1455
+ // err.billing_problem = true;
1456
+ // err.topup = topup;
1457
+ // throw err;
1458
+ // }
1459
1459
 
1460
- const balance = data?.balance?.account || 0; // minus balance represents positive balance
1460
+ // const balance = data?.balance?.account || 0; // minus balance represents positive balance
1461
1461
 
1462
- if (balance > 0) {
1463
- let err = new Error(`negative balance ${-balance}`);
1464
- err.billing_problem = true;
1465
- err.topup = topup - balance; // ask for whole balance
1466
- throw err;
1467
- }
1462
+ // if (balance > 0) {
1463
+ // let err = new Error(`negative balance ${-balance}`);
1464
+ // err.billing_problem = true;
1465
+ // err.topup = topup - balance; // ask for whole balance
1466
+ // throw err;
1467
+ // }
1468
1468
 
1469
- if (topup + balance > 0) {
1470
- let err = new Error(`not enough balance ${topup + balance}`);
1471
- err.billing_problem = true;
1472
- err.topup = topup;
1473
- throw err;
1474
- }
1469
+ // if (topup + balance > 0) {
1470
+ // let err = new Error(`not enough balance ${topup + balance}`);
1471
+ // err.billing_problem = true;
1472
+ // err.topup = topup;
1473
+ // throw err;
1474
+ // }
1475
1475
 
1476
- return true;
1477
- };
1476
+ // return true;
1477
+ // };
1478
1478
 
1479
1479
  const get_prices = function (uid, item) {
1480
1480
  let price;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.85",
3
+ "version": "1.2.86",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.js",
6
6
  "dependencies": {