Wt: Wt::Payment::OrderItem Class Reference

Wt 3.3.0

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

- Class List
- Class Hierarchy
- Class Members

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

Describes an item in an order. More...

`#include <Wt/Payment/OrderItem>`

List of all members.

## Public Member Functions
void | setName (const WString &name)
| Sets the item name.
const WString & | name () const
| Returns item name.
void | setNumber (const std::string &number)
| Sets the item number.
std::string | number () const
| Returns item number.
void | setDescription (const WString &description)
| Sets the item description.
const WString & | description () const
| Returns the item description.
void | setQuantity (double quantity)
| Sets the item quantity.
double | quantity () const
| Returns the item quantity.
void | setUnitCost (const Money &unitCost)
| Changes the item unit cost field.
Money | unitCost () const
| Returns item unit cost.
Money | computeTotal () const
| Returns the total cost for this order item.

## Detailed Description

Describes an item in an 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"));

See also:
  Order

## Member Function Documentation

Money Wt::Payment::OrderItem::computeTotal | ( |  | ) | const

Returns the total cost for this order item.

This returns quantity() * unitCost()

const WString& Wt::Payment::OrderItem::description | ( |  | ) | const

Returns the item description.

See also:
  setDescription()

const WString& Wt::Payment::OrderItem::name | ( |  | ) | const

Returns item name.

See also:
  setName()

std::string Wt::Payment::OrderItem::number | ( |  | ) | const

Returns item number.

See also:
  setNumber()

double Wt::Payment::OrderItem::quantity | ( |  | ) | const

Returns the item quantity.

See also:
  setQuantity()

void Wt::Payment::OrderItem::setQuantity | ( | double | quantity | ) |

Sets the item quantity.

This is either an integer quantity (number of items) or a fractional quantity (e.g. 1.5 times 1 kilogram).

The total price for this item in the order will be the quantity() times the unitCost().

void Wt::Payment::OrderItem::setUnitCost | ( | const Money & | unitCost | ) |

Changes the item unit cost field.

This is the unit cost.

Money Wt::Payment::OrderItem::unitCost | ( |  | ) | const

Returns item unit cost.

See also:
  setUnitCost()

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator