Tasa Cero: regenerate API types + installment-plan client helpers

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Carlos Escalante
2026-07-03 16:13:18 -06:00
parent 3cd2927b5f
commit c563618957
2 changed files with 375 additions and 0 deletions

View File

@@ -396,6 +396,53 @@ export interface paths {
patch?: never; patch?: never;
trace?: never; trace?: never;
}; };
"/api/v1/installment-plans/": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** List Installment Plans */
get: operations["list_installment_plans_api_v1_installment_plans__get"];
put?: never;
/**
* Create Installment Plan
* @description Convert an existing credit-card purchase into a Tasa Cero plan.
*/
post: operations["create_installment_plan_api_v1_installment_plans__post"];
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/api/v1/installment-plans/{plan_id}": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/** Get Installment Plan */
get: operations["get_installment_plan_api_v1_installment_plans__plan_id__get"];
put?: never;
post?: never;
/**
* Delete Installment Plan
* @description Unconvert: remove the plan and its cuotas; the anchor becomes a normal
* transaction again.
*/
delete: operations["delete_installment_plan_api_v1_installment_plans__plan_id__delete"];
options?: never;
head?: never;
/**
* Update Installment Plan
* @description Edit a plan; cuota rows are regenerated (per-cuota edits are lost).
*/
patch: operations["update_installment_plan_api_v1_installment_plans__plan_id__patch"];
trace?: never;
};
"/api/v1/municipal-receipts/": { "/api/v1/municipal-receipts/": {
parameters: { parameters: {
query?: never; query?: never;
@@ -1189,6 +1236,121 @@ export interface components {
/** Detail */ /** Detail */
detail?: components["schemas"]["ValidationError"][]; detail?: components["schemas"]["ValidationError"][];
}; };
/** InstallmentPlanCreate */
InstallmentPlanCreate: {
/** First Installment Date */
first_installment_date?: string | null;
/**
* Num Installments
* @default 3
*/
num_installments: number;
/** Transaction Id */
transaction_id: number;
};
/** InstallmentPlanDetail */
InstallmentPlanDetail: {
/** Anchor Transaction Id */
anchor_transaction_id: number;
/**
* Cuotas
* @default []
*/
cuotas: components["schemas"]["TransactionRead"][];
/** Cuotas Billed */
cuotas_billed: number;
/** Currency */
currency: string;
/**
* First Installment Date
* Format: date-time
*/
first_installment_date: string;
/** Id */
id: number;
/** Installment Amount */
installment_amount: number;
/** Is Completed */
is_completed: boolean;
/** Last Installment Amount */
last_installment_amount: number;
/** Merchant */
merchant: string;
/** Next Cuota Date */
next_cuota_date?: string | null;
/** Notes */
notes?: string | null;
/** Num Installments */
num_installments: number;
/** Paid Amount */
paid_amount: number;
/**
* Purchase Date
* Format: date-time
*/
purchase_date: string;
/** Remaining Amount */
remaining_amount: number;
/** Total Amount */
total_amount: number;
};
/** InstallmentPlanListResponse */
InstallmentPlanListResponse: {
/** Plans */
plans: components["schemas"]["InstallmentPlanRead"][];
/** Total Remaining */
total_remaining: number;
};
/** InstallmentPlanRead */
InstallmentPlanRead: {
/** Anchor Transaction Id */
anchor_transaction_id: number;
/** Cuotas Billed */
cuotas_billed: number;
/** Currency */
currency: string;
/**
* First Installment Date
* Format: date-time
*/
first_installment_date: string;
/** Id */
id: number;
/** Installment Amount */
installment_amount: number;
/** Is Completed */
is_completed: boolean;
/** Last Installment Amount */
last_installment_amount: number;
/** Merchant */
merchant: string;
/** Next Cuota Date */
next_cuota_date?: string | null;
/** Notes */
notes?: string | null;
/** Num Installments */
num_installments: number;
/** Paid Amount */
paid_amount: number;
/**
* Purchase Date
* Format: date-time
*/
purchase_date: string;
/** Remaining Amount */
remaining_amount: number;
/** Total Amount */
total_amount: number;
};
/** InstallmentPlanUpdate */
InstallmentPlanUpdate: {
/** First Installment Date */
first_installment_date?: string | null;
/** Notes */
notes?: string | null;
/** Num Installments */
num_installments?: number | null;
};
/** LoginRequest */ /** LoginRequest */
LoginRequest: { LoginRequest: {
/** Password */ /** Password */
@@ -1857,6 +2019,13 @@ export interface components {
deferred_to_next_cycle: boolean; deferred_to_next_cycle: boolean;
/** Id */ /** Id */
id: number; id: number;
/** Installment Plan Id */
installment_plan_id?: number | null;
/**
* Is Installment Anchor
* @default false
*/
is_installment_anchor: boolean;
/** Merchant */ /** Merchant */
merchant: string; merchant: string;
/** Notes */ /** Notes */
@@ -2955,6 +3124,183 @@ export interface operations {
}; };
}; };
}; };
list_installment_plans_api_v1_installment_plans__get: {
parameters: {
query?: never;
header?: {
authorization?: string | null;
};
path?: never;
cookie?: {
ws_token?: string | null;
};
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["InstallmentPlanListResponse"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
create_installment_plan_api_v1_installment_plans__post: {
parameters: {
query?: never;
header?: {
authorization?: string | null;
};
path?: never;
cookie?: {
ws_token?: string | null;
};
};
requestBody: {
content: {
"application/json": components["schemas"]["InstallmentPlanCreate"];
};
};
responses: {
/** @description Successful Response */
201: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["InstallmentPlanRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
get_installment_plan_api_v1_installment_plans__plan_id__get: {
parameters: {
query?: never;
header?: {
authorization?: string | null;
};
path: {
plan_id: number;
};
cookie?: {
ws_token?: string | null;
};
};
requestBody?: never;
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["InstallmentPlanDetail"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
delete_installment_plan_api_v1_installment_plans__plan_id__delete: {
parameters: {
query?: never;
header?: {
authorization?: string | null;
};
path: {
plan_id: number;
};
cookie?: {
ws_token?: string | null;
};
};
requestBody?: never;
responses: {
/** @description Successful Response */
204: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
update_installment_plan_api_v1_installment_plans__plan_id__patch: {
parameters: {
query?: never;
header?: {
authorization?: string | null;
};
path: {
plan_id: number;
};
cookie?: {
ws_token?: string | null;
};
};
requestBody: {
content: {
"application/json": components["schemas"]["InstallmentPlanUpdate"];
};
};
responses: {
/** @description Successful Response */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["InstallmentPlanRead"];
};
};
/** @description Validation Error */
422: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
list_receipts_api_v1_municipal_receipts__get: { list_receipts_api_v1_municipal_receipts__get: {
parameters: { parameters: {
query?: never; query?: never;

View File

@@ -240,6 +240,35 @@ export const upsertBalanceOverride = (
export const deleteBalanceOverride = (year: number, month: number) => export const deleteBalanceOverride = (year: number, month: number) =>
api.delete(`/budget/balance-override/${year}/${month}`); api.delete(`/budget/balance-override/${year}/${month}`);
// --- Installment Plans (Tasa Cero) ---
export type InstallmentPlan = Schema<'InstallmentPlanRead'>;
export type InstallmentPlanDetail = Schema<'InstallmentPlanDetail'>;
export type InstallmentPlanListResponse = Schema<'InstallmentPlanListResponse'>;
export interface InstallmentPlanCreate {
transaction_id: number;
num_installments?: number;
first_installment_date?: string | null;
}
export interface InstallmentPlanUpdate {
num_installments?: number;
first_installment_date?: string | null;
notes?: string | null;
}
export const getInstallmentPlans = () =>
api.get<InstallmentPlanListResponse>("/installment-plans/");
export const getInstallmentPlanDetail = (id: number) =>
api.get<InstallmentPlanDetail>(`/installment-plans/${id}`);
export const createInstallmentPlan = (data: InstallmentPlanCreate) =>
api.post<InstallmentPlan>("/installment-plans/", data);
export const updateInstallmentPlan = (id: number, data: InstallmentPlanUpdate) =>
api.patch<InstallmentPlan>(`/installment-plans/${id}`, data);
export const deleteInstallmentPlan = (id: number) =>
api.delete(`/installment-plans/${id}`);
// --- Salarios --- // --- Salarios ---
export type SalariosSummary = Schema<'SalariosSummary'>; export type SalariosSummary = Schema<'SalariosSummary'>;