You are here

function uc_ups_request_pickup in Ubercart 5

Same name and namespace in other branches
  1. 8.4 shipping/uc_ups/src/Plugin/Ubercart/FulfillmentMethod/uc_ups.ship.inc \uc_ups_request_pickup()
  2. 6.2 shipping/uc_ups/uc_ups.ship.inc \uc_ups_request_pickup()
  3. 7.3 shipping/uc_ups/uc_ups.ship.inc \uc_ups_request_pickup()

Construct an XML label and pickup request.

Parameters

$digest: Base-64 encoded shipment request.

$order_id: The order id of the shipment.

$packages: An array of package ids to be shipped.

Return value

ShipmentAcceptRequest XML document to send to UPS.

1 call to uc_ups_request_pickup()
uc_ups_confirm_shipment_submit in shipping/uc_ups/uc_ups.module
Submit handler for uc_ups_confirm_shipment().

File

shipping/uc_ups/uc_ups.module, line 1338
Shipping quote module that interfaces with www.ups.com to get rates for small package shipments.

Code

function uc_ups_request_pickup($digest, $order_id = 0, $packages = array()) {
  $packages = (array) $packages;
  $schema = uc_ups_access_request();
  $schema .= "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ShipmentAcceptRequest>\n  <Request>\n    <RequestAction>ShipAccept</RequestAction>";
  if ($order_id || count($packages)) {
    $schema .= "\n<TransactionReference>\n      <CustomerContext>";
    if ($order_id) {
      $schema .= "<OrderId>" . $order_id . "</OrderId>\n";
    }
    foreach ($packages as $pkg_id) {
      $schema .= "<PackageId>" . $pkg_id . "</PackageId>\n";
    }
    $schema .= "</CustomerContext>\n</TransactionReference>\n";
  }
  $schema .= "  </Request>\n  <ShipmentDigest>" . $digest . "</ShipmentDigest>\n</ShipmentAcceptRequest>";

  //drupal_set_message('<pre>'. htmlentities($schema) .'</pre>');
  return $schema;
}