Skip to content

Commit d2f814e

Browse files
refactor: prepare for v2.3.0
1 parent 87cec67 commit d2f814e

File tree

5 files changed

+47
-14
lines changed

5 files changed

+47
-14
lines changed

apps/OpenSign/src/json/plansArr.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ const plans = [
2727
"Decline document support",
2828
"Email notifications",
2929
"Recipient authentication using OTP",
30-
"Bulk send (upto 5 docs)",
3130
"Public profiles",
3231
"And much more"
3332
],
@@ -46,7 +45,6 @@ const plans = [
4645
"Decline document support",
4746
"Email notifications",
4847
"Recipient authentication using OTP",
49-
"Bulk send (upto 5 docs)",
5048
"Public profiles",
5149
"And much more"
5250
]
@@ -77,10 +75,10 @@ const plans = [
7775
"Webhooks",
7876
"Zapier integration",
7977
"API Access",
80-
"100 API signatures included",
78+
"upto 100 API signatures",
8179
"Custom email templates",
8280
"Auto reminders",
83-
"Bulk send (upto 20 docs)",
81+
"Bulk send (upto 100 docs)",
8482
"Premium Public profile usernames",
8583
"Embedding (coming soon)"
8684
],
@@ -92,10 +90,10 @@ const plans = [
9290
"Webhooks",
9391
"Zapier integration",
9492
"API Access",
95-
"240 API signatures included",
93+
"upto 240 API signatures",
9694
"Custom email templates",
9795
"Auto reminders",
98-
"Bulk send (upto 20 docs)",
96+
"Bulk send (upto 240 docs)",
9997
"Premium Public profile usernames",
10098
"Embedding (coming soon)"
10199
]
@@ -118,23 +116,23 @@ const plans = [
118116
target: "_self",
119117
benefits: [
120118
"Everything in OpenSign™ professional",
121-
"100 API signatures included",
119+
"upto 100 API signatures",
122120
"Teams and Organizations",
123121
"Share Templates with teams",
124122
"Share Templates with individuals",
125123
"DocumentId removal from signed docs",
126-
"Bulk send (upto 50 docs)",
124+
"Bulk send (upto 100 docs)",
127125
"Request Payments (coming soon)",
128126
"Mobile app (coming soon)"
129127
],
130128
yearlyBenefits: [
131129
"Everything in OpenSign™ professional",
132-
"500 API signatures included",
130+
"upto 500 API signatures",
133131
"Teams and Organizations",
134132
"Share Templates with teams",
135133
"Share Templates with individuals",
136134
"DocumentId removal from signed docs",
137-
"Bulk send (upto 50 docs)",
135+
"Bulk send (upto 500 docs)",
138136
"Request Payments (coming soon)",
139137
"Mobile app (coming soon)"
140138
]

apps/OpenSignServer/cloud/customRoute/saveSubscription.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,24 @@ export default async function saveSubscription(request, response) {
5555
if (existAddon > 0) {
5656
updateSubscription.set('AllowedUsers', parseInt(existAddon));
5757
}
58-
if (credits > 0) {
59-
updateSubscription.set('AllowedCredits', credits);
58+
const isSameAsPrevPlan = subscription?.get('PlanCode') === planCode;
59+
if (isSameAsPrevPlan) {
60+
const planCredits = subscription?.get('PlanCredits');
61+
if (planCredits) {
62+
updateSubscription.set('AllowedCredits', planCredits);
63+
} else {
64+
if (credits > 0) {
65+
updateSubscription.set('AllowedCredits', credits);
66+
updateSubscription.set('PlanCredits', credits);
67+
}
68+
}
69+
} else {
70+
if (credits > 0) {
71+
updateSubscription.set('AllowedCredits', credits);
72+
updateSubscription.set('PlanCredits', credits);
73+
}
6074
}
75+
6176
await updateSubscription.save(null, { useMasterKey: true });
6277
return response.status(200).json({ status: 'update subscription!' });
6378
} else {

apps/OpenSignServer/cloud/parsefunction/SubscribeFree.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default async function SubscribeFree(request) {
2222
updateSubscription.id = subcripitions.id;
2323
updateSubscription.set('PlanCode', 'freeplan');
2424
updateSubscription.set('AllowedCredits', 0);
25+
updateSubscription.set('PlanCredits', 0);
2526
await updateSubscription.save(null, { useMasterKey: true });
2627
return { status: 'success', result: 'subscribed!' };
2728
} catch (err) {
@@ -36,6 +37,7 @@ export default async function SubscribeFree(request) {
3637
updateSubscription.id = subcripitions.id;
3738
updateSubscription.set('PlanCode', 'freeplan');
3839
updateSubscription.set('AllowedCredits', 0);
40+
updateSubscription.set('PlanCredits', 0);
3941
await updateSubscription.save(null, { useMasterKey: true });
4042
return { status: 'success', result: 'subscribed!' };
4143
} catch (err) {
@@ -64,6 +66,7 @@ export default async function SubscribeFree(request) {
6466
});
6567
}
6668
createSubscription.set('AllowedCredits', 0);
69+
createSubscription.set('PlanCredits', 0);
6770
await createSubscription.save(null, { useMasterKey: true });
6871
return { status: 'success', result: 'subscribed!' };
6972
} catch (err) {

apps/OpenSignServer/cloud/parsefunction/saveSubscription.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,24 @@ export default async function saveSubscription(request) {
7070
if (existAddon > 0) {
7171
updateSubscription.set('AllowedUsers', parseInt(existAddon));
7272
}
73-
if (credits > 0) {
74-
updateSubscription.set('AllowedCredits', credits);
73+
const isSameAsPrevPlan = subscription?.get('PlanCode') === planCode;
74+
if (isSameAsPrevPlan) {
75+
const planCredits = subscription?.get('PlanCredits');
76+
if (planCredits) {
77+
updateSubscription.set('AllowedCredits', planCredits);
78+
} else {
79+
if (credits > 0) {
80+
updateSubscription.set('AllowedCredits', credits);
81+
updateSubscription.set('PlanCredits', credits);
82+
}
83+
}
84+
} else {
85+
if (credits > 0) {
86+
updateSubscription.set('AllowedCredits', credits);
87+
updateSubscription.set('PlanCredits', credits);
88+
}
7589
}
90+
7691
await updateSubscription.save(null, { useMasterKey: true });
7792
return { status: 'update subscription!' };
7893
} else {
@@ -101,6 +116,7 @@ export default async function saveSubscription(request) {
101116
}
102117
if (credits > 0) {
103118
createSubscription.set('AllowedCredits', credits);
119+
createSubscription.set('PlanCredits', credits);
104120
}
105121
await createSubscription.save(null, { useMasterKey: true });
106122
return { status: 'create subscription!' };

apps/OpenSignServer/cloud/parsefunction/usersignup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ async function saveSubscription(extUserId, UserId, tenantId, subscription) {
160160
createSubscription.set('PlanCode', planCode);
161161
if (credits > 0) {
162162
createSubscription.set('AllowedCredits', credits);
163+
createSubscription.set('PlanCredits', credits);
163164
}
164165
await createSubscription.save(null, { useMasterKey: true });
165166
} catch (err) {

0 commit comments

Comments
 (0)