NAME

Amazon::MWS::XML::Order

DESCRIPTION

Class to handle the xml structures returned by ListOrders and ListOrderItems.

The constructor is meant to be called by Amazon::MWS::Uploader when get_orders is called. A list of objects of this class will be returned.

SYNOPSIS

my $order = Amazon::MWS::XML::Order->new(order => $struct, orderline => \@struct);
my @items = $order->items;
print $order->order_number, $order->amazon_order_number;

ACCESSORS

They should be passed to the constructor and are complex structures parsed from the output of Amazon::MWS::Client.

order

It should be the output of ListOrders or GetOrder without the root, e.g. $response-{Orders}->{Order}->[0]>

Field description:

http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_GetOrder.html

orderline

It should be the output of ListOrderItems without the root, like $response-{OrderItems}->{OrderItem}>.

retrieve_orderline_sub

If you want to save API calls, instead of initialize the orderline, you may want to pass a subroutine (which will accept no arguments, so it should be a closure) to the constructor instead, which will be called lazily if the object needs to access the orderline.

order_number

Our order ID.

shipping_address

Shipping address as Amazon::MWS::Client::Address object.

METHODS

They are mostly shortcuts to retrieve the correct information.

amazon_order_number

The Amazon order id.

remote_shop_order_id

Same as amazon_order_number

email

Buyer's email

shipping_address

An Amazon::MWS::XML::Address object with the shipping address.

first_name

Buyer's first name (built lazily using euristics).

last_name

Buyer's last_name (built lazily using euristics)

items

Return a list of Amazon::MWS::XML::OrderlineItem objects with the ordered items.

order_date

Return a DateTime object with th purchase date.

shipping_cost

The total shipping cost, built summing up the shipping cost of each item.

subtotal

The subtotal of the order, built summing up the subtotal of each orderline's item.

number_of_items

Total number of items ordered.

total_cost;

Return OrderTotal.Amount. Throws an exception if it doesn't match shipping_cost + subtotal.

currency

The currency of the order. Looked up in OrderTotal.CurrencyCode.

as_ack_order_hashref

Return an hashref suitable to build an order ack feed.

reported_order_number

If the order was acknowlegded, we should find our order number in this method (read-only, use the order_number setter if you need to ackwnoledge.

order_is_shipped

Return true if the order is marked as shipped by Amazon

order_status

Shortcut to orders' OrderStatus

can_be_imported

Return false if the status is Pending or Canceled.

shop_type

Returns amazon

comments

Returns an empty string.

payment_method

Always returns Amazon

shipping_method

Returns the generic ShipmentServiceLevelCategory (not the ShipServiceLevel which is a non-typed string).

http://docs.developer.amazonservices.com/en_US/orders/2013-09-01/Orders_Datatypes.html

Available values:

Expedited
FreeEconomy
NextDay
SameDay
SecondDay
Scheduled
Standard

Or the empty string if nothing is found.