David Shao Lin Zhuo

NAME

Google::Checkout::General::MerchantItem

SYNOPSIS

  use Google::Checkout::General::GCO;
  use Google::Checkout::General::ShoppingCart;
  use Google::Checkout::General::MerchantItem;
  use Google::Checkout::General::Util qw/is_gco_error/;

  my $checkout_flow = Google::Checkout::General::MerchantCheckoutFlow->new(
                      shipping_method       => [$method],
                      edit_cart_url         => "http://edit/cart/url",
                      continue_shopping_url => "http://continue/shopping/url",
                      buyer_phone           => "1-111-111-1111",
                      tax_table             => [$table1, $table2],
                      merchant_calculation  => $merchant_calculation);

  my $cart = Google::Checkout::General::ShoppingCart->new(
             expiration    => "+1 month",
             private       => "Private data",
             checkout_flow => $checkout_flow);

  my $item1 = Google::Checkout::General::MerchantItem->new(
              name               => "Test item 1",
              description        => "Test description 1",
              price              => 12.34,
              quantity           => 12,
              private            => "Item #1",
              tax_table_selector => "item");


  $cart->add_item($item1);

  my $response = Google::Checkout::General::GCO->new->checkout($cart);

  die $response if is_gco_error($response);

  #--
  #-- redirect URL
  #--
  print $response,"\n";

DESCRIPTION

This is the main class for constructing merchant items which buyer will buy and checkout.

new HASH

Constructor. The following arguments are required (if any one of them is missing, a Google::Checkout::General::Error object is returned instead): NAME, name of the merchant item; DESCRIPTION, a description of the merchant item; PRICE, price; QUANTITY, quantity to order. The following arguments are optional: PRIVATE, private data provided by the merchant; TAX_TABLE_SELECTOR, name of the tax table used to calculate tax for this merchant item.

get_name

Returns the name of the merchant item.

set_name NAME

Sets the name of the merchant item.

get_description

Returns the description of the merchant item.

set_description DESCRIPTION

sets the description of the merchant item.

get_price

Returns the price of the merchant item.

set_price PRICE

Sets the price of the merchant item.

get_quantity

Returns the quantity.

set_quantity QUANTITY

Sets the quantity.

get_private

Returns the private data. This mothod returns the private data in an array reference.

add_private PRIVATE_DATA

Adds another piece of private data.

get_tax_table_selector

Returns the name of the tax table selector.

set_tax_table_selector SELECTOR

Sets the tax table to be used for this merchant item.

get_merchant_item_id

Returns the merchant item id

set_merchant_item_id ID

Sets the merchant item id

COPYRIGHT

Copyright 2006 Google. All rights reserved.

SEE ALSO

Google::Checkout::General::Error