@xuda.io/account_module 1.2.90 → 1.2.92
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/index.js +7 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1447,12 +1447,16 @@ exports.validate_account_topup = async function (uid, items = []) {
|
|
|
1447
1447
|
topup += get_prices(uid, item);
|
|
1448
1448
|
}
|
|
1449
1449
|
|
|
1450
|
-
if (
|
|
1450
|
+
if (!data?.customer_obj?.default_source) {
|
|
1451
|
+
err.code = -90;
|
|
1452
|
+
err.billing_problem = true;
|
|
1453
|
+
|
|
1451
1454
|
throw new Error("no card on file");
|
|
1452
1455
|
}
|
|
1453
1456
|
|
|
1454
1457
|
if (data?.balance?.past_due) {
|
|
1455
1458
|
let err = new Error(`past_due ${data?.balance?.past_due}`);
|
|
1459
|
+
err.code = -91;
|
|
1456
1460
|
err.billing_problem = true;
|
|
1457
1461
|
err.topup = topup;
|
|
1458
1462
|
throw err;
|
|
@@ -1462,6 +1466,7 @@ exports.validate_account_topup = async function (uid, items = []) {
|
|
|
1462
1466
|
|
|
1463
1467
|
if (balance > 0) {
|
|
1464
1468
|
let err = new Error(`negative balance ${-balance}`);
|
|
1469
|
+
err.code = -92;
|
|
1465
1470
|
err.billing_problem = true;
|
|
1466
1471
|
err.topup = topup - balance; // ask for whole balance
|
|
1467
1472
|
throw err;
|
|
@@ -1469,6 +1474,7 @@ exports.validate_account_topup = async function (uid, items = []) {
|
|
|
1469
1474
|
|
|
1470
1475
|
if (topup + balance > 0) {
|
|
1471
1476
|
let err = new Error(`not enough balance ${topup + balance}`);
|
|
1477
|
+
err.code = -93;
|
|
1472
1478
|
err.billing_problem = true;
|
|
1473
1479
|
err.topup = topup;
|
|
1474
1480
|
throw err;
|