You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2024. It is now read-only.
[](https://diconium.com/en/news/adobe-io-hybris)
4
+
# 3rd-Party GraphQL integration with AEM Commerce and CIF on Adobe I/O Runtime
4
5
5
6
## Introduction
6
7
7
8
The [CIF (Commerce Integration Framework) GraphQL connector](https://github.com/adobe/commerce-cif-connector) and the [AEM CIF Core Components](https://github.com/adobe/aem-core-cif-components) offer authoring and frontend integration between AEM (Adobe Experience Manager) and Magento. This integration is based on the [Magento GraphQL API](https://devdocs.magento.com/guides/v2.3/graphql/index.html) which offers a very flexible and efficient integration point between AEM and Magento.
8
9
9
-
In order to support other 3rd-party "non-Magento" commerce platforms, this project demonstrates how a 3rd-party commerce platform like Hybris can be integrated with the CIF GraphQL connector and the AEM CIF Core Components via the Magento GraphQL API. Note that the integration is currently based on the GraphQL API of Magento 2.4.2.
10
+
In order to support other 3rd-party "non-Magento" commerce platforms, this project implements an example "reference" implementation that demonstrates how a 3rd-party commerce platform can be integrated with the CIF GraphQL connector and the AEM CIF Core Components via the Magento GraphQL API. Note that the integration is currently based on the GraphQL API of Magento 2.3.2.
10
11
11
-
This enables customers to reuse our existing connector and components in their project by simply exposing the Magento GraphQL API on top of a 3rd-party commerce platform like Hybris. To offer maximum flexibility and scalability, this "adaptation layer" is deployed on the serverless [Adobe I/O Runtime](https://www.adobe.io/apis/experienceplatform/runtime.html) platform.
12
+
This enables customers to reuse our existing connector and components in their project by simply exposing the Magento GraphQL API on top of any 3rd-party commerce platform. To offer maximum flexibility and scalability, this "adaptation layer" is deployed on the serverless [Adobe I/O Runtime](https://www.adobe.io/apis/experienceplatform/runtime.html) platform.
12
13
13
14
## Getting Started
14
15
15
16
### Project structure
16
17
17
18
This project is organized around [GraphQL resolvers](https://graphql.org/learn/execution/#root-fields-resolvers). Each resolver is either "local" or "remote". A "local" resolver is deployed and executed in the main Adobe I/O action that processes incoming GraphQL requests: we call this action the `dispatcher`. In contrast, a "remote" resolver is deployed as a separate Adobe I/O Runtime action which is referenced in the dispatcher action configuration and integrated via [schema delegation](https://www.apollographql.com/docs/graphql-tools/schema-delegation/).
18
19
19
-
All code is organized in the `cif` folder. In this implementation, all the resolvers are remote resolvers.
20
+
All code is organized in the `src` folder.
20
21
21
22
```
22
-
cif
23
+
src
23
24
├── common
25
+
├── local
24
26
├── dispatcher
25
-
├── cart
26
-
├── src
27
-
├── test
28
-
├── customer
29
-
├── order
30
-
├── product
31
-
├── category
32
-
├── resources
33
-
├── utils
27
+
├── remote
28
+
├── cartResolver
34
29
```
35
30
36
31
The `common` folder contains all the code that fetches and converts 3rd-party data into the GraphQL format. These classes can be used either by the local dispatcher action or by remote resolvers.
@@ -51,7 +46,7 @@ This second diagram illustrates how a GraphQL query is being executed. The `cart
@@ -62,36 +57,14 @@ Make sure you have the following tools installed:
62
57
63
58
OpenWhisk CLI must be available in your systems PATH and set up correctly to either use a local OpenWhisk installation or an Adobe I/O account. Try `wsk --help` to make sure it is working.
64
59
65
-
### Configuration
66
-
To be able to use this CIF connector you will need to provid some Hybris configurations to connect to your Hybris endpoint.
67
-
Under [cif/common/options.yml.example](cif/common/options.yml.example) you will find an example yml file you should use as an example.
You should copy the example file to an options.yml file under the same path, this will be the real file that will have your configurations.
84
-
This file is under .gitignore and should not be commited to the repository since it has client secrets.
85
-
86
-
87
60
### Build & Deployment
88
61
89
62
To install all the npm dependencies, and then execute all the unit tests, simply run:
90
63
```
91
64
$ npm install
92
65
$ npm test
93
66
```
94
-
67
+
```
95
68
To deploy the actions on the Adobe I/O Runtime platform, we use the [serverless](https://serverless.com/framework/docs/providers/openwhisk/) framework. The deployment of independent packages and actions is defined in each package `serverless.yml` file. To deploy everything individually, simply run:
96
69
```
97
70
$ npm run deploy-packages
@@ -100,14 +73,29 @@ $ npm run deploy-packages
100
73
To deploy the actions on the Adobe I/O Runtime platform, we use the [serverless](https://serverless.com/framework/docs/providers/openwhisk/) framework. The deployment of packages and actions is defined in the `serverless.yml` file. To deploy everything, simply run:
101
74
```
102
75
$ npm run deploy
103
-
```
104
76
105
-
This will deploy the `hybris-graphql/dispatcher` and all other actions like cart, oder etc in your namespace (Complete list in serverless.yml file). The dispatcher is a web action that is accessible with the URL `https://adobeioruntime.net/api/v1/web/NAMESPACE/graphql-reference/dispatcher`. To test the GraphQL endpoint, you can for example use the `GraphiQL` plugin in the Chrome browser.
77
+
78
+
This will deploy the `graphql-reference/dispatcher` and `graphql-reference/cart` actions in your namespace. The dispatcher is a web action that is accessible with the URL `https://adobeioruntime.net/api/v1/web/NAMESPACE/graphql-reference/dispatcher`. To test the GraphQL endpoint, you can for example use the `GraphiQL` plugin in the Chrome browser.
79
+
80
+
Post deployment
81
+
82
+
1. Install Latest venia aem-cif-guides-venia.all-2022.02.24-classic.zip for classic AEM or cloud.
83
+
2. Build and Install Latest CIF 2.6.0 on AEM with build package core-cif-components-all-2.6.0 in your package manager
84
+
3. Include the connector server URL in cif configuration with required server details.
85
+
4. Please refer https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/content-and-commerce/home.html for more details on configuration.
86
+
87
+
## Developing a real 3rd-party integration
88
+
89
+
This repository provides a reference implementation that can be used as a starting point to develop a real integration with a 3rd-party commerce system. In order to implement a real integration, one will have to:
90
+
* modify all the `*Loader.js` classes so that they would fetch data via the 3rd-party commerce system (the loaders currently return some "dummy" example data)
91
+
* modify all the `__convertData` conversion methods in the data classes, to convert the data from the 3rd-party system into Magento GraphQL objects
92
+
* modify and extend the `getter` methods in the data classes, to support all the fields not covered by the example integration
93
+
* introduce new local and/or remote resolvers, to incrementally support more fields of the Magento GraphQL API
106
94
107
95
### Contributing
108
96
109
97
Contributions are welcomed! Read the [Contributing Guide](.github/CONTRIBUTING.md) for more information.
110
98
111
99
### Licensing
112
100
113
-
This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information.
101
+
This project is licensed under the Apache V2 License. See [LICENSE](LICENSE) for more information.
0 commit comments