-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Payum] Be2bill onsite implementation #812
Conversation
|
||
$request->setModel($order); | ||
|
||
//$this->httpRequest->getSession()->set('payum_token', $captureToken->getHash()); |
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.
@makasim How do I get this $captureToken
variable to put its hash in the session?
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.
the only difference from other payments that you have to store token hash to session and configure return\cancel urls in the be2bill admin to redirect to http://your-domain-here.dev/payment/capture/session-token
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 could be possible that httpRequest does not have a session. You have to check it and throw exception if session not set.
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.
How do I get this $captureToken variable to put its hash in the session?
@winzou since you are dealing with SecuredCaptureRequest
you can get the token from it:
<?php
$request->getToken()->getHash();
pay attention to payum bundle misses |
Hey, thanks to your feedback I fix a bit the action.
I don't really get all the logic of these actions, so I don't know where to investigate? And what is the |
@winzou try to update payum bundle to 0.7-dev versoin |
|
||
$request->setModel($order); | ||
|
||
$this->httpRequest->getSession()->set('payum_token', $request->getToken()->getHash()); |
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.
in't this too late to set payum_token. I suppose payum->execute($request) at line 68 throws PostRedirectInteractiveRequest
.
in general it looks really good, nice work @winzou! |
@makasim Actually, you don't listen at be2bill notification, am I right? You only use the return URL that the user will request just after its payment. I find it a bit dangerous, what if the user is badly redirected, or close its tab, or whatever? The payment is done on be2bill side, but we don't know on our side. I think we should rely on the notification URL that be2bill calls. Is it possible? |
sure it is possible, though it is harder then ipn for paypal. Because we cannot define a token per payment. Same problem was with return\canel url but it was solved by storing token to session. Here in the notifcation we can rely on |
@makasim so one solution is to build a controller in |
Ah right, I haven't realized. So if you need it too, we should do something generic. |
I think @makasim's solution is to execute https://github.com/Payum/PayumBundle/blob/master/Controller/NotifyController.php#L12-L19 |
payum bundle has to provide similar controller it already has but without token verification. the payment name can be taken from Later in the payum action we can find Order by its Id stored in |
@kayue exactly! The only problem here we have to pass |
@makasim Sounds good to me, thanks 👍 |
I start implementing unsafe notificatoins: Payum/PayumBundle#89. |
just tested notifactions on sandbox, see on http://sandbox.payum.forma-dev.com/payment/notifications/list. The last unknown notification come from be2bill. |
{ | ||
protected $httpRequest; | ||
|
||
public function setRequest(Request $request = null) |
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.
docblock?
could you add some specs? |
PayumBundle 0.7.2 contains a notify action to catch unsafe notifications (one without token). This could be reused here to catch be2bill notifications. I tested it on sandbox, works quite well. Pay attention that you still have to do some checks before you can trust the notifications data. |
@makasim See my last commit. How do I transform the request to get it handled by the rest of the process? Which action is the next, |
btw I need to return http code 200 for be2bill, so request has to be handled for our side (change payment status) + return http 200. |
<?php
throw ResponseInteractiveRequest(new Response('', 200)); as the last line of notify action. |
there is not standard logic to process notification, you have to put all it here:
|
@makasim how better is it now? |
|
||
$previousState = $order->getPayment()->getState(); | ||
|
||
$status = new StatusRequest($order); |
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.
hm before getting status you have to update payment details, just merge notifaction with one payment details already have, and set it back to payment
@makasim cannot update Payum with Composer:
I don't think this |
@winzou my bad, 0.7.3 should be fine. |
All green and tested with a be2bill account! Good for review and merge @makasim @pjedrzejewski |
@@ -46,6 +46,7 @@ public function createPayment(OrderInterface $order) | |||
$payment = $this->paymentRepository->createNew(); | |||
|
|||
$payment->setCurrency($order->getCurrency()); | |||
$payment->setAmount($order->getTotal()); |
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.
👍 Welcome to the pre-alpha where we forget such things. :D
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.
Let's say it was a feature: free orders for everyone at anytime with no minimum spent 👯
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.
wut? I completely out of the context
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.
When I wrote this payment processor, I forgot to set the correct amount on the payment.
Looks good to me! The notify action (except the API part) looks like could be abstracted / made more generic in future. Anyway, that's something we do later with next gateway. 👍 from me, I'll give final word on this to @makasim. |
[Payum] Be2bill onsite implementation
Thanks guys! 👍 |
Be2bill onsite form implementation