46 lines
1.7 KiB
TypeScript
46 lines
1.7 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const SepaBatchTypeEnum = z.enum(['direct_debit', 'credit_transfer']);
|
|
export const SepaBatchStatusEnum = z.enum(['draft', 'ready', 'submitted', 'executed', 'failed', 'cancelled']);
|
|
export const InvoiceStatusEnum = z.enum(['draft', 'sent', 'paid', 'overdue', 'cancelled', 'credited']);
|
|
|
|
export const CreateSepaBatchSchema = z.object({
|
|
accountId: z.string().uuid(),
|
|
batchType: SepaBatchTypeEnum,
|
|
description: z.string().optional(),
|
|
executionDate: z.string(),
|
|
painFormat: z.string().default('pain.008.003.02'),
|
|
});
|
|
export type CreateSepaBatchInput = z.infer<typeof CreateSepaBatchSchema>;
|
|
|
|
export const AddSepaItemSchema = z.object({
|
|
batchId: z.string().uuid(),
|
|
memberId: z.string().uuid().optional(),
|
|
debtorName: z.string().min(1),
|
|
debtorIban: z.string().min(15).max(34),
|
|
debtorBic: z.string().optional(),
|
|
amount: z.number().min(0.01),
|
|
mandateId: z.string().optional(),
|
|
mandateDate: z.string().optional(),
|
|
remittanceInfo: z.string().optional(),
|
|
});
|
|
export type AddSepaItemInput = z.infer<typeof AddSepaItemSchema>;
|
|
|
|
export const CreateInvoiceSchema = z.object({
|
|
accountId: z.string().uuid(),
|
|
invoiceNumber: z.string().min(1),
|
|
memberId: z.string().uuid().optional(),
|
|
recipientName: z.string().min(1),
|
|
recipientAddress: z.string().optional(),
|
|
issueDate: z.string().default(() => new Date().toISOString().split('T')[0]!),
|
|
dueDate: z.string(),
|
|
taxRate: z.number().min(0).default(0),
|
|
notes: z.string().optional(),
|
|
items: z.array(z.object({
|
|
description: z.string().min(1),
|
|
quantity: z.number().min(0.01).default(1),
|
|
unitPrice: z.number(),
|
|
})).min(1),
|
|
});
|
|
export type CreateInvoiceInput = z.infer<typeof CreateInvoiceSchema>;
|