From a0aa2bd42af614a94a50b146a3b116fc398f5d47 Mon Sep 17 00:00:00 2001 From: Barry Fogarty Date: Wed, 22 Jul 2015 23:55:50 +0100 Subject: [PATCH] Fix capture payment routine (referenced extendeddata value is missing) --- .../Controllers/PayPalApiController.cs | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Plugin/Payments/PayPal/src/Merchello.Plugin.Payments.PayPal/Controllers/PayPalApiController.cs b/Plugin/Payments/PayPal/src/Merchello.Plugin.Payments.PayPal/Controllers/PayPalApiController.cs index 6e9fd85a5e..e3d7319d71 100644 --- a/Plugin/Payments/PayPal/src/Merchello.Plugin.Payments.PayPal/Controllers/PayPalApiController.cs +++ b/Plugin/Payments/PayPal/src/Merchello.Plugin.Payments.PayPal/Controllers/PayPalApiController.cs @@ -121,17 +121,12 @@ public HttpResponseMessage SuccessPayment(Guid invoiceKey, Guid paymentKey, stri } // Capture - decimal captureAmount; - Decimal.TryParse(payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.CaptureAmount), out captureAmount); - if (captureAmount > 0) - { - var captureResult = paymentGatewayMethod.CapturePayment(invoice, payment, captureAmount, null); - if (!captureResult.Payment.Success) - { - LogHelper.Error("Payment is not captured.", captureResult.Payment.Exception); - return ShowError(captureResult.Payment.Exception.Message); - } - } + var captureResult = paymentGatewayMethod.CapturePayment(invoice, payment, payment.Amount, null); + if (!captureResult.Payment.Success) + { + LogHelper.Error("Payment is not captured.", captureResult.Payment.Exception); + return ShowError(captureResult.Payment.Exception.Message); + } // redirect to Site var returnUrl = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.ReturnUrl);