@xuda.io/account_module 1.2.322 → 1.2.323
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.mjs +0 -42
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -1326,48 +1326,6 @@ export const get_account_rt_info = async function (uid) {
|
|
|
1326
1326
|
return account_info;
|
|
1327
1327
|
};
|
|
1328
1328
|
|
|
1329
|
-
// export const validate_account_topup = async function (uid, items = []) {
|
|
1330
|
-
// const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
|
|
1331
|
-
|
|
1332
|
-
// const { code, data } = await stripe_module.get_billing_metrics({ uid });
|
|
1333
|
-
// if (code < 0) {
|
|
1334
|
-
// throw new Error(data);
|
|
1335
|
-
// }
|
|
1336
|
-
// let topup = 0;
|
|
1337
|
-
// for (const item of items) {
|
|
1338
|
-
// topup += get_prices(uid, item);
|
|
1339
|
-
// }
|
|
1340
|
-
|
|
1341
|
-
// // if ((!data?.customer_obj?.default_source, { billing_problem: true, topup })) {
|
|
1342
|
-
// // throw new Error("no card on file");
|
|
1343
|
-
// // }
|
|
1344
|
-
// debugger;
|
|
1345
|
-
// if (data?.balance?.past_due) {
|
|
1346
|
-
// throw new Error(`past_due ${data?.balance?.past_due}`, {
|
|
1347
|
-
// billing_problem: true,
|
|
1348
|
-
// topup,
|
|
1349
|
-
// });
|
|
1350
|
-
// }
|
|
1351
|
-
|
|
1352
|
-
// const balance = data?.balance?.account || 0; // minus balance represents positive balance
|
|
1353
|
-
|
|
1354
|
-
// if (balance > 0) {
|
|
1355
|
-
// throw new Error(`negative balance ${-balance}`, {
|
|
1356
|
-
// billing_problem: true,
|
|
1357
|
-
// topup: topup - balance, // ask for whole balance
|
|
1358
|
-
// });
|
|
1359
|
-
// }
|
|
1360
|
-
|
|
1361
|
-
// if (topup + balance > 0) {
|
|
1362
|
-
// throw new Error(`not enough balance ${topup + balance}`, {
|
|
1363
|
-
// billing_problem: true,
|
|
1364
|
-
// topup, //-(topup + balance)
|
|
1365
|
-
// });
|
|
1366
|
-
// }
|
|
1367
|
-
|
|
1368
|
-
// return true;
|
|
1369
|
-
// };
|
|
1370
|
-
|
|
1371
1329
|
export const validate_account_topup = async function (uid, items = []) {
|
|
1372
1330
|
const stripe_module = await import(`${module_path}/stripe_module/index.mjs`);
|
|
1373
1331
|
|