Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Get transactions #15

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Get transactions #15

wants to merge 4 commits into from

Conversation

fernandoalmeida
Copy link
Contributor

Motivation

The API supports transactions listing.

Proposed solution

Adds function to allow transactions listing according to Pluggy's documentation.

"""

@spec all_by_account(
%{
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about creating a type for these params and the response?

  @typep params :: %{
           :account_id => String.t(),
           :from => Date.t(),
           :to => Date.t(),
           optional(:page_size) => integer(),
           optional(:page) => integer()
         }

  @typep ok_response :: %{page: integer(), total_pages: integer(), total: integer(), transactions: [t()]}
  @typep error_response :: PluggyElixir.HttpClient.Error.t() | String.t()
  @typep response :: {:ok, ok_response()} | {:error, error_response()}
Suggested change
%{
params()

},
Config.config_overrides()
) ::
{:ok, %{page: integer(), total_pages: integer(), total: integer(), transactions: [t()]}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Following the thread above we could also replace the code here for response()

]
end

defp parse_transaction(transaction) do
Copy link
Contributor

@dmarasquin dmarasquin May 4, 2021

Choose a reason for hiding this comment

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

What do you think about creating a module called PluggyElixir.Transaction.Parser that includes this and the functions below?

Or even a PluggyElixir.Transaction.ResponseHandler that includes the parser functions and the handling ones too.

Add macro to perform pluggy assertions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants