Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

/var/sites/help-site.com/auto/tmp/CPAN/9677/Google-Checkout-1.1.1/lib/Google/Checkout/General/GCO.pm

/var/sites/help-site.com/auto/tmp/CPAN/9677/Google-Checkout-1.1.1/lib/Google/Checkout/General/GCO.pm


NAME

Google::Checkout::General::GCO


VERSION

Version 1.1.1


SYNOPSIS


  use Google::Checkout::General::GCO;

  use Google::Checkout::General::MerchantItem;

  use Google::Checkout::Command::CancelOrder;

  use Google::Checkout::General::Util qw/is_gco_error/;

  my $gco = Google::Checkout::General::GCO->new(

            config_path => 'conf/GCOSystemGlobal.conf');

  #--

  #-- Or you can pass in the merchant id, key and Checkout URL like this

  #--

  $gco = Google::Checkout::General::GCO->new(

         merchant_id  => 1234,

         merchant_key => 'abcd',

         gco_server   => 'https://sandbox.google.com/...');

  my $cart = Google::Checkout::General::ShoppingCart->new(

             expiration    => "+1 month",

             private       => "Merchant private data",

             checkout_flow => $checkout_flow);

  my $item1 = Google::Checkout::General::MerchantItem->new(

              name        => "Fish",

              description => "A fish",

              price       => 12.34,

              quantity    => 12,

              private     => "gold");

  $cart->add_item($item1);

  #--

  #-- Checkout a cart

  #--

  my $response = $gco->checkout($cart);

    or

  my ($response,$requestXML) = $gco->checkout_with_xml($cart);

  die $response if is_gco_error $response;

  #--

  #-- print the redirect URL

  #--

  print $response,"\n";

  #--

  #-- Send a cancel order command

  #--

  my $cancel = Google::Checkout::Command::CancelOrder->new(

               order_number => 156310171628413,

               amount       => 5,

               reason       => "Cancel order");

  $response = $gco->command($cancel);

  die $response if is_gco_error $response;

  print $response,"\n";


DESCRIPTION

This is the main module for interacting with the Google Checkout system. It allows a user to checkout, send various commands and process notifications.

new CONFIG_PATH => ..., MERCHANT_ID => ..., MERCHANT_KEY => ..., GCO_SERVER => ...
Constructor. Loads the configuration file from CONFIG_PATH. If no configuration file is specified, merchant id, key and Checkout server URL must be specified.

reader
Returns the configuration reader used to parse and load the configuration file.

get_checkout_url
Returns the Google Checkout URL defined in the configuration file.

get_checkout_diagnose_url
Returns the diagnose Google Checkout URL defined in the configuration file.

get_request_url
Returns the URL where requests will be sent to.

get_request_diagnose_url
Same as get_request_url except this function returns the diagnose version of it.

b64_signature XML_CART
Given a shopping cart (in XML), returns the HMAC-SHA1 / Base64 signature of it.

b64_xml_cart XML_CART
Given a shopping cart (in XML), encode and return it in Base64.

get_xml_and_signature CART
Given a Google::Checkout::General::ShoppingCart object CART, return the Base64 encoding signature and XML cart. The return value is a hash reference where 'xml' is the XML cart (Base64 encoded) and 'signature' is the Base64 encoding signature.

checkout CART, DIAGNOSE
Sends the shopping cart (Google::Checkout::General::ShoppingCart object) to Google Checkout. If DIAGNOSE is true, the cart will be sent as a diagnose request.

checkout_with_xml CART, DIAGNOSE
Sends the shopping cart (Google::Checkout::General::ShoppingCart object) to Google Checkout. If DIAGNOSE is true, the cart will be sent as a diagnose request. This method returns both the result and the xml request that was sent to Google Checkout.

raw_checkout XML, DIAGNOSE
Treat XML as a shopping cart and attempt to checkout it. If DIAGNOSE is true, the XML will be sent as a diagnose request. This method is actually used by checkout.

command COMMAND, DIAGNOSE
Sends a command to Google Checkout. COMMAND should be one of Google::Checkout::Command::GCOCommand's sub-class. If DIAGNOSE is true, the command will be sent as a diagnose request.

send_notification_response
After you receive a notification, you are expected to send back a response knowledging the notification is properly handled. This method can be used to ensure a valid response is send back to Google Checkout. Since we are communicating over HTTP, this function will return a 200 header first.

send_merchant_calculation CALCULATIONS
This function is similar to send_notification_response except it's used to send back a response after a merchant calculation callback. CALCULATIONS should be an array reference of Google::Checkout::General::MerchantCalculationResult.

send HASH
A generic function to send request to Google Checkout. Please note that it's not recommanded that you use this function directly. checkout, command, send_notification_response, etc should be all you need to interact with the Google Checkout system.


COPYRIGHT

Copyright 2006 Google. All rights reserved.

Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy