Wt: Wt::Payment::Order Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::Payment::Order Class Reference
Payment module (Wt::Payment)

Contains information of a sales order. More...

`#include <Wt/Payment/Order>`

List of all members.

## 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"));

## Member Function Documentation

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

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

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

Returns the order description.

See also:
  setDescription()

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

Returns handeling.

See also:
  setHandling()

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

Returns all items in the order.

See also:
  OrderItem

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

Returns all items in the order.

See also:
  OrderItem

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

Returns the payment broker.

See also:
  setPaymentBroker()

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

Returns the payment transaction ID.

See also:
  setPaymentTransactionId()

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

Sets the order description.

Sets a description for the total order.

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

Sets handling cost.

This is the total cost for handling.

The default value is 0.

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

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

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

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.

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

Sets shipping insurance.

The total order shipping insurance cost.

The default value is 0.

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 !).

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.

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.

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

Returns the shipping cost.

See also:
  setShipping()

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

Returns the shipping discount.

See also:
  setShippingDiscount()

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

Returns shipping insurance.

See also:
  setShippingInsurance()

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

Returns sales taxes.

See also:
  setTax()

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

Returns the total item cost.

See also:
  setTotalItemCost()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator