* This allows you to build real-time shipping and tax calculations into Express Checkout
 * so that you won't need to display another review page on your own site.   
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once '../includes/config.php';
require_once 'paypal.class.php';
// Configure PayPal object
$paypal_config = array('Sandbox' => $sandbox);
$paypal = new Angelleye_PayPal($paypal_config);
// Receive data from PayPal and load varaibles accordingly.
$method = isset($_POST['METHOD']) ? $_POST['METHOD'] : '';
$token = isset($_POST['TOKEN']) ? $_POST['TOKEN'] : '';
$currency_code = isset($_POST['CURRENCYCODE']) ? $_POST['CURRENCYCODE'] : '';
$local_code = isset($_POST['LOCALECODE']) ? $_POST['LOCALECODE'] : '';
$order_items = $paypal->GetOrderItems($_POST);
$shipping_street = isset($_POST['SHIPTOSTREET']) ? $_POST['SHIPTOSTREET'] : '';
$shipping_street2 = isset($_POST['SHIPTOSTREET2']) ? $_POST['SHIPTOSTREET2'] : '';
$shipping_city = isset($_POST['SHIPTOCITY']) ? $_POST['SHIPTOCITY'] : '';
$shipping_state = isset($_POST['SHIPTOSTATE']) ? $_POST['SHIPTOSTATE'] : '';
$shipping_zip = isset($_POST['SHIPTOZIP']) ? $_POST['SHIPTOZIP'] : '';
$shipping_country_code = isset($_POST['SHIPTOCOUNTRY']) ? $_POST['SHIPTOCOUNTRY'] : '';
// Here, we may setup static shipping and tax options, or we could hit a 3rd party
// web service API (eg. UPS, FedEx, USPS) to gather rates in real-time.
//
//
//
// Now we can generate a response for PayPal based on our new shipping values we got back from our carrier API.
$CBFields = array();
// Gather shipping options.  If you're pulling rates from a carrier API you would be looping through
// their response in order to populate $ShippingOptions.  Here, we're doing it manually for sample purposes.