function uc_ups_access_request in Ubercart 8.4
Same name and namespace in other branches
- 5 shipping/uc_ups/uc_ups.module \uc_ups_access_request()
- 6.2 shipping/uc_ups/uc_ups.module \uc_ups_access_request()
- 7.3 shipping/uc_ups/uc_ups.module \uc_ups_access_request()
Prepares XML access request string.
Return value
string XML access request to be prepended to all requests to the UPS webservice.
4 calls to uc_ups_access_request()
- uc_ups_request_pickup in shipping/
uc_ups/ src/ Plugin/ Ubercart/ FulfillmentMethod/ uc_ups.ship.inc - Constructs an XML label and pickup request.
- uc_ups_shipment_request in shipping/
uc_ups/ src/ Plugin/ Ubercart/ FulfillmentMethod/ uc_ups.ship.inc - Constructs an XML shipment request.
- uc_ups_shipping_quote in shipping/
uc_ups/ uc_ups.module - Constructs an XML quote request.
- uc_ups_void_shipment_request in shipping/
uc_ups/ uc_ups.module - Constructs a void shipment request.
File
- shipping/
uc_ups/ uc_ups.module, line 318 - UPS shipping quote module.
Code
function uc_ups_access_request() {
$ups_config = \Drupal::config('uc_ups.settings');
$access = $ups_config
->get('access_license');
$user = $ups_config
->get('user_id');
$password = $ups_config
->get('password');
$xml = new \XMLWriter();
$xml
->openMemory();
$xml
->startDocument('1.0', 'UTF-8');
$xml
->startElement('AccessRequest');
$xml
->writeAttribute('xml:lang', 'en-US');
$xml
->writeElement('AccessLicenseNumber', $access);
$xml
->writeElement('UserId', $user);
$xml
->writeElement('Password', $password);
$xml
->endElement();
$xml
->endDocument();
return $xml
->outputMemory(TRUE);
}