Files
boursecu_user/src/api/digipayInstallment.ts
T

27 lines
851 B
TypeScript
Raw Normal View History

import useAxios from '@/utils/useAxios'
export interface DigipayInstallmentStatus {
enabled: boolean
status: 'none' | 'pending' | 'active' | string
plan4_remaining_toman: number
plan12_remaining_toman: number
gram_price_rial: number
config: {
onboarding_url: string
fee_shop_percent: number
fee_gateway_percent: number
fee_extra_percent: number
plan4_cap_toman: number
plan12_cap_toman: number
}
}
export const fetchDigipayInstallment = () =>
useAxios.get<DigipayInstallmentStatus>('/customer/digipay_installment')
export const startDigipayInstallment = () =>
useAxios.post<DigipayInstallmentStatus>('/customer/digipay_installment/start')
export const buyDigipayInstallment = (plan: 4 | 12, amountToman: number) =>
useAxios.post('/customer/digipay_installment/buy', { plan, amount_toman: amountToman })