chore: update iyzico payment processing and database schema
All checks were successful
Deploy / deploy (push) Successful in 9m3s
All checks were successful
Deploy / deploy (push) Successful in 9m3s
Enhanced the iyzico payment processing logic by updating the handling of checkout form content. Modified the order schema to include a new field for storing the checkout form content, ensuring it persists across page refreshes. Updated related functions to reflect these changes, improving the overall payment experience. Additionally, updated the app database to incorporate the latest changes.
This commit is contained in:
@@ -90,6 +90,10 @@ export const orders = sqliteTable(
|
||||
.notNull()
|
||||
.default("pending"),
|
||||
iyzicoToken: text("iyzico_token"),
|
||||
// Gömülü ödeme formu script'i (checkoutFormContent) — /odeme/[siparis]
|
||||
// sayfası yenilendiğinde yeniden initialize gerekmesin diye saklanır;
|
||||
// sipariş sonuçlanınca temizlenir.
|
||||
iyzicoFormContent: text("iyzico_form_content"),
|
||||
iyzicoPaymentId: text("iyzico_payment_id"),
|
||||
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
||||
paidAt: integer("paid_at", { mode: "timestamp" }),
|
||||
|
||||
@@ -86,6 +86,8 @@ export interface CheckoutFormInitSonuc {
|
||||
status: string;
|
||||
token?: string;
|
||||
paymentPageUrl?: string;
|
||||
/** Kendi sayfamıza gömülen form script'i — <div id="iyzipay-checkout-form"> ister */
|
||||
checkoutFormContent?: string;
|
||||
conversationId?: string;
|
||||
signature?: string;
|
||||
errorCode?: string;
|
||||
|
||||
@@ -98,7 +98,7 @@ export async function odemeyiSonuclandir(
|
||||
// paid'i asla geri almayız; pending → failed serbest
|
||||
await appDb
|
||||
.update(orders)
|
||||
.set({ status: "failed" })
|
||||
.set({ status: "failed", iyzicoFormContent: null })
|
||||
.where(and(eq(orders.id, orderId), ne(orders.status, "paid")));
|
||||
return "failed";
|
||||
}
|
||||
@@ -122,6 +122,7 @@ export async function odemeyiSonuclandir(
|
||||
.set({
|
||||
status: "paid",
|
||||
iyzicoPaymentId: sonuc.paymentId ?? null,
|
||||
iyzicoFormContent: null,
|
||||
paidAt: new Date(),
|
||||
})
|
||||
.where(and(eq(orders.id, orderId), ne(orders.status, "paid")));
|
||||
|
||||
Reference in New Issue
Block a user