[ECOMMERCE-269] Implement cart, checkout for Salesforce Commerce Created: 02/Mar/20  Updated: 19/Mar/20  Resolved: 17/Mar/20

Status: Closed
Project: E-commerce
Component/s: None
Affects Version/s: None
Fix Version/s: 1.1

Type: Story Priority: Neutral
Reporter: Chuong Doan Huy Assignee: Chuong Doan Huy
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0d
Time Spent: 5d 0.5h
Original Estimate: Not Specified

Attachments: File localhost-salesforce-commerce.postman_collection.json    
Issue Links:
Cloners
clones ECOMMERCE-261 Integration to Salesforce Commerce Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Documentation update required:
Yes
Date of First Response:
Epic Link: Ecom. Further connectors
Sprint: Add-Ons 28, Add-Ons 31, Add-Ons 33
Story Points: 8

 Description   

Implement checkout for SF Comm. for both logged in and anonymous users



 Comments   
Comment by Chuong Doan Huy [ 13/Mar/20 ]

Hi jlegendre,

Here is the reference how cart and checkout process work in case you need to document:

(Request Url, Type, params format...can be found detailed in attached file. Below i only list noteworthy params)

A. For anonymous user :

  1. Prepare guest token (call to Salesforce Commerce sandbox, Magnolia not supporting this) :
    Request : (see detailed information in attached Postman collection)
  • Query param : client_id (get from sandbox : Administration -> Open Commerce API Settings)
    Response :
  • In the response header, you can see one of the item is Authorization and value is "Bearer xyzabc", xyzabc is your token (exclude "Bearer")
  1. Create anonymous cart (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : userId : input your guest token above
    Response :
  • Bunch of information about your card, looking for "basket_id" value, it's your cartId which use a lot later
  1. Add items to cart (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Body param (form-data) : cartId : input your cartId above
  • Body param (form-data) : productId : input your productId you want to add to your cart
    Response :
    - Bunch of information about your card, looking for "product_items" to see if your added product present
  1. Set billing address for anonymous user (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Path param : cartId : input your cartId here
  • Body param (json) : your firstname, lastname, country...
    Response :
    - Bunch of information about your card, looking for "billing_address" to see if your billing address present
  1. Set shipping address and method (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Path param : cartId : input your cartId here
  • Body param (json) : your shipping address and shipping method
    Response :
    - Bunch of information about your card, looking for "shipments" to see if your shipping address and shipping method present
  1. Set payment method and create order (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Path param : cartId : input your cartId here
  • Body param (json) : your payment method
    Response :
    - Bunch of information about your created order, check to see if they are correct

B. For logged in user :

  1. Prepare logged in token (call to Salesforce Commerce sandbox, Magnolia not supporting this) :
    Request : (see detailed information in attached Postman collection)
  • Query param : client_id (get from sandbox : Administration -> Open Commerce API Settings
  • Credentials param : Credentials are passed as HTTP Basic in base 64 in the form username:password (Postman : Authorization -> Basic Auth -> enter username and password)
    Response :
  • In the response header, you can see one of the item is Authorization and value is "Bearer xyzabc", xyzabc is your token (exclude "Bearer")
  1. Create cart (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : userId : input your token above
    Response :
  • Bunch of information about your card, looking for "basket_id" value, it's your cartId which use a lot later
  1. Add items to cart (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your token here
  • Body param (form-data) : cartId : input your cartId above
  • Body param (form-data) : productId : input your productId you want to add to your cart
    Response :
    - Bunch of information about your card, looking for "product_items" to see if your added product present
  1. Set existing addressId of logged in user (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Path param : cartId : input your cartId here
  • Body param (json) : addressId : addressId of logged in user (in sandbox -> Merchant Tools -> Customers -> choose one customer -> open "Addresses" tab)
  • Body param (json) : same_as_billing : flag value 1 (true) or 0 (false) indicate this address can be used as billing address as well
    Response :
    - Bunch of information about your card, looking for "billing_address" to see if your billing address present
  1. Set shipping method (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Path param : cartId : input your cartId here
  • Body param (json) : your shipping methodId (no need shipping address as user already had address)
    Response :
    - Bunch of information about your card, looking for "shipments" to see if your shipping address and shipping method present
  1. Set payment method and create order (call to Magnolia instance) :
    Request : (see detailed information in attached Postman collection)
  • Header param : accessToken : input your guest token here
  • Path param : cartId : input your cartId here
  • Body param (json) : your payment method
    Response :
    - Bunch of information about your created order, check to see if they are correct

If you have any questions, feel free to ping me, thanks

 

Comment by Julie Legendre [ 16/Mar/20 ]

Hi chuong.doan, thank you for the detailed info. I'll cover this in ECOMMERCE-267 :bow:

Generated at Mon Feb 12 01:42:26 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.