omnipay icon indicating copy to clipboard operation
omnipay copied to clipboard

Pending Success

Open lukeholder opened this issue 8 years ago • 11 comments
trafficstars

What is the recommendation for gateway which wants to return a type of 'pending success'. These types of responses are usually returned and relate with the acceptNotification() method, where the real success to sent to the commerce application at a later time outside of the customer checkout flow.

What should the response object's isSuccessful()return when the request worked and the customer should be able to get a success response, but the payment is not actually made yet?

Based on how all other gateway drivers work at the moment, the isSuccessful() method is being used across all gateways as a flag to whether the transaction/payment as a whole was completed and paid.

Welcome thoughts please.

lukeholder avatar May 12 '17 17:05 lukeholder

May be related to https://github.com/thephpleague/omnipay/issues/339

lukeholder avatar May 12 '17 17:05 lukeholder

When it's pending, it's not succesfull. Perhaps isPending() should be added to the interface?

barryvdh avatar May 12 '17 20:05 barryvdh

Something like isPending() would be great.

lukeholder avatar May 12 '17 21:05 lukeholder

Actually I see that there is already a isPending() in AbstractResponse

    /**
     * Is the response successful?
     *
     * @return boolean
     */
    public function isPending()
    {
        return false;
    }

The issue is most of the time the isSuccessful() is really only looking for an absence of an error.

The question is, can isPending and isSuccessful both be true?

lukeholder avatar May 12 '17 21:05 lukeholder

No

barryvdh avatar May 13 '17 07:05 barryvdh

If they can't both be true then I am thinking we need a new pendingSuccessful() right? all others would be false.

lukeholder avatar May 13 '17 08:05 lukeholder

Pending is undefined, so it can still fail, we just don't know.

barryvdh avatar May 13 '17 09:05 barryvdh

The are more transaction status values that can be returned by the payment gateways. This is also related to https://github.com/thephpleague/omnipay-common/issues/153

aimeos avatar May 13 '17 09:05 aimeos

@aimeos correct, but I am not talking about the notification, I am talking about the response for the initial purchase request.

lukeholder avatar May 13 '17 18:05 lukeholder

@lukeholder Yes, but the problem is in principle the same for accepNotification() and completePuchase()

aimeos avatar May 14 '17 13:05 aimeos

It is not uncommon for a gateway to return no result (empty data) for a pending success. Be aware of that. It's also not uncommon for a gateway to time out, which is also normally treated as "pending" because of PCI implications about maximum wait times between financial institutions.

I have seen cases of a notify being sent on a notifyUrl which arrives after the pending success, indicating the true success or failure status. I have also seen cases of the notify arriving before the pending success result -- in those cases the notify data is considered canonical, not the pending result. PaymentWall is a case in point that does this.

I have also seen one gateway that always returns pending for failed transactions, followed up by one or more notifys being sent to the notifyUrl which gives the failure message as well as detailed data about the failure reasons, fraud scores, etc.

delatbabel avatar May 17 '17 08:05 delatbabel