Wt  4.10.4
Public Member Functions | List of all members
Wt::Payment::Order Class Reference

Contains information of a sales order. More...

#include <Wt/Payment/Order.h>

Public Member Functions

void setTax (const Money &tax)
 Sets sales taxes. More...
 
Money tax () const
 Returns sales taxes. More...
 
void setShipping (const Money &shipping)
 Sets shipping cost. More...
 
Money shipping () const
 Returns the shipping cost. More...
 
void setHandling (const Money &handling)
 Sets handling cost. More...
 
Money handling () const
 Returns handeling. More...
 
void setShippingDiscount (const Money &discount)
 Sets the shipping discount. More...
 
Money shippingDiscount () const
 Returns the shipping discount. More...
 
void setShippingInsurance (const Money &insurance)
 Sets shipping insurance. More...
 
Money shippingInsurance () const
 Returns shipping insurance. More...
 
void setPaymentTransactionId (const std::string &transactionId)
 Sets a payment transaction ID. More...
 
std::string paymentTransactionId () const
 Returns the payment transaction ID. More...
 
void setPaymentBroker (const std::string &broker)
 Sets the payment broker. More...
 
std::string paymentBroker () const
 Returns the payment broker. More...
 
void setDescription (const std::string description)
 Sets the order description. More...
 
std::string description () const
 Returns the order description. More...
 
const std::vector< OrderItem > & items () const
 Returns all items in the order. More...
 
std::vector< OrderItem > & items ()
 Returns all items in the order. More...
 
Money computeTotalItemCost () const
 Computes the total net cost of all items. More...
 
void setTotalItemCost (const Money &totalItemCost)
 Sets the total net cost of all items. More...
 
Money totalItemCost () const
 Returns the total item cost. More...
 
Money computeTotalOrderCost () const
 Computes the total cost of the order. More...
 
void setTotalOrderCost (const Money &totalOrderCost)
 Sets the total order cost. More...
 
Money totalOrderCost () const
 Returns the total order cost.
 

Detailed Description

Contains information of a sales order.

Usage example:

item1.setName("Waffle Maker");
item1.setNumber("00001");
item1.setDescription("Emweb FlipSide Belgian Waffle Maker");
item1.setQuantity(1);
item1.setUnitCost(Wt::Payment::Money(49, 99, "USD"));
order.items().push_back(item1);
order.setShipping(Wt::Payment::Money(7, 1, "USD"));
order.setTax(Wt::Payment::Money(500, 99, "USD"));
A value class which describes a monetary value.
Definition: Money.h:27
Describes an item in an order.
Definition: OrderItem.h:46
void setNumber(const std::string &number)
Sets the item number.
Definition: OrderItem.C:11
void setDescription(const WString &description)
Sets the item description.
Definition: OrderItem.C:16
void setQuantity(double quantity)
Sets the item quantity.
Definition: OrderItem.C:21
void setUnitCost(const Money &unitCost)
Changes the item unit cost field.
Definition: OrderItem.C:26
void setName(const WString &name)
Sets the item name.
Definition: OrderItem.C:6
Contains information of a sales order.
Definition: Order.h:41
void setShippingDiscount(const Money &discount)
Sets the shipping discount.
Definition: Order.C:21
void setTax(const Money &tax)
Sets sales taxes.
Definition: Order.C:6
const std::vector< OrderItem > & items() const
Returns all items in the order.
Definition: Order.h:165
void setShipping(const Money &shipping)
Sets shipping cost.
Definition: Order.C:11
void setShippingInsurance(const Money &insurance)
Sets shipping insurance.
Definition: Order.C:26

Member Function Documentation

◆ computeTotalItemCost()

Money Wt::Payment::Order::computeTotalItemCost ( ) const

Computes the total net cost of all items.

This computes the total item cost based on the list of items() in this order. This does not include tax, shipping, shippingDiscount, shippingInsurance and handling fees.

See also
items(), setTotalItemCost()

◆ computeTotalOrderCost()

Money Wt::Payment::Order::computeTotalOrderCost ( ) const

Computes the total cost of the order.

Computes the total of totalItemCost(), tax(), shipping(), handling(), shippinDiscount() and shippingInsurance().

See also
setTotalOrderCost()

◆ description()

std::string Wt::Payment::Order::description ( ) const

Returns the order description.

See also
setDescription()

◆ handling()

Money Wt::Payment::Order::handling ( ) const

Returns handeling.

See also
setHandling()

◆ items() [1/2]

std::vector<OrderItem>& Wt::Payment::Order::items ( )

Returns all items in the order.

See also
OrderItem

◆ items() [2/2]

const std::vector<OrderItem>& Wt::Payment::Order::items ( ) const

Returns all items in the order.

See also
OrderItem

◆ paymentBroker()

std::string Wt::Payment::Order::paymentBroker ( ) const

Returns the payment broker.

See also
setPaymentBroker()

◆ paymentTransactionId()

std::string Wt::Payment::Order::paymentTransactionId ( ) const

Returns the payment transaction ID.

See also
setPaymentTransactionId()

◆ setDescription()

void Wt::Payment::Order::setDescription ( const std::string  description)

Sets the order description.

Sets a description for the total order.

◆ setHandling()

void Wt::Payment::Order::setHandling ( const Money handling)

Sets handling cost.

This is the total cost for handling.

The default value is 0.

◆ setPaymentBroker()

void Wt::Payment::Order::setPaymentBroker ( const std::string &  broker)

Sets the payment broker.

This identifies the payment broker that was used to provide payment for this order. This is usually set together with a payment transaction ID by the payment broker during the payment process.

See also
setPaymentTransactionId()

◆ setPaymentTransactionId()

void Wt::Payment::Order::setPaymentTransactionId ( const std::string &  transactionId)

Sets a payment transaction ID.

This transaction identification number provides tracability of the payment, and is usually set by the payment broker during the payment process.

See also
setPaymentBroker()

◆ setShipping()

void Wt::Payment::Order::setShipping ( const Money shipping)

Sets shipping cost.

This is the total shipping cost for the order, excluding discounts and insurance.

The default value is 0.

See also
setShippingInsurance(), setShippingDiscount()

◆ setShippingDiscount()

void Wt::Payment::Order::setShippingDiscount ( const Money discount)

Sets the shipping discount.

The shipping order discount (which should be a negative number).

The default value is 0.

◆ setShippingInsurance()

void Wt::Payment::Order::setShippingInsurance ( const Money insurance)

Sets shipping insurance.

The total order shipping insurance cost.

The default value is 0.

◆ setTax()

void Wt::Payment::Order::setTax ( const Money tax)

Sets sales taxes.

This is the total amount of taxes for the order.

The default value is 0 (your government may not like that !).

◆ setTotalItemCost()

void Wt::Payment::Order::setTotalItemCost ( const Money totalItemCost)

Sets the total net cost of all items.

This sets the total item cost. This does not include tax, shipping, shippingDiscount, shippingInsurance and handling fees.

If you have specified the individual items, then you can use computeTotalItemCost() to set the computed value.

◆ setTotalOrderCost()

void Wt::Payment::Order::setTotalOrderCost ( const Money totalOrderCost)

Sets the total order cost.

This sets the total order cost. If you have specified the total item cost, and suitable values for tax, shipping and handling, then you can use computeTotalOrderCost() to set the computed value.

◆ shipping()

Money Wt::Payment::Order::shipping ( ) const

Returns the shipping cost.

See also
setShipping()

◆ shippingDiscount()

Money Wt::Payment::Order::shippingDiscount ( ) const

Returns the shipping discount.

See also
setShippingDiscount()

◆ shippingInsurance()

Money Wt::Payment::Order::shippingInsurance ( ) const

Returns shipping insurance.

See also
setShippingInsurance()

◆ tax()

Money Wt::Payment::Order::tax ( ) const

Returns sales taxes.

See also
setTax()

◆ totalItemCost()

Money Wt::Payment::Order::totalItemCost ( ) const

Returns the total item cost.

See also
setTotalItemCost()