83 lines
1.9 KiB
TypeScript
83 lines
1.9 KiB
TypeScript
import { MetadataSchema, MoneySchema, PercentageSchema, QuantitySchema } from "@erp/core";
|
|
import { z } from "zod/v4";
|
|
|
|
export const GetIssuedInvoiceByIdResponseSchema = z.object({
|
|
id: z.uuid(),
|
|
company_id: z.uuid(),
|
|
|
|
is_proforma: z.string(),
|
|
invoice_number: z.string(),
|
|
status: z.string(),
|
|
series: z.string(),
|
|
|
|
invoice_date: z.string(),
|
|
operation_date: z.string(),
|
|
|
|
reference: z.string(),
|
|
description: z.string(),
|
|
notes: z.string(),
|
|
|
|
language_code: z.string(),
|
|
currency_code: z.string(),
|
|
|
|
customer_id: z.string(),
|
|
recipient: z.object({
|
|
id: z.string(),
|
|
name: z.string(),
|
|
tin: z.string(),
|
|
street: z.string(),
|
|
street2: z.string(),
|
|
city: z.string(),
|
|
province: z.string(),
|
|
postal_code: z.string(),
|
|
country: z.string(),
|
|
}),
|
|
|
|
taxes: z.array(
|
|
z.object({
|
|
tax_code: z.string(),
|
|
taxable_amount: MoneySchema,
|
|
taxes_amount: MoneySchema,
|
|
})
|
|
),
|
|
|
|
payment_method: z
|
|
.object({
|
|
payment_id: z.string(),
|
|
payment_description: z.string(),
|
|
})
|
|
.optional(),
|
|
|
|
subtotal_amount: MoneySchema,
|
|
items_discount_amount: MoneySchema,
|
|
discount_percentage: PercentageSchema,
|
|
discount_amount: MoneySchema,
|
|
taxable_amount: MoneySchema,
|
|
taxes_amount: MoneySchema,
|
|
total_amount: MoneySchema,
|
|
|
|
items: z.array(
|
|
z.object({
|
|
id: z.uuid(),
|
|
is_valued: z.string(),
|
|
position: z.string(),
|
|
description: z.string(),
|
|
quantity: QuantitySchema,
|
|
unit_amount: MoneySchema,
|
|
|
|
tax_codes: z.array(z.string()),
|
|
|
|
subtotal_amount: MoneySchema,
|
|
discount_percentage: PercentageSchema,
|
|
discount_amount: MoneySchema,
|
|
taxable_amount: MoneySchema,
|
|
taxes_amount: MoneySchema,
|
|
total_amount: MoneySchema,
|
|
})
|
|
),
|
|
|
|
metadata: MetadataSchema.optional(),
|
|
});
|
|
|
|
export type GetIssuedInvoiceByIdResponseDTO = z.infer<typeof GetIssuedInvoiceByIdResponseSchema>;
|