function uc_usps_configuration in Ubercart 5
Implementation of hook_configuration().
Connect USPS quote action and event.
File
- shipping/
uc_usps/ uc_usps.module, line 102 - Shipping quote method module that receives quotes from the United States Postal Service via XML web service.
Code
function uc_usps_configuration() {
$enabled = variable_get('uc_quote_enabled', array());
$configurations = array(
'uc_usps_get_quote' => array(
'#label' => t('Shipping quote from USPS'),
'#event' => 'get_quote_from_usps',
'#module' => 'uc_usps',
'#active' => $enabled['usps'],
),
'uc_usps_get_intl_quote' => array(
'#label' => t('Shipping quote from USPS Intl.'),
'#event' => 'get_quote_from_usps_intl',
'#module' => 'uc_usps',
'#active' => $enabled['usps_intl'],
),
);
// Domestic areas include U.S., American Samoa, Guam, Puerto Rico, and the Virgin Islands
$countries = array(
16,
316,
630,
840,
850,
);
$us_area_condition = workflow_ng_use_condition('uc_order_condition_delivery_country', array(
'#label' => t('Is in domestic US areas (US, AS, GU, PR, VI)'),
'#settings' => array(
'countries' => $countries,
),
));
$not_us_area_condition = workflow_ng_use_condition('uc_order_condition_delivery_country', array(
'#label' => t('Is not in domestic US areas (US, AS, GU, PR, VI)'),
'#negate' => true,
'#settings' => array(
'countries' => $countries,
),
));
$action = workflow_ng_use_action('uc_quote_action_get_quote', array(
'#label' => t('Fetch a shipping quote'),
));
$configurations['uc_usps_get_quote'] = workflow_ng_configure($configurations['uc_usps_get_quote'], $action, $us_area_condition);
$configurations['uc_usps_get_intl_quote'] = workflow_ng_configure($configurations['uc_usps_get_intl_quote'], $action, $not_us_area_condition);
return $configurations;
}