Skip to content

Commit

Permalink
Fix capture payment routine (referenced extendeddata value is missing)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry Fogarty committed Jul 22, 2015
1 parent 9a8e387 commit a0aa2bd
Showing 1 changed file with 6 additions and 11 deletions.
Expand Up @@ -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<PayPalApiController>("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<PayPalApiController>("Payment is not captured.", captureResult.Payment.Exception);
return ShowError(captureResult.Payment.Exception.Message);
}

// redirect to Site
var returnUrl = payment.ExtendedData.GetValue(Constants.ExtendedDataKeys.ReturnUrl);
Expand Down

0 comments on commit a0aa2bd

Please sign in to comment.