This commit is contained in:
2026-05-22 22:34:00 +03:00
parent fac5e2ea5e
commit 52a0b7f3c7
14 changed files with 823 additions and 158 deletions

View File

@@ -107,3 +107,61 @@ export function createOrder(payload: CreateOrderPayload): Promise<OrderResult> {
body: JSON.stringify(payload),
}, true)
}
export type OrderStatus = 'pending' | 'completed' | 'cancelled' | 'failed'
export interface Order {
id: string
created_at: string
updated_at: string
user_id: string
usdt_amount: string
usdt_exchange_rate: string
gas_fee: string
total_price: string
service_fee: string
status: OrderStatus
client_payment_id: string
itpay_payment_qr_url_desktop: string
itpay_payment_qr_url_android: string
itpay_payment_qr_url_ios: string
itpay_payment_qr_image_desktop: string
itpay_payment_qr_image_android: string
itpay_payment_qr_image_ios: string
itpay_id: string
itpay_qr_id: string
itpay_amount: string
itpay_created_at: string
}
export interface Payment {
id: string
created_at: string
updated_at: string
user_id: string
order_id: string
status: OrderStatus
receipt_cloudekassir_id: string
receipt_cloudekassir_link: string
itpay_payment_id: string
itpay_paid_amount: string
transaction_id: string
web3_transaction_hash: string
paid_at: string
expired_date: string
}
export interface OrderWithPayment {
order: Order
payment: Payment
}
export interface OrdersResponse {
orders: OrderWithPayment[]
}
export const ORDERS_LIMIT = 20
export function getOrders(offset: number, limit: number = ORDERS_LIMIT): Promise<OrdersResponse> {
return doPaymentRequest(`/payment/orders?offset=${offset}&limit=${limit}`, {}, true)
}