[Checkout][StateMachine] Rework order checkout state machine

This commit is contained in:
Arminek 2016-09-05 16:59:27 +02:00
parent 71f8c3a7a6
commit bc3a1b8f71
4 changed files with 6 additions and 76 deletions

View file

@ -49,6 +49,7 @@ Feature: Remember where users actually have left checkout
And I have proceeded order with "Free" shipping method and "Offline" payment
When I go back to addressing step of the checkout
And I specify the shipping address as "Ankh Morpork", "Fire Alley", "90350", "United States" for "Jon Snow"
And I complete the addressing step
Then I should be on the checkout shipping step
@ui
@ -59,6 +60,7 @@ Feature: Remember where users actually have left checkout
And I complete the shipping step
When I go back to addressing step of the checkout
And I specify the shipping address as "Ankh Morpork", "Fire Alley", "90350", "United States" for "Jon Snow"
And I complete the addressing step
Then I should be on the checkout shipping step
@ui

View file

@ -15,30 +15,21 @@ winzou_state_machine:
completed: ~
transitions:
address:
from: [cart]
from: [cart, addressed, shipping_selected, payment_selected]
to: addressed
readdress:
from: [payment_selected, shipping_selected, addressed]
to: cart
select_shipping:
from: [addressed]
from: [addressed, shipping_selected, payment_selected]
to: shipping_selected
reselect_shipping:
from: [payment_selected, shipping_selected]
to: addressed
select_payment:
from: [shipping_selected]
from: [payment_selected, shipping_selected]
to: payment_selected
reselect_payment:
from: [payment_selected]
to: shipping_selected
complete:
from: [payment_selected]
to: completed
callbacks:
after:
sylius_process_cart:
on: ["address", "readdress", "select_shipping", "reselect_shipping", "select_payment", "reselect_payment"]
on: ["address", "select_shipping", "select_payment"]
do: ["@sylius.order_processing.order_processor", "process"]
args: ["object"]
sylius_update_exchange_rate:

View file

@ -30,23 +30,6 @@ sylius_shop_checkout_address:
route: sylius_shop_checkout_select_shipping
parameters: []
sylius_shop_checkout_readdress:
path: /readdress
methods: [PUT]
defaults:
_controller: sylius.controller.order:applyStateMachineTransitionAction
_sylius:
flash: false
repository:
method: find
arguments: [expr:service('sylius.context.cart').getCart()]
state_machine:
graph: sylius_order_checkout
transition: readdress
redirect:
route: sylius_shop_checkout_address
parameters: []
sylius_shop_checkout_select_shipping:
path: /select-shipping
methods: [GET, PUT]
@ -67,23 +50,6 @@ sylius_shop_checkout_select_shipping:
route: sylius_shop_checkout_select_payment
parameters: []
sylius_shop_checkout_reselect_shipping:
path: /reselect-shipping
methods: [PUT]
defaults:
_controller: sylius.controller.order:applyStateMachineTransitionAction
_sylius:
flash: false
repository:
method: find
arguments: [expr:service('sylius.context.cart').getCart()]
state_machine:
graph: sylius_order_checkout
transition: reselect_shipping
redirect:
route: sylius_shop_checkout_select_shipping
parameters: []
sylius_shop_checkout_select_payment:
path: /select-payment
methods: [GET, PUT]
@ -104,23 +70,6 @@ sylius_shop_checkout_select_payment:
route: sylius_shop_checkout_complete
parameters: []
sylius_shop_checkout_reselect_payment:
path: /reselect-payment
methods: [PUT]
defaults:
_controller: sylius.controller.order:applyStateMachineTransitionAction
_sylius:
flash: false
repository:
method: find
arguments: [expr:service('sylius.context.cart').getCart()]
state_machine:
graph: sylius_order_checkout
transition: reselect_payment
redirect:
route: sylius_shop_checkout_select_payment
parameters: []
sylius_shop_checkout_complete:
path: /complete
methods: [GET, PUT]

View file

@ -34,15 +34,3 @@
</div>
</div>
</div>
<form id="sylius_checkout_readdress" action="{{ path('sylius_shop_checkout_readdress') }}" method="post">
<input type="hidden" name="_method" value="PUT" />
</form>
<form id="sylius_checkout_reselect_shipping" action="{{ path('sylius_shop_checkout_reselect_shipping') }}" method="post">
<input type="hidden" name="_method" value="PUT" />
</form>
<form id="sylius_checkout_reselect_payment" action="{{ path('sylius_shop_checkout_reselect_payment') }}" method="post">
<input type="hidden" name="_method" value="PUT" />
</form>