1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-13 23:48:55 +01:00
fab-manager/app/frontend/src/javascript/models/payment-schedule.ts
2022-04-26 10:12:50 +02:00

81 lines
1.6 KiB
TypeScript

import { TDateISO, TDateISODate } from '../typings/date-iso';
export enum PaymentScheduleItemState {
New = 'new',
Pending = 'pending',
RequirePaymentMethod = 'requires_payment_method',
RequireAction = 'requires_action',
Paid = 'paid',
Error = 'error',
GatewayCanceled = 'gateway_canceled'
}
export enum PaymentMethod {
Card = 'card',
Transfer = 'transfer',
Check = 'check'
}
export interface PaymentScheduleItem {
id: number,
amount: number,
due_date: TDateISO,
state: PaymentScheduleItemState,
invoice_id: number,
payment_method: PaymentMethod,
client_secret?: string
}
export interface PaymentSchedule {
max_length?: number;
id: number,
total?: number,
reference?: string,
payment_method: PaymentMethod,
items?: Array<PaymentScheduleItem>,
created_at?: TDateISO,
chained_footprint?: boolean,
main_object?: {
type: string,
id: number
},
user?: {
id: number,
name: string
},
operator?: {
id: number,
first_name: string,
last_name: string,
},
gateway?: 'PayZen' | 'Stripe',
}
export interface PaymentScheduleIndexRequest {
query: {
reference?: string,
customer?: string,
date?: TDateISODate,
page: number,
size: number
}
}
export interface CashCheckResponse {
state: PaymentScheduleItemState,
payment_method: PaymentMethod
}
export interface RefreshItemResponse {
state: 'refreshed'
}
export interface PayItemResponse {
status: 'draft' | 'open' | 'paid' | 'uncollectible' | 'void',
error?: string
}
export interface CancelScheduleResponse {
canceled_at: TDateISO
}