@xuda.io/account_module 1.2.322 → 1.2.324

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.mjs +1 -43
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1268,8 +1268,8 @@ export const add_contact = async function (req, job_id, headers) {
1268
1268
  };
1269
1269
  const ret = await db_module.save_couch_doc('xuda_contacts', doc);
1270
1270
 
1271
- const app_id = await get_account_default_project_id(uid);
1272
1271
  if (!profile_avatar) {
1272
+ const app_id = await get_account_default_project_id(uid);
1273
1273
  const ai_module = await import(`${module_path}/ai_module/index.mjs`);
1274
1274
  ai_module.update_thumbnail('contact', doc, app_id, uid, job_id, headers, 'xuda_contacts');
1275
1275
  }
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/account_module",
3
- "version": "1.2.322",
3
+ "version": "1.2.324",
4
4
  "description": "Xuda Account Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {