Google::Checkout::Notification::NewOrder
use Google::Checkout::General::GCO;
use Google::Checkout::Notification::NewOrder;
use Google::Checkout::General::Util qw/is_gco_error/;
my $xml = "/xml/new_order_notification.xml";
#--
#-- $xml can either be a file or a complete XML doc string
#--
my $new_order = Google::Checkout::Notification::NewOrder->new(xml => $xml);
die $new_order if is_gco_error $new_order;
my $items = $new_order->get_items();
for my $item (@$items)
{
print $item->get_merchant_item_id,"\n",
$item->get_name,"\n",
$item->get_description,"\n",
$item->get_price,"\n",
$item->get_quantity,"\n";
}
Sub-class of
"Google::Checkout::Notification::GCONotification".
When a new order notification is received, this module can be used to extract
various information about the new order.
- new XML => ...
- Constructor. Takes either a XML file or XML doc as data string. If the XML
is invalid (syntax error for example),
"Google::Checkout::General::Error" is
returned.
- type
- Always return
"Google::Checkout::XML::Constants::NEW_ORDER_NOTIFICATION".
- get_order_total
- Returns the total of the order.
- get_buyer_id
- Returns the buyer ID.
- get_fulfillment_state
- Returns the fulfillment state. Since this is a new order, this will most
likely be 'NEW'.
- get_financial_state
- Returns the financial state. Since this is a new order, this will most
likely be 'REVIEWING'.
- marketing_email_allowed
- Returns the string 'true' if marketing email is allowed. Otherwise,
returns the string 'false'.
- get_buyer_info SHIPPING_OR_BILLING, WHICH_DATA
- Returns various buyer info. SHIPPING_OR_BILLING can either be
"Google::Checkout::XML::Constants::GET_SHIPPING"
or
"Google::Checkout::XML::Constants::GET_BILLING"
to get buyer's shipping or billing data respectively. WHICH_DATA can be
"Google::Checkout::XML::Constants::BUYER_CONTACT_NAME",
"Google::Checkout::XML::Constants::BUYER_COMPANY_NAME",
"Google::Checkout::XML::Constants::BUYER_EMAIL",
"Google::Checkout::XML::Constants::BUYER_PHONE",
"Google::Checkout::XML::Constants::BUYER_FAX",
"Google::Checkout::XML::Constants::BUYER_ADDRESS1",
"Google::Checkout::XML::Constants::BUYER_ADDRESS2",
"Google::Checkout::XML::Constants::BUYER_CITY",
"Google::Checkout::XML::Constants::BUYER_REGION",
"Google::Checkout::XML::Constants::BUYER_POSTAL_CODE",
"Google::Checkout::XML::Constants::BUYER_COUNTRY_CODE".
- merchant_calculation_successful
- Returns the string 'true' is merchant calculation is successful. Returns
the string 'false' otherwise.
- get_total_tax
- Returns the total tax applied to the new order.
- get_adjustment_total
- Returns the adjustment total.
- get_gift_certificate_calculated_amount
- Returns the gift certificate calculated amount.
- get_gift_certificate_applied_amount
- Returns the amount actually applied from using the gift certificate.
- get_gift_certificate_code
- Returns the gift certificate code.
- get_gift_certificate_pin
- Returns the gift certificate PIN.
- get_gift_certificate_message
- Returns the gift certificate message.
- get_coupon_calculated_amount
- Returns the coupon calculated amount.
- get_coupon_applied_amount
- Returns the amount actually applied from using the coupon.
- get_coupon_code
- Returns the coupon code.
- get_coupon_message
- Returns the coupon message.
- get_shipping_method
- Returns the shipping method. If no shipping method is found, returns
"Google::Checkout::General::Error"
instead.
- get_shipping_name
- Returns the shipping name.
- get_shipping_cost
- Returns the shipping cost.
- get_cart_expiration
- Returns the expiration date of the shopping cart.
- get_merchant_private_data
- Returns the merchant private data.
- get_items
- Returns all items in the order. The items are returned as an array
reference with each element a
"Google::Checkout::General::MerchantItem"
object.
Copyright 2006 Google. All rights reserved.
Google::Checkout::Notification::GCONotification