feat: payment failure returns checkout_url
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { z } from "zod/v4";
|
||||
// import { z } from "zod/v4";
|
||||
|
||||
export const AutumnMetadataSchema = z.object({
|
||||
id: z.string(),
|
||||
created_at: z.number(),
|
||||
expires_at: z.number(),
|
||||
data: z.any(),
|
||||
});
|
||||
// export const AutumnMetadataSchema = z.object({
|
||||
// id: z.string(),
|
||||
// created_at: z.number(),
|
||||
// expires_at: z.number(),
|
||||
// data: z.any(),
|
||||
// });
|
||||
|
||||
export type AutumnMetadata = z.infer<typeof AutumnMetadataSchema>;
|
||||
// export type AutumnMetadata = z.infer<typeof AutumnMetadataSchema>;
|
||||
|
||||
@@ -1,9 +1,21 @@
|
||||
import { pgTable, text, numeric, jsonb } from "drizzle-orm/pg-core";
|
||||
import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
||||
import { jsonb, numeric, pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { sqlNow } from "../../db/utils.js";
|
||||
|
||||
export enum MetadataType {
|
||||
InvoiceActionRequired = "invoice_action_required",
|
||||
InvoiceCheckout = "invoice_checkout",
|
||||
CheckoutSessionCompleted = "checkout_session_completed",
|
||||
}
|
||||
|
||||
export const metadata = pgTable("metadata", {
|
||||
id: text().primaryKey().notNull(),
|
||||
created_at: numeric({ mode: "number" }).notNull().default(sqlNow),
|
||||
expires_at: numeric({ mode: "number" }),
|
||||
data: jsonb(),
|
||||
type: text("type").$type<MetadataType>(),
|
||||
stripe_invoice_id: text("stripe_invoice_id"),
|
||||
});
|
||||
|
||||
export type Metadata = InferSelectModel<typeof metadata>;
|
||||
export type MetadataInsert = InferInsertModel<typeof metadata>;
|
||||
|
||||
Reference in New Issue
Block a user