mirror of
https://github.com/OpenSignLabs/OpenSign.git
synced 2026-08-21 15:12:34 +02:00
refactor: add help test, remove uncessary code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import { cloudServerUrl } from '../../Utils.js';
|
||||
import { cloudServerUrl, planCredits } from '../../Utils.js';
|
||||
const serverUrl = cloudServerUrl; //process.env.SERVER_URL;
|
||||
const APPID = process.env.APP_ID;
|
||||
const masterKEY = process.env.MASTER_KEY;
|
||||
@@ -135,6 +135,8 @@ async function saveSubscription(extUserId, UserId, tenantId, subscription) {
|
||||
const SubscriptionId = subscription?.data?.subscription?.subscription_id || '';
|
||||
const Next_billing_date = subscription?.data?.subscription?.next_billing_at || '';
|
||||
const planCode = subscription?.data?.subscription?.plan?.plan_code || '';
|
||||
const credits = planCredits?.[planCode] || 0;
|
||||
|
||||
try {
|
||||
const createSubscription = new Parse.Object('contracts_Subscriptions');
|
||||
createSubscription.set('SubscriptionId', SubscriptionId);
|
||||
@@ -156,6 +158,9 @@ async function saveSubscription(extUserId, UserId, tenantId, subscription) {
|
||||
});
|
||||
createSubscription.set('Next_billing_date', new Date(Next_billing_date));
|
||||
createSubscription.set('PlanCode', planCode);
|
||||
if (credits > 0) {
|
||||
createSubscription.set('AllowedCredits', credits);
|
||||
}
|
||||
await createSubscription.save(null, { useMasterKey: true });
|
||||
} catch (err) {
|
||||
console.log('err in save subscription pgsignup', err);
|
||||
|
||||
Reference in New Issue
Block a user