@fiado/api-invoker 1.0.73 → 1.0.75

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.
Files changed (59) hide show
  1. package/README.md +64 -64
  2. package/bin/tern/api/TernApi.d.ts +2 -1
  3. package/bin/tern/api/TernApi.js +4 -0
  4. package/bin/tern/api/interfaces/ITernApi.d.ts +1 -0
  5. package/package.json +28 -28
  6. package/src/account-fiadoinc/AccountFiadoIncApi.ts +37 -37
  7. package/src/account-fiadoinc/index.ts +1 -1
  8. package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +17 -17
  9. package/src/account-fiadosa/AccountFiadoSAApi.ts +22 -22
  10. package/src/account-fiadosa/index.ts +1 -1
  11. package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +9 -9
  12. package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +22 -22
  13. package/src/account-pagoconfiado/index.ts +2 -2
  14. package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +8 -8
  15. package/src/address/AddressApi.ts +46 -46
  16. package/src/address/index.ts +3 -3
  17. package/src/address/interfaces/IAddressApi.ts +30 -30
  18. package/src/authentication/AuthenticationApi.ts +16 -16
  19. package/src/authentication/index.ts +4 -4
  20. package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
  21. package/src/card/CardApi.ts +33 -33
  22. package/src/card/index.ts +3 -3
  23. package/src/card/interfaces/ICardApi.ts +10 -10
  24. package/src/container.config.ts +49 -49
  25. package/src/contract-generator/ContractGeneratorApi.ts +18 -18
  26. package/src/contract-generator/index.ts +2 -2
  27. package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -16
  28. package/src/directory/DirectoryApi.ts +74 -74
  29. package/src/directory/index.ts +3 -3
  30. package/src/directory/interfaces/IDirectoryApi.ts +53 -53
  31. package/src/exchangeRates/ExchangeRatesApi.ts +18 -18
  32. package/src/exchangeRates/index.ts +1 -1
  33. package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +5 -5
  34. package/src/identity/IdentityApi.ts +47 -47
  35. package/src/identity/index.ts +3 -3
  36. package/src/identity/interfaces/IIdentityApi.ts +33 -33
  37. package/src/index.ts +16 -16
  38. package/src/notificationMessages/index.ts +1 -1
  39. package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
  40. package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
  41. package/src/pomelo/api/PomeloApi.ts +99 -99
  42. package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
  43. package/src/pomelo/index.ts +1 -1
  44. package/src/product-catalog/ProductCatalogApi.ts +17 -17
  45. package/src/product-catalog/index.ts +1 -1
  46. package/src/product-catalog/interfaces/IProductCatalogApi.ts +6 -6
  47. package/src/sessionActivity/index.ts +2 -2
  48. package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
  49. package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
  50. package/src/stpAccount/api/STPAccountApi.ts +102 -102
  51. package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +6 -6
  52. package/src/stpAccount/index.ts +1 -1
  53. package/src/tern/api/TernApi.ts +96 -85
  54. package/src/tern/api/interfaces/ITernApi.ts +29 -27
  55. package/src/tern/index.ts +1 -1
  56. package/src/transaction/index.ts +2 -2
  57. package/src/transaction/queue/TransactionPublisher.ts +24 -24
  58. package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
  59. package/tsconfig.json +21 -21
@@ -1,53 +1,53 @@
1
- import { Provider } from "@fiado/type-kit/bin/provider";
2
-
3
- /**
4
- * Interfaz para el servicio Directory que permite operaciones sobre directorios.
5
- */
6
- export interface IDirectoryApi {
7
- /**
8
- * Obtiene una lista de directorios por sus IDs.
9
- * @param ids Array de IDs de directorios (UUIDs) a buscar.
10
- * @returns Una promesa que resuelve a un arreglo de objetos de directorio.
11
- * Puede devolver un arreglo vacío si no se encuentran coincidencias.
12
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
13
- */
14
- getByIds(ids: string[]): Promise<any>;
15
-
16
- /**
17
- * Actualiza el ID de usuario externo en un directorio.
18
- * @param directoryId ID del directorio (UUID) a actualizar.
19
- * @param provider Proveedor de autenticación del usuario.
20
- * @param externalUserId ID de usuario externo.
21
- * @returns Una promesa que resuelve a un objeto vacío.
22
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
23
- */
24
-
25
- updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void>;
26
-
27
- /**
28
- * Actualiza el alcance de un directorio.
29
- * @param directoryId ID del directorio (UUID) a actualizar.
30
- * @param scope Alcance a actualizar.
31
- * @returns Una promesa que resuelve a un objeto vacío.
32
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
33
- */
34
- updateScope(directoryId: string, scope: string[]): Promise<void>;
35
-
36
- /**
37
- * Obtiene un directorio por su ID de directorio propietario.
38
- * @param ownerDirectoryId ID de directorio propietario (UUID) a buscar.
39
- * @returns Una promesa que resuelve a un objeto de directorio.
40
- * Puede devolver un objeto vacío si no se encuentra coincidencia.
41
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
42
- */
43
- getByOwnerDirectoryId(ownerDirectoryId: string): Promise<any>
44
-
45
- /**
46
- * Obtiene un directorio por su número de teléfono.
47
- * @param phoneNumber Número de teléfono a buscar.
48
- * @returns Una promesa que resuelve a un objeto de directorio.
49
- * Puede devolver un objeto vacío si no se encuentra coincidencia.
50
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
51
- */
52
- getByPhoneNumber(phoneNumber: string): Promise<any>
53
- }
1
+ import { Provider } from "@fiado/type-kit/bin/provider";
2
+
3
+ /**
4
+ * Interfaz para el servicio Directory que permite operaciones sobre directorios.
5
+ */
6
+ export interface IDirectoryApi {
7
+ /**
8
+ * Obtiene una lista de directorios por sus IDs.
9
+ * @param ids Array de IDs de directorios (UUIDs) a buscar.
10
+ * @returns Una promesa que resuelve a un arreglo de objetos de directorio.
11
+ * Puede devolver un arreglo vacío si no se encuentran coincidencias.
12
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
13
+ */
14
+ getByIds(ids: string[]): Promise<any>;
15
+
16
+ /**
17
+ * Actualiza el ID de usuario externo en un directorio.
18
+ * @param directoryId ID del directorio (UUID) a actualizar.
19
+ * @param provider Proveedor de autenticación del usuario.
20
+ * @param externalUserId ID de usuario externo.
21
+ * @returns Una promesa que resuelve a un objeto vacío.
22
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
23
+ */
24
+
25
+ updateExternalUserId(directoryId: string, provider: Provider, externalUserId: string): Promise<void>;
26
+
27
+ /**
28
+ * Actualiza el alcance de un directorio.
29
+ * @param directoryId ID del directorio (UUID) a actualizar.
30
+ * @param scope Alcance a actualizar.
31
+ * @returns Una promesa que resuelve a un objeto vacío.
32
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
33
+ */
34
+ updateScope(directoryId: string, scope: string[]): Promise<void>;
35
+
36
+ /**
37
+ * Obtiene un directorio por su ID de directorio propietario.
38
+ * @param ownerDirectoryId ID de directorio propietario (UUID) a buscar.
39
+ * @returns Una promesa que resuelve a un objeto de directorio.
40
+ * Puede devolver un objeto vacío si no se encuentra coincidencia.
41
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
42
+ */
43
+ getByOwnerDirectoryId(ownerDirectoryId: string): Promise<any>
44
+
45
+ /**
46
+ * Obtiene un directorio por su número de teléfono.
47
+ * @param phoneNumber Número de teléfono a buscar.
48
+ * @returns Una promesa que resuelve a un objeto de directorio.
49
+ * Puede devolver un objeto vacío si no se encuentra coincidencia.
50
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
51
+ */
52
+ getByPhoneNumber(phoneNumber: string): Promise<any>
53
+ }
@@ -1,19 +1,19 @@
1
- import {IExchangeRatesApi} from "./interfaces/IExchangeRatesApi";
2
- import {inject, injectable} from "inversify";
3
- import {IHttpRequest} from "@fiado/http-client";
4
- import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
5
-
6
- @injectable()
7
- export default class ExchangeRatesApi implements IExchangeRatesApi {
8
- private readonly baseUrl = process.env.EXCHANGE_RATES_LAMBDA_URL || "";
9
-
10
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
11
- }
12
-
13
- async getExchangeRates(request: GetExchangeRatesRequest): Promise<any> {
14
- const headers = {
15
- "operationName": "getExchangeRates"
16
- }
17
- return await this.httpRequest.post(this.baseUrl, request, headers);
18
- }
1
+ import {IExchangeRatesApi} from "./interfaces/IExchangeRatesApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
5
+
6
+ @injectable()
7
+ export default class ExchangeRatesApi implements IExchangeRatesApi {
8
+ private readonly baseUrl = process.env.EXCHANGE_RATES_LAMBDA_URL || "";
9
+
10
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
11
+ }
12
+
13
+ async getExchangeRates(request: GetExchangeRatesRequest): Promise<any> {
14
+ const headers = {
15
+ "operationName": "getExchangeRates"
16
+ }
17
+ return await this.httpRequest.post(this.baseUrl, request, headers);
18
+ }
19
19
  }
@@ -1,2 +1,2 @@
1
- export * from './interfaces/IExchangeRatesApi';
1
+ export * from './interfaces/IExchangeRatesApi';
2
2
  export * from './ExchangeRatesApi';
@@ -1,6 +1,6 @@
1
- import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
2
-
3
-
4
- export interface IExchangeRatesApi {
5
- getExchangeRates(request: GetExchangeRatesRequest): Promise<any>;
1
+ import GetExchangeRatesRequest from "@fiado/type-kit/bin/exchangeRate/dtos/GetExchangeRatesRequest";
2
+
3
+
4
+ export interface IExchangeRatesApi {
5
+ getExchangeRates(request: GetExchangeRatesRequest): Promise<any>;
6
6
  }
@@ -1,48 +1,48 @@
1
- import { inject, injectable } from "inversify";
2
- import { IIdentityApi } from "./interfaces/IIdentityApi";
3
- import { IHttpRequest } from "@fiado/http-client";
4
- import dotenv from 'dotenv';
5
- import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
6
- dotenv.config();
7
-
8
- @injectable()
9
- export class IdentityApi implements IIdentityApi {
10
-
11
- private readonly baseUrl = process.env.IDENTITY_LAMBDA_URL || "";
12
-
13
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
14
-
15
- async getPeopleByIds(ids: string[]): Promise<any> {
16
-
17
- if (ids.length === 0) {
18
- throw new Error("At least one people ID is required.")
19
- }
20
-
21
- const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
22
- return await this.httpRequest.get(`${url}`);
23
- }
24
-
25
- async updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void> {
26
-
27
- if (!id) {
28
- throw new Error("People ID is required.")
29
- }
30
-
31
- const url = `${this.baseUrl}identities/people/${id}`;
32
- await this.httpRequest.put<void>(url, data);
33
-
34
- }
35
-
36
- async getProfilePicture(directoryId: string): Promise<any> {
37
-
38
- if (!directoryId) {
39
- throw new Error("Directory ID is required.")
40
- }
41
-
42
- const url = `${this.baseUrl}identities/profile?directoryId=${directoryId}&typeOfDirectoryId=USER`;
43
- const operationName = "getUserInfoByIds";
44
-
45
- return await this.httpRequest.get<any>(url, { 'operationName': operationName });
46
-
47
- }
1
+ import { inject, injectable } from "inversify";
2
+ import { IIdentityApi } from "./interfaces/IIdentityApi";
3
+ import { IHttpRequest } from "@fiado/http-client";
4
+ import dotenv from 'dotenv';
5
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
6
+ dotenv.config();
7
+
8
+ @injectable()
9
+ export class IdentityApi implements IIdentityApi {
10
+
11
+ private readonly baseUrl = process.env.IDENTITY_LAMBDA_URL || "";
12
+
13
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
14
+
15
+ async getPeopleByIds(ids: string[]): Promise<any> {
16
+
17
+ if (ids.length === 0) {
18
+ throw new Error("At least one people ID is required.")
19
+ }
20
+
21
+ const url = `${this.baseUrl}identities/people?${ids.map(id => `id=${encodeURIComponent(id)}`).join('&')}`;
22
+ return await this.httpRequest.get(`${url}`);
23
+ }
24
+
25
+ async updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void> {
26
+
27
+ if (!id) {
28
+ throw new Error("People ID is required.")
29
+ }
30
+
31
+ const url = `${this.baseUrl}identities/people/${id}`;
32
+ await this.httpRequest.put<void>(url, data);
33
+
34
+ }
35
+
36
+ async getProfilePicture(directoryId: string): Promise<any> {
37
+
38
+ if (!directoryId) {
39
+ throw new Error("Directory ID is required.")
40
+ }
41
+
42
+ const url = `${this.baseUrl}identities/profile?directoryId=${directoryId}&typeOfDirectoryId=USER`;
43
+ const operationName = "getUserInfoByIds";
44
+
45
+ return await this.httpRequest.get<any>(url, { 'operationName': operationName });
46
+
47
+ }
48
48
  }
@@ -1,4 +1,4 @@
1
-
2
-
3
- export * from './interfaces/IIdentityApi';
1
+
2
+
3
+ export * from './interfaces/IIdentityApi';
4
4
  export * from './IdentityApi';
@@ -1,33 +1,33 @@
1
- import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
2
-
3
- /**
4
- * Interfaz para el servicio Directory que permite operaciones sobre directorios.
5
- */
6
- export interface IIdentityApi {
7
- /**
8
- * Obtiene una lista de people por sus IDs.
9
- * @param ids Array de IDs de peopleId (UUIDs) a buscar.
10
- * @returns Una promesa que resuelve a un arreglo de objetos de people.
11
- * Puede devolver un arreglo vacío si no se encuentran coincidencias.
12
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
13
- */
14
- getPeopleByIds(ids: string[]): Promise<any>;
15
-
16
- /**
17
- * Actualiza la información de un people.
18
- * @param id ID de people a actualizar.
19
- * @param data Datos de people a actualizar.
20
- * @returns Una promesa que resuelve a void.
21
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
22
- */
23
- updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
24
-
25
- /**
26
- * Obtiene la URL de la imagen de perfil de un usuario.
27
- * @param directoryId ID de directorio del usuario.
28
- * @returns Una promesa que resuelve a un objeto con la URL de la imagen de perfil.
29
- * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
30
- */
31
- getProfilePicture(directoryId: string): Promise<any>;
32
-
33
- }
1
+ import { PeopleUpdateRequest } from "@fiado/type-kit/bin/identity";
2
+
3
+ /**
4
+ * Interfaz para el servicio Directory que permite operaciones sobre directorios.
5
+ */
6
+ export interface IIdentityApi {
7
+ /**
8
+ * Obtiene una lista de people por sus IDs.
9
+ * @param ids Array de IDs de peopleId (UUIDs) a buscar.
10
+ * @returns Una promesa que resuelve a un arreglo de objetos de people.
11
+ * Puede devolver un arreglo vacío si no se encuentran coincidencias.
12
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
13
+ */
14
+ getPeopleByIds(ids: string[]): Promise<any>;
15
+
16
+ /**
17
+ * Actualiza la información de un people.
18
+ * @param id ID de people a actualizar.
19
+ * @param data Datos de people a actualizar.
20
+ * @returns Una promesa que resuelve a void.
21
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
22
+ */
23
+ updatePeopleById(id: string, data: PeopleUpdateRequest): Promise<void>;
24
+
25
+ /**
26
+ * Obtiene la URL de la imagen de perfil de un usuario.
27
+ * @param directoryId ID de directorio del usuario.
28
+ * @returns Una promesa que resuelve a un objeto con la URL de la imagen de perfil.
29
+ * @throws {Error} Lanza un error si los parámetros de entrada son inválidos.
30
+ */
31
+ getProfilePicture(directoryId: string): Promise<any>;
32
+
33
+ }
package/src/index.ts CHANGED
@@ -1,17 +1,17 @@
1
- export * from './directory';
2
- export * from './identity';
3
- export * from './notificationMessages';
4
- export * from './sessionActivity';
5
- export * from './tern';
6
- export * from './pomelo';
7
- export * from './address';
8
- export * from './stpAccount'
9
- export * from "./container.config";
10
- export * from "./account-fiadoinc";
11
- export * from "./account-fiadosa";
12
- export * from "./account-pagoconfiado";
13
- export * from "./exchangeRates";
14
- export * from "./authentication";
15
- export * from "./transaction";
16
- export * from "./contract-generator";
1
+ export * from './directory';
2
+ export * from './identity';
3
+ export * from './notificationMessages';
4
+ export * from './sessionActivity';
5
+ export * from './tern';
6
+ export * from './pomelo';
7
+ export * from './address';
8
+ export * from './stpAccount'
9
+ export * from "./container.config";
10
+ export * from "./account-fiadoinc";
11
+ export * from "./account-fiadosa";
12
+ export * from "./account-pagoconfiado";
13
+ export * from "./exchangeRates";
14
+ export * from "./authentication";
15
+ export * from "./transaction";
16
+ export * from "./contract-generator";
17
17
  export * from "./product-catalog";
@@ -1,2 +1,2 @@
1
- export * from './queue/NotificationMessagePublisher';
1
+ export * from './queue/NotificationMessagePublisher';
2
2
  export * from './queue/interfaces/INotificationMessagesPublisher';
@@ -1,23 +1,23 @@
1
- import {INotificationMessagesPublisher} from "./interfaces/INotificationMessagesPublisher";
2
- import {NotificationQueueMessageRequest} from "@fiado/type-kit/bin/notificationMessages";
3
- import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
4
- import {injectable} from "inversify";
5
-
6
- @injectable()
7
- export default class NotificationMessagePublisher implements INotificationMessagesPublisher {
8
- private readonly NOTIFICATION_MESSAGES_QUEUE = process.env.NOTIFICATION_MESSAGES_QUEUE
9
-
10
- async publish(message: NotificationQueueMessageRequest): Promise<void> {
11
- try {
12
- const client: SQSClient = new SQSClient();
13
- const sendMessageRequest: SendMessageRequest = {
14
- QueueUrl: this.NOTIFICATION_MESSAGES_QUEUE,
15
- MessageBody: JSON.stringify(message)
16
- };
17
- const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
18
- await client.send(command);
19
- } catch (error) {
20
- throw new Error(`Error publishing message to queue ${': ' + error.message ?? ''}`);
21
- }
22
- }
1
+ import {INotificationMessagesPublisher} from "./interfaces/INotificationMessagesPublisher";
2
+ import {NotificationQueueMessageRequest} from "@fiado/type-kit/bin/notificationMessages";
3
+ import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
4
+ import {injectable} from "inversify";
5
+
6
+ @injectable()
7
+ export default class NotificationMessagePublisher implements INotificationMessagesPublisher {
8
+ private readonly NOTIFICATION_MESSAGES_QUEUE = process.env.NOTIFICATION_MESSAGES_QUEUE
9
+
10
+ async publish(message: NotificationQueueMessageRequest): Promise<void> {
11
+ try {
12
+ const client: SQSClient = new SQSClient();
13
+ const sendMessageRequest: SendMessageRequest = {
14
+ QueueUrl: this.NOTIFICATION_MESSAGES_QUEUE,
15
+ MessageBody: JSON.stringify(message)
16
+ };
17
+ const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
18
+ await client.send(command);
19
+ } catch (error) {
20
+ throw new Error(`Error publishing message to queue ${': ' + error.message ?? ''}`);
21
+ }
22
+ }
23
23
  }
@@ -1,5 +1,5 @@
1
- import {NotificationQueueMessageRequest} from "@fiado/type-kit/bin/notificationMessages";
2
-
3
- export interface INotificationMessagesPublisher {
4
- publish(message: NotificationQueueMessageRequest): Promise<void>;
1
+ import {NotificationQueueMessageRequest} from "@fiado/type-kit/bin/notificationMessages";
2
+
3
+ export interface INotificationMessagesPublisher {
4
+ publish(message: NotificationQueueMessageRequest): Promise<void>;
5
5
  }
@@ -1,99 +1,99 @@
1
- import { IPomeloApi } from "./interfaces/IPomeloApi";
2
- import { inject, injectable } from "inversify";
3
- import { IHttpRequest } from "@fiado/http-client";
4
- import { CreateBankAccountRequest, CreateBankAccountUserRequest, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account";
5
- import { ActivateBankAccountCardRequest, AssignCardRequest, CreateBankAccountCardShippingRequest, GetBankAccountShippingRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
6
-
7
-
8
- @injectable()
9
- export default class PomeloApi implements IPomeloApi {
10
-
11
- private readonly baseUrl = process.env.POMELO_LAMBDA_URL || "";
12
-
13
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
14
- }
15
-
16
- //USER
17
- async createUser(request: CreateBankAccountUserRequest): Promise<any> {
18
- const url: string = `${this.baseUrl}users/create`;
19
- return await this.httpRequest.post(url, request);
20
- }
21
-
22
- public async getUserById(externalUserId: string): Promise<any> {
23
- const url: string = `${this.baseUrl}users/${externalUserId}`;
24
- return await this.httpRequest.get(url);
25
- }
26
-
27
- public async updateUser(object: UpdateBankAccountUserRequest): Promise<any> {
28
- const url: string = `${this.baseUrl}/users/${object.id}`;
29
- return await this.httpRequest.put(url, object);
30
- }
31
-
32
- // //Card
33
- public async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<any> {
34
- const url: string = `${this.baseUrl}cards/${externalCardId}/sensitive?externalUserId=${externalUserId}`;
35
- return await this.httpRequest.get(url);
36
- }
37
-
38
- public async getCardsById(externalCardId: string): Promise<any> {
39
- const url: string = `${this.baseUrl}cards?externalCardId=${externalCardId}`;
40
- return await this.httpRequest.get(url);
41
- }
42
-
43
- public async getCardsByUserId(externalUserId: string): Promise<any> {
44
- const url: string = `${this.baseUrl}cards?externalUserId=${externalUserId}`;
45
- return await this.httpRequest.get(url);
46
- }
47
-
48
- public async createCard(object: CreateBankAccountRequest): Promise<any> {
49
- const url: string = `${this.baseUrl}cards/create`;
50
- return await this.httpRequest.post(url, object);
51
- }
52
-
53
- public async blockCard(object: UpdateBankAccountCardRequest): Promise<any> {
54
- const url: string = `${this.baseUrl}cards/${object.cardId}/`;
55
- return await this.httpRequest.put(url, object);
56
- }
57
-
58
- public async changePin(object: UpdateBankAccountCardRequest): Promise<any> {
59
- const url: string = `${this.baseUrl}cards/${object.cardId}/`;
60
- return await this.httpRequest.put(url, object);
61
- }
62
-
63
- public async updateCard(object: UpdateBankAccountCardRequest): Promise<any> {
64
- const url: string = `${this.baseUrl}cards/${object.cardId}/`;
65
- return await this.httpRequest.put(url, object);
66
- }
67
-
68
- public async activateCard(object: ActivateBankAccountCardRequest): Promise<any> {
69
- const url: string = `${this.baseUrl}cards/activate`;
70
- return await this.httpRequest.post(url, object);
71
- }
72
-
73
- public async assignCardToUser(request: AssignCardRequest): Promise<any> {
74
- const url: string = `${this.baseUrl}cards/activate`;
75
- return await this.httpRequest.post(url, request);
76
- }
77
-
78
-
79
- // //Shipping
80
-
81
- public async createShipment(object: CreateBankAccountCardShippingRequest): Promise<any> {
82
- const url: string = `${this.baseUrl}shipment/create`;
83
- return await this.httpRequest.post(url, object);
84
- }
85
-
86
- public async getShipment(object: GetBankAccountShippingRequest): Promise<any> {
87
- const url: string = `${this.baseUrl}shipment/${object.externalShippingId}`;
88
- return await this.httpRequest.get(url);
89
- }
90
-
91
- // public async replaceCardByExternalId(object: ExternalReplaceCardRequest): Promise<any> {
92
- // const url: string = `${this.baseUrl}cards/${object.externalCardId}/replace`;
93
- // return await this.httpRequest.put(url, object);
94
- // }
95
-
96
-
97
-
98
-
99
- }
1
+ import { IPomeloApi } from "./interfaces/IPomeloApi";
2
+ import { inject, injectable } from "inversify";
3
+ import { IHttpRequest } from "@fiado/http-client";
4
+ import { CreateBankAccountRequest, CreateBankAccountUserRequest, UpdateBankAccountUserRequest } from "@fiado/type-kit/bin/account";
5
+ import { ActivateBankAccountCardRequest, AssignCardRequest, CreateBankAccountCardShippingRequest, GetBankAccountShippingRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
6
+
7
+
8
+ @injectable()
9
+ export default class PomeloApi implements IPomeloApi {
10
+
11
+ private readonly baseUrl = process.env.POMELO_LAMBDA_URL || "";
12
+
13
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
14
+ }
15
+
16
+ //USER
17
+ async createUser(request: CreateBankAccountUserRequest): Promise<any> {
18
+ const url: string = `${this.baseUrl}users/create`;
19
+ return await this.httpRequest.post(url, request);
20
+ }
21
+
22
+ public async getUserById(externalUserId: string): Promise<any> {
23
+ const url: string = `${this.baseUrl}users/${externalUserId}`;
24
+ return await this.httpRequest.get(url);
25
+ }
26
+
27
+ public async updateUser(object: UpdateBankAccountUserRequest): Promise<any> {
28
+ const url: string = `${this.baseUrl}/users/${object.id}`;
29
+ return await this.httpRequest.put(url, object);
30
+ }
31
+
32
+ // //Card
33
+ public async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<any> {
34
+ const url: string = `${this.baseUrl}cards/${externalCardId}/sensitive?externalUserId=${externalUserId}`;
35
+ return await this.httpRequest.get(url);
36
+ }
37
+
38
+ public async getCardsById(externalCardId: string): Promise<any> {
39
+ const url: string = `${this.baseUrl}cards?externalCardId=${externalCardId}`;
40
+ return await this.httpRequest.get(url);
41
+ }
42
+
43
+ public async getCardsByUserId(externalUserId: string): Promise<any> {
44
+ const url: string = `${this.baseUrl}cards?externalUserId=${externalUserId}`;
45
+ return await this.httpRequest.get(url);
46
+ }
47
+
48
+ public async createCard(object: CreateBankAccountRequest): Promise<any> {
49
+ const url: string = `${this.baseUrl}cards/create`;
50
+ return await this.httpRequest.post(url, object);
51
+ }
52
+
53
+ public async blockCard(object: UpdateBankAccountCardRequest): Promise<any> {
54
+ const url: string = `${this.baseUrl}cards/${object.cardId}/`;
55
+ return await this.httpRequest.put(url, object);
56
+ }
57
+
58
+ public async changePin(object: UpdateBankAccountCardRequest): Promise<any> {
59
+ const url: string = `${this.baseUrl}cards/${object.cardId}/`;
60
+ return await this.httpRequest.put(url, object);
61
+ }
62
+
63
+ public async updateCard(object: UpdateBankAccountCardRequest): Promise<any> {
64
+ const url: string = `${this.baseUrl}cards/${object.cardId}/`;
65
+ return await this.httpRequest.put(url, object);
66
+ }
67
+
68
+ public async activateCard(object: ActivateBankAccountCardRequest): Promise<any> {
69
+ const url: string = `${this.baseUrl}cards/activate`;
70
+ return await this.httpRequest.post(url, object);
71
+ }
72
+
73
+ public async assignCardToUser(request: AssignCardRequest): Promise<any> {
74
+ const url: string = `${this.baseUrl}cards/activate`;
75
+ return await this.httpRequest.post(url, request);
76
+ }
77
+
78
+
79
+ // //Shipping
80
+
81
+ public async createShipment(object: CreateBankAccountCardShippingRequest): Promise<any> {
82
+ const url: string = `${this.baseUrl}shipment/create`;
83
+ return await this.httpRequest.post(url, object);
84
+ }
85
+
86
+ public async getShipment(object: GetBankAccountShippingRequest): Promise<any> {
87
+ const url: string = `${this.baseUrl}shipment/${object.externalShippingId}`;
88
+ return await this.httpRequest.get(url);
89
+ }
90
+
91
+ // public async replaceCardByExternalId(object: ExternalReplaceCardRequest): Promise<any> {
92
+ // const url: string = `${this.baseUrl}cards/${object.externalCardId}/replace`;
93
+ // return await this.httpRequest.put(url, object);
94
+ // }
95
+
96
+
97
+
98
+
99
+ }