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

Feat/security review changes #10

Merged
merged 19 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 83 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,74 @@
[![Kentico Labs](https://img.shields.io/badge/Kentico_Labs-grey?labelColor=orange&logo=data:image/svg+xml;base64,PHN2ZyBjbGFzcz0ic3ZnLWljb24iIHN0eWxlPSJ3aWR0aDogMWVtOyBoZWlnaHQ6IDFlbTt2ZXJ0aWNhbC1hbGlnbjogbWlkZGxlO2ZpbGw6IGN1cnJlbnRDb2xvcjtvdmVyZmxvdzogaGlkZGVuOyIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxwYXRoIGQ9Ik05NTYuMjg4IDgwNC40OEw2NDAgMjc3LjQ0VjY0aDMyYzE3LjYgMCAzMi0xNC40IDMyLTMycy0xNC40LTMyLTMyLTMyaC0zMjBjLTE3LjYgMC0zMiAxNC40LTMyIDMyczE0LjQgMzIgMzIgMzJIMzg0djIxMy40NEw2Ny43MTIgODA0LjQ4Qy00LjczNiA5MjUuMTg0IDUxLjIgMTAyNCAxOTIgMTAyNGg2NDBjMTQwLjggMCAxOTYuNzM2LTk4Ljc1MiAxMjQuMjg4LTIxOS41MnpNMjQxLjAyNCA2NDBMNDQ4IDI5NS4wNFY2NGgxMjh2MjMxLjA0TDc4Mi45NzYgNjQwSDI0MS4wMjR6IiAgLz48L3N2Zz4=)](https://github.com/Kentico/.github/blob/main/SUPPORT.md#labs-limited-support)
[![CI: Build and Test](https://github.com/Kentico/xperience-by-kentico-ecommerce/actions/workflows/ci.yml/badge.svg)](https://github.com/Kentico/xperience-by-kentico-ecommerce/actions/workflows/ci.yml)

**This integration is currently a Proof of Concept (PoC). For further details, please refer to the [Support](#support) section and the [KenticoLabs](https://github.com/Kentico/.github/blob/main/SUPPORT.md#labs-limited-support) tag associated with this feature.**

| Name | Package |
| ------------- |:-------------:|
| Kentico.Xperience.K13Ecommerce | [![NuGet Package](https://img.shields.io/nuget/v/Kentico.Xperience.K13Ecommerce.svg)](https://www.nuget.org/packages/Kentico.Xperience.K13Ecommerce) |
| Kentico.Xperience.Store.Rcl | [![NuGet Package](https://img.shields.io/nuget/v/Kentico.Xperience.Store.Rcl.svg)](https://www.nuget.org/packages/Kentico.Xperience.Store.Rcl) |
| Kentico.Xperience.StoreApi | [![NuGet Package](https://img.shields.io/nuget/v/Kentico.Xperience.StoreApi.svg)](https://www.nuget.org/packages/Kentico.Xperience.StoreApi) |


## Description

Repository contains solution with Xperience By Kentico integration to Kentico Xperience 13 E-Commerce features
to create E-Commerce solution on XByK.
Currently there are 2 solutions:
- Kentico.Xperience.K13Ecommerce.sln
- It shows the possibility of XbyK integration on Kentico 13 E-Commerce solution.
- Consists of these parts:
- Library for Kentico 13 that exposes a REST API for an E-Commerce site (Kentico.Xperience.StoreApi).
- Library for XbyK connecting to the REST Store API running under Kentico 13 (Kentico.Xperience.K13Ecommerce)
- Razor Class Library for selector components (Kentico.Xperience.Store.Rcl)
- Sample Dancing Goat sites
- DancingGoat.csproj - XbyK Dancing Goat enriched with integration to KX 13 Dancing Goat to show how to
create simple e-shop with product listing, product detail and checkout process on XByK
- Kentico13_DancingGoat.csproj - KX 13 Dancing Goat example with configured Store API to show you how you can setup
REST Store API on you own KX 13 e-commerce solution
- Kentico.Xperience.K13Ecommerce.Libs.sln
- Contains only libraries without sample sites

Solution covers several scenarios according to the complexity of integration between XByK and KX 13:
- [Product listing widget example](./examples/DancingGoat-K13Ecommerce/Components/Widgets/Store/ProductListWidget)
- Used to display products directly from the KX 13, purchase itself still takes place
on Kentico 13
- Full scale e-commerce solution
- Product data (with variants and images) are synchronized to Content hub (can be turned off)
- Product listing, detail and checkout process is placed on XbyK (shopping cart is calculated still on KX 13)
- Linking products to categories in Pages channels needs to be done manually from Content hub.
Page types are prepared to CI restore, details info in [this section of User Guide](./docs/Usage-Guide.md#dancing-goat-example---setup).

## Screenshots

![Cart content](./images/screenshots/cart_content.png "Cart content")
![Products in content hub](./images/screenshots/products_content_hub.png "Products in content hub")
This integration is primary intended for existing Kentico 13 (KX 13) E-Commerce projects to enable them to migrate
to new Xperience By Kentico (XbyK) and still use KX 13 E-Commerce functionality.\
It can also be used as a basis for new projects where E-Commerce data will be stored on KX 13, but further development is necessary to achieve this goal.

This solution covers several scenarios according to the complexity of integration between XByK and KX 13:

### Product listing widget
- We recommend to use this widget for simple scenarios such as Landing page offers, etc.
- [Product listing widget example](./examples/DancingGoat-K13Ecommerce/Components/Widgets/Store/ProductListWidget/StoreProductListWidgetViewComponent.cs)
is located in [Dancing Goat XbyK example project](./examples/DancingGoat-K13Ecommerce).
- The widget is used to display products directly from KX 13, purchase itself still takes place on Kentico 13.
- The widget has a couple of properties based on the [Store property selector](./src/Kentico.Xperience.K13Ecommerce/Components/FormComponents/KenticoStorePropertySelector/KenticoStorePropertySelectorComponent.cs) which enable to display products for given category, culture and currency.

![Product listing widget](./images/screenshots/product_listing_widget.png "Product listing widget")
### Full scale e-commerce solution
- We recommend to use for possible partial migration of existing e-commerce projects from KX 13 to XbyK.
- Product data (with variants and images) are [synchronized to Content hub](./docs/Usage-Guide.md#products-synchronization) (can be [turned off](./docs/Usage-Guide.md#setup-1)).
![Products in content hub](./images/screenshots/products_content_hub.png "Products in content hub")
- Product listing, detail and checkout process are placed on XbyK (shopping cart is saved and calculated still on KX 13).
![Cart content](./images/screenshots/cart_content.png "Cart content")
- Orders are created from cart, order related data are saved on KX 13 side.
- Linking products to categories in Pages channels need to be done manually from Content hub.
Page types are prepared to CI restore, details info in [this section of User Guide](./docs/Usage-Guide.md#dancing-goat-example---setup).
![Store pages](./images/screenshots/store_pages.png "Store pages")
- [Sample XbyK Dancing Goat site](./examples/DancingGoat-K13Ecommerce) implements store functionality and can be used as an example of migration of existing e-commerce projects to new XbyK.

There are a couple of services which cover these actions:
- Listing products based on parameters, product categories, prices and inventory
- Actions with shopping cart, changing currency and order creation
- Listing of orders (currently suitable for implementing listing orders in administration, not in My account)
- **Order updates and listing for specific customers are under development**
- Listing site cultures and currencies
- Check [this part of User Guide](./docs/Usage-Guide.md#kx-13-e-commerce-integration-in-xperience-by-kentico) for more specific description


### Project structure

There are currently 2 solutions:

#### Kentico.Xperience.K13Ecommerce.sln

Complete solution with all libraries and sample sites:

- `Kentico.Xperience.StoreApi` - library for Kentico 13 that exposes a [REST API](./docs/Usage-Guide.md#store-api-kentico-xperience-13) for an E-Commerce site.
- `Kentico.Xperience.K13Ecommerce` - library for XbyK connecting to the REST Store API running under Kentico 13.
- `Kentico.Xperience.Store.Rcl` - Razor Class Library for selector components.
- Sample Dancing Goat sites
- `DancingGoat.csproj` - XbyK Dancing Goat (live site channel + administration) enriched with integration to KX 13 Dancing Goat to show how to
create simple e-shop with product listing, product detail and checkout process on XByK.
- `Kentico13_DancingGoat.csproj` - KX 13 Dancing Goat example (live site) with configured Store API to demonstrate how you can set up
REST Store API on your own KX 13 e-commerce solution.
- **KX 13 administration project (CMSApp) is not part of this solution!**

![Project diagram](./images/project_diagram.png "Project diagram")

#### Kentico.Xperience.K13Ecommerce.Libs.sln
- Contains only libraries without sample sites, used for publishing of nuget packages

## Library Version Matrix

Expand All @@ -52,8 +87,6 @@ Summary of libraries which are supported by the following versions Xperince by K

### Dependencies

#### Kentico 13 E-Commerce

Xperience by Kentico application:
- [ASP.NET Core 8.0](https://dotnet.microsoft.com/en-us/download)
- [Xperience by Kentico](https://docs.xperience.io/xp/changelog)
Expand All @@ -64,7 +97,7 @@ Kentico Xperience 13 application (or standalone API app):

## Package Installation

### Kentico Xperience 13 E-Commerce integration
### Xperience by Kentico

Add these packages to your XbyK application using the .NET CLI

Expand All @@ -73,20 +106,22 @@ dotnet add package Kentico.Xperience.K13Ecommerce
dotnet add package Kentico.Xperience.Store.Rcl
```

### Kentico Xperience 13

Add this package to your Kentico Xperience 13 ASP.NET.Core application (live site or create standalone application
when your KX 13 live site is not running)

```powershell
dotnet add package Kentico.Xperience.StoreApi
```

## Quick Start

### Kentico Xperience 13 E-Commerce integration
### Kentico Xperience 13

**First setup your Kentico 13 ASP.NET Core application**:
**First set up your Kentico 13 ASP.NET Core application**:

1. Setup your own settings for Store REST API authentication (based on JWT and OAuth client credentials flow)
1. Set up your own [settings](.\examples\Kentico13_DancingGoatStore\appsettings.json) for Store REST API authentication (based on JWT and OAuth client credentials flow)
```json
{
"CMSStoreApi": {
Expand All @@ -102,7 +137,7 @@ dotnet add package Kentico.Xperience.StoreApi
}
```

2. Add Store API services to application services and configure Swagger
2. Add [Store API services](https://github.com/Kentico/xperience-by-kentico-ecommerce/blob/main/examples/Kentico13_DancingGoatStore/Startup.cs#L130) to application services and configure Swagger
```csharp
// Startup.cs

Expand All @@ -122,9 +157,11 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment environment)
}
```

**Then setup your Xperience By Kentico application**
### Xperience By Kentico

**Then set up your Xperience By Kentico application**

1. Fill settings to connect your Kentico Xperience 13 instance
1. Fill [settings](.\examples\DancingGoat-K13Ecommerce\appsettings.json) to connect your Kentico Xperience 13 instance
```json
{
"CMSKenticoStoreConfig": {
Expand All @@ -136,17 +173,17 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment environment)
}
}
```
2. Add K13Ecommerce library to the application services
2. Add K13Ecommerce library to the [application services](https://github.com/Kentico/xperience-by-kentico-ecommerce/blob/main/examples/DancingGoat-K13Ecommerce/Program.cs#L61)
```csharp
// Program.cs

// Registers Kentico Store API and services for e-commerce support
builder.Services.AddKenticoStoreServices(builder.Configuration);
```
3. For most simple scenario: copy product listing widget from Dancing Goat example project to your project and configure
properties to display products from Kentico 13. Sample widget is located [here](./examples/DancingGoat-K13Ecommerce/Components/Widgets/Store/ProductListWidget).
4. For more complex scenario with full e-shop, you can inspire how Dancing Goat sample Store on XbyK is implemented.
Check [Usage guide](./docs/Usage-Guide.md#store-setup) for detailed instructions how to configure categories, products and cart steps.
3. For the simplest scenario: copy [product listing widget](./examples/DancingGoat-K13Ecommerce/Components/Widgets/Store/ProductListWidget) from Dancing Goat example project to your project and configure
properties to display products from KX 13.
4. For more complex scenario with full e-shop, you can be inspired by implementation of [Dancing Goat sample Store](./examples/DancingGoat-K13Ecommerce) on XbyK.
Check [Usage guide](./docs/Usage-Guide.md#dancing-goat-example---setup) for detailed instructions to configure categories, products and cart steps.
5. Restore CI repository files to database (reusable content types, custom activities). CI files are located in
`.\examples\DancingGoat-K13Ecommerce\App_Data\CIRepository\` and you need to copy these files to your application.
```powershell
Expand Down
21 changes: 21 additions & 0 deletions docs/Kentico.Xperience.K13Ecommerce.argr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<ArchitectureGraph>
<Module Identifier="C30A7837-2BD6-4B0E-996D-2A2B9167173F" Name="Kentico.Xperience.K13Ecommerce" />
<Module Identifier="96B93007-AB51-4A1C-A36D-1C014AD1F608" Name="Kentico.Xperience.Ecommerce.Common" />
<Module Identifier="28755E8F-BB89-4196-AC65-2C5A823EF522" Name="Kentico.Xperience.StoreApi" />
<Module Identifier="E0981D21-9E8F-4A5B-9A98-A84D14EFA250" Name="Kentico.Xperience.Store.Rcl" />
<Module Identifier="4222D570-F1A2-4410-8441-7761011BC52A" Name="Kentico.Xperience.K13Ecommerce.IntegrationTests" />
<Module Identifier="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7" Name="DancingGoat" />
<Module Identifier="219565E2-67AC-4858-A3D1-5C9A27BED0A0" Name="Kentico13_DancingGoat" />
<Module Identifier="622B0A21-4664-42CB-A7B7-31553B56F249" Name="Kentico.Xperience.K13Ecommerce.UnitTests" />
<Reference Identifier="C30A7837-2BD6-4B0E-996D-2A2B9167173F/r:Kentico.Xperience.Ecommerce.Common" SourceId="C30A7837-2BD6-4B0E-996D-2A2B9167173F" Name="Kentico.Xperience.Ecommerce.Common" TargetId="96B93007-AB51-4A1C-A36D-1C014AD1F608" />
<Reference Identifier="E0981D21-9E8F-4A5B-9A98-A84D14EFA250/r:Kentico.Xperience.K13Ecommerce" SourceId="E0981D21-9E8F-4A5B-9A98-A84D14EFA250" Name="Kentico.Xperience.K13Ecommerce" TargetId="C30A7837-2BD6-4B0E-996D-2A2B9167173F" />
<Reference Identifier="E0981D21-9E8F-4A5B-9A98-A84D14EFA250/r:Kentico.Xperience.Ecommerce.Common" SourceId="E0981D21-9E8F-4A5B-9A98-A84D14EFA250" Name="Kentico.Xperience.Ecommerce.Common" TargetId="96B93007-AB51-4A1C-A36D-1C014AD1F608" />
<Reference Identifier="4222D570-F1A2-4410-8441-7761011BC52A/r:Kentico.Xperience.K13Ecommerce" SourceId="4222D570-F1A2-4410-8441-7761011BC52A" Name="Kentico.Xperience.K13Ecommerce" TargetId="C30A7837-2BD6-4B0E-996D-2A2B9167173F" />
<Reference Identifier="4222D570-F1A2-4410-8441-7761011BC52A/r:Kentico.Xperience.Ecommerce.Common" SourceId="4222D570-F1A2-4410-8441-7761011BC52A" Name="Kentico.Xperience.Ecommerce.Common" TargetId="96B93007-AB51-4A1C-A36D-1C014AD1F608" />
<Reference Identifier="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7/r:Kentico.Xperience.Store.Rcl" SourceId="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7" Name="Kentico.Xperience.Store.Rcl" TargetId="E0981D21-9E8F-4A5B-9A98-A84D14EFA250" />
<Reference Identifier="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7/r:Kentico.Xperience.Ecommerce.Common" SourceId="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7" Name="Kentico.Xperience.Ecommerce.Common" TargetId="96B93007-AB51-4A1C-A36D-1C014AD1F608" />
<Reference Identifier="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7/r:Kentico.Xperience.K13Ecommerce" SourceId="2FD89E1B-DD9F-48C3-88C2-DD4C3C1340E7" Name="Kentico.Xperience.K13Ecommerce" TargetId="C30A7837-2BD6-4B0E-996D-2A2B9167173F" />
<Reference Identifier="219565E2-67AC-4858-A3D1-5C9A27BED0A0/r:Kentico.Xperience.StoreApi" SourceId="219565E2-67AC-4858-A3D1-5C9A27BED0A0" Name="Kentico.Xperience.StoreApi" TargetId="28755E8F-BB89-4196-AC65-2C5A823EF522" />
<Reference Identifier="622B0A21-4664-42CB-A7B7-31553B56F249/r:Kentico.Xperience.K13Ecommerce" SourceId="622B0A21-4664-42CB-A7B7-31553B56F249" Name="Kentico.Xperience.K13Ecommerce" TargetId="C30A7837-2BD6-4B0E-996D-2A2B9167173F" />
<Reference Identifier="622B0A21-4664-42CB-A7B7-31553B56F249/r:Kentico.Xperience.Ecommerce.Common" SourceId="622B0A21-4664-42CB-A7B7-31553B56F249" Name="Kentico.Xperience.Ecommerce.Common" TargetId="96B93007-AB51-4A1C-A36D-1C014AD1F608" />
</ArchitectureGraph>
Loading
Loading