From 2755da7e5c59783ad3e7835ad97d11f9bea8db43 Mon Sep 17 00:00:00 2001 From: Anwar0902 Date: Thu, 29 Mar 2018 00:45:08 +0530 Subject: [PATCH] Changes in respond function of SagePay remove the decode code for body in sagepay --- lib/gringotts/gateways/sagepay.ex | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/gringotts/gateways/sagepay.ex b/lib/gringotts/gateways/sagepay.ex index 97d2deb6..2be49b71 100644 --- a/lib/gringotts/gateways/sagepay.ex +++ b/lib/gringotts/gateways/sagepay.ex @@ -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