Skip to content

Commit

Permalink
feat: add a return type to transaction's cardHashKey function (#86)
Browse files Browse the repository at this point in the history
* add CardHashKey interface

* add comments to CardHashKey fields
  • Loading branch information
Arthur Abrantes committed May 5, 2021
1 parent 3a5bd5a commit 59e082a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/client/transactions/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -23,7 +23,7 @@ declare module 'pagarme' {

function capture(opts: TransactionCaptureOptions): Promise<Transaction>;

function cardHashKey(opts: any): any;
function cardHashKey(opts: any): Promise<CardHashKey>;

function collectPayment(opts: any, body: any): any;

Expand Down
11 changes: 11 additions & 0 deletions src/client/transactions/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

0 comments on commit 59e082a

Please sign in to comment.