@cbm-common/cbm-types 0.0.364 → 0.0.365

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { CbmIdentificationModel } from './identification.domain.model';
1
2
  export declare namespace CbmBillingModel {
2
3
  interface GetRucSriBody {
3
4
  ruc: string;
@@ -6,6 +7,8 @@ export declare namespace CbmBillingModel {
6
7
  statusCode: number;
7
8
  body: string;
8
9
  datosRuc?: GetRucSriResponse.Data;
10
+ /** Respuesta completa de api-scrap (establecimientos, representantes legales, avisos del SRI, etc.). */
11
+ rawData?: CbmIdentificationModel.SearchRucResponse;
9
12
  }
10
13
  namespace GetRucSriResponse {
11
14
  interface Data {
@@ -28,6 +31,8 @@ export declare namespace CbmBillingModel {
28
31
  statusCode: number;
29
32
  body: string;
30
33
  datosCedula?: GetCedulaResponse.Data;
34
+ /** Respuesta completa de api-scrap (profesión, padres, fecha de defunción, RUC de la persona, etc.). */
35
+ rawData?: CbmIdentificationModel.SearchCedulaResponse;
31
36
  }
32
37
  namespace GetCedulaResponse {
33
38
  interface Data {
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Respuestas de api-scrap ("Utilitarios Scraper API", https://api-scrap.cbmerp.com/openapi.json):
3
+ * `/SRI/search-ruc`, `/SRI/search-cedula`, `/SRI/search-placa` y `/SRI/search-chasis`.
4
+ * Tipadas según el OpenAPI y respuestas reales. Los campos que el portal no devuelve vienen en `null`.
5
+ * Los resultados quedan en caché unos minutos en api-scrap.
6
+ */
7
+ export declare namespace CbmIdentificationModel {
8
+ interface SearchRucResponse {
9
+ ruc: string;
10
+ razon_social: string | null;
11
+ /** Ej. `ACTIVO`, `SUSPENDIDO`, `CANCELADO`. */
12
+ estado: string | null;
13
+ actividad_principal: string | null;
14
+ /** Ej. `SOCIEDAD`, `PERSONA NATURAL`. */
15
+ tipo_contribuyente: string | null;
16
+ regimen: string | null;
17
+ categoria: string | null;
18
+ obligado_contabilidad: boolean | null;
19
+ agente_retencion: boolean | null;
20
+ contribuyente_especial: boolean | null;
21
+ contribuyente_fantasma: boolean | null;
22
+ transacciones_inexistentes: boolean | null;
23
+ motivo_cancelacion_suspension: string | null;
24
+ fechas: SearchRucResponse.Fechas;
25
+ representantes_legales: SearchRucResponse.RepresentanteLegal[];
26
+ establecimientos: SearchRucResponse.Establecimiento[];
27
+ }
28
+ namespace SearchRucResponse {
29
+ /** Fechas en formato `YYYY-MM-DD`. */
30
+ interface Fechas {
31
+ inicio_actividades: string | null;
32
+ cese: string | null;
33
+ reinicio_actividades: string | null;
34
+ actualizacion: string | null;
35
+ }
36
+ interface RepresentanteLegal {
37
+ identificacion: string | null;
38
+ nombre: string | null;
39
+ }
40
+ interface Establecimiento {
41
+ /** Ej. `001`. La matriz no siempre es el `001`: usar `matriz`. */
42
+ numero: string | null;
43
+ nombre_comercial: string | null;
44
+ /** `MAT` (matriz) u `OFI` (oficina). */
45
+ tipo: string | null;
46
+ /** Formato `PROVINCIA / CANTÓN / PARROQUIA / calle`. */
47
+ direccion: string | null;
48
+ /** `ABIERTO` o `CERRADO`. */
49
+ estado: string | null;
50
+ matriz: boolean;
51
+ }
52
+ }
53
+ interface SearchCedulaResponse {
54
+ /** Origen del dato (ej. `saccs`, `lr`). */
55
+ fuente: string;
56
+ cedula: string;
57
+ nombre_completo: string | null;
58
+ nombres: string | null;
59
+ apellido_paterno: string | null;
60
+ apellido_materno: string | null;
61
+ tipo_persona: string | null;
62
+ existe_registro_civil: boolean | null;
63
+ /** Formato `DD/MM/YYYY`. */
64
+ fecha_nacimiento: string | null;
65
+ lugar_nacimiento: string | null;
66
+ nacionalidad: string | null;
67
+ /** `HOMBRE` o `MUJER`. */
68
+ sexo: string | null;
69
+ /** Ej. `SOLTERO`, `CASADO`, `VIUDO`, `DIVORCIADO`. */
70
+ estado_civil: string | null;
71
+ conyuge: string | null;
72
+ condicion_cedulado: string | null;
73
+ /** Formato `DD/MM/YYYY`. */
74
+ fecha_cedulacion: string | null;
75
+ /** Formato `DD/MM/YYYY`; `null` si la persona vive. */
76
+ fecha_defuncion: string | null;
77
+ instruccion: string | null;
78
+ profesion: string | null;
79
+ nombre_madre: string | null;
80
+ nombre_padre: string | null;
81
+ /** Formato `PROVINCIA/CANTÓN/PARROQUIA`. */
82
+ domicilio: string | null;
83
+ calle: string | null;
84
+ /** Suele venir `000` cuando no hay número. */
85
+ numero_casa: string | null;
86
+ /** Datos del RUC de la persona, si tiene. */
87
+ ruc: SearchRucResponse | null;
88
+ }
89
+ /** Datos del vehículo y rubros de matriculación a pagar. La placa se normaliza a mayúsculas y sin guiones. */
90
+ interface SearchPlacaResponse {
91
+ placa: string;
92
+ vehiculo: SearchPlacaResponse.Vehiculo;
93
+ rubros: SearchPlacaResponse.Rubro[];
94
+ total_a_pagar: number;
95
+ }
96
+ namespace SearchPlacaResponse {
97
+ /** Fechas en formato `YYYY-MM-DD`. */
98
+ interface Vehiculo {
99
+ codigo_vehiculo: number;
100
+ placa: string;
101
+ camv_cpn: string | null;
102
+ marca: string | null;
103
+ modelo: string | null;
104
+ anio: number | null;
105
+ pais_origen: string | null;
106
+ color_1: string | null;
107
+ color_2: string | null;
108
+ cilindraje: string | null;
109
+ clase: string | null;
110
+ servicio: string | null;
111
+ canton: string | null;
112
+ ultimo_anio_pagado: number | null;
113
+ fecha_ultima_matricula: string | null;
114
+ fecha_caducidad_matricula: string | null;
115
+ fecha_revision: string | null;
116
+ fecha_compra_registro: string | null;
117
+ prohibido_enajenar: boolean | null;
118
+ exoneracion: boolean | null;
119
+ aplica_cuota: boolean | null;
120
+ observacion: string | null;
121
+ }
122
+ /** Rubro de matriculación a pagar (impuesto a la propiedad, tasas ANT, SPPAT, etc.). */
123
+ interface Rubro {
124
+ codigo: number;
125
+ descripcion: string | null;
126
+ beneficiario: string | null;
127
+ tipo_deuda: string | null;
128
+ descripcion_tipo_deuda: string | null;
129
+ valor: number;
130
+ anio_desde: number | null;
131
+ anio_hasta: number | null;
132
+ }
133
+ }
134
+ /** Misma respuesta que la consulta por placa, buscando por número de chasis (VIN). */
135
+ type SearchChasisResponse = SearchPlacaResponse;
136
+ /**
137
+ * Cuerpo de error de api-scrap: 400 parámetro inválido, 401 token inválido o ausente,
138
+ * 404 no existe en el portal, 502 / 504 el portal de origen falló o no respondió.
139
+ */
140
+ interface ErrorResponse {
141
+ detail: string;
142
+ }
143
+ /** Cuerpo del 422 (validación de FastAPI): `detail` es un arreglo. */
144
+ interface HTTPValidationError {
145
+ detail: ValidationError[];
146
+ }
147
+ interface ValidationError {
148
+ loc: (string | number)[];
149
+ msg: string;
150
+ type: string;
151
+ input?: unknown;
152
+ ctx?: Record<string, unknown>;
153
+ }
154
+ }
@@ -0,0 +1,11 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ICbmIdentificationInfrastructureRepository } from '../../infrastructure/repositories/identification.infrastructure.repository';
3
+ import { CbmIdentificationModel } from '../models/identification.domain.model';
4
+ export declare class CbmIdentificationDomainRepository implements ICbmIdentificationInfrastructureRepository {
5
+ private readonly service;
6
+ constructor(service: ICbmIdentificationInfrastructureRepository);
7
+ searchRuc(ruc: string): Observable<CbmIdentificationModel.SearchRucResponse>;
8
+ searchCedula(cedula: string): Observable<CbmIdentificationModel.SearchCedulaResponse>;
9
+ searchPlaca(placa: string): Observable<CbmIdentificationModel.SearchPlacaResponse>;
10
+ searchChasis(chasis: string): Observable<CbmIdentificationModel.SearchChasisResponse>;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { Observable } from 'rxjs';
2
+ import { CbmIdentificationModel } from '../../domain/models/identification.domain.model';
3
+ export interface ICbmIdentificationInfrastructureRepository {
4
+ searchRuc(ruc: string): Observable<CbmIdentificationModel.SearchRucResponse>;
5
+ searchCedula(cedula: string): Observable<CbmIdentificationModel.SearchCedulaResponse>;
6
+ searchPlaca(placa: string): Observable<CbmIdentificationModel.SearchPlacaResponse>;
7
+ searchChasis(chasis: string): Observable<CbmIdentificationModel.SearchChasisResponse>;
8
+ }
@@ -1,10 +1,31 @@
1
1
  import { ICbmBillingInfrastructureRepository } from '../repositories/billing.infrastructure.repository';
2
- import { HttpClient } from '@angular/common/http';
3
2
  import { Observable } from 'rxjs';
4
3
  import { CbmBillingModel } from '../../domain/models/billing.domain.model';
4
+ import { CbmIdentificationInfrastructureService } from './identification.infrastructure.service';
5
+ /**
6
+ * Mantiene el contrato `datosRuc` / `datosCedula` que ya usan todas las pantallas (BILLING_REPOSITORY),
7
+ * pero obtiene los datos de api-scrap a través de `CbmIdentificationInfrastructureService`.
8
+ * La respuesta completa de api-scrap (establecimientos, representantes, banderas del SRI, etc.)
9
+ * va tipada en `rawData`.
10
+ */
5
11
  export declare class CbmBillingInfrastructureService implements ICbmBillingInfrastructureRepository {
6
- private readonly http;
7
- constructor(http: HttpClient);
12
+ private readonly identificationService;
13
+ constructor(identificationService: CbmIdentificationInfrastructureService);
8
14
  getRucSri(data: CbmBillingModel.GetRucSriBody): Observable<CbmBillingModel.GetRucSriResponse>;
9
15
  getCedula(data: CbmBillingModel.GetCedulaBody): Observable<CbmBillingModel.GetCedulaResponse>;
16
+ /**
17
+ * Las pantallas leen el error como `error.error.message` (muchas sin `?.`), igual que respondía ms-util.
18
+ * api-scrap usa `{ detail }` y un fallo de red no trae cuerpo, así que todo error sale con esa misma forma.
19
+ */
20
+ private toLegacyError;
21
+ private errorMessage;
22
+ /**
23
+ * Sin `nombre_completo` se lanza error para que las pantallas caigan en su callback `error`
24
+ * ("No se pudo extraer los datos") en vez de un falso éxito.
25
+ */
26
+ private toDatosCedula;
27
+ /**
28
+ * El nombre comercial y la dirección salen del establecimiento con `matriz: true` (no siempre es el 001).
29
+ */
30
+ private toDatosRuc;
10
31
  }
@@ -0,0 +1,20 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { Observable } from 'rxjs';
3
+ import { ICbmIdentificationInfrastructureRepository } from '../repositories/identification.infrastructure.repository';
4
+ import { CbmIdentificationModel } from '../../domain/models/identification.domain.model';
5
+ /**
6
+ * Consulta directa a api-scrap (`/SRI/search-ruc`, `/SRI/search-cedula`, `/SRI/search-placa`,
7
+ * `/SRI/search-chasis`).
8
+ * Se autentica con la cabecera `X-Api-Key`. Errores: `{ detail }` con 400 (parámetro inválido),
9
+ * 401 (token inválido), 404 (no existe), 422 (validación), 502 / 504 (falla del portal de origen).
10
+ */
11
+ export declare class CbmIdentificationInfrastructureService implements ICbmIdentificationInfrastructureRepository {
12
+ private readonly http;
13
+ constructor(http: HttpClient);
14
+ private readonly url;
15
+ private readonly headers;
16
+ searchRuc(ruc: string): Observable<CbmIdentificationModel.SearchRucResponse>;
17
+ searchCedula(cedula: string): Observable<CbmIdentificationModel.SearchCedulaResponse>;
18
+ searchPlaca(placa: string): Observable<CbmIdentificationModel.SearchPlacaResponse>;
19
+ searchChasis(chasis: string): Observable<CbmIdentificationModel.SearchChasisResponse>;
20
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cbm-common/cbm-types",
3
- "version": "0.0.364",
3
+ "version": "0.0.365",
4
4
  "main": "index.js",
5
5
  "types": "public-api.d.ts",
6
6
  "exports": {
@@ -1,13 +0,0 @@
1
- import { AfterViewInit, ElementRef, OnChanges, Renderer2, SimpleChanges } from '@angular/core';
2
- export declare class DropdownMenuDirective implements OnChanges, AfterViewInit {
3
- private element;
4
- private renderer2;
5
- hiddenMenu: import("@angular/core").InputSignal<boolean>;
6
- hiddenMenuOp: import("@angular/core").WritableSignal<boolean>;
7
- constructor(element: ElementRef, renderer2: Renderer2);
8
- ngAfterViewInit(): void;
9
- ngOnChanges(changes: SimpleChanges): void;
10
- toggle(event: Event): void;
11
- private toggleMenu;
12
- initStyle(): void;
13
- }
@@ -1,10 +0,0 @@
1
- import { AfterViewInit, ElementRef, Renderer2 } from '@angular/core';
2
- export declare class DropdownDirective implements AfterViewInit {
3
- private elementRef;
4
- private renderer;
5
- private isOpen;
6
- constructor(elementRef: ElementRef, renderer: Renderer2);
7
- ngAfterViewInit(): void;
8
- toggleDropdown(event: MouseEvent): void;
9
- closeDropdown(event: MouseEvent): void;
10
- }
@@ -1,13 +0,0 @@
1
- import { WritableSignal } from '@angular/core';
2
- import { Router, ActivatedRoute, Params } from '@angular/router';
3
- import { CbmRecordDetailMetadataModel } from "../../types";
4
- export declare class OptionsComponent {
5
- private router;
6
- private route;
7
- constructor(router: Router, route: ActivatedRoute);
8
- metadata: import("@angular/core").InputSignal<CbmRecordDetailMetadataModel.metadata | null>;
9
- options: import("@angular/core").InputSignal<CbmRecordDetailMetadataModel.options[] | undefined>;
10
- optionInSignals: WritableSignal<WritableSignal<CbmRecordDetailMetadataModel.options>[]>;
11
- executeFunction(option: WritableSignal<CbmRecordDetailMetadataModel.options>): void;
12
- navigate(routerLink?: string, queryParams?: Params): void;
13
- }
@@ -1,13 +0,0 @@
1
- import { AfterViewInit, ElementRef, OnChanges, Renderer2, SimpleChanges } from '@angular/core';
2
- export declare class DropdownMenuDirective implements OnChanges, AfterViewInit {
3
- private element;
4
- private renderer2;
5
- hiddenMenu: import("@angular/core").InputSignal<boolean>;
6
- hiddenMenuOp: import("@angular/core").WritableSignal<boolean>;
7
- constructor(element: ElementRef, renderer2: Renderer2);
8
- ngAfterViewInit(): void;
9
- ngOnChanges(changes: SimpleChanges): void;
10
- toggle(event: Event): void;
11
- private toggleMenu;
12
- initStyle(): void;
13
- }
@@ -1,9 +0,0 @@
1
- import { ElementRef, Renderer2 } from '@angular/core';
2
- export declare class DropdownDirective {
3
- private elementRef;
4
- private renderer;
5
- private isOpen;
6
- constructor(elementRef: ElementRef, renderer: Renderer2);
7
- toggleDropdown(event: MouseEvent): void;
8
- closeDropdown(event: MouseEvent): void;
9
- }
@@ -1,91 +0,0 @@
1
- export declare namespace CbmSalesPendingDocumentModel {
2
- type TTypeEstablishment = 'matrix' | 'branch';
3
- export interface ListParams {
4
- page: number;
5
- size: number;
6
- document_number?: string;
7
- date_end?: number;
8
- date_begin?: number;
9
- client_id?: string;
10
- client_branch_id?: string;
11
- type?: string;
12
- }
13
- export interface ListResponse {
14
- success: boolean;
15
- pageNum: number;
16
- pageSize: number;
17
- pages: number;
18
- total: number;
19
- totales: ListResponse.totales;
20
- items: ListResponse.Item[];
21
- }
22
- export namespace ListResponse {
23
- interface Item {
24
- _id: string;
25
- created_at: number;
26
- document_nomenclature: string;
27
- document_emission_point_number: string;
28
- document_sequence: string;
29
- balance: number;
30
- client_id: string;
31
- client_payment_deadline?: number;
32
- client_credit_limit?: number;
33
- client_business_name: string;
34
- client_trade_name: string;
35
- client_document_number: string;
36
- client_credit_application: boolean;
37
- client_price_list_id: string;
38
- client_price_list_code: string;
39
- client_price_list_name: string;
40
- client_document_type_id: string;
41
- client_document_type_name: string;
42
- client_document_type_code: string;
43
- client_category_id: string;
44
- client_category_name: string;
45
- client_branch_id: string;
46
- client_branch_code: string;
47
- client_branch_name: string;
48
- client_branch_address: string;
49
- client_branch_email: string[];
50
- client_branch_phone_code?: string;
51
- client_branch_phone?: string;
52
- client_branch_cellphone?: string;
53
- client_branch_type_establishment: `${TTypeEstablishment}`;
54
- client_branch_province_id?: string;
55
- client_branch_province_code?: string;
56
- client_branch_province_name?: string;
57
- client_branch_canton_id?: string;
58
- client_branch_canton_code?: string;
59
- client_branch_canton_name?: string;
60
- client_branch_parish_id?: string;
61
- client_branch_parish_code?: string;
62
- client_branch_parish_name?: string;
63
- client_branch_longitude?: number;
64
- client_branch_latitude?: number;
65
- client_branch_seller_id: string;
66
- client_branch_seller_identification_number: string;
67
- client_branch_seller_full_name: string;
68
- client_branch_seller_address: string;
69
- client_branch_seller_email: string[];
70
- client_branch_seller_cellphone: string;
71
- client_branch_contact_id?: string;
72
- client_branch_contact_identification_number?: string;
73
- client_branch_contact_full_name?: string;
74
- client_branch_contact_cellphone?: string;
75
- client_branch_contact_email?: string[];
76
- new_document_number: string;
77
- date: number;
78
- type: string;
79
- checked?: boolean;
80
- }
81
- interface totales {
82
- total_retention?: number;
83
- total_down_payment?: number;
84
- total_credit_note?: number;
85
- total_initial_balance_retention?: number;
86
- total_initial_balance_down_payment?: number;
87
- total_initial_balance_credit_note?: number;
88
- }
89
- }
90
- export {};
91
- }
@@ -1,8 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { CbmSalesPendingDocumentModel } from '../models/sales-pending-document.domain.model';
3
- import { ICbmSalesPendingDocumentRepository } from '../../infrastructure/repositories/sales-pending-document.infrastructure.repository';
4
- export declare class CbmSalesPendingDocumentRepository implements ICbmSalesPendingDocumentRepository {
5
- private service;
6
- constructor(service: ICbmSalesPendingDocumentRepository);
7
- list(params: CbmSalesPendingDocumentModel.ListParams): Observable<CbmSalesPendingDocumentModel.ListResponse>;
8
- }
@@ -1,7 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { CbmBlanketAgreementCategoryServiceModel } from "../../domain/models/blanket-agreement-category-service.domain.model";
3
- export interface ICbmBlanketAgreementCategoryServiceRepository {
4
- list(params: CbmBlanketAgreementCategoryServiceModel.ListParams): Observable<CbmBlanketAgreementCategoryServiceModel.ListResponse>;
5
- save(data: CbmBlanketAgreementCategoryServiceModel.SaveBody): Observable<CbmBlanketAgreementCategoryServiceModel.ConfirmResponse>;
6
- delete(id: string): Observable<CbmBlanketAgreementCategoryServiceModel.ConfirmResponse>;
7
- }
@@ -1,5 +0,0 @@
1
- import { Observable } from 'rxjs';
2
- import { CbmSalesPendingDocumentModel } from '../../domain/models/sales-pending-document.domain.model';
3
- export interface ICbmSalesPendingDocumentRepository {
4
- list(params: CbmSalesPendingDocumentModel.ListParams): Observable<CbmSalesPendingDocumentModel.ListResponse>;
5
- }
@@ -1,9 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { Observable } from 'rxjs';
3
- import { CbmSalesPendingDocumentModel } from '../../domain/models/sales-pending-document.domain.model';
4
- export declare class CbmSalesPendingDocumentService {
5
- private http;
6
- constructor(http: HttpClient);
7
- private readonly url;
8
- list(params: CbmSalesPendingDocumentModel.ListParams): Observable<CbmSalesPendingDocumentModel.ListResponse>;
9
- }