Sample PHP code for integration of Google Checkout with the merchant site
--------------------------------------------------------------------------
             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 and key to be set and there is an option 
  to specify which server is to be used for the transactions 
  (Sandbox or Production). 
  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: 
  ----------------------
  This class is instantiated for every shipping option that is to be added to the cart. 
  It requires the shipping name type an price to be specified. 
  Other methods allow specification of the shipping restrictions.

  d) googletaxrule.php:
  ---------------------
  This class is used to define all tax rules for the tax tables. These may be 
  rules for default or alternate tax tables. Methods have been provided to add 
  states and zip patterns for the tax rules.
      
  e) googletaxtable.php:
  ----------------------
  This class is used to aggregate all the defined tax rules to define a tax table.
  This may be a default or alternate tax table identified by the "type" value.

  f) 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. 

  g) 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.
  
  h) 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.    

  f) "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.

