-
-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Labels
EnhancementMinor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Description
Hi,
According to code lines below, "partially_refund" transition is not triggered on order payment state if that state is already on "partially_refund".
| if ($order->getPaymentState() === OrderPaymentStates::STATE_PARTIALLY_REFUNDED) { | |
| return; | |
| } | |
| $stateMachine = $this->stateMachineFactory->get($order, OrderPaymentTransitions::GRAPH); | |
| $stateMachine->apply(OrderPaymentTransitions::TRANSITION_PARTIALLY_REFUND); | |
I think it's a mistake.
sylius_order_payment state machine allow transition from "partially_refund" to "partially_refund". So why not playing transition on a new partial refund ?
Rather than checking current order payment state, you should use if( $stateMachine->can( OrderPaymentTransitions::TRANSITION_PARTIALLY_REFUND ) ) before applying.
What do you think about ?
Thanks a lot ;-)
Metadata
Metadata
Assignees
Labels
EnhancementMinor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).