validate Stripe period end timestamps
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user