@fiado/api-invoker 1.0.32 → 1.0.34

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.
@@ -1,11 +1,11 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
- import { AddressCreateRequest, AddressResponse, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
2
+ import { AddressCreateRequest, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
3
3
  import { IAddressApi } from "./interfaces/IAddressApi";
4
4
  export declare class AddressApi implements IAddressApi {
5
5
  private httpRequest;
6
6
  private readonly baseUrl;
7
7
  constructor(httpRequest: IHttpRequest);
8
- getByDirectoryId(directoryId: string): Promise<AddressResponse[]>;
8
+ getByDirectoryId(directoryId: string): Promise<any>;
9
9
  create(directoryId: string, address: AddressCreateRequest): Promise<void>;
10
10
  getAddressLocationShipping(input: AddressShippingCardRequest): Promise<AddressShippingCardResponse>;
11
11
  private validateBaseUrl;
@@ -1,6 +1,7 @@
1
1
  import { ITernApi } from "./interfaces/ITernApi";
2
2
  import { IHttpRequest } from "@fiado/http-client";
3
3
  import { CreateBankAccountRequest, CreateBankAccountUserRequest, GetBankAccountRequest, GetBankAccountUserRequest } from "@fiado/type-kit/bin/account";
4
+ import { CreateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
4
5
  export default class TernApi implements ITernApi {
5
6
  private httpRequest;
6
7
  private readonly baseUrl;
@@ -9,4 +10,10 @@ export default class TernApi implements ITernApi {
9
10
  createUser(request: CreateBankAccountUserRequest): Promise<any>;
10
11
  getAccount(request: GetBankAccountRequest): Promise<any>;
11
12
  createAccount(request: CreateBankAccountRequest): Promise<any>;
13
+ getCardsById(externalCardId: string): Promise<any>;
14
+ createCard(request: CreateBankAccountCardRequest): Promise<any>;
15
+ blockCard(request: UpdateBankAccountCardRequest): Promise<any>;
16
+ changePin(request: UpdateBankAccountCardRequest): Promise<any>;
17
+ activateCard(request: UpdateBankAccountCardRequest): Promise<any>;
18
+ updateCard(request: UpdateBankAccountCardRequest): Promise<any>;
12
19
  }
@@ -36,6 +36,31 @@ let TernApi = class TernApi {
36
36
  const url = `${this.baseUrl}accounts/create`;
37
37
  return await this.httpRequest.post(url, request);
38
38
  }
39
+ /// CARDS
40
+ async getCardsById(externalCardId) {
41
+ const url = `${this.baseUrl}cards/${externalCardId}/`;
42
+ return await this.httpRequest.get(url);
43
+ }
44
+ async createCard(request) {
45
+ const url = `${this.baseUrl}cards/create`;
46
+ return await this.httpRequest.post(url, request);
47
+ }
48
+ async blockCard(request) {
49
+ const url = `${this.baseUrl}cards/block`;
50
+ return await this.httpRequest.post(url, request);
51
+ }
52
+ async changePin(request) {
53
+ const url = `${this.baseUrl}cards/${request.cardId}/`;
54
+ return await this.httpRequest.put(url, request);
55
+ }
56
+ async activateCard(request) {
57
+ const url = `${this.baseUrl}cards/activate`;
58
+ return await this.httpRequest.post(url, request);
59
+ }
60
+ async updateCard(request) {
61
+ const url = `${this.baseUrl}cards/${request.cardId}/`;
62
+ return await this.httpRequest.put(url, request);
63
+ }
39
64
  };
40
65
  TernApi = __decorate([
41
66
  (0, inversify_1.injectable)(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fiado/api-invoker",
3
- "version": "1.0.32",
3
+ "version": "1.0.34",
4
4
  "description": "Sirve como un puente entre diferentes funciones lambda, facilitando la comunicación entre ellas a traves de invocaciones http",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "@fiado/api-invoker": "^1.0.19",
17
17
  "@fiado/gateway-adapter": "^1.0.30",
18
18
  "@fiado/http-client": "^1.0.1",
19
- "@fiado/type-kit": "^1.0.71",
19
+ "@fiado/type-kit": "^1.0.77",
20
20
  "dotenv": "^16.4.5",
21
21
  "inversify": "^6.0.2",
22
22
  "reflect-metadata": "^0.2.1",
@@ -1,5 +1,5 @@
1
1
  import { IHttpRequest } from "@fiado/http-client";
2
- import { AddressCreateRequest, AddressResponse, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
2
+ import { AddressCreateRequest, AddressShippingCardRequest, AddressShippingCardResponse } from "@fiado/type-kit/bin/address";
3
3
  import { inject, injectable } from "inversify";
4
4
  import { IAddressApi } from "./interfaces/IAddressApi";
5
5
 
@@ -10,7 +10,7 @@ export class AddressApi implements IAddressApi {
10
10
  private readonly baseUrl = process.env.ADDRESS_LAMBDA_URL || "";
11
11
  constructor(@inject("IHttpRequest") private httpRequest: IHttpRequest) { }
12
12
 
13
- async getByDirectoryId(directoryId: string): Promise<AddressResponse[]> {
13
+ async getByDirectoryId(directoryId: string): Promise<any> {
14
14
 
15
15
  this.validateBaseUrl();
16
16
  this.validateDirectoryId(directoryId);
@@ -1,17 +1,13 @@
1
1
  import {ITernApi} from "./interfaces/ITernApi";
2
2
  import {inject, injectable} from "inversify";
3
3
  import {IHttpRequest} from "@fiado/http-client";
4
- import {ApiGatewayResponse} from "@fiado/gateway-adapter";
5
4
  import {
6
5
  CreateBankAccountRequest,
7
- CreateBankAccountResponse,
8
6
  CreateBankAccountUserRequest,
9
- CreateBankAccountUserResponse,
10
7
  GetBankAccountRequest,
11
- GetBankAccountResponse,
12
8
  GetBankAccountUserRequest,
13
- GetBankAccountUserResponse
14
9
  } from "@fiado/type-kit/bin/account";
10
+ import { CreateBankAccountCardRequest, UpdateBankAccountCardRequest } from "@fiado/type-kit/bin/card";
15
11
 
16
12
 
17
13
  @injectable()
@@ -43,5 +39,35 @@ export default class TernApi implements ITernApi {
43
39
  return await this.httpRequest.post(url, request);
44
40
  }
45
41
 
42
+ /// CARDS
43
+ async getCardsById(externalCardId: string): Promise<any> {
46
44
 
45
+ const url = `${this.baseUrl}cards/${externalCardId}/`;
46
+ return await this.httpRequest.get(url);
47
+ }
48
+
49
+ async createCard(request: CreateBankAccountCardRequest): Promise<any> {
50
+ const url = `${this.baseUrl}cards/create`;
51
+ return await this.httpRequest.post(url, request);
52
+ }
53
+
54
+ async blockCard(request: UpdateBankAccountCardRequest): Promise<any> {
55
+ const url = `${this.baseUrl}cards/block`;
56
+ return await this.httpRequest.post(url, request);
57
+ }
58
+
59
+ async changePin(request: UpdateBankAccountCardRequest): Promise<any> {
60
+ const url = `${this.baseUrl}cards/${request.cardId}/`;
61
+ return await this.httpRequest.put(url, request);
62
+ }
63
+
64
+ async activateCard(request: UpdateBankAccountCardRequest): Promise<any> {
65
+ const url = `${this.baseUrl}cards/activate`;
66
+ return await this.httpRequest.post(url, request);
67
+ }
68
+
69
+ async updateCard(request: UpdateBankAccountCardRequest): Promise<any> {
70
+ const url = `${this.baseUrl}cards/${request.cardId}/`;
71
+ return await this.httpRequest.put(url, request);
72
+ }
47
73
  }