Sample PHP code for integration of Google Checkout with the merchant site v1.1.2
--------------------------------------------------------------------------
             File structure and function
            ----------------------------

There are two folders and a log file in the top level directory of 
google-checkout-php-sample.

1. "demo" directory:
This contains two files cartdemo.php and responsehandlerdemo.php

  a)cartdemo.php: 
  ---------------
  This file demonstrates the steps required to add items, shipping, taxes and 
  merchant-calculations to the cart before it is posted to the Checkout server. 
  There are three use case functions defined with different settings for 
  shipping and taxes along with different button usages.

  b)responsehandler.php: 
  ----------------------
  This file will be used to handle the notifications, callbacks and order 
  processing steps. 
  The path for this file must be specified in the merchant's API callback 
  URL in Settings->Integration of the merchant's seller account.
  This file can be used as is and modified by the merchant as per their 
  business workflow details. 
  Some of the intial steps performed in this file include collecting the 
  XML response, request that has been received and get a parsed result in a 
  PHP associative array for easy accesibility
  (For details of parse output refer xmlparser.php which has an 
   example of how an XML maps to the object).
  Order processing can be done using the SendProcessOrder(..) type of
  methods provided in googleresponse.php. Some sample order processing
  command invocations have been provided as comments in the code 
   

2. "library" directory:
This contains the classes defined to describe the API structure so as to easily 
define and add XML entries by defining objects of these classes.

  a) googlecart.php: 
  ------------------
  This is the main class which must be instantiated to post a cart. 
  It requires a merchant ID, Key, which server is to be used for the transactions 
  (Sandbox or Production), and currency. 
  It also has methods to add items, shipping options, tax options and 
  merchant-calculation details.

  b) googleitem.php: 
  ------------------
  This class is instantiated for every item to be added to the cart. 
  It requires the item name, description, price and quantity to be specified.

  c) googleshipping.php: 
  ----------------------
  These classes are used for shipping methods that will be added to the cart. 
  It requires the shipping name and price to be specified. 
  Other methods allow specification of the shipping restrictions.

  d) googletax.php:
  ---------------------
  These classes are used to define tax rules for the tax tables. These may be 
  rules for default or alternate tax tables. Methods have been provided to add 
  country codes and postal areas.

  e) googleresponse.php:
  ----------------------
  An instance of this class is created in the responsehandlerdemo.php.
  This again requires the merchant ID and merchant Key to be specified.
  There are methods provided to send all the different order processing
  commands. 
  All notifications are parsed and the merchant can take required action 
  when a particular notification is received. 

  f) googleresult.php:
  --------------------
  This class is used for merchant-calculations and is invoked for 
  each result in the merchant-calculations-result sent from the 
  merchant in response to a callback.
  
  g) googlemerchantcalculations.php:
  ----------------------------------
  In order to process merchant calculations, an instance of this
  class is created. It is used to aggregate merchant results and 
  respond with the XML response for the callback.    

  h) "xml-processing" directory:
  ------------------------------

    i) xmlbuilder.php:
    -----------------
    This class generates XML and consists of "push" and "pop"
    methods to add open and close tags respectively.
    This is used internally by the library classes to generate
    XML file for posting carts.

    ii)xmlparser.php:
    -----------------
    This class parses XML documents using the SAX parser and is
    compatible with PHP v4 and 5. It converts them to DOM form
    returning the XML data in a PHP associative array.    
    This is used internally by the library classes to parse
    XML requests and responses that are received from the 
    Checkout server.

3. googlemessage.log:
The log file records all the notification and order processing commands that are 
sent and received and can be useful information for debugging purposes.

