Skip to content
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

Cannot complete payment via admin #16160

Closed
pmontury opened this issue Apr 22, 2024 · 0 comments
Closed

Cannot complete payment via admin #16160

pmontury opened this issue Apr 22, 2024 · 0 comments
Labels
Bug Confirmed bugs or bugfixes.

Comments

@pmontury
Copy link

Sylius version affected: 1.12.14

Description
Cannot complete an order payment via admin

Steps to reproduce
On a stock tracked product (onHand = 3 onHold = 0) enter an order for a quantity of 2
After the checkout is completed we have onHand = 3 and onHold = 2 (so far so good)
When trying to complete the order payment via the admin we get the error 'The payment cannot be completed due to insufficient stock of the product.

Possible Solution
The payment via admin triggers the PaymentPreCompleteListener which calls the availabityChecker isStockSufficient method.
isStocksufficient returns false because the order quantity is greater than the variant onHand - onHold quantities.
That seems wrong at that step since the order quantity is already accounted for in the variant onHold quantity and that the check should be done against onHold quantity.

akyoscommunication pushed a commit to akyoscommunication/Sylius that referenced this issue May 14, 2024
Updated the 'isStockSufficient' function in the AvailabilityChecker class to include an optional argument for deferring payment check. Also adjusted the logic in PaymentPreCompleteListener accordingly.
akyoscommunication pushed a commit to akyoscommunication/Sylius that referenced this issue May 14, 2024
Updated the 'isStockSufficient' function in the AvailabilityChecker class to include an optional argument for deferring payment check. Also adjusted the logic in PaymentPreCompleteListener accordingly.
@GSadee GSadee added the Bug Confirmed bugs or bugfixes. label May 15, 2024
@GSadee GSadee closed this as completed in 570a83f Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

No branches or pull requests

2 participants