MuleSoft Accelerator for Salesforce Commerce Cloud icon

MuleSoft Accelerator for Salesforce Commerce Cloud

(0 reviews)

Use case 3 - Order creation

Overview

The following use case is covered:

  • Order creation (B2C Commerce -> OMS)

This use case replicates orders placed in B2C Commerce to an external Order Management System (OMS).

  • Scheduled export of orders from B2C Commerce to an SFTP location; the Mule application
    • Polls for files in the SFTP location
    • Extracts orders and creates matching orders in the OMS.

For demonstration purposes this use case uses Apache OFBiz as the backend OMS.

High-level architecture

sfc-b2c-com-order-creation-api-led-architecture.png

Workflow:

  1. B2C Commerce order export job is triggered on a schedule, or manually. Any orders since the last export execution are exported to a file, and sent by SFTP to the configured location.
  2. Mule SFTP Poller detects the order file, parses the order XML data, and publishes it into an Anypoint MQ queue.
  3. An Anypoint MQ listener in the OMS Process API dequeues the orders and transforms them into JSON. A REST call is made to the OMS System API to store the new order. The OMS Process API is vendor agnostic (not tied to any specific OMS product).
  4. OMS System API uses OFBiz APIs to create the following in OFBiz (Note: this release supports Apache OFBiz. Other OMS will need their own system API logic.):

    • The customer and their address (if customer doesn't exist)
    • Credit card information (if it doesn't exist yet)
    • Order, shipping, and payment information
  5. Customer, address, payment/credit-card information (existing records, or newly created by this process) are used to create the order in the OMS. Note: Customer email address is used as customer ID in OFBiz.

  6. Once the order is created, the OMS system API returns the ID of the newly created order to B2C Commerce.

Sequence diagram

sfc-b2c-com-order-creation-seq-diagram.png

Systems involved:

  • Apache OFBiz OMS: Contains information about orders, customers, shipments etc. Apache OFBiz is accessed through a SOAP RPC Style web services API.
  • B2C Commerce: Where the order is placed. Mule interfaces with B2C Commerce via SFTP.
  • SFTP Server: SFTP Server hosted in AWS EC2 instance is used as the SFTP host.

Setup instructions

B2C Commerce configuration

  • Import product catalog from OMS to B2C Commerce (optional, if needed depending on the OMS being used). This page outlines the details
  • Setup B2C Commerce to export orders to an SFTP location. This page details the requirements and steps to set up the scheduled export of orders from B2C Commerce to an XML file for batch processing by the OMS process API.

Mule projects

B2C Commerce components & configurations

Setup sftp export on B2C Commerce to export orders to an sftp site as per these instructions.

OMS components & configurations:

Data Elements (OFBiz)

Element NameData TypeDescription
order_numberStringThe original order number.
customer_idStringCustomer ID, uniquely identifies customers.
order_dateDateReturns the value of attribute 'order date'.
order_statusStringThe order status
product_idStringThe product as part of the order line item.
product_nameStringThe name of the product.

Reviews

TypeCustom
OrganizationMulesoft Inc.
Published by
MuleSoft Solutions
Published onJun 25, 2021
Asset overview

Asset versions for 1.5.x

Asset versions
VersionActions
1.5.1