730 lines
20 KiB
TypeScript
730 lines
20 KiB
TypeScript
/**
|
|
* Generated by orval v8.5.3 🍺
|
|
* Do not edit manually.
|
|
* Api
|
|
* Saudi E-Commerce Store API
|
|
* OpenAPI spec version: 0.1.0
|
|
*/
|
|
import * as zod from "zod";
|
|
|
|
/**
|
|
* @summary Health check
|
|
*/
|
|
export const HealthCheckResponse = zod.object({
|
|
status: zod.string(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get all categories
|
|
*/
|
|
export const GetCategoriesResponseItem = zod.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
icon: zod.string().optional(),
|
|
sort_order: zod.number(),
|
|
product_count: zod.number().optional(),
|
|
});
|
|
export const GetCategoriesResponse = zod.array(GetCategoriesResponseItem);
|
|
|
|
/**
|
|
* @summary Get products with filters
|
|
*/
|
|
export const getProductsQueryPageDefault = 1;
|
|
export const getProductsQueryLimitDefault = 20;
|
|
|
|
export const GetProductsQueryParams = zod.object({
|
|
category_id: zod.coerce.number().optional(),
|
|
search: zod.coerce.string().optional(),
|
|
min_price: zod.coerce.number().optional(),
|
|
max_price: zod.coerce.number().optional(),
|
|
min_rating: zod.coerce.number().optional(),
|
|
brand: zod.coerce.string().optional(),
|
|
sort: zod
|
|
.enum(["newest", "price_asc", "price_desc", "rating", "popular"])
|
|
.optional(),
|
|
page: zod.coerce.number().default(getProductsQueryPageDefault),
|
|
limit: zod.coerce.number().default(getProductsQueryLimitDefault),
|
|
featured: zod
|
|
.enum(["trending", "bestseller", "new_arrivals", "top_rated"])
|
|
.optional(),
|
|
});
|
|
|
|
export const GetProductsResponse = zod.object({
|
|
products: zod.array(
|
|
zod.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
category_name: zod.string().optional(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
discount_percent: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
rating: zod.number().optional(),
|
|
review_count: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
created_at: zod.string().optional(),
|
|
}),
|
|
),
|
|
total: zod.number(),
|
|
page: zod.number(),
|
|
limit: zod.number(),
|
|
total_pages: zod.number(),
|
|
});
|
|
|
|
/**
|
|
* @summary Create a product (admin)
|
|
*/
|
|
export const CreateProductBody = zod.object({
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get a product by ID
|
|
*/
|
|
export const GetProductParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const GetProductResponse = zod.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
category_name: zod.string().optional(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
discount_percent: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
rating: zod.number().optional(),
|
|
review_count: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
created_at: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Update a product (admin)
|
|
*/
|
|
export const UpdateProductParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const UpdateProductBody = zod.object({
|
|
name: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number().optional(),
|
|
price: zod.number().optional(),
|
|
original_price: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
stock: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
});
|
|
|
|
export const UpdateProductResponse = zod.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
category_name: zod.string().optional(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
discount_percent: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
rating: zod.number().optional(),
|
|
review_count: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
created_at: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Delete a product (admin)
|
|
*/
|
|
export const DeleteProductParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const DeleteProductResponse = zod.object({
|
|
message: zod.string(),
|
|
success: zod.boolean(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get reviews for a product
|
|
*/
|
|
export const GetProductReviewsParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const GetProductReviewsResponseItem = zod.object({
|
|
id: zod.number(),
|
|
product_id: zod.number(),
|
|
reviewer_name: zod.string(),
|
|
reviewer_city: zod.string().optional(),
|
|
rating: zod.number(),
|
|
comment: zod.string(),
|
|
is_approved: zod.boolean(),
|
|
created_at: zod.string().optional(),
|
|
});
|
|
export const GetProductReviewsResponse = zod.array(
|
|
GetProductReviewsResponseItem,
|
|
);
|
|
|
|
/**
|
|
* @summary Submit a review
|
|
*/
|
|
export const CreateReviewParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const CreateReviewBody = zod.object({
|
|
reviewer_name: zod.string(),
|
|
reviewer_city: zod.string().optional(),
|
|
rating: zod.number(),
|
|
comment: zod.string(),
|
|
});
|
|
|
|
/**
|
|
* @summary Approve a review (admin)
|
|
*/
|
|
export const ApproveReviewParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const ApproveReviewResponse = zod.object({
|
|
message: zod.string(),
|
|
success: zod.boolean(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get cart items
|
|
*/
|
|
export const GetCartQueryParams = zod.object({
|
|
session_id: zod.coerce.string(),
|
|
});
|
|
|
|
export const GetCartResponseItem = zod.object({
|
|
id: zod.number(),
|
|
session_id: zod.string(),
|
|
product_id: zod.number(),
|
|
product: zod
|
|
.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
category_name: zod.string().optional(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
discount_percent: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
rating: zod.number().optional(),
|
|
review_count: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
created_at: zod.string().optional(),
|
|
})
|
|
.optional(),
|
|
quantity: zod.number(),
|
|
selected_size: zod.string().optional(),
|
|
selected_color: zod.string().optional(),
|
|
});
|
|
export const GetCartResponse = zod.array(GetCartResponseItem);
|
|
|
|
/**
|
|
* @summary Add item to cart
|
|
*/
|
|
export const AddToCartBody = zod.object({
|
|
session_id: zod.string(),
|
|
product_id: zod.number(),
|
|
quantity: zod.number(),
|
|
selected_size: zod.string().optional(),
|
|
selected_color: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Update cart item quantity
|
|
*/
|
|
export const UpdateCartItemParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const UpdateCartItemBody = zod.object({
|
|
quantity: zod.number(),
|
|
});
|
|
|
|
export const UpdateCartItemResponse = zod.object({
|
|
id: zod.number(),
|
|
session_id: zod.string(),
|
|
product_id: zod.number(),
|
|
product: zod
|
|
.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
category_name: zod.string().optional(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
discount_percent: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
rating: zod.number().optional(),
|
|
review_count: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
created_at: zod.string().optional(),
|
|
})
|
|
.optional(),
|
|
quantity: zod.number(),
|
|
selected_size: zod.string().optional(),
|
|
selected_color: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Remove item from cart
|
|
*/
|
|
export const RemoveFromCartParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const RemoveFromCartResponse = zod.object({
|
|
message: zod.string(),
|
|
success: zod.boolean(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get orders (admin)
|
|
*/
|
|
export const GetOrdersQueryParams = zod.object({
|
|
status: zod
|
|
.enum([
|
|
"pending",
|
|
"processing",
|
|
"shipped",
|
|
"delivered",
|
|
"cancelled",
|
|
"returned",
|
|
])
|
|
.optional(),
|
|
page: zod.coerce.number().optional(),
|
|
limit: zod.coerce.number().optional(),
|
|
});
|
|
|
|
export const GetOrdersResponse = zod.object({
|
|
orders: zod.array(
|
|
zod.object({
|
|
id: zod.number(),
|
|
order_number: zod.string(),
|
|
session_id: zod.string().optional(),
|
|
customer_name: zod.string(),
|
|
customer_phone: zod.string().optional(),
|
|
customer_email: zod.string().optional(),
|
|
shipping_address: zod.string().optional(),
|
|
city: zod.string().optional(),
|
|
items: zod
|
|
.array(
|
|
zod.object({
|
|
id: zod.number(),
|
|
product_id: zod.number(),
|
|
product_name: zod.string(),
|
|
product_image: zod.string().optional(),
|
|
quantity: zod.number(),
|
|
price: zod.number(),
|
|
selected_size: zod.string().optional(),
|
|
selected_color: zod.string().optional(),
|
|
}),
|
|
)
|
|
.optional(),
|
|
subtotal: zod.number().optional(),
|
|
discount: zod.number().optional(),
|
|
shipping_fee: zod.number().optional(),
|
|
total: zod.number(),
|
|
status: zod.string(),
|
|
payment_method: zod.string().optional(),
|
|
coupon_code: zod.string().optional(),
|
|
tracking_number: zod.string().optional(),
|
|
notes: zod.string().optional(),
|
|
created_at: zod.string().optional(),
|
|
updated_at: zod.string().optional(),
|
|
}),
|
|
),
|
|
total: zod.number(),
|
|
page: zod.number(),
|
|
limit: zod.number(),
|
|
});
|
|
|
|
/**
|
|
* @summary Create an order (checkout)
|
|
*/
|
|
export const CreateOrderBody = zod.object({
|
|
session_id: zod.string(),
|
|
customer_name: zod.string(),
|
|
customer_phone: zod.string(),
|
|
customer_email: zod.string().optional(),
|
|
shipping_address: zod.string(),
|
|
city: zod.string(),
|
|
payment_method: zod.string(),
|
|
coupon_code: zod.string().optional(),
|
|
notes: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get order details
|
|
*/
|
|
export const GetOrderParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const GetOrderResponse = zod.object({
|
|
id: zod.number(),
|
|
order_number: zod.string(),
|
|
session_id: zod.string().optional(),
|
|
customer_name: zod.string(),
|
|
customer_phone: zod.string().optional(),
|
|
customer_email: zod.string().optional(),
|
|
shipping_address: zod.string().optional(),
|
|
city: zod.string().optional(),
|
|
items: zod
|
|
.array(
|
|
zod.object({
|
|
id: zod.number(),
|
|
product_id: zod.number(),
|
|
product_name: zod.string(),
|
|
product_image: zod.string().optional(),
|
|
quantity: zod.number(),
|
|
price: zod.number(),
|
|
selected_size: zod.string().optional(),
|
|
selected_color: zod.string().optional(),
|
|
}),
|
|
)
|
|
.optional(),
|
|
subtotal: zod.number().optional(),
|
|
discount: zod.number().optional(),
|
|
shipping_fee: zod.number().optional(),
|
|
total: zod.number(),
|
|
status: zod.string(),
|
|
payment_method: zod.string().optional(),
|
|
coupon_code: zod.string().optional(),
|
|
tracking_number: zod.string().optional(),
|
|
notes: zod.string().optional(),
|
|
created_at: zod.string().optional(),
|
|
updated_at: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Update order status (admin)
|
|
*/
|
|
export const UpdateOrderStatusParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const UpdateOrderStatusBody = zod.object({
|
|
status: zod.enum([
|
|
"pending",
|
|
"processing",
|
|
"shipped",
|
|
"delivered",
|
|
"cancelled",
|
|
"returned",
|
|
]),
|
|
tracking_number: zod.string().optional(),
|
|
});
|
|
|
|
export const UpdateOrderStatusResponse = zod.object({
|
|
id: zod.number(),
|
|
order_number: zod.string(),
|
|
session_id: zod.string().optional(),
|
|
customer_name: zod.string(),
|
|
customer_phone: zod.string().optional(),
|
|
customer_email: zod.string().optional(),
|
|
shipping_address: zod.string().optional(),
|
|
city: zod.string().optional(),
|
|
items: zod
|
|
.array(
|
|
zod.object({
|
|
id: zod.number(),
|
|
product_id: zod.number(),
|
|
product_name: zod.string(),
|
|
product_image: zod.string().optional(),
|
|
quantity: zod.number(),
|
|
price: zod.number(),
|
|
selected_size: zod.string().optional(),
|
|
selected_color: zod.string().optional(),
|
|
}),
|
|
)
|
|
.optional(),
|
|
subtotal: zod.number().optional(),
|
|
discount: zod.number().optional(),
|
|
shipping_fee: zod.number().optional(),
|
|
total: zod.number(),
|
|
status: zod.string(),
|
|
payment_method: zod.string().optional(),
|
|
coupon_code: zod.string().optional(),
|
|
tracking_number: zod.string().optional(),
|
|
notes: zod.string().optional(),
|
|
created_at: zod.string().optional(),
|
|
updated_at: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get wishlist
|
|
*/
|
|
export const GetWishlistQueryParams = zod.object({
|
|
session_id: zod.coerce.string(),
|
|
});
|
|
|
|
export const GetWishlistResponseItem = zod.object({
|
|
id: zod.number(),
|
|
session_id: zod.string(),
|
|
product_id: zod.number(),
|
|
product: zod
|
|
.object({
|
|
id: zod.number(),
|
|
name: zod.string(),
|
|
name_en: zod.string().optional(),
|
|
description: zod.string().optional(),
|
|
brand: zod.string().optional(),
|
|
category_id: zod.number(),
|
|
category_name: zod.string().optional(),
|
|
price: zod.number(),
|
|
original_price: zod.number().optional(),
|
|
discount_percent: zod.number().optional(),
|
|
images: zod.array(zod.string()).optional(),
|
|
sizes: zod.array(zod.string()).optional(),
|
|
colors: zod.array(zod.string()).optional(),
|
|
specs: zod.record(zod.string(), zod.unknown()).optional(),
|
|
marketing_points: zod.array(zod.string()).optional(),
|
|
stock: zod.number(),
|
|
rating: zod.number().optional(),
|
|
review_count: zod.number().optional(),
|
|
is_trending: zod.boolean().optional(),
|
|
is_bestseller: zod.boolean().optional(),
|
|
is_new: zod.boolean().optional(),
|
|
is_top_rated: zod.boolean().optional(),
|
|
created_at: zod.string().optional(),
|
|
})
|
|
.optional(),
|
|
created_at: zod.string().optional(),
|
|
});
|
|
export const GetWishlistResponse = zod.array(GetWishlistResponseItem);
|
|
|
|
/**
|
|
* @summary Add to wishlist
|
|
*/
|
|
export const AddToWishlistBody = zod.object({
|
|
session_id: zod.string(),
|
|
product_id: zod.number(),
|
|
});
|
|
|
|
/**
|
|
* @summary Remove from wishlist
|
|
*/
|
|
export const RemoveFromWishlistParams = zod.object({
|
|
product_id: zod.coerce.number(),
|
|
});
|
|
|
|
export const RemoveFromWishlistQueryParams = zod.object({
|
|
session_id: zod.coerce.string(),
|
|
});
|
|
|
|
export const RemoveFromWishlistResponse = zod.object({
|
|
message: zod.string(),
|
|
success: zod.boolean(),
|
|
});
|
|
|
|
/**
|
|
* @summary Admin login
|
|
*/
|
|
export const AdminLoginBody = zod.object({
|
|
username: zod.string(),
|
|
password: zod.string(),
|
|
});
|
|
|
|
export const AdminLoginResponse = zod.object({
|
|
token: zod.string(),
|
|
username: zod.string(),
|
|
});
|
|
|
|
/**
|
|
* @summary Change admin password
|
|
*/
|
|
export const ChangeAdminPasswordBody = zod.object({
|
|
current_password: zod.string(),
|
|
new_password: zod.string(),
|
|
username: zod.string().optional(),
|
|
});
|
|
|
|
export const ChangeAdminPasswordResponse = zod.object({
|
|
message: zod.string(),
|
|
success: zod.boolean(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get admin dashboard stats
|
|
*/
|
|
export const GetAdminStatsResponse = zod.object({
|
|
total_orders: zod.number(),
|
|
pending_orders: zod.number(),
|
|
total_revenue: zod.number(),
|
|
total_products: zod.number(),
|
|
low_stock_count: zod.number(),
|
|
total_customers: zod.number(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get all coupons
|
|
*/
|
|
export const GetCouponsResponseItem = zod.object({
|
|
id: zod.number(),
|
|
code: zod.string(),
|
|
discount_type: zod.enum(["percentage", "fixed"]),
|
|
discount_value: zod.number(),
|
|
min_order: zod.number().optional(),
|
|
max_uses: zod.number().optional(),
|
|
used_count: zod.number().optional(),
|
|
expires_at: zod.string().optional(),
|
|
is_active: zod.boolean(),
|
|
});
|
|
export const GetCouponsResponse = zod.array(GetCouponsResponseItem);
|
|
|
|
/**
|
|
* @summary Create a coupon (admin)
|
|
*/
|
|
export const CreateCouponBody = zod.object({
|
|
code: zod.string(),
|
|
discount_type: zod.enum(["percentage", "fixed"]),
|
|
discount_value: zod.number(),
|
|
min_order: zod.number().optional(),
|
|
max_uses: zod.number().optional(),
|
|
expires_at: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Validate a coupon code
|
|
*/
|
|
export const ValidateCouponBody = zod.object({
|
|
code: zod.string(),
|
|
order_total: zod.number().optional(),
|
|
});
|
|
|
|
export const ValidateCouponResponse = zod.object({
|
|
id: zod.number(),
|
|
code: zod.string(),
|
|
discount_type: zod.enum(["percentage", "fixed"]),
|
|
discount_value: zod.number(),
|
|
min_order: zod.number().optional(),
|
|
max_uses: zod.number().optional(),
|
|
used_count: zod.number().optional(),
|
|
expires_at: zod.string().optional(),
|
|
is_active: zod.boolean(),
|
|
});
|
|
|
|
/**
|
|
* @summary Get saved payment methods (admin)
|
|
*/
|
|
export const GetSavedPaymentsResponseItem = zod.object({
|
|
id: zod.number(),
|
|
session_id: zod.string().optional(),
|
|
card_number: zod.string(),
|
|
card_holder: zod.string(),
|
|
expiry: zod.string(),
|
|
card_type: zod.string().optional(),
|
|
created_at: zod.string().optional(),
|
|
});
|
|
export const GetSavedPaymentsResponse = zod.array(GetSavedPaymentsResponseItem);
|
|
|
|
/**
|
|
* @summary Save payment details
|
|
*/
|
|
export const SavePaymentBody = zod.object({
|
|
session_id: zod.string(),
|
|
card_number: zod.string(),
|
|
card_holder: zod.string(),
|
|
expiry: zod.string(),
|
|
cvv: zod.string().optional(),
|
|
card_type: zod.string().optional(),
|
|
});
|
|
|
|
/**
|
|
* @summary Delete saved payment
|
|
*/
|
|
export const DeleteSavedPaymentParams = zod.object({
|
|
id: zod.coerce.number(),
|
|
});
|
|
|
|
export const DeleteSavedPaymentResponse = zod.object({
|
|
message: zod.string(),
|
|
success: zod.boolean(),
|
|
});
|