function uc_ups_void_shipment in Ubercart 6.2
Same name and namespace in other branches
- 8.4 shipping/uc_ups/uc_ups.module \uc_ups_void_shipment()
- 5 shipping/uc_ups/uc_ups.module \uc_ups_void_shipment()
- 7.3 shipping/uc_ups/uc_ups.module \uc_ups_void_shipment()
Instructs UPS to cancel (in whole or in part) a shipment.
Parameters
$shipment_number: The UPS shipment tracking number.
$tracking_numbers: Array of tracking numbers for individual packages in the shipment. Optional for shipments of only one package, as they have the same tracking number.
Return value
TRUE if the shipment or packages were successfully voided.
1 string reference to 'uc_ups_void_shipment'
- uc_ups_shipping_method in shipping/
uc_ups/ uc_ups.module - Implements hook_shipping_method().
File
- shipping/
uc_ups/ uc_ups.module, line 801 - Shipping quote module that interfaces with www.ups.com to get rates for small package shipments.
Code
function uc_ups_void_shipment($shipment_number, $tracking_numbers = array()) {
$success = FALSE;
$request = uc_ups_void_shipment_request($shipment_number, $tracking_numbers);
$resp = drupal_http_request(variable_get('uc_ups_connection_address', 'https://wwwcie.ups.com/ups.app/xml/') . 'Void', array(), 'POST', $request);
$response = new SimpleXMLElement($resp->data);
if (isset($response->Response)) {
if (isset($response->Response->ResponseStatusCode)) {
$success = (string) $response->Response->ResponseStatusCode;
}
if (isset($response->Response->Error)) {
foreach ($response->Response->Error as $error) {
drupal_set_message((string) $error->ErrorSeverity . ' ' . (string) $error->ErrorCode . ': ' . (string) $error->ErrorDescription, 'error');
}
}
}
if (isset($response->Status)) {
if (isset($response->Status->StatusType)) {
$success = (string) $response->Status->StatusType->Code;
}
}
return (bool) $success;
}