From 59e082a90bf74e4091f54f49c444486e6701fcc7 Mon Sep 17 00:00:00 2001 From: Arthur Abrantes Date: Wed, 5 May 2021 17:28:20 -0300 Subject: [PATCH] feat: add a return type to transaction's cardHashKey function (#86) * add CardHashKey interface * add comments to CardHashKey fields --- src/client/transactions/namespace.ts | 4 ++-- src/client/transactions/responses.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/client/transactions/namespace.ts b/src/client/transactions/namespace.ts index 9a0d678..95c4f98 100644 --- a/src/client/transactions/namespace.ts +++ b/src/client/transactions/namespace.ts @@ -6,7 +6,7 @@ import { TransactionCaptureOptions, TransactionRefundOptions } from './options'; -import { Transaction, CalculateInstallmentsAmount } from './responses'; +import { Transaction, CalculateInstallmentsAmount, CardHashKey } from './responses'; declare module 'pagarme' { export namespace client { @@ -23,7 +23,7 @@ declare module 'pagarme' { function capture(opts: TransactionCaptureOptions): Promise; - function cardHashKey(opts: any): any; + function cardHashKey(opts: any): Promise; function collectPayment(opts: any, body: any): any; diff --git a/src/client/transactions/responses.ts b/src/client/transactions/responses.ts index 566c44c..3e59ab2 100644 --- a/src/client/transactions/responses.ts +++ b/src/client/transactions/responses.ts @@ -111,3 +111,14 @@ export interface CalculateInstallmentsAmount { [key: string]: Installment; }; } + +export interface CardHashKey { + /** Momento de criação da chave pública. */ + date_created: "string", + /** id retornado e que será utilizado para compor o card_hash, logo, é importante que você o reserve. */ + id: number, + /** IP de onde a request foi originada. */ + ip: string, + /** Chave pública utilizada para criptografar os dados do cartão. */ + public_key: string, +}