@fiado/type-kit 3.495.0 → 3.497.0
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.
- package/_test_/unit/loanCredit/dtos/createSellerPaymentRequest.test.ts +63 -0
- package/_test_/unit/loanCredit/inStorePaymentDtos.test.ts +141 -0
- package/_test_/unit/retailIntegration/applyRetailEventRequest.test.ts +43 -0
- package/_test_/unit/retailIntegration/isIsoDateTimeWithZone.test.ts +85 -0
- package/_test_/unit/retailIntegration/receiveRetailEventRequest.test.ts +93 -0
- package/_test_/unit/retailIntegration/retailOutboundRequests.test.ts +69 -0
- package/_test_/unit/retailIntegration/retailSystemEnums.test.ts +42 -0
- package/bin/index.d.ts +1 -0
- package/bin/index.js +3 -1
- package/bin/loanCredit/dtos/requests/CreateSellerPaymentRequest.d.ts +15 -0
- package/bin/loanCredit/dtos/requests/CreateSellerPaymentRequest.js +56 -0
- package/bin/loanCredit/dtos/requests/InStorePaymentDetail.d.ts +12 -0
- package/bin/loanCredit/dtos/requests/InStorePaymentDetail.js +40 -0
- package/bin/loanCredit/dtos/responses/CreditCustomerListItem.d.ts +46 -0
- package/bin/loanCredit/dtos/responses/CreditCustomerListItem.js +2 -0
- package/bin/loanCredit/dtos/responses/InStorePaymentListItem.d.ts +19 -0
- package/bin/loanCredit/dtos/responses/InStorePaymentListItem.js +2 -0
- package/bin/loanCredit/dtos/responses/LoanPaymentListItem.d.ts +14 -1
- package/bin/loanCredit/dtos/responses/SellerCreditLookupResult.d.ts +10 -0
- package/bin/loanCredit/dtos/responses/SellerCreditLookupResult.js +2 -0
- package/bin/loanCredit/dtos/responses/SellerPaymentOptions.d.ts +36 -0
- package/bin/loanCredit/dtos/responses/SellerPaymentOptions.js +2 -0
- package/bin/loanCredit/dtos/responses/SellerPaymentResult.d.ts +39 -0
- package/bin/loanCredit/dtos/responses/SellerPaymentResult.js +2 -0
- package/bin/loanCredit/enums/CreditCustomerStateEnum.d.ts +6 -0
- package/bin/loanCredit/enums/CreditCustomerStateEnum.js +10 -0
- package/bin/loanCredit/enums/InStorePaymentMethodEnum.d.ts +6 -0
- package/bin/loanCredit/enums/InStorePaymentMethodEnum.js +10 -0
- package/bin/loanCredit/enums/LoanPaymentOriginEnum.d.ts +5 -0
- package/bin/loanCredit/enums/LoanPaymentOriginEnum.js +9 -0
- package/bin/loanCredit/index.d.ts +10 -0
- package/bin/loanCredit/index.js +11 -0
- package/bin/retailIntegration/constants/retailIntegrationLimits.d.ts +7 -0
- package/bin/retailIntegration/constants/retailIntegrationLimits.js +10 -0
- package/bin/retailIntegration/dtos/ApplyRetailEventRequest.d.ts +29 -0
- package/bin/retailIntegration/dtos/ApplyRetailEventRequest.js +54 -0
- package/bin/retailIntegration/dtos/GetRetailInventoryRequest.d.ts +5 -0
- package/bin/retailIntegration/dtos/GetRetailInventoryRequest.js +23 -0
- package/bin/retailIntegration/dtos/ListRetailCatalogRequest.d.ts +4 -0
- package/bin/retailIntegration/dtos/ListRetailCatalogRequest.js +8 -0
- package/bin/retailIntegration/dtos/ListRetailStoresRequest.d.ts +4 -0
- package/bin/retailIntegration/dtos/ListRetailStoresRequest.js +8 -0
- package/bin/retailIntegration/dtos/ListRetailUsersRequest.d.ts +5 -0
- package/bin/retailIntegration/dtos/ListRetailUsersRequest.js +24 -0
- package/bin/retailIntegration/dtos/ReceiveInventoryEventRequest.d.ts +6 -0
- package/bin/retailIntegration/dtos/ReceiveInventoryEventRequest.js +23 -0
- package/bin/retailIntegration/dtos/ReceiveProductEventRequest.d.ts +6 -0
- package/bin/retailIntegration/dtos/ReceiveProductEventRequest.js +23 -0
- package/bin/retailIntegration/dtos/ReceiveRetailEventRequest.d.ts +12 -0
- package/bin/retailIntegration/dtos/ReceiveRetailEventRequest.js +2 -0
- package/bin/retailIntegration/dtos/ReceiveRetailUserEventRequest.d.ts +6 -0
- package/bin/retailIntegration/dtos/ReceiveRetailUserEventRequest.js +23 -0
- package/bin/retailIntegration/dtos/ReceiveStoreEventRequest.d.ts +6 -0
- package/bin/retailIntegration/dtos/ReceiveStoreEventRequest.js +23 -0
- package/bin/retailIntegration/dtos/RegisterRetailSaleRequest.d.ts +4 -0
- package/bin/retailIntegration/dtos/RegisterRetailSaleRequest.js +8 -0
- package/bin/retailIntegration/dtos/RetailEventEnvelope.d.ts +8 -0
- package/bin/retailIntegration/dtos/RetailEventEnvelope.js +33 -0
- package/bin/retailIntegration/dtos/RetailEventResult.d.ts +12 -0
- package/bin/retailIntegration/dtos/RetailEventResult.js +2 -0
- package/bin/retailIntegration/dtos/RetailOutboundResponses.d.ts +30 -0
- package/bin/retailIntegration/dtos/RetailOutboundResponses.js +2 -0
- package/bin/retailIntegration/dtos/RetailPagedQuery.d.ts +6 -0
- package/bin/retailIntegration/dtos/RetailPagedQuery.js +34 -0
- package/bin/retailIntegration/dtos/RetailTenantQuery.d.ts +4 -0
- package/bin/retailIntegration/dtos/RetailTenantQuery.js +23 -0
- package/bin/retailIntegration/enums/InventoryEventTypeEnum.d.ts +4 -0
- package/bin/retailIntegration/enums/InventoryEventTypeEnum.js +8 -0
- package/bin/retailIntegration/enums/ProductEventTypeEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/ProductEventTypeEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailCurrencyEnum.d.ts +5 -0
- package/bin/retailIntegration/enums/RetailCurrencyEnum.js +9 -0
- package/bin/retailIntegration/enums/RetailEventResultEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailEventResultEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailFinancierEnum.d.ts +8 -0
- package/bin/retailIntegration/enums/RetailFinancierEnum.js +12 -0
- package/bin/retailIntegration/enums/RetailLinePaymentTypeEnum.d.ts +5 -0
- package/bin/retailIntegration/enums/RetailLinePaymentTypeEnum.js +9 -0
- package/bin/retailIntegration/enums/RetailMdmProviderEnum.d.ts +5 -0
- package/bin/retailIntegration/enums/RetailMdmProviderEnum.js +9 -0
- package/bin/retailIntegration/enums/RetailPaymentMethodEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailPaymentMethodEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailPieceReasonEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailPieceReasonEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailPieceStatusEnum.d.ts +7 -0
- package/bin/retailIntegration/enums/RetailPieceStatusEnum.js +11 -0
- package/bin/retailIntegration/enums/RetailProductCategoryEnum.d.ts +7 -0
- package/bin/retailIntegration/enums/RetailProductCategoryEnum.js +11 -0
- package/bin/retailIntegration/enums/RetailProductStatusEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailProductStatusEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailProductTierEnum.d.ts +7 -0
- package/bin/retailIntegration/enums/RetailProductTierEnum.js +11 -0
- package/bin/retailIntegration/enums/RetailSaleFinancierEnum.d.ts +9 -0
- package/bin/retailIntegration/enums/RetailSaleFinancierEnum.js +13 -0
- package/bin/retailIntegration/enums/RetailSaleTypeEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailSaleTypeEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailStoreStatusEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailStoreStatusEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailTrackingModeEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailTrackingModeEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailUserAccessStatusEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/RetailUserAccessStatusEnum.js +10 -0
- package/bin/retailIntegration/enums/RetailUserEventTypeEnum.d.ts +7 -0
- package/bin/retailIntegration/enums/RetailUserEventTypeEnum.js +11 -0
- package/bin/retailIntegration/enums/RetailUserRoleEnum.d.ts +7 -0
- package/bin/retailIntegration/enums/RetailUserRoleEnum.js +11 -0
- package/bin/retailIntegration/enums/StoreEventTypeEnum.d.ts +6 -0
- package/bin/retailIntegration/enums/StoreEventTypeEnum.js +10 -0
- package/bin/retailIntegration/enums/index.d.ts +21 -0
- package/bin/retailIntegration/enums/index.js +37 -0
- package/bin/retailIntegration/index.d.ts +25 -0
- package/bin/retailIntegration/index.js +41 -0
- package/bin/retailIntegration/models/RetailPageMeta.d.ts +10 -0
- package/bin/retailIntegration/models/RetailPageMeta.js +2 -0
- package/bin/retailIntegration/models/RetailSystemInventory.d.ts +17 -0
- package/bin/retailIntegration/models/RetailSystemInventory.js +2 -0
- package/bin/retailIntegration/models/RetailSystemProduct.d.ts +32 -0
- package/bin/retailIntegration/models/RetailSystemProduct.js +2 -0
- package/bin/retailIntegration/models/RetailSystemSale.d.ts +46 -0
- package/bin/retailIntegration/models/RetailSystemSale.js +2 -0
- package/bin/retailIntegration/models/RetailSystemStore.d.ts +29 -0
- package/bin/retailIntegration/models/RetailSystemStore.js +2 -0
- package/bin/retailIntegration/models/RetailSystemUser.d.ts +14 -0
- package/bin/retailIntegration/models/RetailSystemUser.js +2 -0
- package/bin/retailIntegration/validators/IsIsoDateTimeWithZone.d.ts +6 -0
- package/bin/retailIntegration/validators/IsIsoDateTimeWithZone.js +29 -0
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/loanCredit/dtos/requests/CreateSellerPaymentRequest.ts +40 -0
- package/src/loanCredit/dtos/requests/InStorePaymentDetail.ts +27 -0
- package/src/loanCredit/dtos/responses/CreditCustomerListItem.ts +51 -0
- package/src/loanCredit/dtos/responses/InStorePaymentListItem.ts +21 -0
- package/src/loanCredit/dtos/responses/LoanPaymentListItem.ts +11 -1
- package/src/loanCredit/dtos/responses/SellerCreditLookupResult.ts +11 -0
- package/src/loanCredit/dtos/responses/SellerPaymentOptions.ts +29 -0
- package/src/loanCredit/dtos/responses/SellerPaymentResult.ts +43 -0
- package/src/loanCredit/enums/CreditCustomerStateEnum.ts +6 -0
- package/src/loanCredit/enums/InStorePaymentMethodEnum.ts +6 -0
- package/src/loanCredit/enums/LoanPaymentOriginEnum.ts +5 -0
- package/src/loanCredit/index.ts +12 -0
- package/src/retailIntegration/constants/retailIntegrationLimits.ts +9 -0
- package/src/retailIntegration/dtos/ApplyRetailEventRequest.ts +49 -0
- package/src/retailIntegration/dtos/GetRetailInventoryRequest.ts +9 -0
- package/src/retailIntegration/dtos/ListRetailCatalogRequest.ts +4 -0
- package/src/retailIntegration/dtos/ListRetailStoresRequest.ts +4 -0
- package/src/retailIntegration/dtos/ListRetailUsersRequest.ts +10 -0
- package/src/retailIntegration/dtos/ReceiveInventoryEventRequest.ts +9 -0
- package/src/retailIntegration/dtos/ReceiveProductEventRequest.ts +9 -0
- package/src/retailIntegration/dtos/ReceiveRetailEventRequest.ts +18 -0
- package/src/retailIntegration/dtos/ReceiveRetailUserEventRequest.ts +9 -0
- package/src/retailIntegration/dtos/ReceiveStoreEventRequest.ts +9 -0
- package/src/retailIntegration/dtos/RegisterRetailSaleRequest.ts +4 -0
- package/src/retailIntegration/dtos/RetailEventEnvelope.ts +20 -0
- package/src/retailIntegration/dtos/RetailEventResult.ts +14 -0
- package/src/retailIntegration/dtos/RetailOutboundResponses.ts +35 -0
- package/src/retailIntegration/dtos/RetailPagedQuery.ts +19 -0
- package/src/retailIntegration/dtos/RetailTenantQuery.ts +9 -0
- package/src/retailIntegration/enums/InventoryEventTypeEnum.ts +4 -0
- package/src/retailIntegration/enums/ProductEventTypeEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailCurrencyEnum.ts +5 -0
- package/src/retailIntegration/enums/RetailEventResultEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailFinancierEnum.ts +8 -0
- package/src/retailIntegration/enums/RetailLinePaymentTypeEnum.ts +5 -0
- package/src/retailIntegration/enums/RetailMdmProviderEnum.ts +5 -0
- package/src/retailIntegration/enums/RetailPaymentMethodEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailPieceReasonEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailPieceStatusEnum.ts +7 -0
- package/src/retailIntegration/enums/RetailProductCategoryEnum.ts +7 -0
- package/src/retailIntegration/enums/RetailProductStatusEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailProductTierEnum.ts +7 -0
- package/src/retailIntegration/enums/RetailSaleFinancierEnum.ts +9 -0
- package/src/retailIntegration/enums/RetailSaleTypeEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailStoreStatusEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailTrackingModeEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailUserAccessStatusEnum.ts +6 -0
- package/src/retailIntegration/enums/RetailUserEventTypeEnum.ts +7 -0
- package/src/retailIntegration/enums/RetailUserRoleEnum.ts +7 -0
- package/src/retailIntegration/enums/StoreEventTypeEnum.ts +6 -0
- package/src/retailIntegration/enums/index.ts +21 -0
- package/src/retailIntegration/index.ts +25 -0
- package/src/retailIntegration/models/RetailPageMeta.ts +11 -0
- package/src/retailIntegration/models/RetailSystemInventory.ts +20 -0
- package/src/retailIntegration/models/RetailSystemProduct.ts +43 -0
- package/src/retailIntegration/models/RetailSystemSale.ts +51 -0
- package/src/retailIntegration/models/RetailSystemStore.ts +33 -0
- package/src/retailIntegration/models/RetailSystemUser.ts +16 -0
- package/src/retailIntegration/validators/IsIsoDateTimeWithZone.ts +21 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { InStorePaymentMethodEnum } from '../../enums/InStorePaymentMethodEnum';
|
|
2
|
+
import type { LoanCustomerPaymentTypeEnum } from '../../enums/LoanCustomerPaymentTypeEnum';
|
|
3
|
+
import type { LoanInstallmentStatusEnum } from '../../enums/LoanInstallmentStatusEnum';
|
|
4
|
+
|
|
5
|
+
/** Algo con id y el nombre congelado al cobrar. */
|
|
6
|
+
export interface NamedRef {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** La cuota que sigue después del pago; null si ya no queda ninguna abierta. */
|
|
12
|
+
export interface SellerNextInstallment {
|
|
13
|
+
installmentNumber: number;
|
|
14
|
+
dueDate: string | null;
|
|
15
|
+
amountCents: number;
|
|
16
|
+
status: LoanInstallmentStatusEnum;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** El crédito con su equipo, para que el comprobante diga qué se pagó. */
|
|
20
|
+
export interface SellerPaymentCredit {
|
|
21
|
+
creditId: string;
|
|
22
|
+
imei: string | null;
|
|
23
|
+
productBrand: string | null;
|
|
24
|
+
productModel: string | null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Respuesta 200 de `POST /seller/credits/{creditId}/payments`: el comprobante en pantalla. */
|
|
28
|
+
export interface SellerPaymentResult {
|
|
29
|
+
creditId: string;
|
|
30
|
+
/** Folio `SK-TD-…`. */
|
|
31
|
+
receipt: string;
|
|
32
|
+
amountCents: number;
|
|
33
|
+
type: LoanCustomerPaymentTypeEnum;
|
|
34
|
+
method: InStorePaymentMethodEnum;
|
|
35
|
+
appliedAt: string;
|
|
36
|
+
outstandingBalanceAfterCents: number;
|
|
37
|
+
/** Solo si el pago emitió documento (comprobante de adelanto o constancia de liquidación). */
|
|
38
|
+
documentId?: string;
|
|
39
|
+
collectedAtStore: NamedRef;
|
|
40
|
+
collectedBySeller: NamedRef;
|
|
41
|
+
nextInstallment: SellerNextInstallment | null;
|
|
42
|
+
credit: SellerPaymentCredit;
|
|
43
|
+
}
|
package/src/loanCredit/index.ts
CHANGED
|
@@ -167,3 +167,15 @@ export * from './enums/LoanPaymentOptionUnavailableReasonEnum';
|
|
|
167
167
|
export * from './dtos/requests/CreateCustomerPaymentRequest';
|
|
168
168
|
export * from './dtos/responses/LoanCustomerPaymentOptions';
|
|
169
169
|
export * from './dtos/responses/LoanCustomerPaymentResult';
|
|
170
|
+
|
|
171
|
+
// Cobro en tienda del Portal del Vendedor
|
|
172
|
+
export * from './enums/InStorePaymentMethodEnum';
|
|
173
|
+
export * from './enums/LoanPaymentOriginEnum';
|
|
174
|
+
export * from './enums/CreditCustomerStateEnum';
|
|
175
|
+
export * from './dtos/requests/InStorePaymentDetail';
|
|
176
|
+
export * from './dtos/requests/CreateSellerPaymentRequest';
|
|
177
|
+
export * from './dtos/responses/SellerPaymentResult';
|
|
178
|
+
export * from './dtos/responses/SellerPaymentOptions';
|
|
179
|
+
export * from './dtos/responses/SellerCreditLookupResult';
|
|
180
|
+
export * from './dtos/responses/InStorePaymentListItem';
|
|
181
|
+
export * from './dtos/responses/CreditCustomerListItem';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Tope de `eventId`: el límite seguro de una llave de DynamoDB. */
|
|
2
|
+
export const RETAIL_EVENT_ID_MAX_LENGTH = 1024;
|
|
3
|
+
|
|
4
|
+
/** Rango de `limit` en las listas paginadas del retailer. */
|
|
5
|
+
export const RETAIL_LIST_LIMIT_MIN = 1;
|
|
6
|
+
export const RETAIL_LIST_LIMIT_MAX = 200;
|
|
7
|
+
|
|
8
|
+
/** Forma válida de un `tenantId`; también arma el nombre del secreto del retailer. */
|
|
9
|
+
export const RETAIL_TENANT_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IsString, Matches } from 'class-validator';
|
|
2
|
+
import { RETAIL_TENANT_ID_PATTERN } from '../constants/retailIntegrationLimits';
|
|
3
|
+
import { ReceiveInventoryEventRequest } from './ReceiveInventoryEventRequest';
|
|
4
|
+
import { ReceiveProductEventRequest } from './ReceiveProductEventRequest';
|
|
5
|
+
import { ReceiveRetailUserEventRequest } from './ReceiveRetailUserEventRequest';
|
|
6
|
+
import { ReceiveStoreEventRequest } from './ReceiveStoreEventRequest';
|
|
7
|
+
import { RetailEventResult } from './RetailEventResult';
|
|
8
|
+
|
|
9
|
+
/** Evento de tienda que el connector manda a retail-org-business, con el tenant de la credencial. */
|
|
10
|
+
export class ApplyStoreEventRequest extends ReceiveStoreEventRequest {
|
|
11
|
+
@IsString()
|
|
12
|
+
@Matches(RETAIL_TENANT_ID_PATTERN)
|
|
13
|
+
tenantId!: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Evento de usuario que el connector manda a retail-org-business, con el tenant de la credencial. */
|
|
17
|
+
export class ApplyRetailUserEventRequest extends ReceiveRetailUserEventRequest {
|
|
18
|
+
@IsString()
|
|
19
|
+
@Matches(RETAIL_TENANT_ID_PATTERN)
|
|
20
|
+
tenantId!: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Evento de producto que el connector manda a retail-catalog-business, con el tenant de la credencial. */
|
|
24
|
+
export class ApplyProductEventRequest extends ReceiveProductEventRequest {
|
|
25
|
+
@IsString()
|
|
26
|
+
@Matches(RETAIL_TENANT_ID_PATTERN)
|
|
27
|
+
tenantId!: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Evento de inventario que el connector manda a retail-catalog-business, con el tenant de la credencial. */
|
|
31
|
+
export class ApplyInventoryEventRequest extends ReceiveInventoryEventRequest {
|
|
32
|
+
@IsString()
|
|
33
|
+
@Matches(RETAIL_TENANT_ID_PATTERN)
|
|
34
|
+
tenantId!: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Cualquiera de los cuatro eventos que el connector manda a un destino. */
|
|
38
|
+
export type ApplyRetailEventRequest =
|
|
39
|
+
| ApplyStoreEventRequest
|
|
40
|
+
| ApplyRetailUserEventRequest
|
|
41
|
+
| ApplyProductEventRequest
|
|
42
|
+
| ApplyInventoryEventRequest;
|
|
43
|
+
|
|
44
|
+
/** El destino contesta `200` con `result`; un rechazo de negocio es `REJECTED`, nunca 4xx. */
|
|
45
|
+
export type ApplyRetailEventResponse = RetailEventResult;
|
|
46
|
+
export type ApplyStoreEventResponse = RetailEventResult;
|
|
47
|
+
export type ApplyRetailUserEventResponse = RetailEventResult;
|
|
48
|
+
export type ApplyProductEventResponse = RetailEventResult;
|
|
49
|
+
export type ApplyInventoryEventResponse = RetailEventResult;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IsString, Matches } from 'class-validator';
|
|
2
|
+
import { RetailTenantQuery } from './RetailTenantQuery';
|
|
3
|
+
|
|
4
|
+
/** Query de `GET /private/retail/inventory`; el inventario es por tienda y no pagina. */
|
|
5
|
+
export class GetRetailInventoryRequest extends RetailTenantQuery {
|
|
6
|
+
@IsString()
|
|
7
|
+
@Matches(/\S/)
|
|
8
|
+
storeId!: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IsOptional, IsString, Matches } from 'class-validator';
|
|
2
|
+
import { RetailPagedQuery } from './RetailPagedQuery';
|
|
3
|
+
|
|
4
|
+
/** Query de `GET /private/retail/users`; sin `storeId` trae todos los usuarios. */
|
|
5
|
+
export class ListRetailUsersRequest extends RetailPagedQuery {
|
|
6
|
+
@IsOptional()
|
|
7
|
+
@IsString()
|
|
8
|
+
@Matches(/\S/)
|
|
9
|
+
storeId?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IsIn } from 'class-validator';
|
|
2
|
+
import { InventoryEventTypeEnum } from '../enums/InventoryEventTypeEnum';
|
|
3
|
+
import { RetailEventEnvelope } from './RetailEventEnvelope';
|
|
4
|
+
|
|
5
|
+
/** Sobre de `POST /webhooks/inventory`. */
|
|
6
|
+
export class ReceiveInventoryEventRequest extends RetailEventEnvelope {
|
|
7
|
+
@IsIn(Object.values(InventoryEventTypeEnum))
|
|
8
|
+
eventType!: InventoryEventTypeEnum;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IsIn } from 'class-validator';
|
|
2
|
+
import { ProductEventTypeEnum } from '../enums/ProductEventTypeEnum';
|
|
3
|
+
import { RetailEventEnvelope } from './RetailEventEnvelope';
|
|
4
|
+
|
|
5
|
+
/** Sobre de `POST /webhooks/catalog`. */
|
|
6
|
+
export class ReceiveProductEventRequest extends RetailEventEnvelope {
|
|
7
|
+
@IsIn(Object.values(ProductEventTypeEnum))
|
|
8
|
+
eventType!: ProductEventTypeEnum;
|
|
9
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InventoryEventTypeEnum } from '../enums/InventoryEventTypeEnum';
|
|
2
|
+
import { ProductEventTypeEnum } from '../enums/ProductEventTypeEnum';
|
|
3
|
+
import { RetailUserEventTypeEnum } from '../enums/RetailUserEventTypeEnum';
|
|
4
|
+
import { StoreEventTypeEnum } from '../enums/StoreEventTypeEnum';
|
|
5
|
+
import { ReceiveInventoryEventRequest } from './ReceiveInventoryEventRequest';
|
|
6
|
+
import { ReceiveProductEventRequest } from './ReceiveProductEventRequest';
|
|
7
|
+
import { ReceiveRetailUserEventRequest } from './ReceiveRetailUserEventRequest';
|
|
8
|
+
import { ReceiveStoreEventRequest } from './ReceiveStoreEventRequest';
|
|
9
|
+
|
|
10
|
+
/** Cualquier `eventType` aceptado por alguno de los cuatro webhooks. */
|
|
11
|
+
export type RetailEventType = StoreEventTypeEnum | RetailUserEventTypeEnum | ProductEventTypeEnum | InventoryEventTypeEnum;
|
|
12
|
+
|
|
13
|
+
/** Sobre ya validado de cualquiera de los cuatro webhooks. */
|
|
14
|
+
export type ReceiveRetailEventRequest =
|
|
15
|
+
| ReceiveStoreEventRequest
|
|
16
|
+
| ReceiveRetailUserEventRequest
|
|
17
|
+
| ReceiveProductEventRequest
|
|
18
|
+
| ReceiveInventoryEventRequest;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IsIn } from 'class-validator';
|
|
2
|
+
import { RetailUserEventTypeEnum } from '../enums/RetailUserEventTypeEnum';
|
|
3
|
+
import { RetailEventEnvelope } from './RetailEventEnvelope';
|
|
4
|
+
|
|
5
|
+
/** Sobre de `POST /webhooks/users`. */
|
|
6
|
+
export class ReceiveRetailUserEventRequest extends RetailEventEnvelope {
|
|
7
|
+
@IsIn(Object.values(RetailUserEventTypeEnum))
|
|
8
|
+
eventType!: RetailUserEventTypeEnum;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IsIn } from 'class-validator';
|
|
2
|
+
import { StoreEventTypeEnum } from '../enums/StoreEventTypeEnum';
|
|
3
|
+
import { RetailEventEnvelope } from './RetailEventEnvelope';
|
|
4
|
+
|
|
5
|
+
/** Sobre de `POST /webhooks/stores`. */
|
|
6
|
+
export class ReceiveStoreEventRequest extends RetailEventEnvelope {
|
|
7
|
+
@IsIn(Object.values(StoreEventTypeEnum))
|
|
8
|
+
eventType!: StoreEventTypeEnum;
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IsObject, IsString, Matches, MaxLength, Validate } from 'class-validator';
|
|
2
|
+
import { RETAIL_EVENT_ID_MAX_LENGTH } from '../constants/retailIntegrationLimits';
|
|
3
|
+
import { IsIsoDateTimeWithZone } from '../validators/IsIsoDateTimeWithZone';
|
|
4
|
+
|
|
5
|
+
/** Payload del evento: el connector no lo valida, lo valida el lambda destino. */
|
|
6
|
+
export type RetailEventPayload = Record<string, unknown>;
|
|
7
|
+
|
|
8
|
+
/** Campos comunes del sobre de un webhook; cada ruta agrega su `eventType`. */
|
|
9
|
+
export abstract class RetailEventEnvelope {
|
|
10
|
+
@IsString()
|
|
11
|
+
@Matches(/\S/)
|
|
12
|
+
@MaxLength(RETAIL_EVENT_ID_MAX_LENGTH)
|
|
13
|
+
eventId!: string;
|
|
14
|
+
|
|
15
|
+
@Validate(IsIsoDateTimeWithZone)
|
|
16
|
+
occurredAt!: string;
|
|
17
|
+
|
|
18
|
+
@IsObject()
|
|
19
|
+
payload!: RetailEventPayload;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RetailEventResultEnum } from '../enums/RetailEventResultEnum';
|
|
2
|
+
|
|
3
|
+
/** Resultado de un evento; `code` explica un `REJECTED` y es `null` en los demás. */
|
|
4
|
+
export interface RetailEventResult {
|
|
5
|
+
eventId: string;
|
|
6
|
+
result: RetailEventResultEnum;
|
|
7
|
+
code: string | null;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ReceiveStoreEventResponse = RetailEventResult;
|
|
11
|
+
export type ReceiveRetailUserEventResponse = RetailEventResult;
|
|
12
|
+
export type ReceiveProductEventResponse = RetailEventResult;
|
|
13
|
+
export type ReceiveInventoryEventResponse = RetailEventResult;
|
|
14
|
+
export type ReceiveRetailEventResponse = RetailEventResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RetailInventoryMeta, RetailPageMeta } from '../models/RetailPageMeta';
|
|
2
|
+
import { RetailSystemPiece, RetailSystemStock } from '../models/RetailSystemInventory';
|
|
3
|
+
import { RetailSystemProduct } from '../models/RetailSystemProduct';
|
|
4
|
+
import { RetailSystemStore } from '../models/RetailSystemStore';
|
|
5
|
+
import { RetailSystemUser } from '../models/RetailSystemUser';
|
|
6
|
+
|
|
7
|
+
/** `data` de `GET /private/retail/stores`. */
|
|
8
|
+
export interface ListRetailStoresResponse {
|
|
9
|
+
items: RetailSystemStore[];
|
|
10
|
+
meta: RetailPageMeta;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** `data` de `GET /private/retail/catalog`. */
|
|
14
|
+
export interface ListRetailCatalogResponse {
|
|
15
|
+
items: RetailSystemProduct[];
|
|
16
|
+
meta: RetailPageMeta;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** `data` de `GET /private/retail/inventory`. */
|
|
20
|
+
export interface GetRetailInventoryResponse {
|
|
21
|
+
pieces: RetailSystemPiece[];
|
|
22
|
+
stock: RetailSystemStock[];
|
|
23
|
+
meta: RetailInventoryMeta;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** `data` de `GET /private/retail/users`. */
|
|
27
|
+
export interface ListRetailUsersResponse {
|
|
28
|
+
items: RetailSystemUser[];
|
|
29
|
+
meta: RetailPageMeta;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** `data` de `POST /private/retail/sales`: el id de la venta en el sistema del retailer. */
|
|
33
|
+
export interface RegisterRetailSaleResponse {
|
|
34
|
+
externalSaleId: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Type } from 'class-transformer';
|
|
2
|
+
import { IsInt, IsOptional, IsString, Matches, Max, Min } from 'class-validator';
|
|
3
|
+
import { RETAIL_LIST_LIMIT_MAX, RETAIL_LIST_LIMIT_MIN } from '../constants/retailIntegrationLimits';
|
|
4
|
+
import { RetailTenantQuery } from './RetailTenantQuery';
|
|
5
|
+
|
|
6
|
+
/** Base de las listas paginadas; `nextToken` es opaco y viaja tal cual. */
|
|
7
|
+
export class RetailPagedQuery extends RetailTenantQuery {
|
|
8
|
+
@IsOptional()
|
|
9
|
+
@Type(() => Number)
|
|
10
|
+
@IsInt()
|
|
11
|
+
@Min(RETAIL_LIST_LIMIT_MIN)
|
|
12
|
+
@Max(RETAIL_LIST_LIMIT_MAX)
|
|
13
|
+
limit?: number;
|
|
14
|
+
|
|
15
|
+
@IsOptional()
|
|
16
|
+
@IsString()
|
|
17
|
+
@Matches(/\S/)
|
|
18
|
+
nextToken?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IsString, Matches } from 'class-validator';
|
|
2
|
+
import { RETAIL_TENANT_ID_PATTERN } from '../constants/retailIntegrationLimits';
|
|
3
|
+
|
|
4
|
+
/** Base de toda llamada de salida: el tenant cuyo retailer se consulta. */
|
|
5
|
+
export class RetailTenantQuery {
|
|
6
|
+
@IsString()
|
|
7
|
+
@Matches(RETAIL_TENANT_ID_PATTERN)
|
|
8
|
+
tenantId!: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** `eventType` válidos en `POST /webhooks/users`. */
|
|
2
|
+
export enum RetailUserEventTypeEnum {
|
|
3
|
+
RETAIL_USER_CREATED_V1 = 'RetailUserCreatedV1',
|
|
4
|
+
RETAIL_USER_UPDATED_V1 = 'RetailUserUpdatedV1',
|
|
5
|
+
RETAIL_USER_TRANSFERRED_V1 = 'RetailUserTransferredV1',
|
|
6
|
+
RETAIL_USER_STATUS_CHANGED_V1 = 'RetailUserStatusChangedV1',
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './RetailEventResultEnum';
|
|
2
|
+
export * from './StoreEventTypeEnum';
|
|
3
|
+
export * from './RetailUserEventTypeEnum';
|
|
4
|
+
export * from './ProductEventTypeEnum';
|
|
5
|
+
export * from './InventoryEventTypeEnum';
|
|
6
|
+
export * from './RetailStoreStatusEnum';
|
|
7
|
+
export * from './RetailProductCategoryEnum';
|
|
8
|
+
export * from './RetailTrackingModeEnum';
|
|
9
|
+
export * from './RetailProductTierEnum';
|
|
10
|
+
export * from './RetailCurrencyEnum';
|
|
11
|
+
export * from './RetailFinancierEnum';
|
|
12
|
+
export * from './RetailMdmProviderEnum';
|
|
13
|
+
export * from './RetailProductStatusEnum';
|
|
14
|
+
export * from './RetailPieceStatusEnum';
|
|
15
|
+
export * from './RetailPieceReasonEnum';
|
|
16
|
+
export * from './RetailUserRoleEnum';
|
|
17
|
+
export * from './RetailUserAccessStatusEnum';
|
|
18
|
+
export * from './RetailSaleTypeEnum';
|
|
19
|
+
export * from './RetailSaleFinancierEnum';
|
|
20
|
+
export * from './RetailPaymentMethodEnum';
|
|
21
|
+
export * from './RetailLinePaymentTypeEnum';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export * from './constants/retailIntegrationLimits';
|
|
2
|
+
export * from './enums';
|
|
3
|
+
export * from './validators/IsIsoDateTimeWithZone';
|
|
4
|
+
export * from './dtos/RetailEventEnvelope';
|
|
5
|
+
export * from './dtos/ReceiveStoreEventRequest';
|
|
6
|
+
export * from './dtos/ReceiveRetailUserEventRequest';
|
|
7
|
+
export * from './dtos/ReceiveProductEventRequest';
|
|
8
|
+
export * from './dtos/ReceiveInventoryEventRequest';
|
|
9
|
+
export * from './dtos/ReceiveRetailEventRequest';
|
|
10
|
+
export * from './dtos/RetailEventResult';
|
|
11
|
+
export * from './dtos/ApplyRetailEventRequest';
|
|
12
|
+
export * from './dtos/RetailTenantQuery';
|
|
13
|
+
export * from './dtos/RetailPagedQuery';
|
|
14
|
+
export * from './dtos/ListRetailStoresRequest';
|
|
15
|
+
export * from './dtos/ListRetailCatalogRequest';
|
|
16
|
+
export * from './dtos/GetRetailInventoryRequest';
|
|
17
|
+
export * from './dtos/ListRetailUsersRequest';
|
|
18
|
+
export * from './dtos/RegisterRetailSaleRequest';
|
|
19
|
+
export * from './dtos/RetailOutboundResponses';
|
|
20
|
+
export * from './models/RetailPageMeta';
|
|
21
|
+
export * from './models/RetailSystemStore';
|
|
22
|
+
export * from './models/RetailSystemProduct';
|
|
23
|
+
export * from './models/RetailSystemInventory';
|
|
24
|
+
export * from './models/RetailSystemUser';
|
|
25
|
+
export * from './models/RetailSystemSale';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** `meta` de una lista paginada del retailer; `nextToken` en `null` cierra la lectura. */
|
|
2
|
+
export interface RetailPageMeta {
|
|
3
|
+
count: number;
|
|
4
|
+
nextToken: string | null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/** `meta` del inventario de una tienda. */
|
|
8
|
+
export interface RetailInventoryMeta {
|
|
9
|
+
storeId: string;
|
|
10
|
+
generatedAt: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { RetailPieceReasonEnum, RetailPieceStatusEnum } from '../enums';
|
|
2
|
+
|
|
3
|
+
export type RetailPieceStatus = `${RetailPieceStatusEnum}`;
|
|
4
|
+
export type RetailPieceReason = `${RetailPieceReasonEnum}`;
|
|
5
|
+
|
|
6
|
+
/** Pieza con IMEI o número de serie. */
|
|
7
|
+
export interface RetailSystemPiece {
|
|
8
|
+
sku: string;
|
|
9
|
+
identifier: string;
|
|
10
|
+
storeId: string;
|
|
11
|
+
status: RetailPieceStatus;
|
|
12
|
+
reason: RetailPieceReason | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Existencia de un producto sin identificador por unidad. */
|
|
16
|
+
export interface RetailSystemStock {
|
|
17
|
+
sku: string;
|
|
18
|
+
storeId: string;
|
|
19
|
+
qty: number;
|
|
20
|
+
}
|