OrchardCMS / OrchardCore.Commerce

The commerce module for Orchard Core.
MIT License
204 stars 83 forks source link

Create REST API endpoints for main features (OCC-253) #450

Open wAsnk opened 1 month ago

wAsnk commented 1 month ago

Currently, there is no way to control shopping cart, checkout through an ApiController, REST API endpoint.

What's missing:

  1. Shopping cart:

    • Get shopping cart
    • Add item
    • Remove item
    • Update line item, or shopping cart update
  2. Checkout process

Jira issue

Piedone commented 1 month ago

Maybe not with an ApiControllet but a potentially more efficient minimal API endpoint, see e.g. https://github.com/OrchardCMS/OrchardCore/tree/main/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api. See rationale and metrics: https://github.com/OrchardCMS/OrchardCore/pull/15294.

infofromca commented 1 month ago

Hi : any update by somebody? for shopping cart ,( or add Item) , I think we need User info. ( for ex. user token) for the api. currently, we use user session for the shopping cart , is it ok for multi-instances of OC or the client app?
what is your opinion?

BY THE WAY, IT SEEMS THAT WE DID NOT USE shoppingCartId in whole project

sarahelsaig commented 1 month ago

Hi : any update by somebody?

Not yet. We will certainly do this eventually. But in the meantime if you want to contribute (even partially) or make further suggestions here, that's also welcome.

for shopping cart ,( or add Item) , I think we need User info. ( for ex. user token) for the api. currently, we use user session for the shopping cart , is it ok for multi-instances of OC or the client app?

There should be an OpenID Connect or JWT bearer token which is required to connect (see info about AuthenticationSchemes in ASP.NET Core docs). OC's OpenID Server module can provide either type. This is not related to the shopping cart ID, which is optional. But you make a good point about the session storage, connecting through API will likely require a different IShoppingCartPersistence implementation.

BY THE WAY, IT SEEMS THAT WE DID NOT USE shoppingCartId in whole project

I think we only don't use it in specific payment provider implementations that don't support multiple shopping carts. If you find it missing somewhere else too, please point it out.