Step by Step to create orders by consuming SAP Commerce Cloud Restful API
Recently Jerry is working on an integration project about creating orders in Wechat platform by consuming SAP Commerce Cloud Restful API.
Consultants who didn't touch SAP Commerce before(such as Jerry ) might get confused once they saw the search result by key word "commerce" in https://help.sap.com:
Several products with similar name are listed in search result.
SAP Commerce:SAP commerce solution based on On-Premises deployment approach
SAP Commerce Cloud on SAP Infrastructure & SAP Commerce Cloud on Public Cloud: as their names give a very clear hint: both are SAP Commerce solution based on cloud, and differentiated by the underlying cloud infrastructure the solution are running. SAP Commerce Cloud on SAP Infrastructure are sometimes called Commerce Cloud Version One and CCV1 for short, while the latter called CCV2.
There is a nice blog Two clouds in practice: a comparison of SAP Commerce Cloud v1 and v2in medium comparing both.
Back to my task, it's helpful if we play around in Commerce Cloud storefront UI to create a order manually to get ourselves familar with the process.
Log in to storefront and browse the site:
And identify a favourite product and add it to cart by pressing button "ADD TO CART":
Press CHECK OUT to proceed:
Now we get a cart ID:
Maintain shipping address:
Maintain payment details:
Once Place Order button is clicked, the order is successfully created with an automatically populated order ID:
In summary, the process of order manual creation in SAP Commerce Cloud consists of five steps:
(1) create a Shopping Cart
(2) add products into the cart
(3) maintain shipping address to the cart
(4) maintain payment details to the cart
(5) execution place order action on the cart to get order created
Now we should figure out for each step, what exactly APIs should be called.
Go to https://api.sap.com, search by keyword "Commerce Cloud", and it's easy to find the supported API list there.
Jerry has written a simple nodejs application to demonstrate how to consume such APIs to create orders in SAP Commerce Cloud. The whole source code is uploaded to my github.
Execute the application, and we can observe the successflly created order with its ID in callback function in line 20:
Search the ID in Commerce Cloud backoffice UI to check the details of created order.
As introduced before, it's necessary to go through five steps to have an order generated. And in Jerry's project there are totally seven "step.js" implementation files, why?
For the additional two step.js, one is for access token retrieve and the other for cart delivery mode set operation. Access token will be appended to the header fields of all the subsequent API calls for authorization purpose. And the cart delivery mode will be set implicitly if performed in storefront UI via browser whereas an explicit API call is necessary in our case. As a result totally seven HTTP roundtrip is needed in API consumption case.
The access token fetch is implemented by following OAuth protocol: send the OAuth Client ID and secret to SAP Commerce Cloud OAuth endpoint to get the issued access token.
First we have to create a new OAuth Client in SAP Commerce Cloud backoffice:
Then in file "step1_get_token.js", send a HTTP POST to Commerce Cloud Authentication endpoint to request access token:
For privacy reason I didn't upload urlconfig.js to github which contains the dedicated url of my own Commerce Cloud API endpoint. Instead I upload the template file: urlconfigTemplate.js. Just replace the place holder marked with "<>" with your actual value there, rename the template file back to urlconfig.js. After that you can create orders in your own Commerce Cloud tenant.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
Step by Step to create orders by consuming SAP Commerce Cloud Restful API的更多相关文章
- Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1)
Step by Step Process of Migrating non-CDBs and PDBs Using ASM for File Storage (Doc ID 1576755.1) AP ...
- [转]Bootstrap 3.0.0 with ASP.NET Web Forms – Step by Step – Without NuGet Package
本文转自:http://www.mytecbits.com/microsoft/dot-net/bootstrap-3-0-0-with-asp-net-web-forms In my earlier ...
- Step by step Process of creating APD
Step by step Process of creating APD: Business Scenario: Here we are going to create an APD on top o ...
- Tomcat Clustering - A Step By Step Guide --转载
Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...
- [ZZ] Understanding 3D rendering step by step with 3DMark11 - BeHardware >> Graphics cards
http://www.behardware.com/art/lire/845/ --> Understanding 3D rendering step by step with 3DMark11 ...
- Step by Step Recipe for Securing Kafka with Kerberos
Short Description: Step by Step Recipe for Securing Kafka with Kerberos. Article I found it is a lit ...
- PyTorch in Action: A Step by Step Tutorial
PyTorch in Action: A Step by Step Tutorial PyTorch in Action: A Step by Step Tutorial Installation ...
- 课程五(Sequence Models),第一 周(Recurrent Neural Networks) —— 1.Programming assignments:Building a recurrent neural network - step by step
Building your Recurrent Neural Network - Step by Step Welcome to Course 5's first assignment! In thi ...
- 课程四(Convolutional Neural Networks),第一周(Foundations of Convolutional Neural Networks) —— 2.Programming assignments:Convolutional Model: step by step
Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignme ...
随机推荐
- Android NFC M1卡读写&芯片卡读写(CPU卡读写)(RFID读写)
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/sgn5200/article/detai ...
- pytorch保证每次运行使用的随机数都相同的方法
其实在代码的开头添加下面几句话即可: # 保证训练时获取的随机数都是一样的 init_seed = torch.manual_seed(init_seed) torch.cuda.manual_see ...
- C# Newtonsoft.Json解析json字符串处理 - JToken 用法
//*调用服务器API(获取可以处理的文件) //1.使用JSON通信协议(调用[待化验任务API]) String retData = null; { JToken json = JToken.Pa ...
- Oracle:Pivot 转多列并包含多个名称
SELECT * FROM (SELECT l.DISTRIBUTOR_ID, d.SKU_CODE, d.WH_CODE, d.ORDER_PACKAGES, d.PRICE, d.YEARLY|| ...
- ubuntu中cmake版本升级
在网上下载一个项目,编译提示版本太低 CMake Error at CMakeLists.txt: (cmake_minimum_required): CMake 编译方式安装(需要openssl) ...
- JavaScript和Jquery个人笔记
目录 前言 价格 * 数量 = 金额 js计算时间差值 判断敲回车或Shift+回车 js控制textarea换行 $(this)选择当前元素 前端调试禁止其他js js添加a标签href属性和文本 ...
- C#易失域、锁的分享,多线程
C#多线程.易失域.锁的分享 一.多线程 windows系统是一个多线程的操作系统.一个程序至少有一个进程,一个进程至少有一个线程.进程是线程的容器,一个C#客户端程序开始于一个单独的线程,CLR(公 ...
- 八、spring生命周期之BeanPostProcessor
BeanPostProcessor我们一般称为Bean的后置处理器,它与我们前面介绍的InitialingBean.init-method等一样,都是在bean的初始化时被调用,具体的用法我们在举例中 ...
- 8、1 周末总结+Mongdb
都说加一个Id 注解就行了,其实还要加一条数据测试表是否生成 这里我们探讨 数据库是谁,表是谁 数据库在mongo启动的时候就指定了,这个无需我们关心 表根据实体类自动生成, 1.pom.xml & ...
- [gRPC] 在 .NET Core 中创建 gRPC 服务端和客户端
gRPC 官网:https://grpc.io/ 1. 创建服务端 1.1 基于 ASP.NET Core Web 应用程序模板创建 gRPC Server 项目. 1.2 编译并运行 2. 创建客户 ...