mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-05 20:57:12 +00:00
Add support for canceling authorized payments and adjust payment transition states
This commit is contained in:
parent
92ef8a2200
commit
b7aa5f8387
3 changed files with 14 additions and 1 deletions
|
|
@ -20,7 +20,10 @@ framework:
|
|||
- !php/const Sylius\Component\Core\OrderPaymentStates::STATE_REFUNDED
|
||||
transitions:
|
||||
!php/const Sylius\Component\Core\OrderPaymentTransitions::TRANSITION_REQUEST_PAYMENT:
|
||||
from: !php/const Sylius\Component\Core\OrderPaymentStates::STATE_CART
|
||||
from:
|
||||
- !php/const Sylius\Component\Core\OrderPaymentStates::STATE_CART
|
||||
- !php/const Sylius\Component\Core\OrderPaymentStates::STATE_AUTHORIZED
|
||||
- !php/const Sylius\Component\Core\OrderPaymentStates::STATE_PARTIALLY_AUTHORIZED
|
||||
to: !php/const Sylius\Component\Core\OrderPaymentStates::STATE_AWAITING_PAYMENT
|
||||
!php/const Sylius\Component\Core\OrderPaymentTransitions::TRANSITION_PARTIALLY_AUTHORIZE:
|
||||
from:
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
<tag name="kernel.event_listener" event="workflow.sylius_payment.completed.process" priority="100" />
|
||||
<tag name="kernel.event_listener" event="workflow.sylius_payment.completed.refund" priority="100" />
|
||||
<tag name="kernel.event_listener" event="workflow.sylius_payment.completed.authorize" priority="100" />
|
||||
<tag name="kernel.event_listener" event="workflow.sylius_payment.completed.cancel" priority="50" />
|
||||
<tag name="kernel.event_listener" event="workflow.sylius_payment.completed.fail" priority="50" />
|
||||
</service>
|
||||
</services>
|
||||
</container>
|
||||
|
|
|
|||
|
|
@ -105,6 +105,14 @@ final class OrderPaymentStateResolver implements StateResolverInterface
|
|||
return OrderPaymentTransitions::TRANSITION_REQUEST_PAYMENT;
|
||||
}
|
||||
|
||||
$hasReplayablePayment =
|
||||
!$this->getPaymentsWithState($order, PaymentInterface::STATE_CART)->isEmpty()
|
||||
|| !$this->getPaymentsWithState($order, PaymentInterface::STATE_NEW)->isEmpty();
|
||||
|
||||
if ($hasReplayablePayment) {
|
||||
return OrderPaymentTransitions::TRANSITION_REQUEST_PAYMENT;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue