Problem/Motivation

Currently, the CheckoutSdkFactory uses the @http_handler_stack service and therefore adds middlewares to the global Handler Stack service.
This is problematic and should be changed to instantiate the new one, like so:

use GuzzleHttp\HandlerStack;
$stack = HandlerStack::create();

This could potentially cause issues with Commerce USPS or Commerce UPS: See #3571397: Incompatible with commerce_ups 4.x, #3571295: Multiple shipping method with different credentials or even #3571396: Incompatible with commerce_usps 2.x.

In order to avoid conflicts, instantiating a dedicated handler stack seems to make more sense. The only drawback is by not using the service, anyone decorating it or swapping it won't see its overrides taken into account. But I believe this is relatively edge case we can safely ignore.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

jsacksick created an issue. See original summary.

tbkot made their first commit to this issue’s fork.

tbkot’s picture

Status: Active » Needs review

  • jsacksick committed 6f0b7ae4 on 2.x authored by tbkot
    fix: #3571669 Instantiate a new HandlerStack from the CheckoutSdkFactory...
jsacksick’s picture

Status: Needs review » Fixed

Merged, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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