How to Coordinate Updates to Orders
If multiple sites or applications can access the Orders database at the same time, there is a chance that orders could be corrupted. Commerce Server Core Systems lets you control concurrent access to the orders database by defining which applications can modify an order. Additionally, you can provide a list of statuses, and Commerce Server Core Systems will only allow an application to modify an order if the order’s status is in the list.
To enable Commerce Server Core Systems to manage concurrent access to the Orders database, you must perform the following actions:
Specify the valid order status values.
Indicate that Commerce Server Core Systems should control access to the orders database.
Specify the status for a newly created order.
Update the table that identifies which applications can modify an order, and which statuses indicate that an order can be modified.
To Specify the Valid Order Status Values
Add the valid status values to the AllowedStatus table in the TransactionConfig database.
Commerce Server Core Systems provides the following status values by default:
NewOrder
Submitted
InProcess
Cancelled
Rejected
Shipped
To Indicate that Commerce Server Core Systems Should Control Access to the Orders Database
Add the honorStatus attribute to the orders element in the Web.config file. Set honorStatus to true to enable Commerce Server Core Systems to control when orders can be modified.
<orders honorStatus=”true”>
To Specify the Status for a Newly Created Order
Add the newOrderStatus attribute to the orders element in the Web.config file. Set newOrderStatus to the status that Commerce Server Core Systems should use when it creates a new order.
Note
The value of newOrderStatus must be one of the valid status values that you defined in the AllowedStatus table.
<orders honorStatus=”true” newOrderStatus=”NewOrder”>
To Create a Table that Identifies Which Applications Can Modify an Order and Which Statuses Indicate that an Order Can Be Modified
Add the allowed combinations of application and status to the StatusManager table in the TransactionConfig database. When an application uses one of the data management APIs to modify an order, Commerce Server Core Systems checks that the application’s ID and the order’s status are in the StatusManager table before permitting the modification.
The following table lists the default applications and statuses that Commerce Server Core Systems provides.
ApplicationID |
FromStatus |
Description |
---|---|---|
Site |
NewOrder |
Site can modify new orders |
LOB Adapter |
NewOrder |
Line-of-business (LOB) adapters can modify new orders |
LOB Adapter |
Submitted |
LOB adapters can modify orders that have been submitted |
LOB Adapter |
InProcess |
LOB adapters can modify orders that are being processed |
Note
The ApplicationID is a user-defined string that you provide as an argument to the data management APIs.
Note
The FromStatus value must be one of the valid status values that you defined in the AllowedStatus table.
Note
If you enable Commerce Server Core Systems to control access to the Orders database, you must use the overloaded Save method instead of the Save method.