From 48655be90a283e535a42de8feb63e8df7c6fd415 Mon Sep 17 00:00:00 2001 From: Vincent Gabriel Date: Wed, 7 Sep 2016 20:11:44 -0700 Subject: [PATCH] #30 - added example for international rate --- demos/autoload.php | 2 +- demos/international_rate.php | 43 ++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 demos/international_rate.php diff --git a/demos/autoload.php b/demos/autoload.php index 0b5c96a..ad2a9e8 100644 --- a/demos/autoload.php +++ b/demos/autoload.php @@ -1,3 +1,3 @@ setInternationalCall(true); +$rate->addExtraOption('Revision', 2); + +$package = new RatePackage; +$package->setPounds(15.12345678); +$package->setOunces(0); +$package->setField('Machinable', 'True'); +$package->setField('MailType', 'Package'); +$package->setField('GXG', array( + 'POBoxFlag' => 'Y', + 'GiftFlag' => 'Y' +)); +$package->setField('ValueOfContents', 200); +$package->setField('Country', 'Australia'); +$package->setField('Container', 'RECTANGULAR'); +$package->setField('Size', 'LARGE'); +$package->setField('Width', 10); +$package->setField('Length', 15); +$package->setField('Height', 10); +$package->setField('Girth', 0); +$package->setField('OriginZip', 18701); +$package->setField('CommercialFlag', 'N'); +$package->setField('AcceptanceDateTime', '2016-07-05T13:15:00-06:00'); +$package->setField('DestinationPostalCode', '2046'); + +// add the package to the rate stack +$rate->addPackage($package); +// Perform the request and print out the result +print_r($rate->getRate()); +print_r($rate->getArrayResponse()); +// Was the call successful +if ($rate->isSuccess()) { + echo 'Done'; +} else { + echo 'Error: ' . $rate->getErrorMessage(); +} \ No newline at end of file