validate Stripe cancellation timestamp

This commit is contained in:
2026-09-06 17:49:09 +03:00
parent dd230a1d8c
commit 5bffc66fc6
+2
View File
@@ -230,6 +230,8 @@ export async function cancelSubscription({ subId, neden, aciklama }) {
if (!res.ok) throw new Error(data?.error?.message || `Stripe hatası: HTTP ${res.status}`); if (!res.ok) throw new Error(data?.error?.message || `Stripe hatası: HTTP ${res.status}`);
if (typeof data.id !== 'string' || !data.id.trim() || typeof data.status !== 'string' || !data.status.trim()) if (typeof data.id !== 'string' || !data.id.trim() || typeof data.status !== 'string' || !data.status.trim())
throw new Error('Stripe abonelik iptal yanıtı geçersiz.'); throw new Error('Stripe abonelik iptal yanıtı geçersiz.');
if (data.cancel_at != null && (!Number.isSafeInteger(data.cancel_at) || data.cancel_at <= 0))
throw new Error('Stripe iptal tarihi geçersiz.');
return { return {
id: data.id, id: data.id,
status: data.status, status: data.status,