@fiado/api-invoker 5.30.0 → 5.31.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/membership/MembershipApi.d.ts +12 -0
- package/bin/membership/MembershipApi.js +32 -0
- package/bin/membership/index.d.ts +2 -0
- package/bin/membership/index.js +2 -0
- package/bin/membership/interfaces/IMembershipApi.d.ts +15 -0
- package/bin/membership/interfaces/IMembershipApi.js +1 -0
- package/bin/notificationWebsockets/NotificationWebsocketApi.d.ts +12 -0
- package/bin/notificationWebsockets/NotificationWebsocketApi.js +32 -0
- package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.d.ts +15 -0
- package/bin/notificationWebsockets/interfaces/INotificationWebsocketApi.js +1 -0
- package/bin/performance-profile/PerformanceProfileApi.d.ts +12 -0
- package/bin/performance-profile/PerformanceProfileApi.js +32 -0
- package/bin/performance-profile/index.d.ts +2 -0
- package/bin/performance-profile/index.js +2 -0
- package/bin/performance-profile/interfaces/IPerformanceProfileApi.d.ts +15 -0
- package/bin/performance-profile/interfaces/IPerformanceProfileApi.js +1 -0
- package/bin/presence-websocket/PresenceWebsocketApi.d.ts +12 -0
- package/bin/presence-websocket/PresenceWebsocketApi.js +32 -0
- package/bin/presence-websocket/index.d.ts +2 -0
- package/bin/presence-websocket/index.js +2 -0
- package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.d.ts +15 -0
- package/bin/presence-websocket/interfaces/IPresenceWebsocketApi.js +1 -0
- package/bin/retailCards/api/RetailCardsBusinessApi.d.ts +6 -7
- package/bin/retailCards/api/RetailCardsBusinessApi.js +6 -10
- package/bin/retailCards/api/interfaces/IRetailCardsBusinessApi.d.ts +15 -19
- package/package.json +2 -2
- package/src/retailCards/api/RetailCardsBusinessApi.ts +19 -16
- package/src/retailCards/api/interfaces/IRetailCardsBusinessApi.ts +27 -23
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IMembershipApi } from "./interfaces/IMembershipApi.js";
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
export declare class MembershipApi implements IMembershipApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
9
|
+
deletedCount: number;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
import dotenv from 'dotenv';
|
|
15
|
+
dotenv.config();
|
|
16
|
+
let MembershipApi = class MembershipApi {
|
|
17
|
+
httpRequest;
|
|
18
|
+
baseUrl = process.env.MEMBERSHIP_BUSINESS_LAMBDA_URL || "";
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async deleteByDirectoryId(directoryId) {
|
|
23
|
+
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
24
|
+
return await this.httpRequest.delete(url);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
MembershipApi = __decorate([
|
|
28
|
+
injectable(),
|
|
29
|
+
__param(0, inject("IHttpRequest")),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], MembershipApi);
|
|
32
|
+
export { MembershipApi };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Membership (membership-business).
|
|
4
|
+
*/
|
|
5
|
+
export interface IMembershipApi {
|
|
6
|
+
/**
|
|
7
|
+
* Borra en cascada las membresías asociadas a un directoryId.
|
|
8
|
+
* @param directoryId ID del directorio.
|
|
9
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
10
|
+
*/
|
|
11
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
12
|
+
deletedCount: number;
|
|
13
|
+
}>>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { INotificationWebsocketApi } from "./interfaces/INotificationWebsocketApi.js";
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
export declare class NotificationWebsocketApi implements INotificationWebsocketApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
9
|
+
deletedCount: number;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
import dotenv from 'dotenv';
|
|
15
|
+
dotenv.config();
|
|
16
|
+
let NotificationWebsocketApi = class NotificationWebsocketApi {
|
|
17
|
+
httpRequest;
|
|
18
|
+
baseUrl = process.env.NOTIFICATIONS_WEBSOCKET_LAMBDA_URL || "";
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async deleteByDirectoryId(directoryId) {
|
|
23
|
+
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
24
|
+
return await this.httpRequest.delete(url);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
NotificationWebsocketApi = __decorate([
|
|
28
|
+
injectable(),
|
|
29
|
+
__param(0, inject("IHttpRequest")),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], NotificationWebsocketApi);
|
|
32
|
+
export { NotificationWebsocketApi };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Notifications Websocket (notifications-websocket).
|
|
4
|
+
*/
|
|
5
|
+
export interface INotificationWebsocketApi {
|
|
6
|
+
/**
|
|
7
|
+
* Borra en cascada las conexiones/notificaciones WS asociadas a un directoryId.
|
|
8
|
+
* @param directoryId ID del directorio.
|
|
9
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
10
|
+
*/
|
|
11
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
12
|
+
deletedCount: number;
|
|
13
|
+
}>>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IPerformanceProfileApi } from "./interfaces/IPerformanceProfileApi.js";
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
export declare class PerformanceProfileApi implements IPerformanceProfileApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
9
|
+
deletedCount: number;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
import dotenv from 'dotenv';
|
|
15
|
+
dotenv.config();
|
|
16
|
+
let PerformanceProfileApi = class PerformanceProfileApi {
|
|
17
|
+
httpRequest;
|
|
18
|
+
baseUrl = process.env.PERFORMANCE_PROFILE_BUSINESS_LAMBDA_URL || "";
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async deleteByDirectoryId(directoryId) {
|
|
23
|
+
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
24
|
+
return await this.httpRequest.delete(url);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
PerformanceProfileApi = __decorate([
|
|
28
|
+
injectable(),
|
|
29
|
+
__param(0, inject("IHttpRequest")),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], PerformanceProfileApi);
|
|
32
|
+
export { PerformanceProfileApi };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Performance Profile (performance-profile-business).
|
|
4
|
+
*/
|
|
5
|
+
export interface IPerformanceProfileApi {
|
|
6
|
+
/**
|
|
7
|
+
* Borra en cascada los perfiles de desempeño asociados a un directoryId.
|
|
8
|
+
* @param directoryId ID del directorio.
|
|
9
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
10
|
+
*/
|
|
11
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
12
|
+
deletedCount: number;
|
|
13
|
+
}>>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IHttpRequest } from "@fiado/http-client";
|
|
2
|
+
import { IPresenceWebsocketApi } from "./interfaces/IPresenceWebsocketApi.js";
|
|
3
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
4
|
+
export declare class PresenceWebsocketApi implements IPresenceWebsocketApi {
|
|
5
|
+
private httpRequest;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(httpRequest: IHttpRequest);
|
|
8
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
9
|
+
deletedCount: number;
|
|
10
|
+
}>>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
12
|
+
};
|
|
13
|
+
import { inject, injectable } from "inversify";
|
|
14
|
+
import dotenv from 'dotenv';
|
|
15
|
+
dotenv.config();
|
|
16
|
+
let PresenceWebsocketApi = class PresenceWebsocketApi {
|
|
17
|
+
httpRequest;
|
|
18
|
+
baseUrl = process.env.PRESENCE_WEBSOCKET_LAMBDA_URL || "";
|
|
19
|
+
constructor(httpRequest) {
|
|
20
|
+
this.httpRequest = httpRequest;
|
|
21
|
+
}
|
|
22
|
+
async deleteByDirectoryId(directoryId) {
|
|
23
|
+
const url = `${this.baseUrl}private/directory/${directoryId}`;
|
|
24
|
+
return await this.httpRequest.delete(url);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
PresenceWebsocketApi = __decorate([
|
|
28
|
+
injectable(),
|
|
29
|
+
__param(0, inject("IHttpRequest")),
|
|
30
|
+
__metadata("design:paramtypes", [Object])
|
|
31
|
+
], PresenceWebsocketApi);
|
|
32
|
+
export { PresenceWebsocketApi };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
type FiadoApiResponse<T> = import("@fiado/type-kit/bin/apiResponse/dtos/FiadoApiResponse.js").default<T>;
|
|
2
|
+
/**
|
|
3
|
+
* Interfaz para el servicio Presence Websocket (presence-websocket).
|
|
4
|
+
*/
|
|
5
|
+
export interface IPresenceWebsocketApi {
|
|
6
|
+
/**
|
|
7
|
+
* Borra en cascada los registros de presencia asociados a un directoryId.
|
|
8
|
+
* @param directoryId ID del directorio.
|
|
9
|
+
* @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
|
|
10
|
+
*/
|
|
11
|
+
deleteByDirectoryId(directoryId: string): Promise<FiadoApiResponse<{
|
|
12
|
+
deletedCount: number;
|
|
13
|
+
}>>;
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { IHttpRequest } from "@fiado/http-client";
|
|
2
2
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
3
|
-
import {
|
|
4
|
-
import { IRetailCardsBusinessApi
|
|
3
|
+
import { CardDeliveryResponse, RegisterCardDeliveryRequest, ReverseCardMovementRequest } from "@fiado/type-kit/bin/retailCards/index.js";
|
|
4
|
+
import { IRetailCardsBusinessApi } from "./interfaces/IRetailCardsBusinessApi.js";
|
|
5
5
|
/**
|
|
6
6
|
* Publisher HTTP del lambda `retail-cards-business` (SureKeep Fase 1, pista Retail) para sus endpoints
|
|
7
|
-
* privados de
|
|
8
|
-
* (tenant por `?tenantId=` canónico, `StandardResponse` → leer `result.data`).
|
|
7
|
+
* privados del inventario de tarjetas físicas PCF. Contrato y semántica completos →
|
|
8
|
+
* `IRetailCardsBusinessApi` (tenant por `?tenantId=` canónico, `StandardResponse` → leer `result.data`).
|
|
9
9
|
*
|
|
10
10
|
* Env var requerida en el consumer: `RETAIL_CARDS_BUSINESS_URL`.
|
|
11
11
|
* El template.yml del consumer la setea con:
|
|
@@ -18,7 +18,6 @@ export default class RetailCardsBusinessApi implements IRetailCardsBusinessApi {
|
|
|
18
18
|
private httpRequest;
|
|
19
19
|
private readonly baseUrl;
|
|
20
20
|
constructor(httpRequest: IHttpRequest);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
release(cardNumber: string, body: ReleaseCardBody, tenantId: string): Promise<StandardResponse<void>>;
|
|
21
|
+
registerDelivery(storeId: string, body: RegisterCardDeliveryRequest, tenantId: string): Promise<StandardResponse<CardDeliveryResponse>>;
|
|
22
|
+
reverseDelivery(storeId: string, body: ReverseCardMovementRequest, tenantId: string): Promise<StandardResponse<void>>;
|
|
24
23
|
}
|
|
@@ -13,8 +13,8 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
import { inject, injectable } from "inversify";
|
|
14
14
|
/**
|
|
15
15
|
* Publisher HTTP del lambda `retail-cards-business` (SureKeep Fase 1, pista Retail) para sus endpoints
|
|
16
|
-
* privados de
|
|
17
|
-
* (tenant por `?tenantId=` canónico, `StandardResponse` → leer `result.data`).
|
|
16
|
+
* privados del inventario de tarjetas físicas PCF. Contrato y semántica completos →
|
|
17
|
+
* `IRetailCardsBusinessApi` (tenant por `?tenantId=` canónico, `StandardResponse` → leer `result.data`).
|
|
18
18
|
*
|
|
19
19
|
* Env var requerida en el consumer: `RETAIL_CARDS_BUSINESS_URL`.
|
|
20
20
|
* El template.yml del consumer la setea con:
|
|
@@ -30,16 +30,12 @@ let RetailCardsBusinessApi = class RetailCardsBusinessApi {
|
|
|
30
30
|
constructor(httpRequest) {
|
|
31
31
|
this.httpRequest = httpRequest;
|
|
32
32
|
}
|
|
33
|
-
async
|
|
34
|
-
const url = `${this.baseUrl}/private/
|
|
33
|
+
async registerDelivery(storeId, body, tenantId) {
|
|
34
|
+
const url = `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/card-deliveries?tenantId=${encodeURIComponent(tenantId)}`;
|
|
35
35
|
return await this.httpRequest.post(url, body);
|
|
36
36
|
}
|
|
37
|
-
async
|
|
38
|
-
const url = `${this.baseUrl}/private/
|
|
39
|
-
return await this.httpRequest.post(url, body);
|
|
40
|
-
}
|
|
41
|
-
async release(cardNumber, body, tenantId) {
|
|
42
|
-
const url = `${this.baseUrl}/private/cards/${encodeURIComponent(cardNumber)}/release?tenantId=${encodeURIComponent(tenantId)}`;
|
|
37
|
+
async reverseDelivery(storeId, body, tenantId) {
|
|
38
|
+
const url = `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/card-movements/reverse?tenantId=${encodeURIComponent(tenantId)}`;
|
|
43
39
|
return await this.httpRequest.post(url, body);
|
|
44
40
|
}
|
|
45
41
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import {
|
|
2
|
+
import { CardDeliveryResponse, RegisterCardDeliveryRequest, ReverseCardMovementRequest } from "@fiado/type-kit/bin/retailCards/index.js";
|
|
3
3
|
/**
|
|
4
4
|
* Contrato del publisher HTTP del lambda `retail-cards-business` (SureKeep Fase 1, pista Retail) para
|
|
5
|
-
* sus endpoints privados de
|
|
5
|
+
* sus endpoints privados del inventario de tarjetas físicas PCF, consumidos por el wizard F2 (paso 09).
|
|
6
6
|
*
|
|
7
7
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
8
8
|
* TENANT — `?tenantId=` CANÓNICO (query), NO header `x-tenant-issuer`.
|
|
@@ -14,28 +14,24 @@ import { AssignCardRequest } from "@fiado/type-kit/bin/retailCards/index.js";
|
|
|
14
14
|
* ⚠️ Retorno `StandardResponse<T>` — el consumer lee `result.data`, NO `result.body`.
|
|
15
15
|
* Errores: el destino lanza `DomainError` tipado → el publisher RECHAZA (no devuelve null).
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `AssignCardRequest` del type-kit (`{ assignedToCustomerId, assignedByUserId, creditId? }`).
|
|
17
|
+
* El inventario se lleva por CANTIDAD: no hay número de tarjeta en ningún path ni body. El `storeId`
|
|
18
|
+
* viaja en el path y el destino valida que la tienda pertenezca al retailer del caller.
|
|
20
19
|
*
|
|
21
20
|
* Env var requerida en el consumer: `RETAIL_CARDS_BUSINESS_URL`.
|
|
22
21
|
* El template.yml del consumer la setea con:
|
|
23
22
|
*
|
|
24
23
|
* RETAIL_CARDS_BUSINESS_URL: '{{resolve:ssm:retail-cards-business}}'
|
|
25
24
|
*/
|
|
26
|
-
/** Body de POST `/private/cards/{cardNumber}/deliver`. */
|
|
27
|
-
export interface MarkDeliveredBody {
|
|
28
|
-
deliveredByUserId?: string;
|
|
29
|
-
}
|
|
30
|
-
/** Body de POST `/private/cards/{cardNumber}/release`. */
|
|
31
|
-
export interface ReleaseCardBody {
|
|
32
|
-
releasedByUserId?: string;
|
|
33
|
-
}
|
|
34
25
|
export interface IRetailCardsBusinessApi {
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
26
|
+
/**
|
|
27
|
+
* POST `/private/stores/{storeId}/card-deliveries` — entrega una tarjeta física a un cliente
|
|
28
|
+
* (paso 09): descuenta el saldo y asienta el movimiento en una sola operación. Idempotente por
|
|
29
|
+
* `sessionId` — el reintento devuelve el `deliveryId` original con 200.
|
|
30
|
+
*/
|
|
31
|
+
registerDelivery(storeId: string, body: RegisterCardDeliveryRequest, tenantId: string): Promise<StandardResponse<CardDeliveryResponse>>;
|
|
32
|
+
/**
|
|
33
|
+
* POST `/private/stores/{storeId}/card-movements/reverse` — revierte un asiento si la venta se
|
|
34
|
+
* cancela (DEC-007 destino). Escribe un contraasiento, no borra el original.
|
|
35
|
+
*/
|
|
36
|
+
reverseDelivery(storeId: string, body: ReverseCardMovementRequest, tenantId: string): Promise<StandardResponse<void>>;
|
|
41
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiado/api-invoker",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.31.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": "^3.
|
|
37
|
+
"@fiado/type-kit": "^3.311.0",
|
|
38
38
|
"dotenv": "^16.4.7"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
@@ -1,17 +1,17 @@
|
|
|
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 { AssignCardRequest } from "@fiado/type-kit/bin/retailCards/index.js";
|
|
5
4
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "
|
|
5
|
+
CardDeliveryResponse,
|
|
6
|
+
RegisterCardDeliveryRequest,
|
|
7
|
+
ReverseCardMovementRequest,
|
|
8
|
+
} from "@fiado/type-kit/bin/retailCards/index.js";
|
|
9
|
+
import { IRetailCardsBusinessApi } from "./interfaces/IRetailCardsBusinessApi.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Publisher HTTP del lambda `retail-cards-business` (SureKeep Fase 1, pista Retail) para sus endpoints
|
|
13
|
-
* privados de
|
|
14
|
-
* (tenant por `?tenantId=` canónico, `StandardResponse` → leer `result.data`).
|
|
13
|
+
* privados del inventario de tarjetas físicas PCF. Contrato y semántica completos →
|
|
14
|
+
* `IRetailCardsBusinessApi` (tenant por `?tenantId=` canónico, `StandardResponse` → leer `result.data`).
|
|
15
15
|
*
|
|
16
16
|
* Env var requerida en el consumer: `RETAIL_CARDS_BUSINESS_URL`.
|
|
17
17
|
* El template.yml del consumer la setea con:
|
|
@@ -27,18 +27,21 @@ export default class RetailCardsBusinessApi implements IRetailCardsBusinessApi {
|
|
|
27
27
|
|
|
28
28
|
constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {}
|
|
29
29
|
|
|
30
|
-
async
|
|
31
|
-
|
|
30
|
+
async registerDelivery(
|
|
31
|
+
storeId: string,
|
|
32
|
+
body: RegisterCardDeliveryRequest,
|
|
33
|
+
tenantId: string,
|
|
34
|
+
): Promise<StandardResponse<CardDeliveryResponse>> {
|
|
35
|
+
const url = `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/card-deliveries?tenantId=${encodeURIComponent(tenantId)}`;
|
|
32
36
|
return await this.httpRequest.post(url, body);
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
async
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const url = `${this.baseUrl}/private/cards/${encodeURIComponent(cardNumber)}/release?tenantId=${encodeURIComponent(tenantId)}`;
|
|
39
|
+
async reverseDelivery(
|
|
40
|
+
storeId: string,
|
|
41
|
+
body: ReverseCardMovementRequest,
|
|
42
|
+
tenantId: string,
|
|
43
|
+
): Promise<StandardResponse<void>> {
|
|
44
|
+
const url = `${this.baseUrl}/private/stores/${encodeURIComponent(storeId)}/card-movements/reverse?tenantId=${encodeURIComponent(tenantId)}`;
|
|
42
45
|
return await this.httpRequest.post(url, body);
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { StandardResponse } from "@fiado/gateway-adapter";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
CardDeliveryResponse,
|
|
4
|
+
RegisterCardDeliveryRequest,
|
|
5
|
+
ReverseCardMovementRequest,
|
|
6
|
+
} from "@fiado/type-kit/bin/retailCards/index.js";
|
|
3
7
|
|
|
4
8
|
/**
|
|
5
9
|
* Contrato del publisher HTTP del lambda `retail-cards-business` (SureKeep Fase 1, pista Retail) para
|
|
6
|
-
* sus endpoints privados de
|
|
10
|
+
* sus endpoints privados del inventario de tarjetas físicas PCF, consumidos por el wizard F2 (paso 09).
|
|
7
11
|
*
|
|
8
12
|
* ─────────────────────────────────────────────────────────────────────────────
|
|
9
13
|
* TENANT — `?tenantId=` CANÓNICO (query), NO header `x-tenant-issuer`.
|
|
@@ -15,33 +19,33 @@ import { AssignCardRequest } from "@fiado/type-kit/bin/retailCards/index.js";
|
|
|
15
19
|
* ⚠️ Retorno `StandardResponse<T>` — el consumer lee `result.data`, NO `result.body`.
|
|
16
20
|
* Errores: el destino lanza `DomainError` tipado → el publisher RECHAZA (no devuelve null).
|
|
17
21
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* `AssignCardRequest` del type-kit (`{ assignedToCustomerId, assignedByUserId, creditId? }`).
|
|
22
|
+
* El inventario se lleva por CANTIDAD: no hay número de tarjeta en ningún path ni body. El `storeId`
|
|
23
|
+
* viaja en el path y el destino valida que la tienda pertenezca al retailer del caller.
|
|
21
24
|
*
|
|
22
25
|
* Env var requerida en el consumer: `RETAIL_CARDS_BUSINESS_URL`.
|
|
23
26
|
* El template.yml del consumer la setea con:
|
|
24
27
|
*
|
|
25
28
|
* RETAIL_CARDS_BUSINESS_URL: '{{resolve:ssm:retail-cards-business}}'
|
|
26
29
|
*/
|
|
27
|
-
|
|
28
|
-
/** Body de POST `/private/cards/{cardNumber}/deliver`. */
|
|
29
|
-
export interface MarkDeliveredBody {
|
|
30
|
-
deliveredByUserId?: string;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** Body de POST `/private/cards/{cardNumber}/release`. */
|
|
34
|
-
export interface ReleaseCardBody {
|
|
35
|
-
releasedByUserId?: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
30
|
export interface IRetailCardsBusinessApi {
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
31
|
+
/**
|
|
32
|
+
* POST `/private/stores/{storeId}/card-deliveries` — entrega una tarjeta física a un cliente
|
|
33
|
+
* (paso 09): descuenta el saldo y asienta el movimiento en una sola operación. Idempotente por
|
|
34
|
+
* `sessionId` — el reintento devuelve el `deliveryId` original con 200.
|
|
35
|
+
*/
|
|
36
|
+
registerDelivery(
|
|
37
|
+
storeId: string,
|
|
38
|
+
body: RegisterCardDeliveryRequest,
|
|
39
|
+
tenantId: string,
|
|
40
|
+
): Promise<StandardResponse<CardDeliveryResponse>>;
|
|
44
41
|
|
|
45
|
-
/**
|
|
46
|
-
|
|
42
|
+
/**
|
|
43
|
+
* POST `/private/stores/{storeId}/card-movements/reverse` — revierte un asiento si la venta se
|
|
44
|
+
* cancela (DEC-007 destino). Escribe un contraasiento, no borra el original.
|
|
45
|
+
*/
|
|
46
|
+
reverseDelivery(
|
|
47
|
+
storeId: string,
|
|
48
|
+
body: ReverseCardMovementRequest,
|
|
49
|
+
tenantId: string,
|
|
50
|
+
): Promise<StandardResponse<void>>;
|
|
47
51
|
}
|