This repository contains a sample POSTMAN collection that you can leverage to understand how the Salesforce Order Management endpoints are working, and can be used to operate with your Salesforce Order Management instance.
In order to start with this collection, please follow these steps:
- Download POSTMAN from the official website and installed it
- Once installed, open POSTMAN
- Once opened, import the collection and the environment from this repository to your POSTMAN workspace
- Once imported, open the
Salesforce Order Management
environment, and modify all the data which contain placeholders (like<YOUR-CLIENT-ID-HERE>
) with your details. Please don't modify the values with{{
and}}
, as these values are calculated values within your POSTMAN environment.. The environment also contains sample values that you can use, or modify, as per your needs. - Once the environment is setup, open the
Salesforce Order Management
collection, and start using it.
This POSTMAN collection authenticate with the Salesforce instance by using the OAuth 2.0 Username-Password Flow for Special Scenarios. Please refer to this documentation to understand how this works. As per the documentation, you need to create a Connected App to be able to use this way of authentication.
If you are using this POSTMAN collection against a sandbox, the url
environment variable is https://test.salesforce.com
, else it is https://login.salesforce.com
. You can also use the url of your instance directly, like https://[your-domain].my.salesforce.com
if you set up a domain in the org.
The client_id
and client_secret
environment variables are the Consumer Key
and Consumer secret
values from the created connected app
In order to get them, please do the following steps:
- Go to your instance
- Go to the gear on the top right, and click on
Setup
- In the left sidebar, search for
App Manager
- Open the connected app you created in the beginning of this chapter
- Click on the
copy
button to copy theConsumer key
and use it as theclient_id
environment variable - Click on the
Click to reveal
andcopy
button to copy theConsumer secret
and use it as theclient_secret
environment variable
As this POSTMAN collection uses the OAuth 2.0 Username-Password Flow for Special Scenarios
, it requires your username, password and security token.
Please use the username you use to authenticate against the org as the username
environment variable, and your password as the password
environment variable.
As said in the previous section, this collection uses the OAuth 2.0 Username-Password Flow for Special Scenarios
. This requires you to generate a security token, and use it as the security_token
environment variable.
In order to generate it, please do the following steps:
- Go to your instance
- Click on your use avatar on the top right and click on
Settings
- In the left sidebar, click on
Reset My Security Token
- Click on the
Reset My Security Token
button. This will email you with the security token
This collection contains use-case based sub-collections. The collection is divided into multiple main components. Basically, the first component is the collection and instance setup, and others contain the use cases.
Within these use-case based folders, you'll find a sub-collection per use case, which contains the list of endpoints which need to be used to perform the desired operation and validate that the operation worked.
All endpoints contain unit tests, which allows the collection to ensure:
✅ The endpoints respond with the correct data/behavior based on the use-case
✅ The API is working as expected, by validating the data before/after some operations, to ensure the API is doing what we expect
The order placement use cases are the following:
- One single order insertion
- Account insertion (so each time, a new account is created by default)
- One single order delivery group, along with its order delivery method
- Two products insertion, within the same order delivery group
- No promotions
- One single order insertion
- Reuse the account previously created in the setup
- One single order delivery group, along with its order delivery method
- Reuse the two products previously created in the setup, within the same order delivery group
- No promotions
- One single order insertion
- Reuse the account previously created in the setup
- Two order delivery groups, along with the same order delivery method, but to two different shipping addresses
- Reuse the two products previously created in the setup, within the same order delivery group
- One order-level promotion
- One single order insertion
- Account insertion (so each time, a new account is created by default)
- One single order delivery group, along with its order delivery method
- Two products insertion, within the same order delivery group
- No promotions
- Reserve inventory against the location configured, which need to exist on the org and on OCI
- One single order insertion
- Reuse the account previously created in the setup
- One single order delivery group, along with its order delivery method
- Reuse the two products previously created in the setup, within the same order delivery group
- No promotions
- Reserve inventory against the location configured, which need to exist on the org and on OCI
- Reuses the last inserted order ID, and calls the Salesforce API to create an order summary from it
- It uses the
order_summary_lifecycle
environment variable to either create aMANAGED
orUNMANAGED
order summary
- One single Fulfillment order created for the given order summary
- All order item summaries added to this single fulfillment order
- Uses the first location found that matches the location type
location_type
environment variable
You can leverage this collection in differente ways:
⏭️ By using the POSTMAN Runner, which will run a full use-case directly, by executing each endpoint one-by-one, sequentially, and so report the unit tests results for each executed endpoint.
Here are the already identified items of the todolist:
- Add fulfillment use cases (creation / update / cancel of fulfillment order item)
- Add invoicing use cases (invoice creation)
- Add credit memo use cases (credit memo creation)
- Add discount use cases
- Add cancellation use cases
- Add return use cases
- Add capture use cases (calling
EnsureFunds
) - Add refund use cases (calling
EnsureRefunds
) - Add routing use cases