feat: implement yookassa redirect payment flow on client
This commit is contained in:
@@ -69,6 +69,18 @@ export async function fetchMyOrder(id: string): Promise<OrderDetailResponse> {
|
||||
return data
|
||||
}
|
||||
|
||||
/** Создать платёж в ЮKassa и получить URL для редиректа на форму оплаты. */
|
||||
export async function createOrderPayment(orderId: string): Promise<{ confirmationUrl: string }> {
|
||||
const { data } = await apiClient.post<{ confirmationUrl: string }>(`me/orders/${orderId}/pay`)
|
||||
return data
|
||||
}
|
||||
|
||||
/** Получить статус платежа для заказа. */
|
||||
export async function getOrderPaymentStatus(orderId: string): Promise<{ status: string | null; paid: boolean }> {
|
||||
const { data } = await apiClient.get<{ status: string | null; paid: boolean }>(`me/orders/${orderId}/payment`)
|
||||
return data
|
||||
}
|
||||
|
||||
export async function postOrderMessage(id: string, text: string): Promise<void> {
|
||||
await apiClient.post(`me/orders/${id}/messages`, { text })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user