Add product into cart, and press the PayPal Express Checkout button, will cause this problems:
PHP Fatal error: Call to undefined function uc_cart_get_contents() in /home/jian/src/drupal8/modules/ubercart/payment/uc_paypal/uc_paypal.module on line 683
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP Stack trace:
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 1. {main}() /home/jian/src/drupal8/index.php:0
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 2. Drupal\Core\DrupalKernel->handle() /home/jian/src/drupal8/index.php:22
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 3. Stack\StackedHttpKernel->handle() /home/jian/src/drupal8/core/lib/Drupal/Core/DrupalKernel.php:637
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 4. Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() /home/jian/src/drupal8/vendor/stack/builder/src/Stack/StackedHttpKernel.php:23
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 5. Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() /home/jian/src/drupal8/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php:55
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 6. Drupal\page_cache\StackMiddleware\PageCache->handle() /home/jian/src/drupal8/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php:51
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 7. Drupal\page_cache\StackMiddleware\PageCache->pass() /home/jian/src/drupal8/core/modules/page_cache/src/StackMiddleware/PageCache.php:82
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 8. Drupal\Core\StackMiddleware\KernelPreHandle->handle() /home/jian/src/drupal8/core/modules/page_cache/src/StackMiddleware/PageCache.php:103
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 9. Drupal\Core\StackMiddleware\Session->handle() /home/jian/src/drupal8/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php:53
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 10. Symfony\Component\HttpKernel\HttpKernel->handle() /home/jian/src/drupal8/core/lib/Drupal/Core/StackMiddleware/Session.php:62
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 11. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /home/jian/src/drupal8/vendor/symfony/http-kernel/HttpKernel.php:62
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 12. call_user_func_array:{/home/jian/src/drupal8/vendor/symfony/http-kernel/HttpKernel.php:139}() /home/jian/src/drupal8/vendor/symfony/http-kernel/HttpKernel.php:139
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 13. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() /home/jian/src/drupal8/vendor/symfony/http-kernel/HttpKernel.php:139
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 14. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() /home/jian/src/drupal8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:102
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 15. Drupal\Core\Render\Renderer->executeInRenderContext() /home/jian/src/drupal8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:129
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 16. Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() /home/jian/src/drupal8/core/lib/Drupal/Core/Render/Renderer.php:577
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 17. call_user_func_array:{/home/jian/src/drupal8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:128}() /home/jian/src/drupal8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:128
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 18. Drupal\uc_cart\Controller\CartController->listing() /home/jian/src/drupal8/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php:128
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 19. Drupal\Core\Form\FormBuilder->getForm() /home/jian/src/drupal8/modules/ubercart/uc_cart/src/Controller/CartController.php:67
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 20. Drupal\Core\Form\FormBuilder->buildForm() /home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormBuilder.php:217
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 21. Drupal\Core\Form\FormBuilder->processForm() /home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormBuilder.php:319
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 22. Drupal\Core\Form\FormSubmitter->doSubmitForm() /home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormBuilder.php:588
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 23. Drupal\Core\Form\FormSubmitter->executeSubmitHandlers() /home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormSubmitter.php:56
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 24. call_user_func_array:{/home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormSubmitter.php:116}() /home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormSubmitter.php:116
Nov 30 00:18:07 jian-ThinkPad-T420 apache2: PHP 25. uc_paypal_ec_form_submit() /home/jian/src/drupal8/core/lib/Drupal/Core/Form/FormSubmitter.php:116
| Comment | File | Size | Author |
|---|---|---|---|
| #70 | paypal-wpp.patch | 17.97 KB | longwave |
| #68 | interdiff-2625276.txt | 15.91 KB | longwave |
| #68 | paypal-ec.patch | 48.28 KB | longwave |
Comments
Comment #2
tr commentedWe haven't ported anything but the internal payment methods (check, COD, other) to D8 yet. See #2621258: Decide on payment methods to ship with 8.x-4.x
I personally haven't put any effort into PayPal because I feel the effort is better spent integrating with Payment. I believe that our own Ubercart-specific version of PayPal is a dead end and it's a waste of time to work on it for D8.
Comment #3
jian he commentedI agree with the effort is better spent integrating with Payment, and integration with Payment is a must have feature.
But my situation is: My project need paypal working as soon as posible (better within 1 week), but the payment + plugin + currency project is not stable, and payment_ubercart project dos not ported to Drupal 8 yet, and payment_paypal project also does not ported to Drupal 8 yet. So it seems my wise choice is uc_paypal at my situation. Please let me know if I am wrong.
Comment #5
tr commentedPayPal Express Checkout is a payment method in Ubercart, so you will have to implement an Ubercart PaymentMethod plugin. Yes, you can write this in 1 week. Normally I'd say 20 hours to do a payment method since it requires a lot of research and testing to make sure you're doing it right - you don't want bugs in a payment method! But it will probably take you longer than normal because there is some porting to D8 to do as well - variables to config etc.
Use uc_payment_pack (which implements 3 payment methods) as an example. PayPal WPS is also a payment method so the same advice applies. PayPal WPP is a payment *gateway* and we currently don't have a plugin definition for payment gateways, so that would require considerably more work.
Comment #6
tr commentedOh and for the test fail above, the route to the admin page for your method is defined in uc_payment, and until you implement the plugin your test won't work. Again, see uc_payment_pack for an example.
One other thing, many of your patches show "\ No newline at end of file" - please make sure that the last character in each file is \n (newline) to prevent this from happening.
Comment #7
jian he commented#2626206: PaymentMethodPlugin should support settings_form which extends from ConfigForm blocks this issue.
Comment #8
jian he commentedIt seems the patch is huge and hard to review. Does this need to split into small patches?
Comment #10
tr commentedWell you're right, this was hard to review. Largely because it's only a partial port - there is still a huge amount of work to do. Part of the problem is that we've made extensive changes to Ubercart in the past month so a lot of the patch needed to be updated, and a lot will have to be reworked now that payment methods are plugins and not hooks.
I've made a lot of changes to the patch and took out some stuff (like the tests, since they no longer work). I'm just going to commit this, if it passes the tests, because it takes us part way there. But there's still a lot more to do which I hope to get done in the next few days.
Comment #12
tr commentedHmm, a 0 byte patch? How did that happen? Here it is again ...
Comment #14
tr commentedAh that's the same old intermittent error we've been getting for a while. Let me just retest until it works ...
Comment #16
tr commentedOK, so it worked. I'm committing this but leaving the issue at "Needs work" because there's still a lot to do.
Comment #17
tr commentedComment #19
tr commentedA very large patch for the testbot to look at. Still not done, but getting there fast ...
Comment #21
tr commentedI didn't mean to include the tests in that patch - I know they're not working yet ... Here's the patch without the tests.
Comment #23
tr commentedCommitted that hunk. Setting back to needs work again, until it's ready to use.
Comment #24
tr commentedBoth EC and WPS are payment methods, so the can both be ported.
Here's my latest patch for the testbot to look at.
Comment #26
tr commentedBack to work ...
Comment #28
tr commentedRemove $_SESSION
Comment #29
tr commentedCommitted, back to needs work.
Comment #31
longwaveWith this patch applied, I have successfully completed checkout through the PayPal WPS sandbox. The IPN isn't yet handled correctly but it's a start!
Comment #33
longwaveWe still use $_SESSION for do_complete.
Comment #35
tr commentedwps_no_shipping should be boolean. If you're getting a variable type conflict in config inspector it's because you had paypal installed before I pushed the schema yesterday and Drupal made an assumption about the type - you have to uninstall then reinstall paypal to make that go away. And in PayPalWebsitePaymentsStandard.php it should probably be initialized to TRUE instead of 1.
Instead of restoring the use of $_SESSION here, why not finish removing it in uc_cart? Most places have been switched to grabbing it from the session service rather than using the superglobal, so I'd rather not go back.
Otherwise looking real good ...
Comment #36
longwaveIt's definitely a string (or perhaps an integer, if we change the keys):
The incorrect type took me some time to track down. With it set to boolean, sending
<input name="no_shipping" value>(ie. with no value attribute at all) causes PayPal to throw a nondescript error.I intend to finish the $_SESSION conversion elsewhere, I will open a new issue for that.
Comment #37
tr commentedOh OK, thanks for catching that.
Comment #38
tr commentedLet's start tagging ...
Comment #39
longwaveThis patch converts the 'redirect' key to an interface so the form can be contained inside the plugin. This will break 2Checkout but that can be fixed later.
Comment #40
longwaveStill to do for PayPal WPS:
Comment #41
tr commentedCan you make the change to uc_2checkout while it's still fresh in your mind?
Comment #42
longwaveFixed 2Checkout in http://cgit.drupalcode.org/ubercart/commit/?id=709e4e8, the form output looks okay but I have not done an end to end test.
Comment #43
longwaveThis patch removes the currency setting (as we have it stored against the order already), the cancel URL (we should just send the user back one page), and the stylesheet that contained a single rule and wasn't being applied anyway.
I think we should also remove wps_no_shipping and wps_address_override, and always send the address entered at checkout but never allow the user to override it at PayPal - I don't see the point in any other combination.
Comment #44
longwaveThis patch additionally removes the address options from the WPS plugin configuration.
Comment #46
longwaveNot entirely sure yet whether we should remove the no_shipping and address_override options so I have left them in for now.
Comment #47
longwaveThis patch cleans up the IPN listener so it POSTs back to PayPal without erroring first, however the PayPal response is still INVALID and I am yet to figure out why.
Comment #48
longwaveAnother patch to send the order currency automatically for WPP and EC.
Comment #49
tr commentedThis might be helpful https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNSimul...
Comment #51
tr commentedResetting issue "Last modified" which was messed up by #2664380: Wrong comment date in automated commit comments
Comment #52
hanniha commentedI'm not sure but I think I found problem why IPN verification not going throug.
Paypal's manual say: After receiving an IPN message from PayPal, you must respond to PayPal with a POST message that is an exact copy of the received message but with "cmd=_notify-validate" added to the end of the message
But what I understand programming that cmd=_notify-validate are added before IPN.
Comment #53
hanniha commentedI fix that validation like this...
Comment #54
hanniha commentedBetter fix. There was only one small mistake for that original code
Comment #55
tr commentedWell, the $data variable isn't defined anywhere, and the 'test_ipn' key isn't defined anywhere either. A proper fix will be to figure out what this test was supposed to do (@longwave? this was added as part of your commit d48c8bbf) and make it work properly. Apparently all your patch does is to force the use of the sandbox server all the time, because you're testing a variable which will always be empty.
Comment #56
longwaveThe test_ipn key is defined in the PayPal documentation but I am not sure it is entirely reliable, or maybe I misread how it is supposed to work. I thought it would be the right way to identify whether to send IPNs back to the live or sandbox site without necessarily needing to refer back to the payment method config, but maybe we need a different method for this.
Comment #57
tr commentedThen shouldn't it be $ipn['test_ipn'] instead of $data['test_ipn'] ? $data isn't defined anywhere ...
Comment #58
longwaveAh, yeah, didn't spot that - could well be the issue! I will try that next time I get some free time to work on this.
Comment #60
longwavePayPal sandbox is down but from reading the docs again I think this should work if I use the right variable name, so I committed this change. Express Checkout and WPP still need work.
Comment #61
longwavePayPal Payments Standard lost the "Website" part from its name some time ago.
Comment #63
longwaveBack to active to finish off Express Checkout, unfortunately I can't work on this until the PayPal sandbox is back up.
Comment #64
longwavePayPal sandbox is back up and delivered an IPN (12 hours late!) that was successfully processed and verified for PayPal Payments Standard, which is good news.
Comment #65
longwaveWork in progress for Express Checkout.
Comment #66
longwaveExpress Checkout now works for both shortcut flow (cart > PayPal > review > complete) and mark flow (cart > checkout > review > PayPal > complete). We can improve things further later, but for now this is at least as good, if not better, than we had in D7.
Comment #67
longwaveThis only leaves Website Payments Pro, which still needs conversion.
Comment #68
longwaveCleaned up version of #66. I have PayPal WPP almost ready to go as well.
Comment #70
longwaveComment #72
longwaveCommitted.