Skip to content

Commit

Permalink
Changes in respond function of SagePay
Browse files Browse the repository at this point in the history
remove the decode code for body in sagepay
  • Loading branch information
Anwar0902 committed Mar 28, 2018
1 parent 7188eca commit 2755da7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/gringotts/gateways/sagepay.ex
Expand Up @@ -279,27 +279,27 @@ defmodule Gringotts.Gateways.SagePay do
@spec respond(term) :: {:ok | :error, Response}

defp respond({:ok, %{status_code: 201, body: body}}) do
body = body |> Poison.decode!()
response_body = body |> Poison.decode!()

{:ok,
%Response{
success: true,
id: body["transactionId"],
id: response_body["transactionId"],
status_code: 201,
message: body["statusDetail"],
raw: body |> Poison.encode!()
message: response_body["statusDetail"],
raw: body
}}
end

defp respond({:ok, %{status_code: status_code, body: body}}) do
body = body |> Poison.decode!()
response_body = body |> Poison.decode!()

{:error,
%Response{
success: false,
id: body["transactionId"],
id: response_body["transactionId"],
status_code: status_code,
message: body["statusDetail"],
message: response_body["statusDetail"],
raw: body
}}
end
Expand Down

0 comments on commit 2755da7

Please sign in to comment.