Closed pmarjan-onestic closed 2 weeks ago
Hello @pmarjan-onestic,
Thank you for providing the fix. Is this PR ready to be reviewed? If so, could you please add a brief description about the fix and how these changes lead us to the solution?
Best Regards, Can
hi @candemiralp
Adyen\Hyva\Model\Configuration
is a configuration reader that previously used to depend on Magento\Checkout\Model\CompositeConfigProvider
. This composite provider comes with all sorts of config providers, and one of them (sorry, but cannot remember which) would just do extra work that would turn the buyRequest for the update item from an array into some data object....
Marc's suggestion was something like: _"My observation is that since the configuration is only needed to populate data in the payment block, it may be sufficient to fetch only the specific configurations required for those blocks, rather than retrieving all configurations."
And the PR is now following this idea, practically introducing "Adyen\Hyva\Model\CompositeConfigProvider" instead of "Magento\Checkout\Model\CompositeConfigProvider". The former is custom configured in di.xml to include config provider that are relevant to the adyen usage, making it more targeted and probably more preformance oriented at the same time.
Let me know please if any questions.
Hello @pmarjan-onestic,
Thank you for providing a fix for this issue. We are still testing it and this PR will be merged after testing.
Best Regards, Can
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code
Summary
Issue happens when One Product is in Stock. No order can be placed. After investigating the issue, it's observed that no problems occur with MSI + Adyen or with Hyva theme + MSI. However, the issue arises when the compatibility module is involved. Specifically, when attempting to add a configurable product with limited stock (e.g., 2 items), the shipping methods do not appear on the checkout page. Interestingly, if the pre-selected shipping method is not changed, the issue does not occur. In the compatibility module, there are two calls to
CartItemPersister
, which processesBuyRequestData
differently each time:First Call:
BuyRequestData
is returned as a float (indicating, possibly, a single unit or specific quantity). Second Call:BuyRequestData
is returned as an object (indicating a detailed configuration request, such as specific product options or custom data). WhenBuyRequestData
is treated as an object in the second request, Magento’sQuote.php
interprets this as a full update request for the cart. It tries to add more of the product to the cart, potentially exceeding the available stock, thus triggering an out-of-stock exception.Since the configuration is only needed to populate information in the payment block, we might avoid the issue by fetching only the specific configuration data required for that payment block, without altering the existing cart item quantities.
With the proposed solution, The
CompositeConfigProvider
consolidates configurations from various ConfigProviderInterface implementations. By including only the necessary configuration providers, we avoid any unnecessary processing that might interfere with cart items or stock levels.Tested scenarios
It's possible to change the country It's possible to select a shipping method Successful Payment with the limited quantity in stock for configurable object
Fixes #59