@fiado/api-invoker 1.1.62 → 1.1.63

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 (122) hide show
  1. package/README.md +64 -64
  2. package/bin/activity/ActivityApi.d.ts +17 -0
  3. package/bin/activity/ActivityApi.js +72 -0
  4. package/bin/activity/index.d.ts +2 -0
  5. package/bin/activity/index.js +18 -0
  6. package/bin/activity/interfaces/IActivityApi.d.ts +39 -0
  7. package/bin/activity/interfaces/IActivityApi.js +2 -0
  8. package/bin/transaction/api/TransactionApi.d.ts +22 -0
  9. package/bin/transaction/api/TransactionApi.js +52 -0
  10. package/bin/transaction/api/interfaces/ITransactionApi.d.ts +17 -0
  11. package/bin/transaction/api/interfaces/ITransactionApi.js +2 -0
  12. package/bin/transaction/index.d.ts +2 -0
  13. package/bin/transaction/index.js +2 -0
  14. package/package.json +28 -28
  15. package/src/account-beneficiary/AccountBeneficiaryApi.ts +18 -18
  16. package/src/account-beneficiary/index.ts +2 -2
  17. package/src/account-beneficiary/interfaces/IAccountBeneficiaryApi.ts +7 -7
  18. package/src/account-fiadoinc/AccountFiadoIncApi.ts +65 -65
  19. package/src/account-fiadoinc/index.ts +1 -1
  20. package/src/account-fiadoinc/interfaces/IAccountFiadoIncApi.ts +32 -32
  21. package/src/account-fiadosa/AccountFiadoSAApi.ts +32 -32
  22. package/src/account-fiadosa/index.ts +1 -1
  23. package/src/account-fiadosa/interfaces/IAccountFiadoSAApi.ts +13 -13
  24. package/src/account-pagoconfiado/AccountPagoConfiadoApi.ts +46 -46
  25. package/src/account-pagoconfiado/index.ts +2 -2
  26. package/src/account-pagoconfiado/interfaces/IAccountPagoConfiadoApi.ts +24 -24
  27. package/src/activity-business/ActivityApi.ts +34 -34
  28. package/src/activity-business/index.ts +5 -5
  29. package/src/activity-business/interfaces/IActivityApi.ts +9 -9
  30. package/src/activity-business/queue/ActivityPublisher.ts +28 -28
  31. package/src/activity-business/queue/IActivityPublisher.ts +4 -4
  32. package/src/address/AddressApi.ts +46 -46
  33. package/src/address/index.ts +3 -3
  34. package/src/address/interfaces/IAddressApi.ts +30 -30
  35. package/src/authentication/AuthenticationApi.ts +16 -16
  36. package/src/authentication/index.ts +4 -4
  37. package/src/authentication/interfaces/IAuthenticationApi.ts +5 -5
  38. package/src/bankAccount/BankAccountApi.ts +48 -48
  39. package/src/bankAccount/index.ts +1 -1
  40. package/src/bankAccount/interfaces/IBankAccountApi.ts +6 -6
  41. package/src/bbvaRst/api/BBVARstApi.ts +16 -16
  42. package/src/bbvaRst/api/interfaces/IBBVARstApi.ts +4 -4
  43. package/src/bbvaRst/index.ts +1 -1
  44. package/src/card/CardApi.ts +36 -36
  45. package/src/card/index.ts +3 -3
  46. package/src/card/interfaces/ICardApi.ts +10 -10
  47. package/src/cnbv-business/CnbvApi.ts +22 -22
  48. package/src/cnbv-business/index.ts +4 -4
  49. package/src/cnbv-business/interfaces/ICnbvApi.ts +6 -6
  50. package/src/collector/CollectorApi.ts +25 -25
  51. package/src/collector/index.ts +2 -2
  52. package/src/collector/interfaces/ICollectorApi.ts +21 -21
  53. package/src/contactInformation/ContactInformationApi.ts +20 -20
  54. package/src/contactInformation/index.ts +2 -2
  55. package/src/contactInformation/interface/IContactInformationApi.ts +8 -8
  56. package/src/container.config.ts +88 -88
  57. package/src/contract-generator/ContractGeneratorApi.ts +18 -18
  58. package/src/contract-generator/index.ts +2 -2
  59. package/src/contract-generator/interfaces/IContractGeneratorApi.ts +16 -16
  60. package/src/directory/DirectoryApi.ts +128 -128
  61. package/src/directory/index.ts +3 -3
  62. package/src/directory/interfaces/IDirectoryApi.ts +63 -63
  63. package/src/exchangeRates/ExchangeRatesApi.ts +27 -27
  64. package/src/exchangeRates/index.ts +1 -1
  65. package/src/exchangeRates/interfaces/IExchangeRatesApi.ts +8 -8
  66. package/src/fiadoMessages/api/FiadoMessagesApi.ts +20 -20
  67. package/src/fiadoMessages/api/interfaces/IFiadoMessagesApi.ts +2 -2
  68. package/src/fiadoMessages/index.ts +1 -1
  69. package/src/fraudPreventionEngine/api/FraudPreventionEngineApi.ts +22 -22
  70. package/src/fraudPreventionEngine/api/interfaces/IFraudPreventionEngineApi.ts +7 -7
  71. package/src/fraudPreventionEngine/index.ts +1 -1
  72. package/src/group/GroupApi.ts +24 -24
  73. package/src/group/index.ts +1 -1
  74. package/src/group/interfaces/IGroupApi.ts +23 -23
  75. package/src/identity/IdentityApi.ts +47 -47
  76. package/src/identity/index.ts +3 -3
  77. package/src/identity/interfaces/IIdentityApi.ts +33 -33
  78. package/src/index.ts +31 -31
  79. package/src/notificationMessages/index.ts +1 -1
  80. package/src/notificationMessages/queue/NotificationMessagePublisher.ts +22 -22
  81. package/src/notificationMessages/queue/interfaces/INotificationMessagesPublisher.ts +4 -4
  82. package/src/p2pContact/api/P2pContactApi.ts +19 -19
  83. package/src/p2pContact/api/interfaces/IP2pContactApi.ts +4 -4
  84. package/src/p2pContact/index.ts +1 -1
  85. package/src/pomelo/api/PomeloApi.ts +99 -99
  86. package/src/pomelo/api/interfaces/IPomeloApi.ts +27 -27
  87. package/src/pomelo/index.ts +1 -1
  88. package/src/pomeloProcessor/api/PomeloProcessorApi.ts +17 -17
  89. package/src/pomeloProcessor/api/interfaces/IPomeloProcessorApi.ts +2 -2
  90. package/src/pomeloProcessor/index.ts +2 -2
  91. package/src/product-catalog/ProductCatalogApi.ts +17 -17
  92. package/src/product-catalog/index.ts +1 -1
  93. package/src/product-catalog/interfaces/IProductCatalogApi.ts +6 -6
  94. package/src/riskProfile/api/RiskProfileApi.ts +29 -29
  95. package/src/riskProfile/api/interfaces/IRiskProfileApi.ts +10 -10
  96. package/src/riskProfile/index.ts +4 -4
  97. package/src/riskProfile/queue/TransactionAlarmPublisher.ts +24 -24
  98. package/src/riskProfile/queue/interfaces/ITransactionAlarmPublisher.ts +4 -4
  99. package/src/sessionActivity/index.ts +2 -2
  100. package/src/sessionActivity/queue/SessionActivityPublisher.ts +22 -22
  101. package/src/sessionActivity/queue/interfaces/ISessionActivityPublisher.ts +4 -4
  102. package/src/stpAccount/api/STPAccountApi.ts +111 -111
  103. package/src/stpAccount/api/interfaces/ISTPAccountApi.ts +7 -7
  104. package/src/stpAccount/index.ts +1 -1
  105. package/src/stpServicePayment/api/StpServicePaymentApi.ts +40 -40
  106. package/src/stpServicePayment/api/interfaces/IStpServicePaymentApi.ts +13 -13
  107. package/src/stpServicePayment/index.ts +1 -1
  108. package/src/stpSpei/api/StpSpeiApi.ts +32 -32
  109. package/src/stpSpei/api/interfaces/IStpSpeiApi.ts +6 -6
  110. package/src/stpSpei/index.ts +1 -1
  111. package/src/tern/api/TernApi.ts +137 -137
  112. package/src/tern/api/interfaces/ITernApi.ts +38 -38
  113. package/src/tern/index.ts +1 -1
  114. package/src/transaction/api/TransactionApi.ts +46 -0
  115. package/src/transaction/api/interfaces/ITransactionApi.ts +20 -0
  116. package/src/transaction/index.ts +5 -2
  117. package/src/transaction/queue/TransactionPublisher.ts +24 -24
  118. package/src/transaction/queue/interfaces/ITransactionPublisher.ts +4 -4
  119. package/src/transactionProcessor/api/TransactionProcessorApi.ts +37 -37
  120. package/src/transactionProcessor/api/interfaces/ITransactionProcessorApi.ts +15 -15
  121. package/src/transactionProcessor/index.ts +1 -1
  122. package/tsconfig.json +21 -21
@@ -1,138 +1,138 @@
1
- import { ITernApi } from "./interfaces/ITernApi";
2
- import { inject, injectable } from "inversify";
3
- import { IHttpRequest } from "@fiado/http-client";
4
- import {
5
- BankAccountP2pTransferRequest,
6
- CreateBankAccountRequest,
7
- CreateBankAccountUserRequest,
8
- GetBankAccountRequest,
9
- GetBankAccountUserRequest,
10
- } from "@fiado/type-kit/bin/account";
11
- import {
12
- ActivateBankAccountCardRequest,
13
- AssignCardRequest,
14
- CreateBankAccountCardRequest,
15
- UpdateBankAccountCardRequest
16
- } from "@fiado/type-kit/bin/card";
17
-
18
-
19
- @injectable()
20
- export default class TernApi implements ITernApi {
21
- private readonly baseUrl = process.env.TERN_LAMBDA_URL || "";
22
-
23
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
24
- }
25
-
26
- /// USERS
27
- async getUser(request: GetBankAccountUserRequest): Promise<any> {
28
- const url: string = `${this.baseUrl}users/${request.externalUserId}`;
29
- return await this.httpRequest.get(url);
30
- }
31
-
32
- async createUser(request: CreateBankAccountUserRequest): Promise<any> {
33
- const url: string = `${this.baseUrl}users/create`;
34
- return await this.httpRequest.post(url, request);
35
- }
36
-
37
- /// ACCOUNTS
38
- async getAccount(request: GetBankAccountRequest): Promise<any> {
39
- const url: string = `${this.baseUrl}accounts/${request.externalAccountId}`;
40
- return await this.httpRequest.get(url);
41
- }
42
-
43
- async getBusinessAccount(request: GetBankAccountRequest): Promise<any> {
44
- const url: string = `${this.baseUrl}accounts/${request.externalAccountId}?accountType=BUSINESS`;
45
- return await this.httpRequest.get(url);
46
- }
47
-
48
- async createAccount(request: CreateBankAccountRequest): Promise<any> {
49
- const url: string = `${this.baseUrl}accounts/create`;
50
- return await this.httpRequest.post(url, request);
51
- }
52
-
53
- /// CARDS
54
-
55
- async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<any> {
56
-
57
- const url = `${this.baseUrl}cards/${externalCardId}/sensitive`;
58
- return await this.httpRequest.get(url);
59
- }
60
-
61
- async getCardsById(externalCardId: string): Promise<any> {
62
-
63
- const url = `${this.baseUrl}cards/${externalCardId}/`;
64
- return await this.httpRequest.get(url);
65
- }
66
-
67
- async createCard(request: CreateBankAccountCardRequest): Promise<any> {
68
- const url = `${this.baseUrl}cards/create`;
69
- return await this.httpRequest.post(url, request);
70
- }
71
-
72
- async blockCard(request: UpdateBankAccountCardRequest): Promise<any> {
73
- const url = `${this.baseUrl}cards/block`;
74
- return await this.httpRequest.post(url, request);
75
- }
76
-
77
- async changePin(request: UpdateBankAccountCardRequest): Promise<any> {
78
- const url = `${this.baseUrl}cards/${request.cardId}/`;
79
- return await this.httpRequest.put(url, request);
80
- }
81
-
82
- async updateCard(request: UpdateBankAccountCardRequest): Promise<any> {
83
- const url = `${this.baseUrl}cards/${request.cardId}/`;
84
- return await this.httpRequest.put(url, request);
85
- }
86
-
87
- async activateCard(request: ActivateBankAccountCardRequest): Promise<any> {
88
- const url = `${this.baseUrl}cards/activate`;
89
- return await this.httpRequest.post(url, request);
90
- }
91
-
92
- async assignCardToUser(request: AssignCardRequest): Promise<any> {
93
- const url = `${this.baseUrl}cards/activate`;
94
- return await this.httpRequest.post(url, request);
95
- }
96
-
97
- async p2pTransfer(request: BankAccountP2pTransferRequest): Promise<any> {
98
- const url: string = `${this.baseUrl}users/accounts/transfer_balances`;
99
- return await this.httpRequest.patch(url, request);
100
- }
101
-
102
- //transactions
103
- async getTransactions(accountId: string, page: number, pageSize?: number | null, startDate?: string | null, endDate?: string | null, detail: boolean = false, raw: boolean = false): Promise<any> {
104
- try {
105
- let url = `${this.baseUrl}users/${accountId}/v2/transactions?page=${page}&detail=${detail}&raw=${raw}`;
106
-
107
- // Verificar si pageSize es válido y agregarlo
108
- if (pageSize != null) {
109
- url += `&pageSize=${encodeURIComponent(pageSize)}`;
110
- }
111
-
112
- // Verificar si startDate es válido y agregarlo
113
- if (startDate) {
114
- url += `&startDate=${encodeURIComponent(startDate)}`;
115
- }
116
-
117
- // Verificar si endDate es válido y agregarlo
118
- if (endDate) {
119
- url += `&endDate=${encodeURIComponent(endDate)}`;
120
- }
121
-
122
- return await this.httpRequest.get(url);
123
- } catch (error) {
124
- console.log(error);
125
- throw error;
126
- }
127
- }
128
-
129
- async getCardTransactions(externalUserId: string, page: number, pageSize: number): Promise<any> {
130
- const url = `${this.baseUrl}users/${externalUserId}/transactions?page=${page}&pageSize=${pageSize}`;
131
- return await this.httpRequest.get(url);
132
- }
133
-
134
- async getAccountTransactions(accountId: string): Promise<any> {
135
- const url = `${this.baseUrl}accounts/${accountId}/transactions/all`;
136
- return await this.httpRequest.get(url);
137
- }
1
+ import { ITernApi } from "./interfaces/ITernApi";
2
+ import { inject, injectable } from "inversify";
3
+ import { IHttpRequest } from "@fiado/http-client";
4
+ import {
5
+ BankAccountP2pTransferRequest,
6
+ CreateBankAccountRequest,
7
+ CreateBankAccountUserRequest,
8
+ GetBankAccountRequest,
9
+ GetBankAccountUserRequest,
10
+ } from "@fiado/type-kit/bin/account";
11
+ import {
12
+ ActivateBankAccountCardRequest,
13
+ AssignCardRequest,
14
+ CreateBankAccountCardRequest,
15
+ UpdateBankAccountCardRequest
16
+ } from "@fiado/type-kit/bin/card";
17
+
18
+
19
+ @injectable()
20
+ export default class TernApi implements ITernApi {
21
+ private readonly baseUrl = process.env.TERN_LAMBDA_URL || "";
22
+
23
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
24
+ }
25
+
26
+ /// USERS
27
+ async getUser(request: GetBankAccountUserRequest): Promise<any> {
28
+ const url: string = `${this.baseUrl}users/${request.externalUserId}`;
29
+ return await this.httpRequest.get(url);
30
+ }
31
+
32
+ async createUser(request: CreateBankAccountUserRequest): Promise<any> {
33
+ const url: string = `${this.baseUrl}users/create`;
34
+ return await this.httpRequest.post(url, request);
35
+ }
36
+
37
+ /// ACCOUNTS
38
+ async getAccount(request: GetBankAccountRequest): Promise<any> {
39
+ const url: string = `${this.baseUrl}accounts/${request.externalAccountId}`;
40
+ return await this.httpRequest.get(url);
41
+ }
42
+
43
+ async getBusinessAccount(request: GetBankAccountRequest): Promise<any> {
44
+ const url: string = `${this.baseUrl}accounts/${request.externalAccountId}?accountType=BUSINESS`;
45
+ return await this.httpRequest.get(url);
46
+ }
47
+
48
+ async createAccount(request: CreateBankAccountRequest): Promise<any> {
49
+ const url: string = `${this.baseUrl}accounts/create`;
50
+ return await this.httpRequest.post(url, request);
51
+ }
52
+
53
+ /// CARDS
54
+
55
+ async getCardSensitiveInformation(externalCardId: string, externalUserId?: string): Promise<any> {
56
+
57
+ const url = `${this.baseUrl}cards/${externalCardId}/sensitive`;
58
+ return await this.httpRequest.get(url);
59
+ }
60
+
61
+ async getCardsById(externalCardId: string): Promise<any> {
62
+
63
+ const url = `${this.baseUrl}cards/${externalCardId}/`;
64
+ return await this.httpRequest.get(url);
65
+ }
66
+
67
+ async createCard(request: CreateBankAccountCardRequest): Promise<any> {
68
+ const url = `${this.baseUrl}cards/create`;
69
+ return await this.httpRequest.post(url, request);
70
+ }
71
+
72
+ async blockCard(request: UpdateBankAccountCardRequest): Promise<any> {
73
+ const url = `${this.baseUrl}cards/block`;
74
+ return await this.httpRequest.post(url, request);
75
+ }
76
+
77
+ async changePin(request: UpdateBankAccountCardRequest): Promise<any> {
78
+ const url = `${this.baseUrl}cards/${request.cardId}/`;
79
+ return await this.httpRequest.put(url, request);
80
+ }
81
+
82
+ async updateCard(request: UpdateBankAccountCardRequest): Promise<any> {
83
+ const url = `${this.baseUrl}cards/${request.cardId}/`;
84
+ return await this.httpRequest.put(url, request);
85
+ }
86
+
87
+ async activateCard(request: ActivateBankAccountCardRequest): Promise<any> {
88
+ const url = `${this.baseUrl}cards/activate`;
89
+ return await this.httpRequest.post(url, request);
90
+ }
91
+
92
+ async assignCardToUser(request: AssignCardRequest): Promise<any> {
93
+ const url = `${this.baseUrl}cards/activate`;
94
+ return await this.httpRequest.post(url, request);
95
+ }
96
+
97
+ async p2pTransfer(request: BankAccountP2pTransferRequest): Promise<any> {
98
+ const url: string = `${this.baseUrl}users/accounts/transfer_balances`;
99
+ return await this.httpRequest.patch(url, request);
100
+ }
101
+
102
+ //transactions
103
+ async getTransactions(accountId: string, page: number, pageSize?: number | null, startDate?: string | null, endDate?: string | null, detail: boolean = false, raw: boolean = false): Promise<any> {
104
+ try {
105
+ let url = `${this.baseUrl}users/${accountId}/v2/transactions?page=${page}&detail=${detail}&raw=${raw}`;
106
+
107
+ // Verificar si pageSize es válido y agregarlo
108
+ if (pageSize != null) {
109
+ url += `&pageSize=${encodeURIComponent(pageSize)}`;
110
+ }
111
+
112
+ // Verificar si startDate es válido y agregarlo
113
+ if (startDate) {
114
+ url += `&startDate=${encodeURIComponent(startDate)}`;
115
+ }
116
+
117
+ // Verificar si endDate es válido y agregarlo
118
+ if (endDate) {
119
+ url += `&endDate=${encodeURIComponent(endDate)}`;
120
+ }
121
+
122
+ return await this.httpRequest.get(url);
123
+ } catch (error) {
124
+ console.log(error);
125
+ throw error;
126
+ }
127
+ }
128
+
129
+ async getCardTransactions(externalUserId: string, page: number, pageSize: number): Promise<any> {
130
+ const url = `${this.baseUrl}users/${externalUserId}/transactions?page=${page}&pageSize=${pageSize}`;
131
+ return await this.httpRequest.get(url);
132
+ }
133
+
134
+ async getAccountTransactions(accountId: string): Promise<any> {
135
+ const url = `${this.baseUrl}accounts/${accountId}/transactions/all`;
136
+ return await this.httpRequest.get(url);
137
+ }
138
138
  }
@@ -1,39 +1,39 @@
1
- import {CreateBankAccountRequest, CreateBankAccountUserRequest} from "@fiado/type-kit/bin/account";
2
- import {GetBankAccountUserRequest} from "@fiado/type-kit/bin/account/dtos/GetBankAccountUserRequest";
3
- import {GetBankAccountRequest} from "@fiado/type-kit/bin/account/dtos/GetBankAccountRequest";
4
- import { ActivateBankAccountCardRequest, AssignCardRequest, CreateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
5
-
6
- export interface ITernApi {
7
- getUser(request: GetBankAccountUserRequest): Promise<any>;
8
-
9
- getAccount(request: GetBankAccountRequest): Promise<any>;
10
-
11
- getBusinessAccount(request: GetBankAccountRequest): Promise<any>
12
-
13
- createUser(request: CreateBankAccountUserRequest): Promise<any>;
14
-
15
- createAccount(request: CreateBankAccountRequest): Promise<any>
16
-
17
- getCardsById(externalCardId: string): Promise<any>;
18
-
19
- createCard(request: CreateBankAccountCardRequest): Promise<any>;
20
-
21
- blockCard(request: UpdateBankAccountCardRequest): Promise<any>;
22
-
23
- changePin(request: UpdateBankAccountCardRequest): Promise<any>;
24
-
25
- updateCard(request: UpdateBankAccountCardRequest): Promise<any>;
26
-
27
- activateCard(request: ActivateBankAccountCardRequest): Promise<any>;
28
-
29
- assignCardToUser(request: AssignCardRequest): Promise<any>;
30
-
31
- p2pTransfer(request: any): Promise<any>
32
-
33
- getTransactions(accountId: string, page: number, pageSize?: number | null, startDate?: string | null, endDate?: string | null, detail?: boolean): Promise<any>;
34
-
35
- getCardTransactions(externalUserId: string, page: number, pageSize: number): Promise<any>;
36
-
37
- getAccountTransactions(accountId: string): Promise<any>
38
-
1
+ import {CreateBankAccountRequest, CreateBankAccountUserRequest} from "@fiado/type-kit/bin/account";
2
+ import {GetBankAccountUserRequest} from "@fiado/type-kit/bin/account/dtos/GetBankAccountUserRequest";
3
+ import {GetBankAccountRequest} from "@fiado/type-kit/bin/account/dtos/GetBankAccountRequest";
4
+ import { ActivateBankAccountCardRequest, AssignCardRequest, CreateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
5
+
6
+ export interface ITernApi {
7
+ getUser(request: GetBankAccountUserRequest): Promise<any>;
8
+
9
+ getAccount(request: GetBankAccountRequest): Promise<any>;
10
+
11
+ getBusinessAccount(request: GetBankAccountRequest): Promise<any>
12
+
13
+ createUser(request: CreateBankAccountUserRequest): Promise<any>;
14
+
15
+ createAccount(request: CreateBankAccountRequest): Promise<any>
16
+
17
+ getCardsById(externalCardId: string): Promise<any>;
18
+
19
+ createCard(request: CreateBankAccountCardRequest): Promise<any>;
20
+
21
+ blockCard(request: UpdateBankAccountCardRequest): Promise<any>;
22
+
23
+ changePin(request: UpdateBankAccountCardRequest): Promise<any>;
24
+
25
+ updateCard(request: UpdateBankAccountCardRequest): Promise<any>;
26
+
27
+ activateCard(request: ActivateBankAccountCardRequest): Promise<any>;
28
+
29
+ assignCardToUser(request: AssignCardRequest): Promise<any>;
30
+
31
+ p2pTransfer(request: any): Promise<any>
32
+
33
+ getTransactions(accountId: string, page: number, pageSize?: number | null, startDate?: string | null, endDate?: string | null, detail?: boolean): Promise<any>;
34
+
35
+ getCardTransactions(externalUserId: string, page: number, pageSize: number): Promise<any>;
36
+
37
+ getAccountTransactions(accountId: string): Promise<any>
38
+
39
39
  }
package/src/tern/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from './api/TernApi';
1
+ export * from './api/TernApi';
2
2
  export * from './api/interfaces/ITernApi';
@@ -0,0 +1,46 @@
1
+ import { inject, injectable } from "inversify";
2
+ import { IHttpRequest } from "@fiado/http-client";
3
+ import { ITransactionApi } from "./interfaces/ITransactionApi";
4
+ import { TransactionSourceEnum } from "@fiado/type-kit/bin/transaction";
5
+
6
+
7
+ @injectable()
8
+ export default class TransactionApi implements ITransactionApi {
9
+ private readonly baseUrl = process.env.TERN_LAMBDA_URL || "";
10
+
11
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
12
+ }
13
+ async getTransactionsByDirectoryIdAndSource(params: { directoryId: string; source: TransactionSourceEnum; index?: string; pageSize?: number; }): Promise<any> {
14
+
15
+ let queryParams = [];
16
+ if (!params.index) {
17
+ queryParams.push(`index=${params.index}`);
18
+ }
19
+
20
+ if (!params.pageSize) {
21
+ queryParams.push(`pageSize=${params.pageSize}`);
22
+ }
23
+
24
+ const url: string = `${this.baseUrl}trx/transactions/${params.source}/${params.directoryId}?${queryParams.join('&')}`;
25
+ return await this.httpRequest.get(url);
26
+ }
27
+ async getFiadoTxByDirectoryAndBetweenDates(params: { directoryId: string; targetOrSource: string; startDate: string; endDate: string; index?: string; pageSize?: number; }): Promise<any> {
28
+ let queryParams = [];
29
+ if (!params.index) {
30
+ queryParams.push(`index=${params.index}`);
31
+ }
32
+
33
+ if (!params.pageSize) {
34
+ queryParams.push(`pageSize=${params.pageSize}`);
35
+ }
36
+
37
+ queryParams.push(`startDate=${params.startDate}`);
38
+ queryParams.push(`endDate=${params.endDate}`);
39
+ queryParams.push(`targetOrSource=${params.targetOrSource}`);
40
+
41
+ const url: string = `${this.baseUrl}trx/fiadotx/${params.directoryId}/bdates?${queryParams.join('&')}`;
42
+
43
+ return await this.httpRequest.get(url);
44
+ }
45
+
46
+ }
@@ -0,0 +1,20 @@
1
+ import { TransactionSourceEnum } from "@fiado/type-kit/bin/transaction";
2
+
3
+ export interface ITransactionApi {
4
+ getTransactionsByDirectoryIdAndSource(params: {
5
+ directoryId: string;
6
+ source: TransactionSourceEnum;
7
+ index?: string;
8
+ pageSize?: number;
9
+ }): Promise<any>;
10
+
11
+
12
+ getFiadoTxByDirectoryAndBetweenDates(params:{
13
+ directoryId: string;
14
+ targetOrSource: string;
15
+ startDate: string;
16
+ endDate: string;
17
+ index?: string;
18
+ pageSize?: number;
19
+ }): Promise<any>;
20
+ }
@@ -1,2 +1,5 @@
1
- export * from './queue/TransactionPublisher';
2
- export * from './queue/interfaces/ITransactionPublisher';
1
+ export * from './queue/TransactionPublisher';
2
+ export * from './queue/interfaces/ITransactionPublisher';
3
+ export * from './api/TransactionApi';
4
+ export * from './api/interfaces/ITransactionApi';
5
+
@@ -1,25 +1,25 @@
1
- import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
2
- import {ITransactionPublisher} from "./interfaces/ITransactionPublisher";
3
- import {injectable} from "inversify";
4
- import {TransactionCreateRequest} from "@fiado/type-kit/bin/transaction";
5
-
6
- @injectable()
7
- export class TransactionPublisher implements ITransactionPublisher {
8
- private readonly TRANSACTION_QUEUE = process.env.TRANSACTION_QUEUE
9
-
10
- async publish(message: TransactionCreateRequest): Promise<void> {
11
- try {
12
- const client: SQSClient = new SQSClient();
13
- const sendMessageRequest: SendMessageRequest = {
14
- QueueUrl: this.TRANSACTION_QUEUE,
15
- MessageBody: JSON.stringify(message),
16
- MessageGroupId: message.transactionNumber,
17
- MessageDeduplicationId: message.transactionNumber
18
- };
19
- const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
20
- await client.send(command);
21
- } catch (error) {
22
- throw new Error(`Error publishing message to queue ${': ' + error.message ?? ''}`);
23
- }
24
- }
1
+ import {SendMessageCommand, SendMessageRequest, SQSClient} from "@aws-sdk/client-sqs";
2
+ import {ITransactionPublisher} from "./interfaces/ITransactionPublisher";
3
+ import {injectable} from "inversify";
4
+ import {TransactionCreateRequest} from "@fiado/type-kit/bin/transaction";
5
+
6
+ @injectable()
7
+ export class TransactionPublisher implements ITransactionPublisher {
8
+ private readonly TRANSACTION_QUEUE = process.env.TRANSACTION_QUEUE
9
+
10
+ async publish(message: TransactionCreateRequest): Promise<void> {
11
+ try {
12
+ const client: SQSClient = new SQSClient();
13
+ const sendMessageRequest: SendMessageRequest = {
14
+ QueueUrl: this.TRANSACTION_QUEUE,
15
+ MessageBody: JSON.stringify(message),
16
+ MessageGroupId: message.transactionNumber,
17
+ MessageDeduplicationId: message.transactionNumber
18
+ };
19
+ const command: SendMessageCommand = new SendMessageCommand(sendMessageRequest);
20
+ await client.send(command);
21
+ } catch (error) {
22
+ throw new Error(`Error publishing message to queue ${': ' + error.message ?? ''}`);
23
+ }
24
+ }
25
25
  }
@@ -1,5 +1,5 @@
1
- import { TransactionCreateRequest } from "@fiado/type-kit/bin/transaction";
2
-
3
- export interface ITransactionPublisher {
4
- publish(message: TransactionCreateRequest): Promise<void>;
1
+ import { TransactionCreateRequest } from "@fiado/type-kit/bin/transaction";
2
+
3
+ export interface ITransactionPublisher {
4
+ publish(message: TransactionCreateRequest): Promise<void>;
5
5
  }
@@ -1,38 +1,38 @@
1
- import {ITransactionProcessorApi} from "./interfaces/ITransactionProcessorApi";
2
- import {inject, injectable} from "inversify";
3
- import {IHttpRequest} from "@fiado/http-client";
4
- import {
5
- AuthorizeCollectorTransactionRequest,
6
- AuthorizeCreditCardPurchaseRequest,
7
- AuthorizeSpeiMexBankTransferInRequest
8
- } from "@fiado/type-kit/bin/transactionProcessor";
9
- import ProcessUpdateLevelRequest from "@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest";
10
-
11
- @injectable()
12
- export default class TransactionProcessorApi implements ITransactionProcessorApi {
13
- private readonly baseUrl = process.env.TRANSACTION_PROCESSOR_LAMBDA_URL || "";
14
-
15
- constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
16
- }
17
-
18
- async authorizeTransaction(request: AuthorizeCreditCardPurchaseRequest): Promise<any> {
19
- const url: string = `${this.baseUrl}authorize`;
20
- return await this.httpRequest.post(url, request);
21
- }
22
-
23
- async authorizeSpeiBankTransferInTransaction(request: AuthorizeSpeiMexBankTransferInRequest): Promise<any> {
24
- const url: string = `${this.baseUrl}spei/authorize`;
25
- return await this.httpRequest.post(url, request);
26
- }
27
-
28
- async processUpdateLevel(request: ProcessUpdateLevelRequest): Promise<any> {
29
- const url: string = `${this.baseUrl}accountLevel`;
30
- return await this.httpRequest.put(url, request);
31
- }
32
-
33
- async authorizeCollectorTransaction(request: AuthorizeCollectorTransactionRequest): Promise<any> {
34
- const url: string = `${this.baseUrl}collector`;
35
- return await this.httpRequest.post(url, request);
36
- }
37
-
1
+ import {ITransactionProcessorApi} from "./interfaces/ITransactionProcessorApi";
2
+ import {inject, injectable} from "inversify";
3
+ import {IHttpRequest} from "@fiado/http-client";
4
+ import {
5
+ AuthorizeCollectorTransactionRequest,
6
+ AuthorizeCreditCardPurchaseRequest,
7
+ AuthorizeSpeiMexBankTransferInRequest
8
+ } from "@fiado/type-kit/bin/transactionProcessor";
9
+ import ProcessUpdateLevelRequest from "@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest";
10
+
11
+ @injectable()
12
+ export default class TransactionProcessorApi implements ITransactionProcessorApi {
13
+ private readonly baseUrl = process.env.TRANSACTION_PROCESSOR_LAMBDA_URL || "";
14
+
15
+ constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) {
16
+ }
17
+
18
+ async authorizeTransaction(request: AuthorizeCreditCardPurchaseRequest): Promise<any> {
19
+ const url: string = `${this.baseUrl}authorize`;
20
+ return await this.httpRequest.post(url, request);
21
+ }
22
+
23
+ async authorizeSpeiBankTransferInTransaction(request: AuthorizeSpeiMexBankTransferInRequest): Promise<any> {
24
+ const url: string = `${this.baseUrl}spei/authorize`;
25
+ return await this.httpRequest.post(url, request);
26
+ }
27
+
28
+ async processUpdateLevel(request: ProcessUpdateLevelRequest): Promise<any> {
29
+ const url: string = `${this.baseUrl}accountLevel`;
30
+ return await this.httpRequest.put(url, request);
31
+ }
32
+
33
+ async authorizeCollectorTransaction(request: AuthorizeCollectorTransactionRequest): Promise<any> {
34
+ const url: string = `${this.baseUrl}collector`;
35
+ return await this.httpRequest.post(url, request);
36
+ }
37
+
38
38
  }
@@ -1,16 +1,16 @@
1
- import {
2
- AuthorizeCollectorTransactionRequest,
3
- AuthorizeCreditCardPurchaseRequest,
4
- AuthorizeSpeiMexBankTransferInRequest
5
- } from "@fiado/type-kit/bin/transactionProcessor";
6
- import ProcessUpdateLevelRequest from "@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest";
7
-
8
- export interface ITransactionProcessorApi {
9
- authorizeTransaction(request: AuthorizeCreditCardPurchaseRequest): Promise<any>;
10
-
11
- authorizeSpeiBankTransferInTransaction(request: AuthorizeSpeiMexBankTransferInRequest): Promise<any>
12
-
13
- processUpdateLevel(request: ProcessUpdateLevelRequest): Promise<any>;
14
-
15
- authorizeCollectorTransaction(request: AuthorizeCollectorTransactionRequest): Promise<any>;
1
+ import {
2
+ AuthorizeCollectorTransactionRequest,
3
+ AuthorizeCreditCardPurchaseRequest,
4
+ AuthorizeSpeiMexBankTransferInRequest
5
+ } from "@fiado/type-kit/bin/transactionProcessor";
6
+ import ProcessUpdateLevelRequest from "@fiado/type-kit/bin/transactionProcessor/dtos/ProcessUpdateLevelRequest";
7
+
8
+ export interface ITransactionProcessorApi {
9
+ authorizeTransaction(request: AuthorizeCreditCardPurchaseRequest): Promise<any>;
10
+
11
+ authorizeSpeiBankTransferInTransaction(request: AuthorizeSpeiMexBankTransferInRequest): Promise<any>
12
+
13
+ processUpdateLevel(request: ProcessUpdateLevelRequest): Promise<any>;
14
+
15
+ authorizeCollectorTransaction(request: AuthorizeCollectorTransactionRequest): Promise<any>;
16
16
  }
@@ -1,2 +1,2 @@
1
- export * from './api/TransactionProcessorApi';
1
+ export * from './api/TransactionProcessorApi';
2
2
  export * from './api/interfaces/ITransactionProcessorApi';