function commerce_usps_return_lookup in Commerce USPS 7
USPS return value for MailService is differs from what is used for request. This array is used map the MailService to the commerce_usps_service_list
Parameters
sting $mail_service: A string that matches what is returned from USPS
Return value
string A string that matches the initial codes used for XML request
1 call to commerce_usps_return_lookup()
- commerce_usps_rate in ./
commerce_usps.module - Shipping service callback: returns a base price array for a shipping service calculated for the given order.
File
- ./
commerce_usps.module, line 175 - Defines the USPS shipping method and services for Drupal Commerce.
Code
function commerce_usps_return_lookup($mail_service) {
$service_map = array(
'First-Class Mail' => 'FIRST CLASS',
'Priority Mail' => 'PRIORITY',
'Express Mail' => 'EXPRESS',
'Parcel Post' => 'PARCEL',
'Media Mail' => 'MEDIA',
'Library Mail' => 'LIBRARY',
);
if (isset($service_map[$mail_service])) {
$service_name = preg_replace('/[^a-z0-9_]+/', '_', drupal_strtolower($service_map[$mail_service]));
return $service_name;
}
}