SAPコマースクラウドRESTfulなAPIを消費して注文を作成するためのステップバイステップ

最近、ジェリーは、SAPコマースクラウドRESTfulなAPIを消費することによって微信プラットフォームでオーダーを作成する方法について統合プロジェクトに取り組んでいます。

彼らはhttps://help.sap.comでキーワード「コマース」で、検索結果を見た後に(例えばジェリーなど)の前にSAPコマースには触れませんでしたコンサルタントが混乱し得る可能性があります:

clipboard1,1

似た名前を持ついくつかの製品は、検索結果に表示されます。

  • SAPコマース:オンプレミス展開アプローチに基づくSAPコマースソリューション

  • パブリック・クラウド上のSAPインフラ・SAPコマースクラウド上のSAPコマースクラウド:自分の名前は非常に明確なヒントを与えるよう:SAPコマースソリューションは、クラウドに基づいて、その溶液が実行されている基盤となるクラウドインフラストラクチャによって区別されている両方。後者はCCV2と呼ばれる一方、SAPインフラストラクチャ上のSAPコマースクラウドは時々、略しコマースクラウドバージョンOneとCCV1と呼ばれています。

素敵なブログがあります実際には二つの雲:SAPコマースクラウドv1とv2の比較媒体中では、両方を比較します。

clipboard2,2

我々はプロセスと自分自身が慣れ得るために手動でオーダーを作成するコマースクラウド店頭UIで遊ぶ場合は戻って私のタスクに、それは便利です。

店頭やサイトを閲覧するにはログインします。
clipboard3,3

そして、好きな物を識別し、ボタンを押して、カートに追加「買い物かごに入れます」:

clipboard4,4

押して続行するためにチェックアウト:

clipboard5,5

Now we get a cart ID:

clipboard6,6

Maintain shipping address:

clipboard7,7

Maintain payment details:

clipboard8,8

Once Place Order button is clicked, the order is successfully created with an automatically populated order ID:

clipboard9,9

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.

clipboard10,10

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:

clipboard11,11

Search the ID in Commerce Cloud backoffice UI to check the details of created order.

clipboard12,12
clipboard13,13

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.

clipboard14,14

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:

clipboard15,15

Then in file "step1_get_token.js", send a HTTP POST to Commerce Cloud Authentication endpoint to request access token:

clipboard16,16

プライバシーの理由から私は自分コマースクラウドAPIエンドポイントの専用URLが含まれていますgithubのにurlconfig.jsをアップロードしませんでした。urlconfigTemplate.js:代わりに、私は、テンプレートファイルをアップロードします。ただ、そこにあなたの実際の値に付いたプレースホルダを「<>」置き換え、バックurlconfig.jsにテンプレートファイルの名前を変更します。その後は独自のコマースクラウドテナントでオーダーを作成することができます。

clipboard17,17

もっとジェリーの元の記事については、公共の番号「王Zixi」に注意を払ってください。
いいえ公共のスクリーンショットありません

おすすめ

転載: www.cnblogs.com/sap-jerry/p/11790996.html