Changeset 12748
- Timestamp:
- 11/08/08 08:42:43 (5 years ago)
- Files:
-
- plugins/sfUPSShippingPlugin/README (modified) (1 diff)
- plugins/sfUPSShippingPlugin/lib/sfUPSShipping.class.php (modified) (7 diffs)
- plugins/sfUPSShippingPlugin/test/sfUPSShippingTest.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfUPSShippingPlugin/README
r12745 r12748 5 5 of costs for all possible shipping types. 6 6 7 See test/sfUPSShippingTest.phpfor examples on useage of the API.7 See <a href="http://svn.symfony-project.com/plugins/sfUPSShippingPlugin/test/sfUPSShippingTest.php">test/sfUPSShippingTest.php</a> for examples on useage of the API. plugins/sfUPSShippingPlugin/lib/sfUPSShipping.class.php
r12745 r12748 49 49 ); 50 50 51 public $debugOn = false; 52 51 53 private $apiurl = "https://www.ups.com/ups.app/xml/Rate"; 52 54 … … 77 79 $isResidentialAddressFlag, $pickupType, 'Rate'); 78 80 81 if( $this->debugOn ) { 82 print "Options are : " . print_r($parsed, true) . "\n"; 83 } 84 79 85 $price = $parsed->RatedShipment->TotalCharges->MonetaryValue; 80 86 return($price); … … 87 93 $isResidentialAddressFlag, '01', 'Shop'); 88 94 89 #print "Options are : " . print_r($parsed, true) . "\n"; 95 if( $this->debugOn ) { 96 print "Options are : " . print_r($parsed, true) . "\n"; 97 } 90 98 91 99 $ret = array(); … … 176 184 </RatingServiceSelectionRequest>"; 177 185 178 #print "Query: $data\n\n"; 186 if( $this->debugOn ) { 187 print "Query: $data\n\n"; 188 } 179 189 180 190 … … 192 202 193 203 194 throw(new UPS APIException("Unknown service code string '$serviceString'"));204 throw(new UPSShippingException("Unknown service code string '$serviceString'")); 195 205 } 196 206 … … 200 210 } 201 211 202 throw(new UPS APIException("Invalid ups code '$code'"));212 throw(new UPSShippingException("Invalid ups code '$code'")); 203 213 } 204 214 … … 223 233 $parsedresponse = simplexml_load_string($response, "SimpleXMLElement", LIBXML_NOWARNING ); 224 234 235 if( $parsedresponse->Response->ResponseStatusCode == 0 ) {//Failure 236 $description = (string) $parsedresponse->Response->ResponseStatusDescription; 237 $severity = (string) $parsedresponse->Response->Error->ErrorSeverity; 238 $errorCode= (string) $parsedresponse->Response->Error->ErrorCode; 239 $errorDescription = (string) $parsedresponse->Response->Error->ErrorDescription; 240 $errorLocation= (string) $parsedresponse->Response->Error->ErrorLocation->ErrorLocationElementName; 241 242 243 throw(new UPSShippingException("Error from UPS server: '$description', '$errorCode', '$errorDescription', '$errorLocation'")); 244 } 245 225 246 return $parsedresponse; 226 247 } plugins/sfUPSShippingPlugin/test/sfUPSShippingTest.php
r12745 r12748 16 16 17 17 $ups = new UPSShipping($accessKey, $userId, $password, $shipperPostalCode, $shipperCountry, $upsAccountNumber); 18 $ups->debugOn = true; 18 19 19 20