Skip to content
This repository has been archived by the owner on Jul 18, 2018. It is now read-only.

It seems #2

Open
twicejr opened this issue Nov 6, 2015 · 2 comments
Open

It seems #2

twicejr opened this issue Nov 6, 2015 · 2 comments

Comments

@twicejr
Copy link

twicejr commented Nov 6, 2015

Take care. Even if a payment fails isSuccessful() returns true!

    //First request
    $gateway = \Omnipay\Omnipay::create('Ideal');


  //// ..........payment occurs after redirect etc.................





 //Request 2:
    if($gateway->supportsCompletePurchase())
    {
          $purchaseResponse = $this->gateway()->completePurchase($parameters)->send();
    }

    if($purchaseResponse->isSuccessful())
    {
          //WILL ALWAYS RETURN TRUE AT THE MOMENT 
    } 
@markdegrootnl
Copy link
Owner

Please explain

@twicejr
Copy link
Author

twicejr commented Dec 1, 2015

The payment doesn't have to be succesful, for $purchaseResponse->isSuccessful() to return true.
Even if the payment is not finished, it returns true.

I fixed it by adding the following to src/Omnipay/Ideal/Message/CompletePurchaseResponse.php:

public function isErrorResponse()
{
     return $this->getData()->Transaction->status != 'Success';
}

(see how isSuccessful works in src/Omnipay/Ideal/Message/AbstractResponse.php):::

    return !$this->isErrorResponse() && isset($this->getData()->Acquirer) && $this->rootElementExists();

Do you also think this is the appropriate solution?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants