I'm trying to create a custom gateway using omnipay for an unsupported payment gateway. However I'm having a difficult time creating the response class for my provider's 3D secure implementation.
I've had a look at sagepay, but the response for 3D secure seems to all be returned in 1 api request.
To complete a 3D secure payment I need to perform the following actions:
- API request to check if the card is enrolled in 3D secure
- Redirect the user (POST - Hidden Form) to a url
- API request to verify the 3D secure value
- Make the payment (PurchaseRequest)
Do I need a different response classes for each api request? So VerifyEnrolledResponse, VerifySigResponse and PurchaseResponse?
or do I need something like this:
if ($response->isSuccessful()) {
// payment was successful
} elseif ($response->isRedirect()) {
// redirect to offsite payment gateway
$response->redirect();
} elseif ($response->notEnrolled() {
// User not enrolled in 3D secure - make auth or display error
} elseif ($response->3DSecureSuccess() {
// Card passed 3D secure
} else {
// payment failed: display message to customer
echo $response->getMessage();
}
Really lost here, I want to keep it abstracted with isSuccessful(), isRedirect() etc. Any help is really appreciated.
Documentation: https://resourcecentre.globaliris.com/documents/pdf.html?id=98