Payment auth failed, but history shows payment completed?
Posted: Wed May 25, 2011 3:53 am
I'm trying to diagnose an issue on our shop where orders are being marked as Completed but at the same time are showing Capture Failed in the payment status and a full unprocessed balance. We're using the ProtxProvider payment gateway and, although I'm struggling to fully understand the checkout/payment flow, I think I can see where the final part of the process forks upon the payment results from Protx (SagePay). The code below seems to be at fault:
Although it could not be at fault, because the payment itself is marked as Capture Failed.
Ultimately I think the payment is being marked as finished, when it hasn't quite finished, and what I'd like to do is stop this happening or simply reverse the process. Hope that makes sense, any pointers would be greatly appreciated! If you'd like any more code or information I'll do my best.
Code: Select all
string postToProtx = GenerateProtxPostFor3DSecure(MD, PaRes);
string protxResponce = SendPostFor3DSecureCheckToProtx(service_3dSecure, postToProtx);
Dictionary<string, string> protxInformation = ParseResponse(protxResponce);
if (HasTransactionBeenAccepted(protxInformation["Status"]))
{
if (HasTransactionBeenAccepted(protxInformation["3DSecureStatus"]))
{
order.Payments[0].PaymentStatus = PaymentStatus.Captured;
order.Save();
return true;
}else{
/* if we get here it means the transaction was marked as 'INVALID' but that doesn't actually mean it's failed */
order.Payments[0].PaymentStatus = PaymentStatus.Captured;
order.Save();
return true;
}
}
else
{
order.Payments[0].PaymentStatus = PaymentStatus.CaptureFailed;
order.Save(true, true);
return false;
}
Ultimately I think the payment is being marked as finished, when it hasn't quite finished, and what I'd like to do is stop this happening or simply reverse the process. Hope that makes sense, any pointers would be greatly appreciated! If you'd like any more code or information I'll do my best.