fix(odeme): önce kredi sonra paid damgası; çift pakette iade akışı; UNIQUE tespiti
All checks were successful
Deploy / deploy (push) Successful in 8m50s
All checks were successful
Deploy / deploy (push) Successful in 8m50s
- odemeyiSonuclandir krediyi yazıp sonra paid damgalar; araya kesinti girerse
sipariş pending kalır ve yeniden denenir (eskiden: paid görünür, kredi yok).
paid + deftersiz eski siparişler ilk ziyarette onarılır
- paket tek seferlik: grantCredits({ paketTekil }) zaten paketliye yazmaz
(kontrol UPDATE'in WHERE'inde). Sipariş paid damgalanır, senkron log +
destek@ e-postası, /odeme/sonuc 'Bu ödeme iade edilecek' kartı, /kosullar#iade
- drizzle DrizzleQueryError üst mesajında 'UNIQUE' yok → idempotent no-op yerine
hata fırlıyordu (grant + iki spend yolu); cause zincirine bakılıyor
- callback geçici DB hatasında 500 yerine sonuç sayfasına yönlendirir
- krediKaydiVarMi (reason, ref_id) indeksini kullanır; haftalık mutabakat sorgusu
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -36,7 +36,16 @@ export async function POST(request: NextRequest) {
|
||||
return NextResponse.redirect(`${appUrl}/paket?hata=siparis`, 303);
|
||||
}
|
||||
|
||||
await odemeyiSonuclandir(order.id);
|
||||
// Geçici DB hatası (yazma kilidi vb.) kullanıcıya çıplak 500 göstermesin:
|
||||
// sonuç sayfası aynı sonuçlandırmayı yeniden dener (self-healing).
|
||||
try {
|
||||
await odemeyiSonuclandir(order.id);
|
||||
} catch (e) {
|
||||
console.error("[odeme] callback sonuçlandırma hatası", {
|
||||
siparis: order.id,
|
||||
e,
|
||||
});
|
||||
}
|
||||
// 303: iyzico'nun POST'u GET'e döner, kullanıcı sonuç sayfasında yenileme
|
||||
// yaptığında form yeniden gönderilmez.
|
||||
return NextResponse.redirect(`${appUrl}/odeme/sonuc?siparis=${order.id}`, 303);
|
||||
|
||||
Reference in New Issue
Block a user