Skip to content

Commit

Permalink
fix: remove param casting to atom (#807)
Browse files Browse the repository at this point in the history
  • Loading branch information
yordis authored Oct 4, 2023
1 parent 067653d commit bac80fa
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 @@ -100,7 +100,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 @@ -164,7 +164,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 bac80fa

Please sign in to comment.