@fiado/api-invoker 1.1.14 → 1.1.16

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 (100) hide show
  1. package/README.md +64 -64
  2. package/bin/container.config.js +2 -0
  3. package/bin/index.d.ts +1 -0
  4. package/bin/index.js +1 -0
  5. package/bin/transactionProcessor/api/TransactionProcessorApi.d.ts +11 -0
  6. package/bin/transactionProcessor/api/TransactionProcessorApi.js +35 -0
  7. package/bin/transactionProcessor/api/interfaces/ITransactionProcessorApi.d.ts +6 -0
  8. package/bin/transactionProcessor/api/interfaces/ITransactionProcessorApi.js +2 -0
  9. package/bin/transactionProcessor/index.d.ts +2 -0
  10. package/bin/transactionProcessor/index.js +18 -0
  11. package/package.json +28 -28
  12. package/src/account-beneficiary/AccountBeneficiaryApi.ts +18 -18
  13. package/src/account-beneficiary/index.ts +2 -2
  14. package/src/account-beneficiary/interfaces/IAccountBeneficiaryApi.ts +7 -7
  15. package/src/account-fiadoinc/AccountFiadoIncApi.ts +65 -65
  16. package/src/account-fiadoinc/index.ts +1 -1
  17. package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +32 -32
  18. package/src/account-fiadosa/AccountFiadoSAApi.ts +27 -27
  19. package/src/account-fiadosa/index.ts +1 -1
  20. package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +11 -11
  21. package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +32 -32
  22. package/src/account-pagoconfiado/index.ts +2 -2
  23. package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +10 -10
  24. package/src/activity-business/ActivityApi.ts +21 -21
  25. package/src/activity-business/index.ts +5 -5
  26. package/src/activity-business/interfaces/IActivityApi.ts +8 -8
  27. package/src/activity-business/queue/ActivityPublisher.ts +26 -26
  28. package/src/activity-business/queue/IActivityPublisher.ts +4 -4
  29. package/src/address/AddressApi.ts +46 -46
  30. package/src/address/index.ts +3 -3
  31. package/src/address/interfaces/IAddressApi.ts +30 -30
  32. package/src/authentication/AuthenticationApi.ts +16 -16
  33. package/src/authentication/index.ts +4 -4
  34. package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
  35. package/src/bankAccount/BankAccountApi.ts +37 -37
  36. package/src/bankAccount/index.ts +1 -1
  37. package/src/bankAccount/interfaces/IBankAccountApi.ts +4 -4
  38. package/src/bbvaRst/api/BBVARstApi.ts +16 -16
  39. package/src/bbvaRst/api/interfaces/IBBVARstApi.ts +4 -4
  40. package/src/bbvaRst/index.ts +1 -1
  41. package/src/card/CardApi.ts +36 -36
  42. package/src/card/index.ts +3 -3
  43. package/src/card/interfaces/ICardApi.ts +10 -10
  44. package/src/collector/CollectorApi.ts +21 -21
  45. package/src/collector/index.ts +2 -2
  46. package/src/collector/interfaces/ICollectorApi.ts +19 -19
  47. package/src/container.config.ts +75 -72
  48. package/src/contract-generator/ContractGeneratorApi.ts +18 -18
  49. package/src/contract-generator/index.ts +2 -2
  50. package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -16
  51. package/src/directory/DirectoryApi.ts +115 -115
  52. package/src/directory/index.ts +3 -3
  53. package/src/directory/interfaces/IDirectoryApi.ts +66 -66
  54. package/src/exchangeRates/ExchangeRatesApi.ts +27 -27
  55. package/src/exchangeRates/index.ts +1 -1
  56. package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +8 -8
  57. package/src/fraudPreventionEngine/api/FraudPreventionEngineApi.ts +22 -22
  58. package/src/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.ts +7 -7
  59. package/src/fraudPreventionEngine/index.ts +1 -1
  60. package/src/group/GroupApi.ts +24 -24
  61. package/src/group/index.ts +1 -1
  62. package/src/group/interfaces/IGroupApi.ts +23 -23
  63. package/src/identity/IdentityApi.ts +47 -47
  64. package/src/identity/index.ts +3 -3
  65. package/src/identity/interfaces/IIdentityApi.ts +33 -33
  66. package/src/index.ts +28 -27
  67. package/src/notificationMessages/index.ts +1 -1
  68. package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
  69. package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
  70. package/src/p2pContact/api/P2pContactApi.ts +19 -19
  71. package/src/p2pContact/api/interfaces/IP2pContactApi.ts +4 -4
  72. package/src/p2pContact/index.ts +1 -1
  73. package/src/pomelo/api/PomeloApi.ts +99 -99
  74. package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
  75. package/src/pomelo/index.ts +1 -1
  76. package/src/product-catalog/ProductCatalogApi.ts +17 -17
  77. package/src/product-catalog/index.ts +1 -1
  78. package/src/product-catalog/interfaces/IProductCatalogApi.ts +6 -6
  79. package/src/sessionActivity/index.ts +2 -2
  80. package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
  81. package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
  82. package/src/stpAccount/api/STPAccountApi.ts +102 -102
  83. package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +6 -6
  84. package/src/stpAccount/index.ts +1 -1
  85. package/src/stpServicePayment/api/StpServicePaymentApi.ts +35 -35
  86. package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +11 -11
  87. package/src/stpServicePayment/index.ts +1 -1
  88. package/src/stpSpei/api/StpSpeiApi.ts +20 -20
  89. package/src/stpSpei/api/interfaces/IStpSpeiApi.ts +4 -4
  90. package/src/stpSpei/index.ts +1 -1
  91. package/src/tern/api/TernApi.ts +96 -96
  92. package/src/tern/api/interfaces/ITernApi.ts +29 -29
  93. package/src/tern/index.ts +1 -1
  94. package/src/transaction/index.ts +2 -2
  95. package/src/transaction/queue/TransactionPublisher.ts +24 -24
  96. package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
  97. package/src/transactionProcessor/api/TransactionProcessorApi.ts +24 -0
  98. package/src/transactionProcessor/api/interfaces/ITransactionProcessorApi.ts +8 -0
  99. package/src/transactionProcessor/index.ts +2 -0
  100. package/tsconfig.json +21 -21
@@ -1,2 +1,2 @@
1
- export * from './interfaces/IProductCatalogApi';
1
+ export * from './interfaces/IProductCatalogApi';
2
2
  export * from './ProductCatalogApi';
@@ -1,7 +1,7 @@
1
- import {ApiGatewayResponse} from "@fiado/gateway-adapter";
2
- import GetProductCatalogResponse from "@fiado/type-kit/bin/productCatalog/dtos/GetProductCatalogResponse";
3
-
4
-
5
- export interface IProductCatalogApi {
6
- getProductCatalogByIds(ids: string[]): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
1
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
2
+ import GetProductCatalogResponse from "@fiado/type-kit/bin/productCatalog/dtos/GetProductCatalogResponse";
3
+
4
+
5
+ export interface IProductCatalogApi {
6
+ getProductCatalogByIds(ids: string[]): Promise<ApiGatewayResponse<GetProductCatalogResponse[]>>;
7
7
  }
@@ -1,2 +1,2 @@
1
- export * from './queue/SessionActivityPublisher';
2
- export * from './queue/interfaces/ISessionActivityPublisher';
1
+ export * from './queue/SessionActivityPublisher';
2
+ export * from './queue/interfaces/ISessionActivityPublisher';
@@ -1,23 +1,23 @@
1
- import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
2
- import {ISessionActivityPublisher} from "./interfaces/ISessionActivityPublisher";
3
- import {SessionActivityQueueMessageRequest} from "@fiado/type-kit/bin/sessionActivity";
4
- import {injectable} from "inversify";
5
-
6
- @injectable()
7
- export class SessionActivityPublisher implements ISessionActivityPublisher {
8
- private readonly SESSION_ACTIVITY_QUEUE = process.env.SESSION_ACTIVITY_QUEUE
9
-
10
- async publish(message: SessionActivityQueueMessageRequest): Promise<void> {
11
- try {
12
- const client: SQSClient = new SQSClient();
13
- const sendMessageRequest: SendMessageRequest = {
14
- QueueUrl: this.SESSION_ACTIVITY_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 {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
2
+ import {ISessionActivityPublisher} from "./interfaces/ISessionActivityPublisher";
3
+ import {SessionActivityQueueMessageRequest} from "@fiado/type-kit/bin/sessionActivity";
4
+ import {injectable} from "inversify";
5
+
6
+ @injectable()
7
+ export class SessionActivityPublisher implements ISessionActivityPublisher {
8
+ private readonly SESSION_ACTIVITY_QUEUE = process.env.SESSION_ACTIVITY_QUEUE
9
+
10
+ async publish(message: SessionActivityQueueMessageRequest): Promise<void> {
11
+ try {
12
+ const client: SQSClient = new SQSClient();
13
+ const sendMessageRequest: SendMessageRequest = {
14
+ QueueUrl: this.SESSION_ACTIVITY_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 {SessionActivityQueueMessageRequest} from "@fiado/type-kit/bin/sessionActivity";
2
-
3
- export interface ISessionActivityPublisher {
4
- publish(message: SessionActivityQueueMessageRequest): Promise<void>;
1
+ import {SessionActivityQueueMessageRequest} from "@fiado/type-kit/bin/sessionActivity";
2
+
3
+ export interface ISessionActivityPublisher {
4
+ publish(message: SessionActivityQueueMessageRequest): Promise<void>;
5
5
  }
@@ -1,102 +1,102 @@
1
- import {ISTPAccountApi } from "./interfaces/ISTPAccountApi";
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
-
6
-
7
- @injectable()
8
- export default class PomeloApi implements ISTPAccountApi {
9
-
10
-
11
- private readonly baseUrl = process.env.STP_ACCOUNT_LAMBDA_URL || "";
12
-
13
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
14
- }
15
-
16
- //ACCOUNT
17
- // //USER
18
- async createAccount(request: CreateBankAccountRequest): Promise<any> {
19
- const url: string = `${this.baseUrl}account/create`;
20
- return await this.httpRequest.post(url, request);
21
- }
22
-
23
-
24
- // //USER
25
- // async createUser(request: CreateBankAccountUserRequest): Promise<any> {
26
- // const url: string = `${this.baseUrl}users/create`;
27
- // return await this.httpRequest.post(url, request);
28
- // }
29
-
30
- // public async getUserById(externalUserId: string): Promise<any> {
31
- // const url: string = `${this.baseUrl}users/${externalUserId}`;
32
- // return await this.httpRequest.get(url);
33
- // }
34
-
35
- // public async updateUser(object: UpdateBankAccountUserRequest): Promise<any> {
36
- // const url: string = `${this.baseUrl}/users/${object.id}`;
37
- // return await this.httpRequest.put(url, object);
38
- // }
39
-
40
- // //Card
41
- // public async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<GetBankAccountSensitiveInformationOutput> {
42
- // const url: string = `${this.baseUrl}cards/${externalCardId}/sensitive?externalUserId=${externalUserId}`;
43
- // return await this.httpRequest.get(url);
44
- // }
45
-
46
- // public async getCardsById(externalCardId: string): Promise<GetBankAccountCardOutput> {
47
- // const url: string = `${this.baseUrl}cards?externalCardId=${externalCardId}`;
48
- // return await this.httpRequest.get(url);
49
- // }
50
-
51
- // public async getCardsByUserId(externalUserId: string): Promise<GetBankAccountCardOutput> {
52
- // const url: string = `${this.baseUrl}cards?externalUserId=${externalUserId}`;
53
- // return await this.httpRequest.get(url);
54
- // }
55
-
56
- // public async createCard(object: CreateBankAccountCardInput): Promise<CreateBankAccountCardOutput> {
57
- // const url: string = `${this.baseUrl}cards/create`;
58
- // return await this.httpRequest.post(url, object);
59
- // }
60
-
61
- // public async blockCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
62
- // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
63
- // return await this.httpRequest.put(url, object);
64
- // }
65
-
66
- // public async changePin(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
67
- // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
68
- // return await this.httpRequest.put(url, object);
69
- // }
70
-
71
- // public async activateCard(object: ActivateBankAccountCardInput): Promise<ActivateBankAccountCardOutput> {
72
- // const url: string = `${this.baseUrl}cards/activate`;
73
- // return await this.httpRequest.post(url, object);
74
- // }
75
-
76
- // public async updateCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
77
- // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
78
- // return await this.httpRequest.put(url, object);
79
- // }
80
-
81
-
82
- // //Shipping
83
-
84
- // public async createShipment(object: CreateBankAccountCardShippingInput): Promise<any> {
85
- // const url: string = `${this.baseUrl}shipment/create`;
86
- // return await this.httpRequest.post(url, object);
87
- // }
88
-
89
- // public async getShipment(object: GetBankAccountShippingInput): Promise<GetBankAccountShippingOutput> {
90
- // const url: string = `${this.baseUrl}shipment/${object.shippingId}`;
91
- // return await this.httpRequest.get(url);
92
- // }
93
-
94
- // public async replaceCardByExternalId(object: ExternalReplaceCardInput): Promise<ExternalReplaceCardOutput> {
95
- // const url: string = `${this.baseUrl}cards/${object.externalCardId}/replace`;
96
- // return await this.httpRequest.put(url, object);
97
- // }
98
-
99
-
100
-
101
-
102
- }
1
+ import {ISTPAccountApi } from "./interfaces/ISTPAccountApi";
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
+
6
+
7
+ @injectable()
8
+ export default class PomeloApi implements ISTPAccountApi {
9
+
10
+
11
+ private readonly baseUrl = process.env.STP_ACCOUNT_LAMBDA_URL || "";
12
+
13
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
14
+ }
15
+
16
+ //ACCOUNT
17
+ // //USER
18
+ async createAccount(request: CreateBankAccountRequest): Promise<any> {
19
+ const url: string = `${this.baseUrl}account/create`;
20
+ return await this.httpRequest.post(url, request);
21
+ }
22
+
23
+
24
+ // //USER
25
+ // async createUser(request: CreateBankAccountUserRequest): Promise<any> {
26
+ // const url: string = `${this.baseUrl}users/create`;
27
+ // return await this.httpRequest.post(url, request);
28
+ // }
29
+
30
+ // public async getUserById(externalUserId: string): Promise<any> {
31
+ // const url: string = `${this.baseUrl}users/${externalUserId}`;
32
+ // return await this.httpRequest.get(url);
33
+ // }
34
+
35
+ // public async updateUser(object: UpdateBankAccountUserRequest): Promise<any> {
36
+ // const url: string = `${this.baseUrl}/users/${object.id}`;
37
+ // return await this.httpRequest.put(url, object);
38
+ // }
39
+
40
+ // //Card
41
+ // public async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<GetBankAccountSensitiveInformationOutput> {
42
+ // const url: string = `${this.baseUrl}cards/${externalCardId}/sensitive?externalUserId=${externalUserId}`;
43
+ // return await this.httpRequest.get(url);
44
+ // }
45
+
46
+ // public async getCardsById(externalCardId: string): Promise<GetBankAccountCardOutput> {
47
+ // const url: string = `${this.baseUrl}cards?externalCardId=${externalCardId}`;
48
+ // return await this.httpRequest.get(url);
49
+ // }
50
+
51
+ // public async getCardsByUserId(externalUserId: string): Promise<GetBankAccountCardOutput> {
52
+ // const url: string = `${this.baseUrl}cards?externalUserId=${externalUserId}`;
53
+ // return await this.httpRequest.get(url);
54
+ // }
55
+
56
+ // public async createCard(object: CreateBankAccountCardInput): Promise<CreateBankAccountCardOutput> {
57
+ // const url: string = `${this.baseUrl}cards/create`;
58
+ // return await this.httpRequest.post(url, object);
59
+ // }
60
+
61
+ // public async blockCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
62
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
63
+ // return await this.httpRequest.put(url, object);
64
+ // }
65
+
66
+ // public async changePin(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
67
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
68
+ // return await this.httpRequest.put(url, object);
69
+ // }
70
+
71
+ // public async activateCard(object: ActivateBankAccountCardInput): Promise<ActivateBankAccountCardOutput> {
72
+ // const url: string = `${this.baseUrl}cards/activate`;
73
+ // return await this.httpRequest.post(url, object);
74
+ // }
75
+
76
+ // public async updateCard(object: UpdateBankAccountCardInput): Promise<UpdateBankAccountCardOutput> {
77
+ // const url: string = `${this.baseUrl}cards/${object.cardId}/`;
78
+ // return await this.httpRequest.put(url, object);
79
+ // }
80
+
81
+
82
+ // //Shipping
83
+
84
+ // public async createShipment(object: CreateBankAccountCardShippingInput): Promise<any> {
85
+ // const url: string = `${this.baseUrl}shipment/create`;
86
+ // return await this.httpRequest.post(url, object);
87
+ // }
88
+
89
+ // public async getShipment(object: GetBankAccountShippingInput): Promise<GetBankAccountShippingOutput> {
90
+ // const url: string = `${this.baseUrl}shipment/${object.shippingId}`;
91
+ // return await this.httpRequest.get(url);
92
+ // }
93
+
94
+ // public async replaceCardByExternalId(object: ExternalReplaceCardInput): Promise<ExternalReplaceCardOutput> {
95
+ // const url: string = `${this.baseUrl}cards/${object.externalCardId}/replace`;
96
+ // return await this.httpRequest.put(url, object);
97
+ // }
98
+
99
+
100
+
101
+
102
+ }
@@ -1,7 +1,7 @@
1
- import {CreateBankAccountRequest, CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserRequest, GetBankAccountUserResponse, UpdateBankAccountUserRequest, UpdateBankAccountUserResponse} from "@fiado/type-kit/bin/account";
2
-
3
- export interface ISTPAccountApi {
4
- // updateUser(object: UpdateBankAccountUserRequest): Promise<any>
5
- // getUserById(externalUserId: string): Promise<any>
6
- createAccount(request: CreateBankAccountRequest): Promise<any>;
1
+ import {CreateBankAccountRequest, CreateBankAccountUserRequest, CreateBankAccountUserResponse, GetBankAccountUserRequest, GetBankAccountUserResponse, UpdateBankAccountUserRequest, UpdateBankAccountUserResponse} from "@fiado/type-kit/bin/account";
2
+
3
+ export interface ISTPAccountApi {
4
+ // updateUser(object: UpdateBankAccountUserRequest): Promise<any>
5
+ // getUserById(externalUserId: string): Promise<any>
6
+ createAccount(request: CreateBankAccountRequest): Promise<any>;
7
7
  }
@@ -1,2 +1,2 @@
1
- export * from './api/STPAccountApi';
1
+ export * from './api/STPAccountApi';
2
2
  export * from './api/interfaces/ISTPAccountApi';
@@ -1,36 +1,36 @@
1
- import {IStpServicePaymentApi} from "./interfaces/IStpServicePaymentApi";
2
- import {inject, injectable} from "inversify";
3
- import {IHttpRequest} from "@fiado/http-client";
4
- import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
5
- import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
-
7
- @injectable()
8
- export default class StpServicePaymentApi implements IStpServicePaymentApi {
9
- private readonly baseUrl = process.env.STP_SERVICE_PAY_LAMBDA_URL || "";
10
-
11
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
- }
13
-
14
- async pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>> {
15
- const url = `${this.baseUrl}/pay`;
16
- return await this.httpRequest.post(url, request);
17
- }
18
-
19
- async getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
20
- const url = `${this.baseUrl}/transaction/${transactionNumber}`;
21
- return await this.httpRequest.get(url);
22
- }
23
-
24
- async getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
25
- const url = `${this.baseUrl}/pay/validation/${transactionNumber}`;
26
- return await this.httpRequest.get(url);
27
- }
28
-
29
- async getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>> {
30
- let url = `${this.baseUrl}/catalog`;
31
- if (params) {
32
- url += `?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
33
- }
34
- return await this.httpRequest.get(url);
35
- }
1
+ import {IStpServicePaymentApi} from "./interfaces/IStpServicePaymentApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
5
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
6
+
7
+ @injectable()
8
+ export default class StpServicePaymentApi implements IStpServicePaymentApi {
9
+ private readonly baseUrl = process.env.STP_SERVICE_PAY_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+
14
+ async pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>> {
15
+ const url = `${this.baseUrl}/pay`;
16
+ return await this.httpRequest.post(url, request);
17
+ }
18
+
19
+ async getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
20
+ const url = `${this.baseUrl}/transaction/${transactionNumber}`;
21
+ return await this.httpRequest.get(url);
22
+ }
23
+
24
+ async getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>> {
25
+ const url = `${this.baseUrl}/pay/validation/${transactionNumber}`;
26
+ return await this.httpRequest.get(url);
27
+ }
28
+
29
+ async getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>> {
30
+ let url = `${this.baseUrl}/catalog`;
31
+ if (params) {
32
+ url += `?${Object.keys(params).map(key => `${key}=${encodeURIComponent(params[key])}`).join('&')}`;
33
+ }
34
+ return await this.httpRequest.get(url);
35
+ }
36
36
  }
@@ -1,12 +1,12 @@
1
- import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
2
- import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
-
4
- export interface IStpServicePaymentApi {
5
- pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>>;
6
-
7
- getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
8
-
9
- getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>>
10
-
11
- getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>>;
1
+ import {GetCatalogParams, ServicePaymentRequest} from "@fiado/type-kit/bin/servicePayment";
2
+ import {ApiGatewayResponse} from "@fiado/gateway-adapter";
3
+
4
+ export interface IStpServicePaymentApi {
5
+ pay(request: ServicePaymentRequest): Promise<ApiGatewayResponse<any>>;
6
+
7
+ getTransaction(transactionNumber: string): Promise<ApiGatewayResponse<any>>;
8
+
9
+ getPaymentValidation(transactionNumber: string): Promise<ApiGatewayResponse<any>>
10
+
11
+ getCatalog(params: GetCatalogParams): Promise<ApiGatewayResponse<any>>;
12
12
  }
@@ -1,2 +1,2 @@
1
- export * from './api/interfaces/IStpServicePaymentApi';
1
+ export * from './api/interfaces/IStpServicePaymentApi';
2
2
  export * from './api/StpServicePaymentApi';
@@ -1,21 +1,21 @@
1
- import {IStpSpeiApi} from "./interfaces/IStpSpeiApi";
2
- import {inject, injectable} from "inversify";
3
- import {IHttpRequest} from "@fiado/http-client";
4
- import {PutStpOrderRequest} from "@fiado/type-kit/bin/stpSpei";
5
-
6
- @injectable()
7
- export class StpSpeiApi implements IStpSpeiApi {
8
- private readonly baseUrl = process.env.STP_SPEI_LAMBDA_URL || "";
9
-
10
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
11
- }
12
-
13
- async putStpOrder(request: PutStpOrderRequest): Promise<any> {
14
- const url = `${this.baseUrl}`;
15
- const headers = {
16
- 'Content-Type': 'application/json',
17
- operationName: "putConnectorStpOrders"
18
- }
19
- return await this.httpRequest.post(url, request, headers);
20
- }
1
+ import {IStpSpeiApi} from "./interfaces/IStpSpeiApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {PutStpOrderRequest} from "@fiado/type-kit/bin/stpSpei";
5
+
6
+ @injectable()
7
+ export class StpSpeiApi implements IStpSpeiApi {
8
+ private readonly baseUrl = process.env.STP_SPEI_LAMBDA_URL || "";
9
+
10
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
11
+ }
12
+
13
+ async putStpOrder(request: PutStpOrderRequest): Promise<any> {
14
+ const url = `${this.baseUrl}`;
15
+ const headers = {
16
+ 'Content-Type': 'application/json',
17
+ operationName: "putConnectorStpOrders"
18
+ }
19
+ return await this.httpRequest.post(url, request, headers);
20
+ }
21
21
  }
@@ -1,5 +1,5 @@
1
- import {PutStpOrderRequest} from "@fiado/type-kit/bin/stpSpei";
2
-
3
- export interface IStpSpeiApi {
4
- putStpOrder(request: PutStpOrderRequest): Promise<any>;
1
+ import {PutStpOrderRequest} from "@fiado/type-kit/bin/stpSpei";
2
+
3
+ export interface IStpSpeiApi {
4
+ putStpOrder(request: PutStpOrderRequest): Promise<any>;
5
5
  }
@@ -1,2 +1,2 @@
1
- export * from './api/interfaces/IStpSpeiApi';
1
+ export * from './api/interfaces/IStpSpeiApi';
2
2
  export * from './api/StpSpeiApi';