Interface IOrderService
Service for reading and creating orders.
Namespace: DirectScale.Disco.Extension.Services
Assembly: DirectScale.Disco.Extension.Abstractions.dll
Syntax
public interface IOrderService
Methods
CancelOrder(Int32)
Voids orderNumber
.
Declaration
Task CancelOrder(int orderNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | orderNumber | Order to cancel. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
System.Exception | If it is too late to cancel this order. |
System.NullReferenceException | If the order is not found. |
FinalizeAcceptedOrder(Order)
Indicates existing order
has completed successfully. It's volume will now count towards commissions and items will now be shipped.
Declaration
Task FinalizeAcceptedOrder(Order order)
Parameters
Type | Name | Description |
---|---|---|
Order | order | The completed order. OrderNumber must already exist. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
This method will never need to be called directly for normal operations. Instead use SubmitOrder(NewOrderDetail, NewPayment[]). If this method is called, FinalizeOrderPaymentStatus(OrderPaymentStatusUpdate) should also be called to mark payments as paid. One case where this method might need to be called, is if an external merchant needs to mark orders as paid and complated.
FinalizeNonAcceptedOrder(Order)
Indiates that an existing order
has completed unsuccessfully. It will now be visible as a declined order.
Declaration
Task FinalizeNonAcceptedOrder(Order order)
Parameters
Type | Name | Description |
---|---|---|
Order | order | The completed order. OrderNumber must already exist. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
This method will never need to be called directly for normal operations. Instead use SubmitOrder(NewOrderDetail, NewPayment[]). If this method is called, FinalizeOrderPaymentStatus(OrderPaymentStatusUpdate) should also be called to set the payment result. One case where this method might need to be called, is if an external merchant needs to mark orders as declined.
FinalizeOrderPaymentStatus(OrderPaymentStatusUpdate)
Updates the result of a specific OrderPaymentId to the values in orderPaymentStatusUpdate
.
Declaration
Task<PaymentResponse> FinalizeOrderPaymentStatus(OrderPaymentStatusUpdate orderPaymentStatusUpdate)
Parameters
Type | Name | Description |
---|---|---|
OrderPaymentStatusUpdate | orderPaymentStatusUpdate |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PaymentResponse> | Newly updated payment result. |
Remarks
orderPaymentStatusUpdate
's OrderPaymentId must already exist. Use InsertOrderPayment(PaymentResponse) instead to insert a new payment result.
This method will not normally need to be called directly. Payments will be created when <xref href="DirectScale.Disco.Extension.Services.IOrderService.SubmitOrder(DirectScale.Disco.Extension.NewOrderDetail%2cDirectScale.Disco.Extension.NewPayment%5b%5d)" data-throw-if-not-resolved="false"></xref> is called.
GetAssociatesOrdersByModifiedDate(Int32, DateTime, DateTime)
Get all of associateId
's orders which have been updated between begin
and end
dates.
Declaration
Task<Order[]> GetAssociatesOrdersByModifiedDate(int associateId, DateTime begin, DateTime end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate to get orders for. |
System.DateTime | begin | Begin date for of orders. |
System.DateTime | end | End date for of orders. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Order[]> | Array of orders found. |
See Also
GetAssociatesOrdersByOrderDate(Int32, DateTime, DateTime)
Get all of associateId
's orders place between begin
and end
dates.
Declaration
Task<Order[]> GetAssociatesOrdersByOrderDate(int associateId, DateTime begin, DateTime end)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate to get orders for. |
System.DateTime | begin | Begin date for of orders. |
System.DateTime | end | End date for of orders. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Order[]> | Array of orders found. |
See Also
GetOrderByOrderNumber(Int32)
Gets the order details for the requested orderNumber
.
Declaration
Task<Order> GetOrderByOrderNumber(int orderNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | orderNumber | The order to look up. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Order> | The order with |
Remarks
Orders will be sorted by order date from oldest to newest.
See Also
GetOrders(Int32[])
Gets the order details for the requested orderNumbers
.
Declaration
Task<Order[]> GetOrders(int[] orderNumbers)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | orderNumbers | Array of order numbers to look up. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Order[]> | Array of orders found. |
Remarks
Orders will be sorted by order date from oldest to newest.
See Also
GetOrdersByAssociateId(Int32, String)
Get all of the orders associateId
made.
Declaration
Task<Order[]> GetOrdersByAssociateId(int associateId, string filter)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | associateId | Associate to get orders for. |
System.String | filter | Optional. Provide a string to find orders with |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Order[]> | Array of orders found. |
Remarks
Does not include Void orders. The other get order methods return void orders.
See Also
GetOrdersWSort(Int32[], String)
Gets the order details for the requested orderNumbers
.
Declaration
Task<Order[]> GetOrdersWSort(int[] orderNumbers, string sort)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | orderNumbers | Array of order numbers to look up. |
System.String | sort | Orders will be sorted by order date, value should be either "ASC" or "DESC". |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<Order[]> | Array of orders found. |
Remarks
The other get order methods sort by "ASC" (oldest to newest).
See Also
GetPackageDetail(Int32)
Read the values for a specific package record.
Declaration
Task<ShipPackage> GetPackageDetail(int packageId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | packageId | The package recordnumber. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<ShipPackage> |
GetTotals(LineItem[], Int32, String, Int32, Address, String[], OrderType, Int32)
Prior to creating an order, this method can be called to calculate how much the order will cost. For example, on a checkout page.
Declaration
Task<OrderTotal[]> GetTotals(LineItem[] lineItems, int associateId, string currencyCode, int shipMethodId, Address shipAddress, string[] couponCodes, OrderType orderType, int warehouseId)
Parameters
Type | Name | Description |
---|---|---|
LineItem[] | lineItems | The items being purchased. |
System.Int32 | associateId | The associate checking out. |
System.String | currencyCode | The currency code. See ICurrencyService for more information. |
System.Int32 | shipMethodId | The shipping method selected. |
Address | shipAddress | The shipping address. |
System.String[] | couponCodes | The coupons applied to cart. |
OrderType | orderType | The type of order being placed. |
System.Int32 | warehouseId | The warehouse that will be used. Optional, will be supplied by |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<OrderTotal[]> | The detailed order totals. Normally this will be a single element array. In some weird cases there will be one OrderTotal for each currency being used. |
GetTotalsWithOverrides(LineItem[], Int32, String, Int32, Address, String[], OrderType, Int32, ShippingTaxOverride)
Same as GetTotals(LineItem[], Int32, String, Int32, Address, String[], OrderType, Int32), but can calculate the totals with manual values set for tax and/or shipping shipTaxOverride
.
Declaration
Task<OrderTotal[]> GetTotalsWithOverrides(LineItem[] lineItems, int associateId, string currencyCode, int shipMethodId, Address shipAddress, string[] couponCodes, OrderType orderType, int warehouseId, ShippingTaxOverride shipTaxOverride)
Parameters
Type | Name | Description |
---|---|---|
LineItem[] | lineItems | |
System.Int32 | associateId | |
System.String | currencyCode | |
System.Int32 | shipMethodId | |
Address | shipAddress | |
System.String[] | couponCodes | |
OrderType | orderType | |
System.Int32 | warehouseId | |
ShippingTaxOverride | shipTaxOverride | Gives the ab
Used to manually set shipping or tax costs. If the other method is called, shipping is calculated from |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<OrderTotal[]> |
See Also
GetUnshippedPackages(Int32, String)
Find all the packages that still need to be shipped from warehouseId
Declaration
Task<OrderPackage[]> GetUnshippedPackages(int warehouseId, string search)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | warehouseId | The warehouse shipping packages. |
System.String | search | Optional. Limit packages to only ones containing |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<OrderPackage[]> | Found unshipped packages. |
InsertOrderPayment(PaymentResponse)
Manually insert a new payment for an order.
Declaration
Task<int> InsertOrderPayment(PaymentResponse paymentResponse)
Parameters
Type | Name | Description |
---|---|---|
PaymentResponse | paymentResponse | The details of the payment. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Int32> | A new OrderPaymentId. |
Remarks
This method will not normally be called directly. Payments will be created when SubmitOrder(NewOrderDetail, NewPayment[]) is called.
IsMoveOrderPermitted(Order)
Indicates if the order
is not locked and can be moved by the current user.
Declaration
Task<MoveOrderPermission> IsMoveOrderPermitted(Order order)
Parameters
Type | Name | Description |
---|---|---|
Order | order | The order to move. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<MoveOrderPermission> |
Remarks
Currently will always return false, unless MoveOrder hook is hooked.
IsOrderLocked(Int32)
Indicates if orderNumber
is locked for editing.
Declaration
Task<bool> IsOrderLocked(int orderNumber)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | orderNumber | The order to check. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | True if the order is locked and cannot be changed. |
See Also
Log(Int32, String)
Add a log message
to orderNumber
.
Declaration
Task Log(int orderNumber, string message)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | orderNumber | The order to add notes to. |
System.String | message | The notes to add. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
These are visible on the corporate order page.
PayOrder(Int32, Int32, String, NewPayment[])
Attempt to charge the associate for an existing orderNumber
. SubmitOrder(NewOrderDetail, NewPayment[]) for new orders.
Declaration
Task<PaymentResponse> PayOrder(int orderNumber, int shipMethodId, string languageCode, NewPayment[] payments)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | orderNumber | The order being paid. |
System.Int32 | shipMethodId | Unused. |
System.String | languageCode | Unused. |
NewPayment[] | payments | The payment details, how the associate is paying. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PaymentResponse> | Charge results. |
Remarks
This will also complete the order by calling FinalizeOrderPaymentStatus(OrderPaymentStatusUpdate) then either FinalizeAcceptedOrder(Order) or FinalizeNonAcceptedOrder(Order) internally.
See Also
RefundPayment(Int32, Refund[])
Give the associate back their money for orderNumber
.
Declaration
Task RefundPayment(int orderNumber, Refund[] refunds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | orderNumber | The order to refund. |
Refund[] | refunds | Where to send the money |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Remarks
If the full amount of the order is refunded, then the commission engine will undo the order. If money has been paid out for this order, then a clawback will be initiated for those funds. If the order is still within an open period, then it's volume will no longer be counted.
SubmitOrder(NewOrderDetail, NewPayment[])
Validates, records, and processes a new order
with payments
.
Declaration
Task<PaymentResponse> SubmitOrder(NewOrderDetail order, NewPayment[] payments)
Parameters
Type | Name | Description |
---|---|---|
NewOrderDetail | order | The new order submitted. |
NewPayment[] | payments | The associate's payment to charge. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<PaymentResponse> | Order result. |
Remarks
Triggers the full order process. Calls PayOrder(Int32, Int32, String, NewPayment[]) internally.
UpdateOrder(UpdateOrderInfo)
Updates OrderNumber with all the values from order
.
Declaration
Task UpdateOrder(UpdateOrderInfo order)
Parameters
Type | Name | Description |
---|---|---|
UpdateOrderInfo | order | The order and information to update. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
See Also
UpdateOrders(UpdateOrderInfo[])
Updates multiple OrderNumbers with all the values from orders
.
Declaration
Task UpdateOrders(UpdateOrderInfo[] order)
Parameters
Type | Name | Description |
---|---|---|
UpdateOrderInfo[] | order | The orders and their update information. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
See Also
UpdateOrderTotal(OrderTotal)
Update the total
record in DB. Id must be an existing OrderTotal record.
Declaration
Task UpdateOrderTotal(OrderTotal total)
Parameters
Type | Name | Description |
---|---|---|
OrderTotal | total | The OrderTotal record to update. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
UpdatePackage(Int32, Int32, Int32, Address)
Update the packageId
record in DB. packageId
must be an existing package record.
Declaration
Task UpdatePackage(int packageId, int warehouseId, int shipMethodId, Address address)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | packageId | The package recordnumber to update. |
System.Int32 | warehouseId | The new warehouseId. |
System.Int32 | shipMethodId | The new ship method id. |
Address | address | The new address, if not null. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |