-
-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NotificationInterface method(s) for responding to the gateway #149
Comments
We can return a response, just like the redirect response (Symfony, not psr7), with a method to send the headers and echo content. |
Would calling I'll probably just roll out whatever we decide on the few 2.x drivers I have and we can leave it as a recommendation rather than changing the spec. For 3.x we can make it more formal. |
Of something like redirect: reply() and replyResponse() or something. Something related about this, I want (or already did actually) to drop the exit after sending. This breaks the response flow, perhaps unexpected. But it's breaking so for 3.x only. |
I've gone for Yes, the exit needs to go. By returning the Symfony response object, the site can In addition, sometimes the site needs to feed some results into the response, such as an indication of whether the notification was accepted or not, and sometimes a text message if it was rejected for any reason. This is also the point at which the final redirect URL is provided, to take the user to the final payment screen. It will be gateway-specific, but I think there needs to be some flexibility in data that is provided for the acknowledgement. And one more thing, the transaction status has one of three possible values: |
I'm trying to use the For a typical Omnipay request message, the message is given the objects to make a request to the remote gateway (or fake a request) and then get a response in return. That response is fed into an Omnipay response object for the merchant site to act on. For the notification messages, what needs to happen is usually the other way around. In this case a server request comes in to the merchant site. The notification message grabs and parses all the data (including HTTP headers for some gateways) in it to provide a standard interface to the merchant site. Now, sometimes the gateway needs a specific response so it knows the notification has been received and accepted, often based on the notification data that was sent and some additional response from the merchant site. Some gateways do not need a specific response (just a HTTP 200 will do for them). But either way, the notification message needs to return a HTTP response - something to return to the gateway. In order for this notification message to be successfully initialised, it extends the Omnipay Right now, every time I implement a notification handler, I feel like I'm fighting against Omnipay, trying to shoe-horn the wrong things into it. I'm going to try to create an |
On the heals of #148, there is no common defined way to respond to the remote gateway after recieving a notification.
All notifications must be responded to appropriately, so that the remote gateway knows the notification has been received, handled, passed any signature tests etc. This has been left up to each driver to define so far, which is great until you want to wrap the notification handlers in a generic way.
Ideally the response will be a HTTP response object, but I'm not sure if Omnipay 2.x will support that?
At the moment we have drivers that
echo
the result text and leave the merchant site to exit with a200
code. We may not need more than that for the drivers we have now, and may be enough for 2.x. Or maybe we should have methods to return the HTTP code, body and any additional headers that may be needed, so the merchant site can construct the response that the gateway needs? Not sure if that makes returning a PSR-7 response object later more difficult - I expect not.Any thoughts?
Before I start proposing method names, I need a better feeling about what the various gateways are expecting back from the drivers. I also believe the drivers should NOT exit after responding, since the merchant site may need to do further processing; they should just provide the data and/or tools for responding appropriately in a standard way.
The text was updated successfully, but these errors were encountered: