-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add CardCreateOptions and Card interfaces * add CardFindOptions and CardAllOptions interfaces
- Loading branch information
Arthur Abrantes
authored
May 5, 2021
1 parent
59e082a
commit 6edc3d6
Showing
3 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
import {CardCreateOptions, CardFindOptions, CardAllOptions} from "./options"; | ||
import {Card} from "./responses"; | ||
|
||
declare module 'pagarme' { | ||
export namespace client { | ||
export namespace cards { | ||
function all(opts: any, pagination: any): any; | ||
function all(opts: any, pagination: CardAllOptions): Promise<Array<Card>>; | ||
|
||
function create(opts: any, body: any): any; | ||
function create(opts: any, body: CardCreateOptions): Promise<Card>; | ||
|
||
function find(opts: any, body: any): any; | ||
function find(opts: any, body: CardFindOptions): Promise<Card>; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export interface CardCreateOptions { | ||
/** Número do cartão. */ | ||
card_number: string; | ||
/** Data de expiração do cartão. */ | ||
card_expiration_date: string; | ||
/** Nome no cartão do portador. */ | ||
card_holder_name: string; | ||
/** Código de segurança do cartão. */ | ||
card_cvv?: string; | ||
/** Informações do cliente do card a ser gerado. */ | ||
customer_id?: string; | ||
/** Dados criptografados do cartão */ | ||
card_hash: string; | ||
} | ||
|
||
export interface CardFindOptions { | ||
/** Id do cartão que deseja consultar os dados. */ | ||
id: string; | ||
} | ||
|
||
export type CardAllOptions = CardFindOptions & { | ||
/** Pagination option to get a list of cards. Number of cards in a page */ | ||
count?: number; | ||
/** Pagination option for a list of cards. The page index. */ | ||
page?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import {Customer} from "../customers/responses"; | ||
|
||
export interface Card { | ||
/** Nome do tipo do objeto criado/modificado. */ | ||
object: "card"; | ||
/** Identificador do cartão. */ | ||
id: string; | ||
/** Data de criação do objeto card. */ | ||
date_created: string; | ||
/** Data de atualização do objeto card. */ | ||
date_updated: string; | ||
/** Data de atualização do objeto card. */ | ||
brand: string; | ||
/** Nome do portador do cartão. */ | ||
holder_name: string; | ||
/** 6 primeiros dígitos do cartão. */ | ||
first_digits: string; | ||
/** 4 últimos dígitos do cartão. */ | ||
last_digits: string; | ||
/** País do cartão. */ | ||
country: string; | ||
/** Hash que permite comparar dois cartões através de seus fingerprints para saber se são o mesmo. */ | ||
fingerprint: string; | ||
/** Objeto com dados do comprador. */ | ||
customer: Customer | null; | ||
/** Propriedade para verificar a validade do cartão, ou seja, caso true, é possível cobrar o cartão em condições normais, para false, não pode ser utilizado. */ | ||
valid: boolean; | ||
/** Data de expiração do cartão. */ | ||
expiration_date: string; | ||
} |