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

Partial payments with a cancelled part #6

Closed
rickschippers opened this issue Aug 5, 2021 · 2 comments
Closed

Partial payments with a cancelled part #6

rickschippers opened this issue Aug 5, 2021 · 2 comments
Assignees

Comments

@rickschippers
Copy link
Contributor

rickschippers commented Aug 5, 2021

When a partial payment has one part that is cancelled, the order in shopware will be cancelled and remain cancelled. Even when another succesful part completes the entire payment.

What happens is when you have a failed part - for example when someone enters an incorrect pin on a giftcard - a push is sent to shopware with a 690 status. This causes the order state to change to cancelled.

Then when another payment part has been succesful a new push is sent to shopware with status 190. This is supposed to reopen the order and handle the payment. However the check to see if the order should be reopened breaks. This causes the order to remain cancelled. The rest of the handling fails because you will get illegal state transitions, since the order is still cancelled instead of reopened.

The issue is in the PushController at line 140 - the part that should reopen the order:

if ($this->checkoutHelper->isOrderState(['cancelled'], $brqOrderId, $context)) {
  $this->logger->info(__METHOD__ . "|35|");
  $this->checkoutHelper->changeOrderStatus($brqOrderId, $context, 'reopen');
}

The order state is being checked to see if the order has the state cancelled. This check fails, since it is being checked against:
StateMachineTransitionActions::ACTION_CANCEL which is cancel, not cancelled.

The check is in the CheckoutHelper->getOrderTransactionStatesNameFromAction

@saranchuk-hys
Copy link
Contributor

Hello @rickschippers
Thank you for you pull request

@rickschippers
Copy link
Contributor Author

rickschippers commented Aug 5, 2021

Another side effect of this issue is that this check will return true if the order state is open. Since the getOrderTransactionStatesNameFromAction will return OrderTransactionStates::STATE_OPEN; if it doesn't find a match.

So you propably want to make the isOrderState method a bit more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants