Skip to content

Commit

Permalink
fix: remove param casting to atom
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis committed Aug 21, 2023
1 parent f4bdaf9 commit 6884881
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/stripe/error.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defmodule Stripe.Error do
extra: %{
optional(:card_code) => card_error_code,
optional(:decline_code) => String.t(),
optional(:param) => atom,
optional(:param) => String.t(),
optional(:charge_id) => Stripe.id(),
optional(:http_status) => 400..599,
optional(:raw_error) => map,
Expand Down Expand Up @@ -163,7 +163,7 @@ defmodule Stripe.Error do
%{raw_error: error_data, http_status: status}
|> maybe_put(:card_code, error_data |> Map.get("code") |> maybe_to_atom())
|> maybe_put(:decline_code, error_data |> Map.get("decline_code"))
|> maybe_put(:param, error_data |> Map.get("param") |> maybe_to_atom())
|> maybe_put(:param, Map.get(error_data, "param"))
|> maybe_put(:charge_id, error_data |> Map.get("charge"))

%__MODULE__{
Expand Down
2 changes: 1 addition & 1 deletion test/stripe/error_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Stripe.ErrorTest do
error = Error.from_stripe_error(400, error_data, "id")
assert error.code == :invalid_request_error
assert error.extra.http_status == 400
assert error.extra.param == :type
assert error.extra.param == "type"
assert error.extra.raw_error == error_data
assert error.message == "Received unknown parameter: type"
assert error.request_id == "id"
Expand Down

0 comments on commit 6884881

Please sign in to comment.