Wt: Wt::Payment::Order Class Reference

Wt 4.10.4

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

## Detailed Description

Contains information of a sales order.

Usage example:

Wt::Payment::OrderItem item1, item2;
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"));
Wt::Payment::Order order;
order.items().push_back(item1);
order.setShipping(Wt::Payment::Money(7, 1, "USD"));
order.setShippingDiscount(Wt::Payment::Money(-7, 0, "USD"));
order.setShippingInsurance(Wt::Payment::Money(2, 23, "USD"));
order.setTax(Wt::Payment::Money(500, 99, "USD"));
Wt::Payment::Money
A value class which describes a monetary value.
Definition Money.h:27
Wt::Payment::OrderItem
Describes an item in an order.
Definition OrderItem.h:46
Wt::Payment::OrderItem::setNumber
void setNumber(const std::string &number)
Sets the item number.
Wt::Payment::OrderItem::setDescription
void setDescription(const WString &description)
Sets the item description.
Wt::Payment::OrderItem::setQuantity
void setQuantity(double quantity)
Sets the item quantity.
Wt::Payment::OrderItem::setUnitCost
void setUnitCost(const Money &unitCost)
Changes the item unit cost field.
Wt::Payment::OrderItem::setName
void setName(const WString &name)
Sets the item name.
Wt::Payment::Order
Contains information of a sales order.
Definition Order.h:41
Wt::Payment::Order::items
const std::vector< OrderItem > & items() const
Returns all items in the order.
Definition Order.h:165
Wt::Payment::Order::setShippingDiscount
void setShippingDiscount(const Money &discount)
Sets the shipping discount.
Wt::Payment::Order::setTax
void setTax(const Money &tax)
Sets sales taxes.
Wt::Payment::Order::setShipping
void setShipping(const Money &shipping)
Sets shipping cost.
Wt::Payment::Order::setShippingInsurance
void setShippingInsurance(const Money &insurance)
Sets shipping insurance.

## 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()