Skip to content
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

Package crashes if a creditor is required #10

Open
tosbourn opened this issue Jul 5, 2017 · 2 comments
Open

Package crashes if a creditor is required #10

tosbourn opened this issue Jul 5, 2017 · 2 comments
Labels

Comments

@tosbourn
Copy link
Contributor

tosbourn commented Jul 5, 2017

When creating items like Mandates which require a creditor to be set if your account has multiple creditors the package will crash when one isn't set.

Here is a sample call and the output

Sample Call

params = %{
  mandates: %{
    scheme: "bacs",
    links: %{
      customer_bank_account: "BA00000000",
    }
  }
}
Gocardless.Client.create_mandate(params)

Output

** (exit) exited in: GenServer.call(Gocardless.Client, {:create_mandate, %{mandates: %{links: %{customer_bank_account: "BA00000000"}, scheme: "bacs"}}}, 5000)
    ** (EXIT) time out
    (elixir) lib/gen_server.ex:737: GenServer.call/3
iex(1)> [error] GenServer Gocardless.Client terminating
** (KeyError) key :body not found in: %HTTPotion.ErrorResponse{message: "req_timedout"}
    (gocardless) lib/gocardless/utils/comms.ex:31: Gocardless.Utils.Comms.decode_json/1
    (gocardless) lib/gocardless/client.ex:10: Gocardless.Client.handle_call/3
    (stdlib) gen_server.erl:636: :gen_server.try_handle_call/4
    (stdlib) gen_server.erl:665: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.273.0>): {:create_mandate, %{mandates: %{links: %{customer_bank_account: "BA0001V89MDYMQ"}, scheme: "bacs"}}}
State: %{}
Client #PID<0.273.0> is alive
    (iex) lib/iex/evaluator.ex:59: IEx.Evaluator.loop/3
    (iex) lib/iex/evaluator.ex:21: IEx.Evaluator.init/4
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

Adding a creditor in the links section fixes the issue.

@tosbourn tosbourn added the bug label Jul 5, 2017
@overture8
Copy link
Contributor

@tosbourn How did you get around this for testing staging? Just delete all the creditors except for one?

@tosbourn
Copy link
Contributor Author

@overture8 basically yeah – I ended up just always sending a creditor and working out which one was the valid one for our purposes.

From memory you can't easily tell which creditor is which from the GoCardless dashboard, which is a shame.

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

No branches or pull requests

2 participants