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

Add the "sync" mode to api/order/create #2008

Closed
pkarw opened this issue Nov 20, 2018 · 1 comment
Closed

Add the "sync" mode to api/order/create #2008

pkarw opened this issue Nov 20, 2018 · 1 comment
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can

Comments

@pkarw
Copy link
Collaborator

pkarw commented Nov 20, 2018

What is the motivation for adding / enhancing this feature?

Currently the vue-storefront-api order/create endpoint is pushing the order to Redis queue and then the orders are asynchronously pushed back to eCommerce backend (i.e. using o2m for pushing them to Magento2)

We achieved massive scalability by having order process async BUT in case of errors with transmitting the orders to the backend - the user is currently not avare of the problems

We need to move the createSingleOrder directly to https://github.com/DivanteLtd/vue-storefront-api/blob/92c96a6c28e78ba68f2e009d71bf9287ea89a078/src/api/order.js#L18

This second mode should be enabled via config variable

What are the acceptance criteria

  • export createSingleOrder from kind of shared module/helper and use it inside order_2_magento and api/order/create
  • add config variable config.orders.directBackendSync (default = false); when set to true then call createSingleOrder and return the result directly to the frontend
  • add config.orders.directBackendSync (default = false) in the vue-storefront. When set to true then Checkout should not make the order async like currently is doing but rather place it and wait for the result (we probably need to modify this method: https://github.com/DivanteLtd/vue-storefront/blob/102b3923804ccd6d76de5965b7d9e57a14d82726/core/pages/Checkout.js#L323 - and use notification-progress-start event for displaying the "Processing order ..."

Can you complete this feature request by yourself?

YES but I'm short on time :)

@pkarw pkarw added the feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can label Nov 20, 2018
@pkarw
Copy link
Collaborator Author

pkarw commented Nov 20, 2018

Of course: with this option set to on offline orders won't work - or rather: in offline mode we can not use this option (we need to use the fallback to current/default async behaviour anyway)

pkarw added a commit to vuestorefront/vue-storefront-api that referenced this issue Nov 21, 2018
…front/vue-storefront#2008

Orders are by default passed directly to Magento when sent from frontend
pkarw added a commit that referenced this issue Nov 21, 2018
@NataliaTepluhina - please add this to the docs as well:

Starting with Vue Storefront v1.6 we changed the default order-placing behaviour. Currently the `config.orders.directBackendSync` is set to `true` be default. With this option enabled - if the user is online, Vue Storefront tries to pass the order immediately and synchronously (waiting for result) to the eCommerce backend. This option gives immediate and direct feedback to the user. If there is an app-level error (for example validation error on Magento side) user will be notified immediately. If there is transmission issue (no connection, servers are down etc) the order is being put into queue (as it was prior to 1.6). If `config.orders.directBackendSync` is set to false - then the legacy behaviour with queuing all the orders is being used. With `directBackendSync` set to true we do have access to the server confirmation (with backend orderId) in `store.state.order.last_order_confirmation`
@pkarw pkarw closed this as completed Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new features. Please be as specific as possible and provide proposal API if it you can
Projects
None yet
Development

No branches or pull requests

1 participant