Getting this error when doing a checkout....

"TypeError: Argument 5 passed to uc_payment_enter() must be of the type array, object given, called in .../modules/ubercart/payment/uc_credit/src/CreditCardPaymentMethodBase.php on line 625 in uc_payment_enter() (line 146 of .../modules/ubercart/payment/uc_payment/uc_payment.module) #0 "

CommentFileSizeAuthor
#10 2937509-10.patch8.81 KBtr
#4 wpp.patch973 bytestr
#3 wpp.patch893 bytestr

Comments

Cayenne created an issue. See original summary.

tr’s picture

What payment method are you using? About a month ago I added type hinting to the uc_payment_enter() parameters (http://cgit.drupalcode.org/ubercart/commit/?id=c85275a), which affects that 5th parameter. I'm pretty sure all of core Ubercart is correctly passing an array, not an object, but I can't speak for other contributed modules...

Regardless, the important information here would be where is the uc_payment_enter() call coming from - that's the code that needs fixing.

tr’s picture

Status: Active » Needs review
StatusFileSize
new893 bytes

Hmm, maybe PayPal Website Payment Pro?

If so, try this patch. I don't see anything else in core Ubercart that looks like it could be a problem.

tr’s picture

StatusFileSize
new973 bytes

Or, better yet, let's make that a little more consistent with what we do in uc_authorizenet.

cayenne’s picture

Sorry, this is Paypal Website Payments Pro.

I'll set up a test site to try the current release of the dev. I had to revert to keep the business running!

cayenne’s picture

deleted. mis-patched

cayenne’s picture

Re #6 above, the payments are getting through, but the ipn callback is triggering an error, it seems. Paypal reports the payments as being made, and the order now shows as completed on my site, but the user experiences an error with whitescreen on checkout.

So... Progress, but....

cayenne’s picture

Here is the error we get. It's in the post-sale side, being the ipn that should not give us the white error screen.

The key, I guess is undefined method Drupal\uc_paypal\Controller\PayPalController::logger()

Error: Call to undefined method Drupal\uc_paypal\Controller\PayPalController::logger() in Drupal\uc_paypal\Controller\PayPalController->processIpn() (line 174 of /***Drupal***/modules/ubercart/payment/uc_paypal/src/Controller/PayPalController.php) #0 /***Drupal***/modules/ubercart/payment/uc_paypal/src/Controller/PayPalController.php(93): Drupal\uc_paypal\Controller\PayPalController->processIpn(Array) #1 [internal function]: Drupal\uc_paypal\Controller\PayPalController->ipn(Object(Symfony\Component\HttpFoundation\Request)) #2 /***Drupal***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #3 /***Drupal***/core/lib/Drupal/Core/Render/Renderer.php(576): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #4 /***Drupal***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #5 /***Drupal***/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #6 [internal function]: Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #7 /***Drupal***/vendor/symfony/http-kernel/HttpKernel.php(153): call_user_func_array(Object(Closure), Array) #8 /***Drupal***/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #9 /***Drupal***/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #10 /***Drupal***/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #11 /***Drupal***/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #12 /***Drupal***/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #13 /***Drupal***/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /***Drupal***/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /***Drupal***/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /***Drupal***/core/lib/Drupal/Core/DrupalKernel.php(657): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /***Drupal***/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #18 {main}.

cayenne’s picture

Should the call to $this->logger() instead be \Drupal::logger?

Further note, when I comment out line 174, it reveals a next error:

Error: Call to undefined method Drupal\Component\Render\HtmlEscapedText::toString() in Drupal\uc_paypal\Plugin\Ubercart\PaymentMethod\PayPalWebsitePaymentsPro->chargeCard() (line 218 of /..../modules/ubercart/payment/uc_paypal/src/Plugin/Ubercart/PaymentMethod/PayPalWebsitePaymentsPro.php) #0 /..../modules/ubercart/payment/uc_credit/src/CreditCardPaymentMethodBase.php(619): .........

tr’s picture

StatusFileSize
new8.81 KB

Try this... (Now using $this->getLogger() because ControllerBase has changed since we wrote this and now we don't have to inject the logger anymore...)

cayenne’s picture

SUCCESS with the patch in #10

"Order complete
Your order is complete! Your order number is 29.

Thank you for shopping at..."

  • TR committed c2b919e on 8.x-4.x
    Issue #2937509 by TR: Failed PayPal WPP Credit Card Checkout with latest...
tr’s picture

OK, committed. Thanks for testing the patch.

Can you test another small PayPal patch while you're at it? #2800003-8: New Paypal IPN address for HTTPS

cayenne’s picture

The patch referenced in #13 works both with Paypal Standard and WSP.

Nice work.

tr’s picture

Status: Needs review » Fixed

Committed fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.