You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
Hi, I'm using your gateway and I think I found a bug in isSuccessful method. Documentation isn't say directly how to implement it, but some examples and other omnipay drivers show that isSuccessful is always true only when payment was processed successfully. If you create a new purchase and you recive a redirect URL then your payment isn't proceed successfully yet, because you need to redirect off-site to complete the purchase. In this case you should return false, but you return true, what is wrong.
The isSuccessful method should rely on the token you received instead of the HTTP status code.
PayPal Express example:
/* * Is this complete purchase response successful? Will not be successful if it's a redirect response. * * @return bool */publicfunctionisSuccessful()
{
$success = isset($this->data['ACK']) && in_array($this->data['ACK'], array('Success', 'SuccessWithWarning'));
return !$this->isRedirect() && $success;
}
Mollie example:
/** * When you do a `purchase` the request is never successful because * you need to redirect off-site to complete the purchase. * * {@inheritdoc} */publicfunctionisSuccessful()
{
returnfalse;
}
Even example from the Omnipay documentation shows that we should rely on the token in this case:
$response = $gateway->purchase(['amount' => '10.00', 'card' => $card])->send();
if ($response->isSuccessful()) {
// payment is complete
} elseif ($response->isRedirect()) {
$response->redirect(); // this will automatically forward the customer
} else {
// not successful
}
How to reproduce
Each purchase method calling
Possible Solution
Start to rely on the received data instead of the HTTP status codes.
The text was updated successfully, but these errors were encountered:
Description
Hi, I'm using your gateway and I think I found a bug in
isSuccessful
method. Documentation isn't say directly how to implement it, but some examples and other omnipay drivers show thatisSuccessful
is alwaystrue
only when payment was processed successfully. If you create a new purchase and you recive a redirect URL then your payment isn't proceed successfully yet, because you need to redirect off-site to complete the purchase. In this case you should returnfalse
, but you returntrue
, what is wrong.The
isSuccessful
method should rely on the token you received instead of the HTTP status code.PayPal Express example:
Mollie example:
Even example from the Omnipay documentation shows that we should rely on the token in this case:
How to reproduce
Each
purchase
method callingPossible Solution
Start to rely on the received data instead of the HTTP status codes.
The text was updated successfully, but these errors were encountered: