Skip to content

Ported the JVM shop pages to Carts.Api - #324

Open
oskardudycz wants to merge 2 commits into
mainfrom
e-commerce-shop-pages
Open

oskardudycz wants to merge 2 commits into
mainfrom
e-commerce-shop-pages

Conversation

@oskardudycz

Copy link
Copy Markdown
Owner

The ECommerce sample is a port of the JVM e-commerce sample. Until now, customers could shop only through the cart's web API. With this change, Carts.Api also serves the JVM shop pages, so a customer can log in by name, add products, look at the cart, remove products, check out and log out through HTML forms, as in the JVM sample.

  • The pages are ASP.NET Core MVC controllers with Razor views, the closest match to the JVM's Spring MVC page classes and Thymeleaf templates. ShopController serves the login, the logout and the layout. ShoppingCartsController serves the products and cart pages and their forms. The layout, header, styles and htmx script are copied from the JVM, and the header keeps every JVM link.
  • After a failed remove or checkout, the cart page shows the JVM messages ("Your cart has changed…", "Some prices have changed…"). They are carried across the redirect in TempData, the ASP.NET Core counterpart of Spring's flash attributes.
  • The cart views are inline Marten projections, so the cart page reads a cart right after the form that changed it. This replaces the JVM's wait for the written version, which the JVM needs because its views are updated asynchronously. The cart's version comes from Marten's revision metadata, so the store keeps Marten's default (Quick) append mode. The cart endpoints no longer wait for the current cart to appear.
  • The JVM ShopPagesTests and the CartPages tests are ported one to one, plus two tests for the cart page's failure messages, added to the JVM in the same way.
  • Ogooreck is upgraded to 1.5.0, whose cookie and HTML checks these tests use.

The checkout redirects to the order page, and the header links to the orders, Swagger UI, Springwolf, the sandboxes and the developer tools. None of these pages exists in the .NET sample yet.

…mer id from earlier responses; test names follow the Ogooreck naming rule

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant