26 lines
1023 B
TypeScript
26 lines
1023 B
TypeScript
import client from './client'
|
|
import type { Merchant, MerchantApplication, MerchantStatus } from '../types'
|
|
|
|
export const merchantApi = {
|
|
list: (params: { status?: MerchantStatus; limit?: number; offset?: number }) =>
|
|
client.get<{ data: { list: Merchant[] } }>('/admin/merchant', { params }),
|
|
|
|
get: (merchantID: string) =>
|
|
client.get<{ data: Merchant }>(`/admin/merchant/${merchantID}`),
|
|
|
|
create: (data: Partial<Merchant>) =>
|
|
client.post<{ data: Merchant }>('/admin/merchant', data),
|
|
|
|
freeze: (merchantID: string) =>
|
|
client.post(`/admin/merchant/${merchantID}/freeze`),
|
|
|
|
unfreeze: (merchantID: string) =>
|
|
client.post(`/admin/merchant/${merchantID}/unfreeze`),
|
|
|
|
apply: (merchantID: string, data: { channel_code: string; submit_data?: Record<string, unknown> }) =>
|
|
client.post<{ data: { application_id: string } }>(`/admin/merchant/${merchantID}/apply`, data),
|
|
|
|
auditStatus: (merchantID: string) =>
|
|
client.get<{ data: MerchantApplication }>(`/admin/merchant/${merchantID}/audit`),
|
|
}
|