Skip to content

Add invoice pull request and invoice pull subscription #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joaogpw-stark
Copy link
Member

No description provided.

## Attributes (return-only):
- id [string]: unique id returned when InvoicePullRequest is created. ex: "5656565656565656"
- status [string]: current InvoicePullRequest status. ex: "pending", "scheduled", "success", "failed", "canceled"
- bacen_id [string]: unique authentication id at the Central Bank. ex: "ccf9bd9c-e99d-999e-bab9-b999ca999f99"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coloca um exemplo na formatação do bacen id: ex "RR2001818320250616dtsPkBVaBYs"

sent to the Stark Bank API. The 'create' function sends the objects
to the Stark Bank API and returns the list of created objects.
## Parameters (required):
- start [datetime.date or string]: subscription start date in UTC ISO format. ex: "2022-04-01"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Se é date acho que não deveríamos falar que é em UTC

- amount_min_limit [integer, 0 None]: subscription minimum amount in cents. Required if an amount is not informed. Minimum = 1 (R$ 0.01). ex: 100 (= R$ 1.00)
## Parameters (optional):
- display_description [string, default None]: Invoice description to be shown to the payer. ex: "Subscription payment"
- due [datetime.timedelta or integer, default None]: subscription invoice due offset. Available only for type "push". ex: timedelta(days=7)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O default é 31 dias para o due. Não sei se foi adicionado esse default no invoice pull, mas no SPI vai criar a subscription com 31 dias de due caso o valor não seja passado

- due [datetime.timedelta or integer, default None]: subscription invoice due offset. Available only for type "push". ex: timedelta(days=7)
- external_id [string, default None]: string that must be unique among all your InvoicePullSubscriptions. Duplicated external_ids will cause failures. ex: "my-external-id"
- reference_code [string, default None]: reference code for reconciliation. ex: "REF123456"
- end [datetime.date or string, default None]: subscription end date in UTC ISO format. ex: "2023-04-01"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesma coisa do start, tirar o UTC

- end [datetime.date or string, default None]: subscription end date in UTC ISO format. ex: "2023-04-01"
- data [dictionary, default None]: additional data for the subscription based on type
- name [string, default None]: subscription debtor name. ex: "Iron Bank S.A."
- tax_id [string, default None]: subscription debtor tax ID (CPF or CNPJ) with or without formatting. ex: "01234567890" or "20.018.183/0001-80"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não vi ainda como ficou no invoice-pull, mas acho que deveria ser conditionally required, obrigatório para type diferente de push, já que o cpf do devedor é um dado obrigatório para se exibido no BRCode. Seria bom documentar que não deve ser passado quando type é push caso seja o mesmo tax_id de dentro do data.

## Attributes (return-only):
- id [string]: unique id returned when InvoicePullSubscription is created. ex: "5656565656565656"
- status [string]: current InvoicePullSubscription status. ex: "active", "canceled"
- bacen_id [string]: unique authentication id at the Central Bank. ex: "ccf9bd9c-e99d-999e-bab9-b999ca999f99"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ex: "RR2001818320250616dtsPkBVaBYs"

@@ -1,4 +1,4 @@
version = "2.28.1"
version = "2.29.0"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essa alteração de versão não deveria ser realizada apenas no bump?

@@ -14,6 +14,14 @@ Given a version number MAJOR.MINOR.PATCH, increment:

## [Unreleased]

## [2.29.0] - 2024-01-09

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Essa alteração de versão não deveria ser realizada apenas no bump?

Comment on lines +14 to +17
print(f"Number of InvoicePullRequests: {len(requests)}")
for request in requests:
self.assertIsNotNone(request.id)
print(request)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eu removeria os prints e deixaria apenas os asserts pra facilitar a leitura dos testes. Começamos a fazer isso nos outros SDKs e estamos limpando conforme realizamos alterações.

starkbank.user = exampleProject


class TestInvoicePullRequestQuery(TestCase):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não tem teste pra create?

- invoice_id [string]: Id of the invoice previously created to be sent for payment. ex: "5656565656565656"
- due [datetime.datetime or string]: payment scheduled date in UTC ISO format. ex: "2023-10-28T17:59:26.249976+00:00"
## Parameters (optional):
- attempt_type [string, default "default"]: attempt type for the payment. Options: "default", "retry". ex: "retry"
Copy link

@nicolasalmeida-stark nicolasalmeida-stark Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acho que não precisa do exemplo no attempt_type se você já citou as opções possíveis que o campo pode ter

## Parameters (required):
- start [datetime.date or string]: subscription start date in UTC ISO format. ex: "2022-04-01"
- interval [string]: subscription installment interval. Options: "week", "month", "quarter", "semester", "year"
- pull_mode [string]: subscription pull mode. Options: "manual", "automatic". Automatic mode will create the Invoice Pull Requests automatcally

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Faltou um 'i' no automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants