restrict Stripe webhook plan ids
This commit is contained in:
+2
-1
@@ -1321,7 +1321,8 @@ const server = http.createServer(async (req, res) => {
|
|||||||
const rawEmail = o.client_reference_id || o.customer_email || o.metadata?.email || '';
|
const rawEmail = o.client_reference_id || o.customer_email || o.metadata?.email || '';
|
||||||
const email = typeof rawEmail === 'string' ? rawEmail.trim().toLowerCase() : '';
|
const email = typeof rawEmail === 'string' ? rawEmail.trim().toLowerCase() : '';
|
||||||
const rawPlanId = o.metadata?.planId;
|
const rawPlanId = o.metadata?.planId;
|
||||||
const planId = typeof rawPlanId === 'string' && rawPlanId.trim() ? rawPlanId.trim() : 'pro';
|
const candidatePlan = typeof rawPlanId === 'string' ? rawPlanId.trim() : '';
|
||||||
|
const planId = ['pro', 'kurumsal'].includes(candidatePlan) ? candidatePlan : 'pro';
|
||||||
if (email) {
|
if (email) {
|
||||||
store.setPlan(email, {
|
store.setPlan(email, {
|
||||||
plan: planId, kaynak: 'stripe',
|
plan: planId, kaynak: 'stripe',
|
||||||
|
|||||||
Reference in New Issue
Block a user