Class OrderService
- Namespace
- Dynamicweb.Ecommerce.Orders
- Assembly
- Dynamicweb.Ecommerce.dll
The OrderService class providing methods for querying and saving The Order aggregate to and from persistence.
- Inheritance
-
Order
Service
- Implements
- Inherited Members
Constructors
OrderService()
Methods
CalculateDiscounts(Order)
Calculates the discounts for this Order.
If Dynamicweb.false
or if Calculate is false
, discounts will not be calculated.
Parameters
order
OrderThe Order.
CalculateDiscounts(Order, bool)
Calculates the discounts for this Order.
If Dynamicweb.false
or if Calculate is false
, discounts will not be calculated.
Parameters
CalculatePaymentFee(Order, string)
Calculates payment fee for an order given a payment method id
Parameters
Returns
CalculateShippingFee(Order, string)
Calculates shipping fees for an order given a shipping method id
Parameters
Returns
CanRegisterNewRma(Order)
Indicates if this order allows new RMAs to be registered.
Parameters
order
OrderThe order
Returns
Capture(Order)
Performs capture on the order and stores the resulting OrderCaptureInfo on the order.
Parameters
order
OrderThe Order.
Returns
- Order
Capture Info The generated Order
Capture object, or null if capture is not supported.Info
Capture(Order, long, bool)
Performs capture on the order and stores the resulting OrderCaptureInfo on the order.
Parameters
order
OrderThe Order.
amount
longThe amount that is multiplied by 100.
final
boolThe capture is final.
Returns
- Order
Capture Info The generated Order
Capture object, or null if capture is not supported.Info
ClearCache()
Resets all keys to the default value for objects stored in the object cache
ClearCache(IEnumerable<string>)
Resets the specified keys to the default value for objects stored in the object cache
Parameters
keys
IEnumerable<string>Keys to reset
ClearCache(string)
Resets the specified key to the default value for objects stored in the object cache
Parameters
key
stringKey to reset
ClearCachedPrices(Order)
Clears the cached prices.
Parameters
order
OrderThe Order.
Complete(Order)
Sets the order complete state to true.
Parameters
order
OrderThe Order.
Delete(string)
Deletes the order.
Parameters
orderId
stringThe Order ID.
DowngradeToCart(Order)
Converts the order back to cart.
Parameters
order
OrderThe Order.
DowngradeToCart(Order, bool)
Converts the order back to cart.
Parameters
FindOrders(string, string, string, string, bool, string)
Finds the orders by parameters.
public IEnumerable<Order> FindOrders(string keyword, string stateId, string startdate, string enddate, bool showCart, string shopId)
Parameters
keyword
stringThe search keyword.
stateId
stringThe state ID.
startdate
stringThe search interval start date. Field used for search is OrderDate.
enddate
stringThe search interval end date. Field used for search is OrderDate.
showCart
boolThe value indicating whether the carts should be included in results or not.
shopId
stringThe shop ID.
Returns
- IEnumerable<Order>
The collection of the Order.
ForcePriceRecalculation(Order)
Forces the recalculation of the Price.
Parameters
order
OrderThe Order.
GetAll()
Gets all orders in solution.
Returns
- IEnumerable<Order>
The collection of the Order.
GetAllVersions(string)
Gets all versions for the order.
Parameters
orderId
stringThe Order ID.
Returns
- IEnumerable<Order>
The collection of the Order.
GetByAutoId(int)
Gets the order by auto ID.
Parameters
orderAutoId
intThe Auto ID.
Returns
GetById(string)
Gets the order by ID.
Parameters
orderId
stringThe Order ID.
Returns
GetBySecret(string)
Gets the order by secret.
Parameters
secret
stringThe order secret.
Returns
GetCartFormName(string)
Gets the name of the cart form.
Parameters
orderId
stringThe Cart ID.
Returns
- string
"CartForm_[ID]"
GetCompletedOrders(int, string, string)
Gets the compleated orders.
Parameters
customerId
intThe customer ID. Set to 0 to skip this argument.
customerNumber
stringThe customer number. Set to "" to skip this argument.
shopIds
stringThe shop IDs. Set to "" to skip this argument.
Returns
- IEnumerable<Order>
The collection of the Order.
GetCustomerOrdersByType(int, string, OrderType, int, bool, string, DateTime)
Gets customer's orders of specified type.
public IEnumerable<Order> GetCustomerOrdersByType(int customerId, string shopIds, OrderType orderType, int recurringOrderId, bool useCustomerNumber, string orderContextIds, DateTime fromDate)
Parameters
customerId
intThe User ID.
shopIds
stringThe Shops IDs.
orderType
OrderType The Order
Type .recurringOrderId
intThe ID of the recerring order.
useCustomerNumber
boolIf set to
true
, search by customer number, otherwise search by customer ID.orderContextIds
stringThe order context IDs.
fromDate
DateTime
Returns
- IEnumerable<Order>
The collection of the Order.
GetCustomerOrdersByType(int, string, OrderType, int, bool, string, DateTime, bool)
Gets customer's orders of specified type.
public IEnumerable<Order> GetCustomerOrdersByType(int customerId, string shopIds, OrderType orderType, int recurringOrderId, bool useCustomerNumber, string orderContextIds, DateTime fromDate, bool includeImpersonation)
Parameters
customerId
intThe User ID.
shopIds
stringThe Shops IDs.
orderType
OrderType The Order
Type .recurringOrderId
intThe ID of the recerring order.
useCustomerNumber
boolIf set to
true
, search by customer number, otherwise search by customer ID.orderContextIds
stringThe order context IDs.
fromDate
DateTime includeImpersonation
boolThe orders will be retrieved for user considering users he can impersonate.
Returns
- IEnumerable<Order>
The collection of the Order.
Remarks
The parameter "useCustomerNumber" doesn't work when IncludeImpersonation is set to true
GetCustomerOrdersByType(int, string, OrderType, int, bool, string, DateTime, bool, bool)
Gets customer's orders of specified type.
public IEnumerable<Order> GetCustomerOrdersByType(int customerId, string shopIds, OrderType orderType, int recurringOrderId, bool useCustomerNumber, string orderContextIds, DateTime fromDate, bool includeImpersonation, bool isCart)
Parameters
customerId
intThe User ID.
shopIds
stringThe Shops IDs.
orderType
OrderType The Order
Type .recurringOrderId
intThe ID of the recerring order.
useCustomerNumber
boolIf set to
true
, search by customer number, otherwise search by customer ID.orderContextIds
stringThe order context IDs.
fromDate
DateTime includeImpersonation
boolThe orders will be retrieved for user considering users he can impersonate.
isCart
boolIf set to
true
, search orders in cart state.
Returns
- IEnumerable<Order>
The collection of the Order.
Remarks
The parameter "useCustomerNumber" doesn't work when IncludeImpersonation is set to true
GetCustomerOrdersByType(int, string, OrderType, int, bool, string, DateTime, bool, bool, bool)
Gets customer's orders of specified type.
public IEnumerable<Order> GetCustomerOrdersByType(int customerId, string shopIds, OrderType orderType, int recurringOrderId, bool useCustomerNumber, string orderContextIds, DateTime fromDate, bool includeImpersonation, bool isCart, bool includeUserAndSecondaryUserIds)
Parameters
customerId
intThe User ID.
shopIds
stringThe Shops IDs.
orderType
OrderType The Order
Type .recurringOrderId
intThe ID of the recerring order.
useCustomerNumber
boolIf set to
true
, search by customer number, otherwise search by customer ID.orderContextIds
stringThe order context IDs.
fromDate
DateTime includeImpersonation
boolThe orders will be retrieved for user considering users he can impersonate.
isCart
boolIf set to
true
, search orders in cart state.includeUserAndSecondaryUserIds
boolThe orders will be retrieved for user while impersonating.
Returns
- IEnumerable<Order>
The collection of the Order.
Remarks
The parameter "useCustomerNumber" doesn't work when IncludeImpersonation is set to true
GetCustomerUnclosedOrders(int)
Gets unclosed orders of customer.
Parameters
customerId
intThe User ID.
Returns
- IEnumerable<Order>
The collection of the Order.
GetLastFailedRecurringOrderId(int)
Gets the last failed recurring order ID.
Parameters
recurringOrderId
intThe recurring order ID.
Returns
- string
The Order ID.
GetOrderForCurrentUser(string)
Gets the order for current user.
Parameters
orderId
stringThe order identifier.
Returns
GetOrderForCurrentUser(string, bool)
Gets the order for current user.
Parameters
Returns
GetOrdersByIds(IEnumerable<string>)
Gets the orders by IDs
Parameters
ids
IEnumerable<string>The ids of orders
Returns
- IEnumerable<Order>
The collection of the Order.
GetOrdersBySearch(OrderSearchFilter)
Gets orders by search settings
Parameters
filter
OrderSearch Filter Search filter
Returns
GetPreviousOrderIds(int)
Gets the previous recurring orders IDs.
Parameters
recurringOrderId
intThe recurring order ID.
Returns
- IEnumerable<string>
The collection of the order IDs.
GetProductOrderLines(Order)
Gets an Order
Parameters
order
Order
Returns
Remarks
The function returns order lines of type: Product, Fixed, Point
GetPropertyType(Order, string)
Gets the property type.
Parameters
Returns
- string
The property type.
GetPropertyValue(Order, string)
Gets the property value.
Parameters
Returns
- object
The property value.
GetTopOrders(int)
Gets the specified number of the top Orders, ordered by creation date (descending), then by order ID (descending).
Parameters
count
intThe count of Orders.
Returns
- IEnumerable<Order>
The collection of the Order.
GetTotalPurchasesByCustomerId(int, DateTime, Currency)
Gets the total purchase price by customer ID.
public PriceInfo GetTotalPurchasesByCustomerId(int customerId, DateTime fromDate, Currency priceCurrency)
Parameters
customerId
intThe User ID.
fromDate
DateTime The search interval start date. Field used for search is OrderDate.
priceCurrency
CurrencyThe Currency.
Returns
IsComplete(string)
Gets the value determines whether the order is completed or not.
Parameters
orderId
stringThe Order ID.
Returns
MarkOrderAsDeleted(Order)
Marks the Order as deleted and set deleted order state if it exists.
Parameters
order
OrderThe Order.
Remarks
If order has related Recurring
RemoveNoneActiveProducts(Order)
Removes all orderlines that is of type Product and that no longer exist in the database. Also removes products according to the control panel settings: Active, on stock, price is zero.
Parameters
order
OrderThe Order.
RemoveOrderCache(string)
Removes order and its order lines from cache.
Parameters
orderId
stringThe Order ID.
Save(Order)
Saves the order.
Parameters
order
OrderThe order.
Save(Order, bool)
Saves the order.
Parameters
SaveGatewayResult(Order)
Saves the gateway result.
Parameters
order
OrderThe Order.
SendEmail(Order, ref PageView, string, IEnumerable<string>, string, string, ref Template)
Sends the mail to the specified addresses.
public bool SendEmail(Order order, ref PageView pageView, string subject, IEnumerable<string> toMailAddresses, string fromMailAddress, string fromMailName, ref Template mailTemplate)
Parameters
order
OrderThe Order.
pageView
PageView The page view.
subject
stringThe subject.
toMailAddresses
IEnumerable<string>The recipients email addresses.
fromMailAddress
stringThe sender email address.
fromMailName
stringThe sender name.
mailTemplate
TemplateThe templpate.
Returns
- bool
true
if mail was successfully sent, otherwisefalse
.
SendEmail(Order, ref PageView, string, string, string, string, ref Template)
Sends the mail to the specified address.
public bool SendEmail(Order order, ref PageView pageView, string subject, string toMailAddress, string fromMailAddress, string fromMailName, ref Template mailTemplate)
Parameters
order
OrderThe Order.
pageView
PageView The page view.
subject
stringThe subject.
toMailAddress
stringThe recipient email address.
fromMailAddress
stringThe sender email address.
fromMailName
stringThe sender name.
mailTemplate
TemplateThe templpate.
Returns
- bool
true
if mail was successfully sent, otherwisefalse
.
SetDefaultState(Order)
Set default state for the order, cart or quote.
Parameters
order
OrderThe Order.
SetUserDetailsOnOrder(Order, User, bool)
Parameters
UpdateCartState(Order, string)
Updates the cart state.
Parameters
UpdateCartToOrder(Order)
Updates the cart to order.
Parameters
order
OrderThe Order.
UpdateCartToOrder(Order, bool)
Parameters
UpdateCartToQuote(Order)
Updates the cart to quote.
Parameters
order
OrderThe Order.
UpdateGatewayResult(Order, bool)
Updates the gateway result.
Parameters
order
OrderThe Order.
setComplete
boolIf set to
true
, the Order complete state will be also set totrue
.
UpdateOrderId(Order, string)
Updates the Order ID.
Parameters
UpdateQuoteState(Order, string)
Updates the quote state.
Parameters
UpdateVat(Order, double)
Updates the order VAT.
Parameters
UpdateVat(Order, double, double)
Updates the order VAT.
Parameters
order
OrderThe Order.
newVat
doubleThe new VAT value.
newVatPercent
doubleThe new VAT percent value.
ValidatePricesInDatabase(Order, ref double, ref double, ref double)
Validates the prices in database.
public bool ValidatePricesInDatabase(Order order, ref double orderPrice, ref double orderlinePrice, ref double priceDifference)
Parameters
order
OrderThe Order.
orderPrice
doubleSets the order price if prices are invalid.
orderlinePrice
doubleSets the order lines price if prices are invalid.
priceDifference
doubleSets the price difference if prices are invalid.
Returns
- bool
true
if prices are valid, otherwisefalse
.