feat: похуйу

This commit is contained in:
2026-05-12 23:14:45 +03:00
parent 2bea3f5eea
commit 35e537933e
8 changed files with 115 additions and 29 deletions

View File

@@ -0,0 +1,46 @@
import { getCsrfToken } from '@shared/api/csrf'
const PAYMENT_API_URL = 'https://app.payment.elcsa.ru'
export interface PaymentConfig {
status_code: number
usdt_exchange_rate: string
gas_fee: string
service_fee_rate: string
one_usdt_service_fee: string
one_usdt_total_price: string
created_at: string
}
export interface PaymentQuote {
status_code: number
usdt_amount: string
usdt_exchange_rate: string
gas_fee: string
service_fee: string
total_price: string
service_fee_rate: string
created_at: string
}
export async function getPaymentConfig(): Promise<PaymentConfig> {
const csrf = await getCsrfToken()
const res = await fetch(`${PAYMENT_API_URL}/config`, {
credentials: 'include',
headers: { 'X-CSRF-Token': csrf },
})
const data = await res.json()
if (!res.ok) throw data
return data
}
export async function getPaymentQuote(usdtAmount: number): Promise<PaymentQuote> {
const csrf = await getCsrfToken()
const res = await fetch(`${PAYMENT_API_URL}/payment/quote?usdt_amount=${usdtAmount}`, {
credentials: 'include',
headers: { 'X-CSRF-Token': csrf },
})
const data = await res.json()
if (!res.ok) throw data
return data
}