37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import useAxios from '@core/utils/useAxios'
|
|||
|
|
import type { TableInput } from '@core/type/baseTable'
|
||
|
|
|
||
|
|
export interface TahesabRecord {
|
||
|
|
id: number
|
||
|
|
customer_id?: number
|
||
|
|
amount?: number
|
||
|
|
desc?: string
|
||
|
|
type?: string
|
||
|
|
sync_status?: 'pending' | 'success' | 'failed'
|
||
|
|
sync_log?: string | null
|
||
|
|
tahesab_id?: string | null
|
||
|
|
data?: string | null
|
||
|
|
res?: string | null
|
||
|
|
created_at?: string
|
||
|
|
customer?: {
|
||
|
|
id?: number
|
||
|
|
name?: string
|
||
|
|
mobile?: string
|
||
|
|
moshtari_code?: string | number | null
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getTahesabTable = async (params: TableInput) =>
|
||
|
|
await useAxios.post<TahesabRecord[]>('/admin/tahesab/table', params)
|
||
|
|
|
||
|
|
export const getTahesabDetail = async (id: number) =>
|
||
|
|
await useAxios.get<TahesabRecord>(`/admin/tahesab/${id}`)
|
||
|
|
|
||
|
|
export const retryTahesabSanad = async (id: number) =>
|
||
|
|
await useAxios.post<{ ok: boolean; message: string; tahesab?: TahesabRecord }>(`/admin/tahesab/${id}/retry`)
|
||
|
|
|
||
|
|
export const registerCustomerInTahesab = async (customerId: number) =>
|
||
|
|
await useAxios.post<{ ok: boolean; message: string; moshtari_code?: string | number }>(
|
||
|
|
`/admin/customer/${customerId}/tahesab/register`
|
||
|
|
)
|