2021-01-25 17:42:30 +01:00
|
|
|
import apiClient from './api-client';
|
|
|
|
import { AxiosResponse } from 'axios';
|
2021-02-08 08:56:01 +01:00
|
|
|
import {
|
|
|
|
CashCheckResponse,
|
|
|
|
PaymentSchedule,
|
|
|
|
PaymentScheduleIndexRequest,
|
|
|
|
} from '../models/payment-schedule';
|
2021-01-25 17:42:30 +01:00
|
|
|
import wrapPromise, { IWrapPromise } from '../lib/wrap-promise';
|
|
|
|
|
|
|
|
export default class PaymentScheduleAPI {
|
|
|
|
async list (query: PaymentScheduleIndexRequest): Promise<Array<PaymentSchedule>> {
|
|
|
|
const res: AxiosResponse = await apiClient.post(`/api/payment_schedules/list`, query);
|
|
|
|
return res?.data;
|
|
|
|
}
|
|
|
|
|
2021-02-08 08:56:01 +01:00
|
|
|
async cashCheck(paymentScheduleItemId: number): Promise<CashCheckResponse> {
|
2021-02-04 17:00:02 +01:00
|
|
|
const res: AxiosResponse = await apiClient.post(`/api/payment_schedules/items/${paymentScheduleItemId}/cash_check`);
|
|
|
|
return res?.data;
|
|
|
|
}
|
|
|
|
|
2021-02-08 15:28:47 +01:00
|
|
|
async refreshItem(paymentScheduleItemId: number): Promise<void> {
|
|
|
|
const res: AxiosResponse = await apiClient.post(`/api/payment_schedules/items/${paymentScheduleItemId}/refresh_item`);
|
|
|
|
return res?.data;
|
|
|
|
}
|
|
|
|
|
2021-01-25 17:42:30 +01:00
|
|
|
static list (query: PaymentScheduleIndexRequest): IWrapPromise<Array<PaymentSchedule>> {
|
|
|
|
const api = new PaymentScheduleAPI();
|
|
|
|
return wrapPromise(api.list(query));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|