-
Notifications
You must be signed in to change notification settings - Fork 25
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
Added NotifyAction #28
Conversation
* Add `fetchTransaction` requirement to supports.
@steffenbrem Looks good to me. Can you add some tests? |
@makasim Sure will do, wanted to have a confirmation first 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While reading the issue thephpleague/omnipay#339, I found out that we have to use acceptNotification method.
https://github.com/collizo4sky/omnipay-2checkout/blob/master/src/Gateway.php#L230
https://github.com/thephpleague/omnipay-sagepay#notification-handler
/** | ||
* @author Steffen Brem <[email protected]> | ||
*/ | ||
class NotifyAction extends BaseApiAwareAction implements GatewayAwareInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better not to use that BaseApiAwareAction class. Do something like this:
<?php
class NotifyAction implements GatewayAwareInterface, ApiAwareInterface, ActionInterface
{
use ApiAwareTrait;
public function __construct()
{
$this->apiClass = Foo::class;
}
}
* Added some basic unit tests for the action.
@makasim Some gateways only use the |
I think everything is ready now. I am currently using it in production and notify requests now properly updates the payments for me (I am using Sylius). |
$response = $this->omnipayGateway->fetchTransaction($details->toUnsafeArray())->send(); | ||
if (method_exists($this->api, 'fetchTransaction')) { | ||
$response = $this->api->fetchTransaction($details->toUnsafeArray())->send(); | ||
} else if (method_exists($this->api, 'acceptNotification')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not we try call acceptNotification first?
This PR is a PoC for issue Payum/Payum#590.
I am trying to accomplish that the payment details gets synced when a
Notify
request comes in. Right now I simply replace the request details and also set some response specific data on it for debugging purposes.@makasim Could you maybe check if this implementation is correct?