validate Stripe period end timestamps

This commit is contained in:
2026-09-06 17:51:05 +03:00
parent 60dc7a1760
commit 4c9354362a
+2
View File
@@ -1334,6 +1334,8 @@ const server = http.createServer(async (req, res) => {
const aktif = ['active', 'trialing'].includes(o.status); const aktif = ['active', 'trialing'].includes(o.status);
const k = store.findByStripe({ customerId: o.customer, subId: o.id }); const k = store.findByStripe({ customerId: o.customer, subId: o.id });
if (k) { if (k) {
if (o.current_period_end != null && (!Number.isSafeInteger(o.current_period_end) || o.current_period_end <= 0))
throw new Error('Stripe dönem sonu tarihi geçersiz.');
store.setPlan(k.email, { store.setPlan(k.email, {
plan: aktif ? planId : 'ucretsiz', kaynak: 'stripe', plan: aktif ? planId : 'ucretsiz', kaynak: 'stripe',
bitis: o.current_period_end ? new Date(o.current_period_end * 1000).toISOString() : null, bitis: o.current_period_end ? new Date(o.current_period_end * 1000).toISOString() : null,