@fiado/api-invoker 5.90.0 → 5.92.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/bin/loanCredit/api/LoanCreditBusinessApi.d.ts +3 -1
- package/bin/loanCredit/api/LoanCreditBusinessApi.js +7 -0
- package/bin/loanCredit/api/interfaces/ILoanCreditBusinessApi.d.ts +10 -1
- package/bin/retailCatalog/api/RetailCatalogBusinessApi.d.ts +11 -1
- package/bin/retailCatalog/api/RetailCatalogBusinessApi.js +32 -0
- package/bin/retailCatalog/api/interfaces/IRetailCatalogBusinessApi.d.ts +17 -1
- package/package.json +2 -2
- package/src/loanCredit/api/LoanCreditBusinessApi.ts +27 -0
- package/src/loanCredit/api/interfaces/ILoanCreditBusinessApi.ts +25 -0
- package/src/retailCatalog/api/RetailCatalogBusinessApi.ts +90 -1
- package/src/retailCatalog/api/interfaces/IRetailCatalogBusinessApi.ts +65 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
3
|
+
import { ActivationCheckRequest, ActivationCheckResponse, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
4
4
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "./dtos/LoanCreditAnalyticsBatch.js";
|
|
5
5
|
import { CustomerCreditHistoryResponse } from "./dtos/CustomerCreditHistory.js";
|
|
6
6
|
import { CreditLifecycleFactRequest, CreditLifecycleFactResponse } from "./dtos/CreditLifecycleFact.js";
|
|
@@ -45,4 +45,6 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
45
45
|
}): Promise<StandardResponse<LoanPaymentListResponse>>;
|
|
46
46
|
listCustomerCreditContracts(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanContractResponse[]>>;
|
|
47
47
|
getCustomerCreditContractUrl(directoryId: string, creditId: string, contractId: string, tenantId: string): Promise<StandardResponse<LoanContractDownloadUrl>>;
|
|
48
|
+
getCustomerPaymentOptions(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanCustomerPaymentOptions>>;
|
|
49
|
+
createCustomerPayment(directoryId: string, creditId: string, tenantId: string, body: CreateCustomerPaymentRequest): Promise<StandardResponse<LoanCustomerPaymentResult>>;
|
|
48
50
|
}
|
|
@@ -114,6 +114,13 @@ let LoanCreditBusinessApi = class LoanCreditBusinessApi {
|
|
|
114
114
|
async getCustomerCreditContractUrl(directoryId, creditId, contractId, tenantId) {
|
|
115
115
|
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/contracts/${encodeURIComponent(contractId)}/url?tenantId=${encodeURIComponent(tenantId)}`);
|
|
116
116
|
}
|
|
117
|
+
// ─── Pagos de cliente (retail-loan-business) ────────────────────────────────
|
|
118
|
+
async getCustomerPaymentOptions(directoryId, creditId, tenantId) {
|
|
119
|
+
return await this.httpRequest.get(`${this.customerCreditsUrl(directoryId, creditId)}/payment-options?tenantId=${encodeURIComponent(tenantId)}`);
|
|
120
|
+
}
|
|
121
|
+
async createCustomerPayment(directoryId, creditId, tenantId, body) {
|
|
122
|
+
return await this.httpRequest.post(`${this.customerCreditsUrl(directoryId, creditId)}/payments?tenantId=${encodeURIComponent(tenantId)}`, body);
|
|
123
|
+
}
|
|
117
124
|
};
|
|
118
125
|
LoanCreditBusinessApi = __decorate([
|
|
119
126
|
injectable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
2
|
+
import { ActivationCheckRequest, CreditPaymentAppliedRequest, CreditPaymentAppliedResponse, CreditSettledRequest, CreditSettledResponse, ActivationCheckResponse, LoanBorrowerResponse, ListMessagingCandidatesRequest, ListMessagingCandidatesResponse, LoanCreditResponse, OriginateLoanCreditRequest, OriginateLoanCreditResponse, QuoteLoanCreditRequest, QuoteLoanCreditResponse, SignLoanCreditRequest, SignLoanCreditResponse, UpsertLoanBorrowerRequest, LoanBorrowerCreditItem, LoanContractDownloadUrl, LoanContractResponse, LoanCreditDetail, LoanInstallmentResponse, LoanPaymentListResponse, CreateCustomerPaymentRequest, LoanCustomerPaymentOptions, LoanCustomerPaymentResult } from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
3
3
|
import { LoanCreditAnalyticsBatchRequest, LoanCreditAnalyticsBatchResponse } from "../dtos/LoanCreditAnalyticsBatch.js";
|
|
4
4
|
import { CustomerCreditHistoryResponse } from "../dtos/CustomerCreditHistory.js";
|
|
5
5
|
import { CreditLifecycleFactRequest, CreditLifecycleFactResponse } from "../dtos/CreditLifecycleFact.js";
|
|
@@ -131,4 +131,13 @@ export interface ILoanCreditBusinessApi {
|
|
|
131
131
|
listCustomerCreditContracts(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanContractResponse[]>>;
|
|
132
132
|
/** URL prefirmada del PDF de un contrato. 404 CONTRACT_NOT_FOUND · 409 CONTRACT_PDF_NOT_READY. */
|
|
133
133
|
getCustomerCreditContractUrl(directoryId: string, creditId: string, contractId: string, tenantId: string): Promise<StandardResponse<LoanContractDownloadUrl>>;
|
|
134
|
+
/** Opciones de pago de un crédito del cliente, con montos ya calculados. */
|
|
135
|
+
getCustomerPaymentOptions(directoryId: string, creditId: string, tenantId: string): Promise<StandardResponse<LoanCustomerPaymentOptions>>;
|
|
136
|
+
/**
|
|
137
|
+
* Pide el cobro de una opción de pago (202). Misma `idempotencyKey` y mismo cuerpo devuelven la
|
|
138
|
+
* misma respuesta. 404 CREDIT_NOT_FOUND · 409 AD_HOC_CHARGE_PENDING · 409 CREDIT_NOT_CURRENT ·
|
|
139
|
+
* 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED · 422 PAYMENT_OPTION_UNAVAILABLE · 422 IDEMPOTENCY_KEY_MISMATCH ·
|
|
140
|
+
* 5xx si el motor de cobro no contesta.
|
|
141
|
+
*/
|
|
142
|
+
createCustomerPayment(directoryId: string, creditId: string, tenantId: string, body: CreateCustomerPaymentRequest): Promise<StandardResponse<LoanCustomerPaymentResult>>;
|
|
134
143
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import type { ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
|
|
3
|
+
import type { GetStoreStockCatalogResponse, ReleaseStockRequest, ReleaseStockResponse, RenewReservationsRequest, RenewReservationsResponse, ReserveStockRequest, ReserveStockResponse, ReturnStockRequest, ReturnStockResponse, SellStockRequest, SellStockResponse, SuggestPiecesQuery, SuggestPiecesResponse, SyncInventoryRequest, SyncInventoryResponse, ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
|
|
4
4
|
import { IRetailCatalogBusinessApi, ProductsByRetailersResponse, ReleaseReservationBody, ReserveInventoryBody, ReserveInventoryResult, SellInventoryBody, StoreCatalogItem } from "./interfaces/IRetailCatalogBusinessApi.js";
|
|
5
5
|
/**
|
|
6
6
|
* Publisher HTTP del lambda `retail-catalog-business` (SureKeep Fase 1, pista Retail) para sus
|
|
@@ -27,4 +27,14 @@ export default class RetailCatalogBusinessApi implements IRetailCatalogBusinessA
|
|
|
27
27
|
sellInventory(imei: string, body: SellInventoryBody, issuer: string): Promise<StandardResponse<void>>;
|
|
28
28
|
releaseInventory(imei: string, body: ReleaseReservationBody, issuer: string): Promise<StandardResponse<void>>;
|
|
29
29
|
returnInventory(imei: string, issuer: string): Promise<StandardResponse<void>>;
|
|
30
|
+
/** URL de una ruta de tienda con `tenantId` y los parámetros extra en query. */
|
|
31
|
+
private storeUrl;
|
|
32
|
+
reserveStock(storeId: string, body: ReserveStockRequest, tenantId: string): Promise<StandardResponse<ReserveStockResponse>>;
|
|
33
|
+
renewReservations(storeId: string, body: RenewReservationsRequest, tenantId: string): Promise<StandardResponse<RenewReservationsResponse>>;
|
|
34
|
+
suggestPieces(storeId: string, query: SuggestPiecesQuery, tenantId: string): Promise<StandardResponse<SuggestPiecesResponse>>;
|
|
35
|
+
sellStock(storeId: string, body: SellStockRequest, tenantId: string): Promise<StandardResponse<SellStockResponse>>;
|
|
36
|
+
releaseStock(storeId: string, body: ReleaseStockRequest, tenantId: string): Promise<StandardResponse<ReleaseStockResponse>>;
|
|
37
|
+
returnStock(storeId: string, body: ReturnStockRequest, tenantId: string): Promise<StandardResponse<ReturnStockResponse>>;
|
|
38
|
+
syncInventory(retailerId: string, body: SyncInventoryRequest, tenantId: string): Promise<StandardResponse<SyncInventoryResponse>>;
|
|
39
|
+
getStoreStockCatalog(storeId: string, tenantId: string): Promise<StandardResponse<GetStoreStockCatalogResponse>>;
|
|
30
40
|
}
|
|
@@ -70,6 +70,38 @@ let RetailCatalogBusinessApi = class RetailCatalogBusinessApi {
|
|
|
70
70
|
const url = `${this.baseUrl}/private/inventory/${encodeURIComponent(imei)}/return`;
|
|
71
71
|
return await this.httpRequest.put(url, undefined, this.tenantHeader(issuer));
|
|
72
72
|
}
|
|
73
|
+
/** URL de una ruta de tienda con `tenantId` y los parámetros extra en query. */
|
|
74
|
+
storeUrl(storeId, suffix, tenantId, extra = {}) {
|
|
75
|
+
const query = new URLSearchParams({ tenantId, ...extra });
|
|
76
|
+
return `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/${suffix}?${query.toString()}`;
|
|
77
|
+
}
|
|
78
|
+
async reserveStock(storeId, body, tenantId) {
|
|
79
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "reservations", tenantId), body);
|
|
80
|
+
}
|
|
81
|
+
async renewReservations(storeId, body, tenantId) {
|
|
82
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "reservations/renew", tenantId), body);
|
|
83
|
+
}
|
|
84
|
+
async suggestPieces(storeId, query, tenantId) {
|
|
85
|
+
const extra = { sku: query.sku, prefix: query.prefix };
|
|
86
|
+
return await this.httpRequest.get(this.storeUrl(storeId, "pieces", tenantId, extra));
|
|
87
|
+
}
|
|
88
|
+
async sellStock(storeId, body, tenantId) {
|
|
89
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "sales", tenantId), body);
|
|
90
|
+
}
|
|
91
|
+
async releaseStock(storeId, body, tenantId) {
|
|
92
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "reservations/release", tenantId), body);
|
|
93
|
+
}
|
|
94
|
+
async returnStock(storeId, body, tenantId) {
|
|
95
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "returns", tenantId), body);
|
|
96
|
+
}
|
|
97
|
+
async syncInventory(retailerId, body, tenantId) {
|
|
98
|
+
const query = new URLSearchParams({ tenantId });
|
|
99
|
+
const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/inventory/sync?${query.toString()}`;
|
|
100
|
+
return await this.httpRequest.post(url, body);
|
|
101
|
+
}
|
|
102
|
+
async getStoreStockCatalog(storeId, tenantId) {
|
|
103
|
+
return await this.httpRequest.get(this.storeUrl(storeId, "stock-catalog", tenantId));
|
|
104
|
+
}
|
|
73
105
|
};
|
|
74
106
|
RetailCatalogBusinessApi = __decorate([
|
|
75
107
|
injectable(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import type { MdmLockModeEnum, MdmProviderEnum, ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
|
|
2
|
+
import type { GetStoreStockCatalogResponse, MdmLockModeEnum, MdmProviderEnum, ReleaseStockRequest, ReleaseStockResponse, RenewReservationsRequest, RenewReservationsResponse, ReserveStockRequest, ReserveStockResponse, ReturnStockRequest, ReturnStockResponse, SellStockRequest, SellStockResponse, SuggestPiecesQuery, SuggestPiecesResponse, SyncInventoryRequest, SyncInventoryResponse, ValidateProductResponse } from "@fiado/type-kit/bin/retailCatalog/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contrato del publisher HTTP del lambda `retail-catalog-business` (SureKeep Fase 1, pista Retail)
|
|
5
5
|
* para sus endpoints privados del ciclo de venta del IMEI, consumidos por el wizard F2.
|
|
@@ -152,4 +152,20 @@ export interface IRetailCatalogBusinessApi {
|
|
|
152
152
|
releaseInventory(imei: string, body: ReleaseReservationBody, issuer: string): Promise<StandardResponse<void>>;
|
|
153
153
|
/** PUT `/private/inventory/{imei}/return` — devuelve el IMEI vendido al stock (SOLD → AVAILABLE, sin body). */
|
|
154
154
|
returnInventory(imei: string, issuer: string): Promise<StandardResponse<void>>;
|
|
155
|
+
/** PUT `/private/stores/{storeId}/reservations` — reserva una línea (kit completo) de forma idempotente. */
|
|
156
|
+
reserveStock(storeId: string, body: ReserveStockRequest, tenantId: string): Promise<StandardResponse<ReserveStockResponse>>;
|
|
157
|
+
/** PUT `/private/stores/{storeId}/reservations/renew` — extiende las reservas de las líneas. */
|
|
158
|
+
renewReservations(storeId: string, body: RenewReservationsRequest, tenantId: string): Promise<StandardResponse<RenewReservationsResponse>>;
|
|
159
|
+
/** GET `/private/stores/{storeId}/pieces` — piezas disponibles del SKU que empiezan con `prefix`. */
|
|
160
|
+
suggestPieces(storeId: string, query: SuggestPiecesQuery, tenantId: string): Promise<StandardResponse<SuggestPiecesResponse>>;
|
|
161
|
+
/** PUT `/private/stores/{storeId}/sales` — vende las líneas con sus identificadores en una transacción. */
|
|
162
|
+
sellStock(storeId: string, body: SellStockRequest, tenantId: string): Promise<StandardResponse<SellStockResponse>>;
|
|
163
|
+
/** PUT `/private/stores/{storeId}/reservations/release` — libera las reservas de las líneas. */
|
|
164
|
+
releaseStock(storeId: string, body: ReleaseStockRequest, tenantId: string): Promise<StandardResponse<ReleaseStockResponse>>;
|
|
165
|
+
/** PUT `/private/stores/{storeId}/returns` — regresa al stock las piezas de una venta cancelada. */
|
|
166
|
+
returnStock(storeId: string, body: ReturnStockRequest, tenantId: string): Promise<StandardResponse<ReturnStockResponse>>;
|
|
167
|
+
/** POST `/private/retailers/{retailerId}/inventory/sync` — puerta de entrada de productos, precios y stock. */
|
|
168
|
+
syncInventory(retailerId: string, body: SyncInventoryRequest, tenantId: string): Promise<StandardResponse<SyncInventoryResponse>>;
|
|
169
|
+
/** GET `/private/stores/{storeId}/stock-catalog` — catálogo vendible de la tienda, una fila por SKU. */
|
|
170
|
+
getStoreStockCatalog(storeId: string, tenantId: string): Promise<StandardResponse<GetStoreStockCatalogResponse>>;
|
|
155
171
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.92.0",
|
|
4
4
|
"description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a través de invocaciones http",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "bin/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@fiado/gateway-adapter": "^3.9.0",
|
|
35
35
|
"@fiado/http-client": "^2.0.1",
|
|
36
36
|
"@fiado/logger": "^1.1.3",
|
|
37
|
-
"@fiado/type-kit": "
|
|
37
|
+
"@fiado/type-kit": "3.462.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -25,6 +25,9 @@ import {
|
|
|
25
25
|
LoanCreditDetail,
|
|
26
26
|
LoanInstallmentResponse,
|
|
27
27
|
LoanPaymentListResponse,
|
|
28
|
+
CreateCustomerPaymentRequest,
|
|
29
|
+
LoanCustomerPaymentOptions,
|
|
30
|
+
LoanCustomerPaymentResult,
|
|
28
31
|
} from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
29
32
|
import {
|
|
30
33
|
LoanCreditAnalyticsBatchRequest,
|
|
@@ -238,4 +241,28 @@ export default class LoanCreditBusinessApi implements ILoanCreditBusinessApi {
|
|
|
238
241
|
`${this.customerCreditsUrl(directoryId, creditId)}/contracts/${encodeURIComponent(contractId)}/url?tenantId=${encodeURIComponent(tenantId)}`,
|
|
239
242
|
);
|
|
240
243
|
}
|
|
244
|
+
|
|
245
|
+
// ─── Pagos de cliente (retail-loan-business) ────────────────────────────────
|
|
246
|
+
|
|
247
|
+
async getCustomerPaymentOptions(
|
|
248
|
+
directoryId: string,
|
|
249
|
+
creditId: string,
|
|
250
|
+
tenantId: string,
|
|
251
|
+
): Promise<StandardResponse<LoanCustomerPaymentOptions>> {
|
|
252
|
+
return await this.httpRequest.get(
|
|
253
|
+
`${this.customerCreditsUrl(directoryId, creditId)}/payment-options?tenantId=${encodeURIComponent(tenantId)}`,
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async createCustomerPayment(
|
|
258
|
+
directoryId: string,
|
|
259
|
+
creditId: string,
|
|
260
|
+
tenantId: string,
|
|
261
|
+
body: CreateCustomerPaymentRequest,
|
|
262
|
+
): Promise<StandardResponse<LoanCustomerPaymentResult>> {
|
|
263
|
+
return await this.httpRequest.post(
|
|
264
|
+
`${this.customerCreditsUrl(directoryId, creditId)}/payments?tenantId=${encodeURIComponent(tenantId)}`,
|
|
265
|
+
body,
|
|
266
|
+
);
|
|
267
|
+
}
|
|
241
268
|
}
|
|
@@ -23,6 +23,9 @@ import {
|
|
|
23
23
|
LoanCreditDetail,
|
|
24
24
|
LoanInstallmentResponse,
|
|
25
25
|
LoanPaymentListResponse,
|
|
26
|
+
CreateCustomerPaymentRequest,
|
|
27
|
+
LoanCustomerPaymentOptions,
|
|
28
|
+
LoanCustomerPaymentResult,
|
|
26
29
|
} from "@fiado/type-kit/bin/loanCredit/index.js";
|
|
27
30
|
import {
|
|
28
31
|
LoanCreditAnalyticsBatchRequest,
|
|
@@ -255,4 +258,26 @@ export interface ILoanCreditBusinessApi {
|
|
|
255
258
|
contractId: string,
|
|
256
259
|
tenantId: string,
|
|
257
260
|
): Promise<StandardResponse<LoanContractDownloadUrl>>;
|
|
261
|
+
|
|
262
|
+
// ─── Pagos de cliente (retail-loan-business) ────────────────────────────────
|
|
263
|
+
|
|
264
|
+
/** Opciones de pago de un crédito del cliente, con montos ya calculados. */
|
|
265
|
+
getCustomerPaymentOptions(
|
|
266
|
+
directoryId: string,
|
|
267
|
+
creditId: string,
|
|
268
|
+
tenantId: string,
|
|
269
|
+
): Promise<StandardResponse<LoanCustomerPaymentOptions>>;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Pide el cobro de una opción de pago (202). Misma `idempotencyKey` y mismo cuerpo devuelven la
|
|
273
|
+
* misma respuesta. 404 CREDIT_NOT_FOUND · 409 AD_HOC_CHARGE_PENDING · 409 CREDIT_NOT_CURRENT ·
|
|
274
|
+
* 409 CUSTOMER_PAYMENT_AMOUNT_CHANGED · 422 PAYMENT_OPTION_UNAVAILABLE · 422 IDEMPOTENCY_KEY_MISMATCH ·
|
|
275
|
+
* 5xx si el motor de cobro no contesta.
|
|
276
|
+
*/
|
|
277
|
+
createCustomerPayment(
|
|
278
|
+
directoryId: string,
|
|
279
|
+
creditId: string,
|
|
280
|
+
tenantId: string,
|
|
281
|
+
body: CreateCustomerPaymentRequest,
|
|
282
|
+
): Promise<StandardResponse<LoanCustomerPaymentResult>>;
|
|
258
283
|
}
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import { inject, injectable } from "inversify";
|
|
2
2
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
3
3
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
GetStoreStockCatalogResponse,
|
|
6
|
+
ReleaseStockRequest,
|
|
7
|
+
ReleaseStockResponse,
|
|
8
|
+
RenewReservationsRequest,
|
|
9
|
+
RenewReservationsResponse,
|
|
10
|
+
ReserveStockRequest,
|
|
11
|
+
ReserveStockResponse,
|
|
12
|
+
ReturnStockRequest,
|
|
13
|
+
ReturnStockResponse,
|
|
14
|
+
SellStockRequest,
|
|
15
|
+
SellStockResponse,
|
|
16
|
+
SuggestPiecesQuery,
|
|
17
|
+
SuggestPiecesResponse,
|
|
18
|
+
SyncInventoryRequest,
|
|
19
|
+
SyncInventoryResponse,
|
|
20
|
+
ValidateProductResponse,
|
|
21
|
+
} from "@fiado/type-kit/bin/retailCatalog/index.js";
|
|
5
22
|
import {
|
|
6
23
|
IRetailCatalogBusinessApi,
|
|
7
24
|
ProductsByRetailersBody,
|
|
@@ -97,4 +114,76 @@ export default class RetailCatalogBusinessApi implements IRetailCatalogBusinessA
|
|
|
97
114
|
const url = `${this.baseUrl}/private/inventory/${encodeURIComponent(imei)}/return`;
|
|
98
115
|
return await this.httpRequest.put(url, undefined, this.tenantHeader(issuer));
|
|
99
116
|
}
|
|
117
|
+
|
|
118
|
+
/** URL de una ruta de tienda con `tenantId` y los parámetros extra en query. */
|
|
119
|
+
private storeUrl(storeId: string, suffix: string, tenantId: string, extra: Record<string, string> = {}): string {
|
|
120
|
+
const query = new URLSearchParams({ tenantId, ...extra });
|
|
121
|
+
return `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/${suffix}?${query.toString()}`;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async reserveStock(
|
|
125
|
+
storeId: string,
|
|
126
|
+
body: ReserveStockRequest,
|
|
127
|
+
tenantId: string,
|
|
128
|
+
): Promise<StandardResponse<ReserveStockResponse>> {
|
|
129
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "reservations", tenantId), body);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async renewReservations(
|
|
133
|
+
storeId: string,
|
|
134
|
+
body: RenewReservationsRequest,
|
|
135
|
+
tenantId: string,
|
|
136
|
+
): Promise<StandardResponse<RenewReservationsResponse>> {
|
|
137
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "reservations/renew", tenantId), body);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async suggestPieces(
|
|
141
|
+
storeId: string,
|
|
142
|
+
query: SuggestPiecesQuery,
|
|
143
|
+
tenantId: string,
|
|
144
|
+
): Promise<StandardResponse<SuggestPiecesResponse>> {
|
|
145
|
+
const extra = { sku: query.sku, prefix: query.prefix };
|
|
146
|
+
return await this.httpRequest.get(this.storeUrl(storeId, "pieces", tenantId, extra));
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async sellStock(
|
|
150
|
+
storeId: string,
|
|
151
|
+
body: SellStockRequest,
|
|
152
|
+
tenantId: string,
|
|
153
|
+
): Promise<StandardResponse<SellStockResponse>> {
|
|
154
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "sales", tenantId), body);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async releaseStock(
|
|
158
|
+
storeId: string,
|
|
159
|
+
body: ReleaseStockRequest,
|
|
160
|
+
tenantId: string,
|
|
161
|
+
): Promise<StandardResponse<ReleaseStockResponse>> {
|
|
162
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "reservations/release", tenantId), body);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
async returnStock(
|
|
166
|
+
storeId: string,
|
|
167
|
+
body: ReturnStockRequest,
|
|
168
|
+
tenantId: string,
|
|
169
|
+
): Promise<StandardResponse<ReturnStockResponse>> {
|
|
170
|
+
return await this.httpRequest.put(this.storeUrl(storeId, "returns", tenantId), body);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async syncInventory(
|
|
174
|
+
retailerId: string,
|
|
175
|
+
body: SyncInventoryRequest,
|
|
176
|
+
tenantId: string,
|
|
177
|
+
): Promise<StandardResponse<SyncInventoryResponse>> {
|
|
178
|
+
const query = new URLSearchParams({ tenantId });
|
|
179
|
+
const url = `${this.baseUrl}/private/retailers/${encodeURIComponent(retailerId)}/inventory/sync?${query.toString()}`;
|
|
180
|
+
return await this.httpRequest.post(url, body);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async getStoreStockCatalog(
|
|
184
|
+
storeId: string,
|
|
185
|
+
tenantId: string,
|
|
186
|
+
): Promise<StandardResponse<GetStoreStockCatalogResponse>> {
|
|
187
|
+
return await this.httpRequest.get(this.storeUrl(storeId, "stock-catalog", tenantId));
|
|
188
|
+
}
|
|
100
189
|
}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
2
|
import type {
|
|
3
|
+
GetStoreStockCatalogResponse,
|
|
3
4
|
MdmLockModeEnum,
|
|
4
5
|
MdmProviderEnum,
|
|
6
|
+
ReleaseStockRequest,
|
|
7
|
+
ReleaseStockResponse,
|
|
8
|
+
RenewReservationsRequest,
|
|
9
|
+
RenewReservationsResponse,
|
|
10
|
+
ReserveStockRequest,
|
|
11
|
+
ReserveStockResponse,
|
|
12
|
+
ReturnStockRequest,
|
|
13
|
+
ReturnStockResponse,
|
|
14
|
+
SellStockRequest,
|
|
15
|
+
SellStockResponse,
|
|
16
|
+
SuggestPiecesQuery,
|
|
17
|
+
SuggestPiecesResponse,
|
|
18
|
+
SyncInventoryRequest,
|
|
19
|
+
SyncInventoryResponse,
|
|
5
20
|
ValidateProductResponse,
|
|
6
21
|
} from "@fiado/type-kit/bin/retailCatalog/index.js";
|
|
7
22
|
|
|
@@ -186,4 +201,54 @@ export interface IRetailCatalogBusinessApi {
|
|
|
186
201
|
|
|
187
202
|
/** PUT `/private/inventory/{imei}/return` — devuelve el IMEI vendido al stock (SOLD → AVAILABLE, sin body). */
|
|
188
203
|
returnInventory(imei: string, issuer: string): Promise<StandardResponse<void>>;
|
|
204
|
+
|
|
205
|
+
// Contrato de stock por SKU: el tenant va en `?tenantId=`; errores tipados del destino se propagan.
|
|
206
|
+
|
|
207
|
+
/** PUT `/private/stores/{storeId}/reservations` — reserva una línea (kit completo) de forma idempotente. */
|
|
208
|
+
reserveStock(
|
|
209
|
+
storeId: string,
|
|
210
|
+
body: ReserveStockRequest,
|
|
211
|
+
tenantId: string,
|
|
212
|
+
): Promise<StandardResponse<ReserveStockResponse>>;
|
|
213
|
+
|
|
214
|
+
/** PUT `/private/stores/{storeId}/reservations/renew` — extiende las reservas de las líneas. */
|
|
215
|
+
renewReservations(
|
|
216
|
+
storeId: string,
|
|
217
|
+
body: RenewReservationsRequest,
|
|
218
|
+
tenantId: string,
|
|
219
|
+
): Promise<StandardResponse<RenewReservationsResponse>>;
|
|
220
|
+
|
|
221
|
+
/** GET `/private/stores/{storeId}/pieces` — piezas disponibles del SKU que empiezan con `prefix`. */
|
|
222
|
+
suggestPieces(
|
|
223
|
+
storeId: string,
|
|
224
|
+
query: SuggestPiecesQuery,
|
|
225
|
+
tenantId: string,
|
|
226
|
+
): Promise<StandardResponse<SuggestPiecesResponse>>;
|
|
227
|
+
|
|
228
|
+
/** PUT `/private/stores/{storeId}/sales` — vende las líneas con sus identificadores en una transacción. */
|
|
229
|
+
sellStock(storeId: string, body: SellStockRequest, tenantId: string): Promise<StandardResponse<SellStockResponse>>;
|
|
230
|
+
|
|
231
|
+
/** PUT `/private/stores/{storeId}/reservations/release` — libera las reservas de las líneas. */
|
|
232
|
+
releaseStock(
|
|
233
|
+
storeId: string,
|
|
234
|
+
body: ReleaseStockRequest,
|
|
235
|
+
tenantId: string,
|
|
236
|
+
): Promise<StandardResponse<ReleaseStockResponse>>;
|
|
237
|
+
|
|
238
|
+
/** PUT `/private/stores/{storeId}/returns` — regresa al stock las piezas de una venta cancelada. */
|
|
239
|
+
returnStock(
|
|
240
|
+
storeId: string,
|
|
241
|
+
body: ReturnStockRequest,
|
|
242
|
+
tenantId: string,
|
|
243
|
+
): Promise<StandardResponse<ReturnStockResponse>>;
|
|
244
|
+
|
|
245
|
+
/** POST `/private/retailers/{retailerId}/inventory/sync` — puerta de entrada de productos, precios y stock. */
|
|
246
|
+
syncInventory(
|
|
247
|
+
retailerId: string,
|
|
248
|
+
body: SyncInventoryRequest,
|
|
249
|
+
tenantId: string,
|
|
250
|
+
): Promise<StandardResponse<SyncInventoryResponse>>;
|
|
251
|
+
|
|
252
|
+
/** GET `/private/stores/{storeId}/stock-catalog` — catálogo vendible de la tienda, una fila por SKU. */
|
|
253
|
+
getStoreStockCatalog(storeId: string, tenantId: string): Promise<StandardResponse<GetStoreStockCatalogResponse>>;
|
|
189
254
|
}
|