From a832f200490f3e27d7a016e792c8dd36b20cdb6a Mon Sep 17 00:00:00 2001 From: Arthur Abrantes Date: Mon, 5 Jul 2021 22:50:53 -0300 Subject: [PATCH] fix: bulk anticipations (#114) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update main (#98) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields * fix: update TransactionCreateOptionsBase split_rules type (#97) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * fix: update TransactionCreateOptionsBase split_rules type * fix: update TransactionCreateOptionsBase split_rules type Co-authored-by: Jonathan Célio * fix: remove 'opts' argument from cards functions (#95) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * remove 'opts' argument from cards functions * fix: remove 'opts' argument from cards functions * fix: remove 'opts' argument from cards functions Co-authored-by: Jonathan Célio * fix: change type of customer.id from string to number (#96) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * fix: change type of customer.id from string to number * fix customer field of TransactionCreateOptionsBase * fix: change type of customer.id from string to number * fix customer field of TransactionCreateOptionsBase Co-authored-by: Jonathan Célio Co-authored-by: Arthur Abrantes * ci: update ci to trigger in next version * chore: update master (#100) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields * fix: update TransactionCreateOptionsBase split_rules type (#97) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * fix: update TransactionCreateOptionsBase split_rules type * fix: update TransactionCreateOptionsBase split_rules type Co-authored-by: Jonathan Célio * fix: remove 'opts' argument from cards functions (#95) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * remove 'opts' argument from cards functions * fix: remove 'opts' argument from cards functions * fix: remove 'opts' argument from cards functions Co-authored-by: Jonathan Célio * fix: change type of customer.id from string to number (#96) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * fix: change type of customer.id from string to number * fix customer field of TransactionCreateOptionsBase * fix: change type of customer.id from string to number * fix customer field of TransactionCreateOptionsBase Co-authored-by: Jonathan Célio * chore: update next (#99) * chore: update main (#98) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields * fix: update TransactionCreateOptionsBase split_rules type (#97) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * fix: update TransactionCreateOptionsBase split_rules type * fix: update TransactionCreateOptionsBase split_rules type Co-authored-by: Jonathan Célio * fix: remove 'opts' argument from cards functions (#95) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * remove 'opts' argument from cards functions * fix: remove 'opts' argument from cards functions * fix: remove 'opts' argument from cards functions Co-authored-by: Jonathan Célio * fix: change type of customer.id from string to number (#96) * Update package.json (#93) * Release Next Version (#94) * Update package.json * fix: add comment to external_id field (#91) * fix: add percentage field to SplitRuleArg and add comments (#90) * fix: Customer interface (#92) * fix: add missing fields to Customer and fix birthday in CustomerCreateOptiosn * fix: add comments to Document's new fields Co-authored-by: Arthur Abrantes * fix: change type of customer.id from string to number * fix customer field of TransactionCreateOptionsBase * fix: change type of customer.id from string to number * fix customer field of TransactionCreateOptionsBase Co-authored-by: Jonathan Célio Co-authored-by: Arthur Abrantes * ci: update ci to trigger in next version Co-authored-by: Arthur Abrantes * chore: update package.json Co-authored-by: Arthur Abrantes * fix: create BulkAnticipationsCreateOptions and BulkAnticipation interfaces * fix: bulkAnticipations.create's return type * fix: recipientId property * fix: write interfaces for bulkAnticipations.confirm method Co-authored-by: Jonathan Célio Co-authored-by: arthur_abrantes --- src/client/bulkAnticipations/namespace.ts | 7 +++++-- src/client/bulkAnticipations/options.ts | 21 +++++++++++++++++++++ src/client/bulkAnticipations/responses.ts | 18 ++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 src/client/bulkAnticipations/options.ts create mode 100644 src/client/bulkAnticipations/responses.ts diff --git a/src/client/bulkAnticipations/namespace.ts b/src/client/bulkAnticipations/namespace.ts index 9c67f89..868b274 100644 --- a/src/client/bulkAnticipations/namespace.ts +++ b/src/client/bulkAnticipations/namespace.ts @@ -1,3 +1,6 @@ +import {BulkAnticipationsConfirmOptions, BulkAnticipationsCreateOptions} from "./options"; +import {BulkAnticipation} from "./responses"; + declare module 'pagarme' { export namespace client { export namespace bulkAnticipations { @@ -5,9 +8,9 @@ declare module 'pagarme' { function cancel(opts: any, body: any): any; - function confirm(opts: any, body: any): any; + function confirm(opts: BulkAnticipationsConfirmOptions): Promise; - function create(opts: any, body: any): any; + function create(opts: BulkAnticipationsCreateOptions): Promise; function days(opts: any, body: any): any; diff --git a/src/client/bulkAnticipations/options.ts b/src/client/bulkAnticipations/options.ts new file mode 100644 index 0000000..9c9ab76 --- /dev/null +++ b/src/client/bulkAnticipations/options.ts @@ -0,0 +1,21 @@ +export interface BulkAnticipationsCreateOptions { + /** ID do recebedor para o qual criar a antecipação */ + recipientId: string; + /** Data que você deseja receber a antecipação em sua conta Pagar.me */ + payment_date: string; + /** Define o período de onde os recebíveis serão escolhidos. start define recebíveis próximos, perto de serem pagos, e end define recebíveis longes, no final de todos recebíveis que você possui para receber */ + timeframe: "start" | "end"; + /** Valor líquido, em centavos, que você deseja receber de antecipação */ + requested_amount: number; + /** Define se a antecipação deve retornar status 'building' */ + build?: boolean; + /** Define se o valor da antecipação será transferido automaticamente para a conta bancária do recebedor */ + automatic_transfer?: boolean; +} + +export interface BulkAnticipationsConfirmOptions { + /** ID de recebedor desejado */ + recipientId: string; + /** ID da antecipação desejada */ + id: string; +} \ No newline at end of file diff --git a/src/client/bulkAnticipations/responses.ts b/src/client/bulkAnticipations/responses.ts new file mode 100644 index 0000000..d213ba4 --- /dev/null +++ b/src/client/bulkAnticipations/responses.ts @@ -0,0 +1,18 @@ +export interface BulkAnticipation { + /** Nome do tipo do objeto criado/modificado */ + object: "bulk_anticipation"; + /** Status atual da antecipação */ + status: "building" | "pending" | "approved" | "refused" | "canceled"; + /** período do qual os recebíveis irão vir, */ + timeframe: "start" | "end"; + /** Data de pagamento da antecipação. */ + payment_date: string; + /** valor bruto, em centavos, da antecipação criada. */ + amount: number; + /** Taxa de adquirência relacionada aos recebíveis antecipados. */ + fee: number; + /** Taxa de antecipação relacionada aos recebíveis antecipados. */ + anticipation_fee: number; + /** Identificador da antecipação */ + id: string; +} \ No newline at end of file