Skip to content

Commit

Permalink
[Maintenance][Core] Update payment state machine
Browse files Browse the repository at this point in the history
  • Loading branch information
NoResponseMate committed Oct 12, 2023
1 parent df61733 commit 6205943
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
12 changes: 11 additions & 1 deletion UPGRADE-1.13.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,12 @@
- From: `void`
- To: `unknown`

1. In the `sylius_payment` state machine of `PaymentBundle`, a new state `authorized` has been introduced, with the following transition:
1. In the `sylius_payment` state machine of `PaymentBundle`, a new state `authorized` has been introduced, along with a new transition:
- Transition `authorize`:
- From states: [`new`, `processing`]
- To state: `authorized`

Due to that the following transitions have been updated:
- Transition `complete`:
- From states: [`new`, `processing`, `authorized`]
- To state: `completed`
Expand All @@ -190,3 +192,11 @@
- Transition `void`:
- From states: [`new`, `processing`, `authorized`]
- To state: `unknown`

1. The `sylius_payment` state machine of `CoreBundle` has been updated to allow failing an authorized payment:
```diff
fail:
- from: [new, processing]
+ from: [new, processing, authorized]
to: failed
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ winzou_state_machine:
from: [new, processing, authorized]
to: completed
fail:
from: [new, processing]
from: [new, processing, authorized]
to: failed
cancel:
from: [new, processing, authorized]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ framework:
from:
- !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_NEW
- !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_PROCESSING
- !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_AUTHORIZED
to: !php/const Sylius\Component\Payment\Model\PaymentInterface::STATE_FAILED
!php/const Sylius\Component\Payment\PaymentTransitions::TRANSITION_CANCEL:
from:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public function availableTransitions(): iterable
yield [PaymentInterface::STATE_AUTHORIZED, PaymentTransitions::TRANSITION_COMPLETE, PaymentInterface::STATE_COMPLETED];
yield [PaymentInterface::STATE_NEW, PaymentTransitions::TRANSITION_FAIL, PaymentInterface::STATE_FAILED];
yield [PaymentInterface::STATE_PROCESSING, PaymentTransitions::TRANSITION_FAIL, PaymentInterface::STATE_FAILED];
yield [PaymentInterface::STATE_AUTHORIZED, PaymentTransitions::TRANSITION_FAIL, PaymentInterface::STATE_FAILED];
yield [PaymentInterface::STATE_NEW, PaymentTransitions::TRANSITION_CANCEL, PaymentInterface::STATE_CANCELLED];
yield [PaymentInterface::STATE_PROCESSING, PaymentTransitions::TRANSITION_CANCEL, PaymentInterface::STATE_CANCELLED];
yield [PaymentInterface::STATE_AUTHORIZED, PaymentTransitions::TRANSITION_CANCEL, PaymentInterface::STATE_CANCELLED];
Expand Down

0 comments on commit 6205943

Please sign in to comment.