diff --git app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php index 3e94f2d..4d5e86e 100644 --- app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php +++ app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php @@ -741,6 +741,9 @@ class Mage_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Controller } else { $this->_redirect('*/*/', array('store'=>$storeId)); } + if (!isset($stockData['is_decimal_divided']) || $stockData['is_qty_decimal'] == 0) { + $stockData['is_decimal_divided'] = 0; + } } /** diff --git app/code/core/Mage/Catalog/etc/config.xml app/code/core/Mage/Catalog/etc/config.xml index f5dbcb5..ebc9bb4 100644 --- app/code/core/Mage/Catalog/etc/config.xml +++ app/code/core/Mage/Catalog/etc/config.xml @@ -58,6 +58,13 @@ + + 1 + + + + + 1 1 diff --git app/code/core/Mage/CatalogInventory/Helper/Data.php app/code/core/Mage/CatalogInventory/Helper/Data.php index 1e6d3b0..f38f326 100644 --- app/code/core/Mage/CatalogInventory/Helper/Data.php +++ app/code/core/Mage/CatalogInventory/Helper/Data.php @@ -103,6 +103,7 @@ class Mage_CatalogInventory_Helper_Data extends Mage_Core_Helper_Abstract 'manage_stock', 'enable_qty_increments', 'qty_increments', + 'is_decimal_divided', ); } diff --git app/code/core/Mage/CatalogInventory/Model/Stock/Item.php app/code/core/Mage/CatalogInventory/Model/Stock/Item.php index 456570f..6b61805 100644 --- app/code/core/Mage/CatalogInventory/Model/Stock/Item.php +++ app/code/core/Mage/CatalogInventory/Model/Stock/Item.php @@ -669,7 +669,7 @@ class Mage_CatalogInventory_Model_Stock_Item extends Mage_Core_Model_Abstract $qtyIncrements = $this->getDefaultQtyIncrements(); } - if ($qtyIncrements && ($qty % $qtyIncrements != 0)) { + if ($qtyIncrements && (Mage::helper('core')->getExactDivision($qty, $qtyIncrements) != 0)) { $result->setHasError(true) ->setQuoteMessage( Mage::helper('cataloginventory')->__('Some of the products cannot be ordered in the requested quantity.') diff --git app/code/core/Mage/CatalogInventory/etc/config.xml app/code/core/Mage/CatalogInventory/etc/config.xml index 1c53e2e..3ea4f2d 100644 --- app/code/core/Mage/CatalogInventory/etc/config.xml +++ app/code/core/Mage/CatalogInventory/etc/config.xml @@ -28,7 +28,7 @@ - 1.6.0.0 + 1.6.0.0.1.2 diff --git app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1.1-1.6.0.0.1.2.php app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1.1-1.6.0.0.1.2.php new file mode 100644 index 0000000..89c4798 --- /dev/null +++ app/code/core/Mage/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1.1-1.6.0.0.1.2.php @@ -0,0 +1,45 @@ +getConnection() + ->addColumn( + $installer->getTable('cataloginventory/stock_item'), + 'is_decimal_divided', + array( + 'TYPE' => Varien_Db_Ddl_Table::TYPE_SMALLINT, + 'LENGTH' => 5, + 'UNSIGNED' => true, + 'NULLABLE' => false, + 'DEFAULT' => 0, + 'COMMENT' => 'Is Divided into Multiple Boxes for Shipping' + ) + ); diff --git app/code/core/Mage/Checkout/Block/Cart/Shipping.php app/code/core/Mage/Checkout/Block/Cart/Shipping.php index 65fa073..f0d21bd 100644 --- app/code/core/Mage/Checkout/Block/Cart/Shipping.php +++ app/code/core/Mage/Checkout/Block/Cart/Shipping.php @@ -27,10 +27,30 @@ class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstract { + /** + * Available Carriers Instances + * @var null|array + */ protected $_carriers = null; + + /** + * Estimate Rates + * @var array + */ protected $_rates = array(); + + /** + * Address Model + * + * @var array + */ protected $_address = array(); + /** + * Get Estimate Rates + * + * @return array + */ public function getEstimateRates() { if (empty($this->_rates)) { @@ -41,7 +61,7 @@ class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstrac } /** - * Get address model + * Get Address Model * * @return Mage_Sales_Model_Quote_Address */ @@ -53,6 +73,12 @@ class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstrac return $this->_address; } + /** + * Get Carrier Name + * + * @param string $carrierCode + * @return mixed + */ public function getCarrierName($carrierCode) { if ($name = Mage::getStoreConfig('carriers/'.$carrierCode.'/title')) { @@ -61,51 +87,107 @@ class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstrac return $carrierCode; } + /** + * Get Shipping Method + * + * @return string + */ public function getAddressShippingMethod() { return $this->getAddress()->getShippingMethod(); } + /** + * Get Estimate Country Id + * + * @return string + */ public function getEstimateCountryId() { return $this->getAddress()->getCountryId(); } + /** + * Get Estimate Postcode + * + * @return string + */ public function getEstimatePostcode() { return $this->getAddress()->getPostcode(); } + /** + * Get Estimate City + * + * @return string + */ public function getEstimateCity() { return $this->getAddress()->getCity(); } + /** + * Get Estimate Region Id + * + * @return mixed + */ public function getEstimateRegionId() { return $this->getAddress()->getRegionId(); } + /** + * Get Estimate Region + * + * @return string + */ public function getEstimateRegion() { return $this->getAddress()->getRegion(); } + /** + * Show City in Shipping Estimation + * + * @return bool + */ public function getCityActive() { - return (bool)Mage::getStoreConfig('carriers/dhl/active'); + return (bool)Mage::getStoreConfig('carriers/dhl/active') + || (bool)Mage::getStoreConfig('carriers/dhlint/active'); } + /** + * Show State in Shipping Estimation + * + * @return bool + */ public function getStateActive() { - return (bool)Mage::getStoreConfig('carriers/dhl/active') || (bool)Mage::getStoreConfig('carriers/tablerate/active'); + return (bool)Mage::getStoreConfig('carriers/dhl/active') + || (bool)Mage::getStoreConfig('carriers/tablerate/active') + || (bool)Mage::getStoreConfig('carriers/dhlint/active'); } + /** + * Convert price from default currency to current currency + * + * @param float $price + * @return float + */ public function formatPrice($price) { return $this->getQuote()->getStore()->convertPrice($price, true); } + /** + * Get Shipping Price + * + * @param float $price + * @param bool $flag + * @return float + */ public function getShippingPrice($price, $flag) { return $this->formatPrice($this->helper('tax')->getShippingPrice( @@ -175,7 +257,7 @@ class Mage_Checkout_Block_Cart_Shipping extends Mage_Checkout_Block_Cart_Abstrac public function isZipCodeRequired() { foreach ($this->getCarriers() as $carrier) { - if ($carrier->isZipCodeRequired()) { + if ($carrier->isZipCodeRequired($this->getEstimateCountryId())) { return true; } } diff --git app/code/core/Mage/Core/Helper/Data.php app/code/core/Mage/Core/Helper/Data.php index 7f2601d..0143c49 100644 --- app/code/core/Mage/Core/Helper/Data.php +++ app/code/core/Mage/Core/Helper/Data.php @@ -40,6 +40,11 @@ class Mage_Core_Helper_Data extends Mage_Core_Helper_Abstract const XML_PATH_CONNECTION_TYPE = 'global/resources/default_setup/connection/type'; /** + * Const for correct dividing decimal values + */ + const DIVIDE_EPSILON = 10000; + + /** * @var Mage_Core_Model_Encryption */ protected $_encryptor = null; @@ -805,4 +810,23 @@ XML; $value = (string) Mage::getConfig()->getNode($path); return (bool) $value; } + + /** + * Returns the floating point remainder (modulo) of the division of the arguments + * + * @param float|int $dividend + * @param float|int $divisor + * @return float|int + */ + public function getExactDivision($dividend, $divisor) + { + $epsilon = $divisor / self::DIVIDE_EPSILON; + + $remainder = fmod($dividend, $divisor); + if (abs($remainder - $divisor) < $epsilon || abs($remainder) < $epsilon) { + $remainder = 0; + } + + return $remainder; + } } diff --git app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php index f6f080a..02822ea 100644 --- app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php +++ app/code/core/Mage/ImportExport/Model/Import/Entity/Product.php @@ -1421,27 +1421,28 @@ class Mage_ImportExport_Model_Import_Entity_Product extends Mage_ImportExport_Mo protected function _saveStockItem() { $defaultStockData = array( - 'manage_stock' => 1, - 'use_config_manage_stock' => 1, - 'qty' => 0, - 'min_qty' => 0, - 'use_config_min_qty' => 1, - 'min_sale_qty' => 1, - 'use_config_min_sale_qty' => 1, - 'max_sale_qty' => 10000, - 'use_config_max_sale_qty' => 1, - 'is_qty_decimal' => 0, - 'backorders' => 0, - 'use_config_backorders' => 1, - 'notify_stock_qty' => 1, - 'use_config_notify_stock_qty' => 1, - 'enable_qty_increments' => 0, - 'use_config_enable_qty_inc' => 1, - 'qty_increments' => 0, - 'use_config_qty_increments' => 1, - 'is_in_stock' => 0, - 'low_stock_date' => null, - 'stock_status_changed_auto' => 0 + 'manage_stock' => 1, + 'use_config_manage_stock' => 1, + 'qty' => 0, + 'min_qty' => 0, + 'use_config_min_qty' => 1, + 'min_sale_qty' => 1, + 'use_config_min_sale_qty' => 1, + 'max_sale_qty' => 10000, + 'use_config_max_sale_qty' => 1, + 'is_qty_decimal' => 0, + 'backorders' => 0, + 'use_config_backorders' => 1, + 'notify_stock_qty' => 1, + 'use_config_notify_stock_qty' => 1, + 'enable_qty_increments' => 0, + 'use_config_enable_qty_inc' => 1, + 'qty_increments' => 0, + 'use_config_qty_increments' => 1, + 'is_in_stock' => 0, + 'low_stock_date' => null, + 'stock_status_changed_auto' => 0, + 'is_decimal_divided' => 0 ); $entityTable = Mage::getResourceModel('cataloginventory/stock_item')->getMainTable(); diff --git app/code/core/Mage/Sales/Model/Quote/Address.php app/code/core/Mage/Sales/Model/Quote/Address.php index 2d9ef9b..4d1bc6d 100644 --- app/code/core/Mage/Sales/Model/Quote/Address.php +++ app/code/core/Mage/Sales/Model/Quote/Address.php @@ -874,6 +874,8 @@ class Mage_Sales_Model_Quote_Address extends Mage_Customer_Model_Address_Abstrac $request->setPackageCurrency($this->getQuote()->getStore()->getCurrentCurrency()); $request->setLimitCarrier($this->getLimitCarrier()); + $request->setBaseSubtotalInclTax($this->getBaseSubtotalInclTax()); + $result = Mage::getModel('shipping/shipping')->collectRates($request)->getResult(); $found = false; diff --git app/code/core/Mage/Shipping/Model/Carrier/Abstract.php app/code/core/Mage/Shipping/Model/Carrier/Abstract.php index 36d5ac2..adcd19c 100644 --- app/code/core/Mage/Shipping/Model/Carrier/Abstract.php +++ app/code/core/Mage/Shipping/Model/Carrier/Abstract.php @@ -27,11 +27,35 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object { + /** + * Carrier's code + * + * @var string + */ protected $_code; + + /** + * Rates result + * + * @var array + */ protected $_rates = null; + + /** + * Number of boxes in package + * + * @var int + */ protected $_numBoxes = 1; /** + * Free Method config path + * + * @var string + */ + protected $_freeMethod = 'free_method'; + + /** * Whether this carrier has fixed rates calculation * * @var bool @@ -316,7 +340,7 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object return; } - $freeMethod = $this->getConfigData('free_method'); + $freeMethod = $this->getConfigData($this->_freeMethod); if (!$freeMethod) { return; } @@ -378,9 +402,9 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object */ public function getMethodPrice($cost, $method='') { - if ($method == $this->getConfigData('free_method') && $this->getConfigData('free_shipping_enable') - && $this->getConfigData('free_shipping_subtotal') <= $this->_rawRequest->getValueWithDiscount() - ){ + if ($method == $this->getConfigData($this->_freeMethod) && $this->getConfigData('free_shipping_enable') + && $this->getConfigData('free_shipping_subtotal') <= $this->_rawRequest->getBaseSubtotalInclTax() + ) { $price = '0.00'; } else { $price = $this->getFinalPriceWithHandlingFee($cost); @@ -391,12 +415,12 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object /** * get the handling fee for the shipping + cost * - * @return final price for shipping emthod + * @param float $cost + * @return float final price for shipping method */ public function getFinalPriceWithHandlingFee($cost) { $handlingFee = $this->getConfigData('handling_fee'); - $finalMethodPrice = 0; $handlingType = $this->getConfigData('handling_type'); if (!$handlingType) { $handlingType = self::HANDLING_TYPE_FIXED; @@ -406,22 +430,43 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object $handlingAction = self::HANDLING_ACTION_PERORDER; } - if($handlingAction == self::HANDLING_ACTION_PERPACKAGE) - { - if ($handlingType == self::HANDLING_TYPE_PERCENT) { - $finalMethodPrice = ($cost + ($cost * $handlingFee/100)) * $this->_numBoxes; - } else { - $finalMethodPrice = ($cost + $handlingFee) * $this->_numBoxes; - } - } else { - if ($handlingType == self::HANDLING_TYPE_PERCENT) { - $finalMethodPrice = ($cost * $this->_numBoxes) + ($cost * $this->_numBoxes * $handlingFee / 100); - } else { - $finalMethodPrice = ($cost * $this->_numBoxes) + $handlingFee; - } + return ($handlingAction == self::HANDLING_ACTION_PERPACKAGE) + ? $this->_getPerpackagePrice($cost, $handlingType, $handlingFee) + : $this->_getPerorderPrice($cost, $handlingType, $handlingFee); + } + /** + * Get final price for shipping method with handling fee per package + * + * @param float $cost + * @param string $handlingType + * @param float $handlingFee + * @return float + */ + protected function _getPerpackagePrice($cost, $handlingType, $handlingFee) + { + if ($handlingType == self::HANDLING_TYPE_PERCENT) { + return ($cost + ($cost * $handlingFee/100)) * $this->_numBoxes; } - return $finalMethodPrice; + + return ($cost + $handlingFee) * $this->_numBoxes; + } + + /** + * Get final price for shipping method with handling fee per order + * + * @param float $cost + * @param string $handlingType + * @param float $handlingFee + * @return float + */ + protected function _getPerorderPrice($cost, $handlingType, $handlingFee) + { + if ($handlingType == self::HANDLING_TYPE_PERCENT) { + return ($cost * $this->_numBoxes) + ($cost * $this->_numBoxes * $handlingFee / 100); + } + + return ($cost * $this->_numBoxes) + $handlingFee; } /** @@ -476,11 +521,12 @@ abstract class Mage_Shipping_Model_Carrier_Abstract extends Varien_Object } /** - * Check if zip code option required + * Determine whether zip-code is required for the country of destination * - * @return boolean + * @param string|null $countryId + * @return bool */ - public function isZipCodeRequired() + public function isZipCodeRequired($countryId = null) { return false; } diff --git app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php index 7394193..c940bf0 100644 --- app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php +++ app/code/core/Mage/Shipping/Model/Carrier/Freeshipping.php @@ -53,14 +53,12 @@ class Mage_Shipping_Model_Carrier_Freeshipping } $result = Mage::getModel('shipping/rate_result'); - $packageValue = $request->getPackageValue(); $this->_updateFreeMethodQuote($request); - $allow = ($request->getFreeShipping()) - || ($packageValue >= $this->getConfigData('free_shipping_subtotal')); - - if ($allow) { + if (($request->getFreeShipping()) + || ($request->getBaseSubtotalInclTax() >= $this->getConfigData('free_shipping_subtotal')) + ) { $method = Mage::getModel('shipping/rate_result_method'); $method->setCarrier('freeshipping'); diff --git app/code/core/Mage/Shipping/Model/Rate/Result.php app/code/core/Mage/Shipping/Model/Rate/Result.php index 906bdf0..f92137b 100644 --- app/code/core/Mage/Shipping/Model/Rate/Result.php +++ app/code/core/Mage/Shipping/Model/Rate/Result.php @@ -27,11 +27,24 @@ class Mage_Shipping_Model_Rate_Result { + /** + * Shippin method rates + * + * @var array + */ protected $_rates = array(); + + /** + * Shipping errors + * + * @var null|bool + */ protected $_error = null; /** * Reset result + * + * @return Mage_Shipping_Model_Rate_Result */ public function reset() { @@ -39,11 +52,22 @@ class Mage_Shipping_Model_Rate_Result return $this; } + /** + * Set Error + * + * @param bool $error + * @return void + */ public function setError($error) { $this->_error = $error; } + /** + * Get Error + * + * @return null|bool; + */ public function getError() { return $this->_error; @@ -53,6 +77,7 @@ class Mage_Shipping_Model_Rate_Result * Add a rate to the result * * @param Mage_Shipping_Model_Rate_Result_Abstract|Mage_Shipping_Model_Rate_Result $result + * @return Mage_Shipping_Model_Rate_Result */ public function append($result) { @@ -73,6 +98,8 @@ class Mage_Shipping_Model_Rate_Result /** * Return all quotes in the result + * + * @return array */ public function getAllRates() { @@ -81,6 +108,9 @@ class Mage_Shipping_Model_Rate_Result /** * Return rate by id in array + * + * @param int $id + * @return Mage_Shipping_Model_Rate_Result_Method|null */ public function getRateById($id) { @@ -90,19 +120,25 @@ class Mage_Shipping_Model_Rate_Result /** * Return quotes for specified type * - * @param string $type + * @param string $carrier + * @return array */ public function getRatesByCarrier($carrier) { $result = array(); foreach ($this->_rates as $rate) { - if ($rate->getCarrier()===$carrier) { + if ($rate->getCarrier() === $carrier) { $result[] = $rate; } } return $result; } + /** + * Converts object to array + * + * @return array + */ public function asArray() { $currencyFilter = Mage::app()->getStore()->getPriceFilter(); @@ -111,20 +147,25 @@ class Mage_Shipping_Model_Rate_Result foreach ($allRates as $rate) { $rates[$rate->getCarrier()]['title'] = $rate->getCarrierTitle(); $rates[$rate->getCarrier()]['methods'][$rate->getMethod()] = array( - 'title'=>$rate->getMethodTitle(), - 'price'=>$rate->getPrice(), - 'price_formatted'=>$currencyFilter->filter($rate->getPrice()), + 'title' => $rate->getMethodTitle(), + 'price' => $rate->getPrice(), + 'price_formatted' => $currencyFilter->filter($rate->getPrice()), ); } return $rates; } + /** + * Get cheapest rate + * + * @return null|Mage_Shipping_Model_Rate_Result_Method + */ public function getCheapestRate() { $cheapest = null; $minPrice = 100000; foreach ($this->getAllRates() as $rate) { - if (is_numeric($rate->getPrice()) && $rate->getPrice()<$minPrice) { + if (is_numeric($rate->getPrice()) && $rate->getPrice() < $minPrice) { $cheapest = $rate; $minPrice = $rate->getPrice(); } @@ -133,11 +174,11 @@ class Mage_Shipping_Model_Rate_Result } /** - * Sort rates by price from min to max + * Sort rates by price from min to max * - * @return Mage_Shipping_Model_Rate_Result + * @return Mage_Shipping_Model_Rate_Result */ - public function sortRatesByPrice () + public function sortRatesByPrice() { if (!is_array($this->_rates) || !count($this->_rates)) { return $this; @@ -157,4 +198,21 @@ class Mage_Shipping_Model_Rate_Result $this->_rates = $result; return $this; } + + /** + * Set price for each rate according to count of packages + * + * @param int $packageCount + * @return Mage_Shipping_Model_Rate_Result + */ + public function updateRatePrice($packageCount) + { + if ($packageCount > 1) { + foreach ($this->_rates as $rate) { + $rate->setPrice($rate->getPrice() * $packageCount); + } + } + + return $this; + } } diff --git app/code/core/Mage/Shipping/Model/Shipping.php app/code/core/Mage/Shipping/Model/Shipping.php index 1775395..d4aba1d 100644 --- app/code/core/Mage/Shipping/Model/Shipping.php +++ app/code/core/Mage/Shipping/Model/Shipping.php @@ -147,12 +147,13 @@ class Mage_Shipping_Model_Shipping /** * Collect rates of given carrier * - * @param string $carrierCode + * @param string $carrierCode * @param Mage_Shipping_Model_Rate_Request $request * @return Mage_Shipping_Model_Shipping */ public function collectCarrierRates($carrierCode, $request) { + /* @var $carrier Mage_Shipping_Model_Carrier_Abstract */ $carrier = $this->getCarrierByCode($carrierCode, $request->getStoreId()); if (!$carrier) { return $this; @@ -164,11 +165,47 @@ class Mage_Shipping_Model_Shipping } /* * Result will be false if the admin set not to show the shipping module - * if the devliery country is not within specific countries + * if the delivery country is not within specific countries */ if (false !== $result){ if (!$result instanceof Mage_Shipping_Model_Rate_Result_Error) { - $result = $carrier->collectRates($request); + if ($carrier->getConfigData('shipment_requesttype')) { + $packages = $this->composePackagesForCarrier($carrier, $request); + if (!empty($packages)) { + $sumResults = array(); + foreach ($packages as $weight => $packageCount) { + $request->setPackageWeight($weight); + $result = $carrier->collectRates($request); + if (!$result) { + return $this; + } else { + $result->updateRatePrice($packageCount); + } + $sumResults[] = $result; + } + if (!empty($sumResults) && count($sumResults) > 1) { + $result = array(); + foreach ($sumResults as $res) { + if (empty($result)) { + $result = $res; + continue; + } + foreach ($res->getAllRates() as $method) { + foreach ($result->getAllRates() as $resultMethod) { + if ($method->getMethod() == $resultMethod->getMethod()) { + $resultMethod->setPrice($method->getPrice() + $resultMethod->getPrice()); + continue; + } + } + } + } + } + } else { + $result = $carrier->collectRates($request); + } + } else { + $result = $carrier->collectRates($request); + } if (!$result) { return $this; } @@ -186,6 +223,141 @@ class Mage_Shipping_Model_Shipping } /** + * Compose Packages For Carrier. + * Devides order into items and items into parts if it's neccesary + * + * @param Mage_Shipping_Model_Carrier_Abstract $carrier + * @param Mage_Shipping_Model_Rate_Request $request + * @return array [int, float] + */ + public function composePackagesForCarrier($carrier, $request) + { + $allItems = $request->getAllItems(); + $fullItems = array(); + + $maxWeight = (float) $carrier->getConfigData('max_package_weight'); + + foreach ($allItems as $item) { + if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE + && $item->getProduct()->getShipmentType() + ) { + continue; + } + + $qty = $item->getQty(); + $changeQty = true; + $checkWeight = true; + $decimalItems = array(); + + if ($item->getParentItem()) { + if (!$item->getParentItem()->getProduct()->getShipmentType()) { + continue; + } + $qty = $item->getIsQtyDecimal() + ? $item->getParentItem()->getQty() + : $item->getParentItem()->getQty() * $item->getQty(); + } + + $itemWeight = $item->getWeight(); + if ($item->getIsQtyDecimal() && $item->getProductType() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) { + $stockItem = $item->getProduct()->getStockItem(); + if ($stockItem->getIsDecimalDivided()) { + if ($stockItem->getEnableQtyIncrements() && $stockItem->getQtyIncrements()) { + $itemWeight = $itemWeight * $stockItem->getQtyIncrements(); + $qty = round(($item->getWeight() / $itemWeight) * $qty); + $changeQty = false; + } else { + $itemWeight = $itemWeight * $item->getQty(); + if ($itemWeight > $maxWeight) { + $qtyItem = floor($itemWeight / $maxWeight); + $decimalItems[] = array('weight' => $maxWeight, 'qty' => $qtyItem); + $weightItem = Mage::helper('core')->getExactDivision($itemWeight, $maxWeight); + if ($weightItem) { + $decimalItems[] = array('weight' => $weightItem, 'qty' => 1); + } + $checkWeight = false; + } else { + $itemWeight = $itemWeight * $item->getQty(); + } + } + } else { + $itemWeight = $itemWeight * $item->getQty(); + } + } + + if ($checkWeight && $maxWeight && $itemWeight > $maxWeight) { + return array(); + } + + if ($changeQty && !$item->getParentItem() && $item->getIsQtyDecimal() + && $item->getProductType() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE + ) { + $qty = 1; + } + + if (!empty($decimalItems)) { + foreach ($decimalItems as $decimalItem) { + $fullItems = array_merge($fullItems, + array_fill(0, $decimalItem['qty'] * $qty, $decimalItem['weight']) + ); + } + } else { + $fullItems = array_merge($fullItems, array_fill(0, $qty, $itemWeight)); + } + } + sort($fullItems); + + return $this->_makePieces($fullItems, $maxWeight); + } + + /** + * Make pieces + * Compose packeges list based on given items, so that each package is as heavy as possible + * + * @param array $items + * @param float $maxWeight + * @return array + */ + protected function _makePieces($items, $maxWeight) + { + $pieces = array(); + if (!empty($items)) { + $sumWeight = 0; + + $reverseOrderItems = $items; + arsort($reverseOrderItems); + + foreach ($reverseOrderItems as $key => $weight) { + if (!isset($items[$key])) { + continue; + } + unset($items[$key]); + $sumWeight = $weight; + foreach ($items as $key => $weight) { + if (($sumWeight + $weight) < $maxWeight) { + unset($items[$key]); + $sumWeight += $weight; + } elseif (($sumWeight + $weight) > $maxWeight) { + $pieces[] = (string)(float)$sumWeight; + break; + } else { + unset($items[$key]); + $pieces[] = (string)(float)($sumWeight + $weight); + $sumWeight = 0; + break; + } + } + } + if ($sumWeight > 0) { + $pieces[] = (string)(float)$sumWeight; + } + $pieces = array_count_values($pieces); + } + + return $pieces; + } + + /** * Collect rates by address * * @param Varien_Object $address @@ -211,6 +383,8 @@ class Mage_Shipping_Model_Shipping $request->setPackageCurrency(Mage::app()->getStore()->getCurrentCurrency()); $request->setLimitCarrier($limitCarrier); + $request->setBaseSubtotalInclTax($address->getBaseSubtotalInclTax()); + return $this->collectRates($request); } @@ -297,24 +471,24 @@ class Mage_Shipping_Model_Shipping $request->setShipperContactCompanyName($storeInfo->getName()); $request->setShipperContactPhoneNumber($storeInfo->getPhone()); $request->setShipperEmail($admin->getEmail()); - $request->setShipperAddressStreet($originStreet1 . ' ' . $originStreet2); + $request->setShipperAddressStreet(trim($originStreet1 . ' ' . $originStreet2)); $request->setShipperAddressStreet1($originStreet1); $request->setShipperAddressStreet2($originStreet2); $request->setShipperAddressCity(Mage::getStoreConfig(self::XML_PATH_STORE_CITY, $shipmentStoreId)); $request->setShipperAddressStateOrProvinceCode($shipperRegionCode); $request->setShipperAddressPostalCode(Mage::getStoreConfig(self::XML_PATH_STORE_ZIP, $shipmentStoreId)); $request->setShipperAddressCountryCode(Mage::getStoreConfig(self::XML_PATH_STORE_COUNTRY_ID, $shipmentStoreId)); - $request->setRecipientContactPersonName($address->getFirstname() . ' ' . $address->getLastname()); + $request->setRecipientContactPersonName(trim($address->getFirstname() . ' ' . $address->getLastname())); $request->setRecipientContactPersonFirstName($address->getFirstname()); $request->setRecipientContactPersonLastName($address->getLastname()); $request->setRecipientContactCompanyName($address->getCompany()); $request->setRecipientContactPhoneNumber($address->getTelephone()); $request->setRecipientEmail($address->getEmail()); - $request->setRecipientAddressStreet($address->getStreetFull()); + $request->setRecipientAddressStreet(trim($address->getStreet1() . ' ' . $address->getStreet2())); $request->setRecipientAddressStreet1($address->getStreet1()); $request->setRecipientAddressStreet2($address->getStreet2()); $request->setRecipientAddressCity($address->getCity()); - $request->setRecipientAddressStateOrProvinceCode($address->getRegion()); + $request->setRecipientAddressStateOrProvinceCode($address->getRegionCode()); $request->setRecipientAddressRegionCode($recipientRegionCode); $request->setRecipientAddressPostalCode($address->getPostcode()); $request->setRecipientAddressCountryCode($address->getCountryId()); diff --git app/code/core/Mage/Shipping/etc/system.xml app/code/core/Mage/Shipping/etc/system.xml index e8242fb..6054a6d 100644 --- app/code/core/Mage/Shipping/etc/system.xml +++ app/code/core/Mage/Shipping/etc/system.xml @@ -56,6 +56,7 @@ text + validate-number 2 1 1 @@ -162,6 +163,7 @@ text + validate-number validate-zero-or-greater 5 1 1 @@ -179,6 +181,7 @@ text + validate-number validate-zero-or-greater 8 1 1 @@ -268,6 +271,7 @@ text + validate-number validate-zero-or-greater 4 1 1 @@ -356,6 +360,7 @@ text + validate-number validate-zero-or-greater 8 1 1 diff --git app/code/core/Mage/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php app/code/core/Mage/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php new file mode 100644 index 0000000..43bce83 --- /dev/null +++ app/code/core/Mage/Usa/Block/Adminhtml/Dhl/Unitofmeasure.php @@ -0,0 +1,82 @@ + + */ +class Mage_Usa_Block_Adminhtml_Dhl_Unitofmeasure extends Mage_Adminhtml_Block_System_Config_Form_Field +{ + + /** + * Define params and variables + * + * @return void + */ + public function _construct() + { + parent::_construct(); + + $carrierModel = Mage::getSingleton('usa/shipping_carrier_dhl_international'); + + $this->setInch($this->jsQuoteEscape($carrierModel->getCode('unit_of_dimension_cut', 'I'))); + $this->setCm($this->jsQuoteEscape($carrierModel->getCode('unit_of_dimension_cut', 'C'))); + + $this->setHeight($this->jsQuoteEscape($carrierModel->getCode('dimensions', 'height'))); + $this->setDepth($this->jsQuoteEscape($carrierModel->getCode('dimensions', 'depth'))); + $this->setWidth($this->jsQuoteEscape($carrierModel->getCode('dimensions', 'width'))); + + $kgWeight = 70; + + $this->setDivideOrderWeightNoteKg( + $this->jsQuoteEscape($this->__('Allows breaking total order weight into smaller pieces if it exeeds %s %s to ensure accurate calculation of shipping charges.', $kgWeight, 'kg')) + ); + + $weight = round( + Mage::helper('usa')->convertMeasureWeight( + $kgWeight, Zend_Measure_Weight::KILOGRAM, Zend_Measure_Weight::POUND), 3); + + $this->setDivideOrderWeightNoteLbp( + $this->jsQuoteEscape($this->__('Allows breaking total order weight into smaller pieces if it exeeds %s %s to ensure accurate calculation of shipping charges.', $weight, 'pounds')) + ); + + $this->setTemplate('usa/dhl/unitofmeasure.phtml'); + } + + /** + * Retrieve Element HTML fragment + * + * @param Varien_Data_Form_Element_Abstract $element + * @return string + */ + protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) + { + return parent::_getElementHtml($element) . $this->renderView(); + } +} diff --git app/code/core/Mage/Usa/Helper/Data.php app/code/core/Mage/Usa/Helper/Data.php index 8b3b554..175fb81 100644 --- app/code/core/Mage/Usa/Helper/Data.php +++ app/code/core/Mage/Usa/Helper/Data.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -109,26 +109,27 @@ class Mage_Usa_Helper_Data extends Mage_Core_Helper_Abstract */ public function displayGirthValue($shippingMethod) { - if (in_array($shippingMethod, array('usps_Priority Mail International', - 'usps_Priority Mail International Small Flat Rate Box', - 'usps_Priority Mail International Medium Flat Rate Box', - 'usps_Priority Mail International Large Flat Rate Box', - 'usps_Priority Mail International Flat Rate Envelope', - 'usps_Express Mail International Flat Rate Envelope', - 'usps_Express Mail Hold For Pickup', - 'usps_Express Mail International', - 'usps_First-Class Mail International Package', - 'usps_First-Class Mail International Large Envelope', - 'usps_First-Class Mail International', - 'usps_Global Express Guaranteed (GXG)', - 'usps_USPS GXG Envelopes', - 'usps_Global Express Guaranteed Non-Document Non-Rectangular', - 'usps_Media Mail', - 'usps_Parcel Post', - 'usps_Express Mail', - 'usps_Priority Mail' - ) - )) { + if (in_array($shippingMethod, array( + 'usps_Priority Mail International', + 'usps_Priority Mail International Small Flat Rate Box', + 'usps_Priority Mail International Medium Flat Rate Box', + 'usps_Priority Mail International Large Flat Rate Box', + 'usps_Priority Mail International Flat Rate Envelope', + 'usps_Express Mail International Flat Rate Envelope', + 'usps_Express Mail Hold For Pickup', + 'usps_Express Mail International', + 'usps_First-Class Mail International Package', + 'usps_First-Class Mail International Parcel', + 'usps_First-Class Mail International Large Envelope', + 'usps_First-Class Mail International', + 'usps_Global Express Guaranteed (GXG)', + 'usps_USPS GXG Envelopes', + 'usps_Global Express Guaranteed Non-Document Non-Rectangular', + 'usps_Media Mail', + 'usps_Parcel Post', + 'usps_Express Mail', + 'usps_Priority Mail' + ))) { return true; } else { return false; diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php index 69f8221..7a7cc8f 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -108,12 +108,16 @@ abstract class Mage_Usa_Model_Shipping_Carrier_Abstract extends Mage_Shipping_Mo } /** - * Check if zip code option required + * Determine whether zip-code is required for the country of destination * - * @return boolean + * @param string|null $countryId + * @return bool */ - public function isZipCodeRequired() + public function isZipCodeRequired($countryId = null) { + if ($countryId != null) { + return !Mage::helper('directory')->isZipCodeOptional($countryId); + } return true; } @@ -128,7 +132,41 @@ abstract class Mage_Usa_Model_Shipping_Carrier_Abstract extends Mage_Shipping_Mo } /** - * Processing additional validation to check is carrier applicable. + * Return items for further shipment rate evaluation. We need to pass children of a bundle instead passing the + * bundle itself, otherwise we may not get a rate at all (e.g. when total weight of a bundle exceeds max weight + * despite each item by itself is not) + * + * @param Mage_Shipping_Model_Rate_Request $request + * @return array + */ + public function getAllItems(Mage_Shipping_Model_Rate_Request $request) + { + $items = array(); + if ($request->getAllItems()) { + foreach ($request->getAllItems() as $item) { + /* @var $item Mage_Sales_Model_Quote_Item */ + if ($item->getProduct()->isVirtual() || $item->getParentItem()) { + // Don't process children here - we will process (or already have processed) them below + continue; + } + + if ($item->getHasChildren() && $item->isShipSeparately()) { + foreach ($item->getChildren() as $child) { + if (!$child->getFreeShipping() && !$child->getProduct()->isVirtual()) { + $items[] = $child; + } + } + } else { + // Ship together - count compound item as one solid + $items[] = $item; + } + } + } + return $items; + } + + /** + * Processing additional validation to check if carrier applicable. * * @param Mage_Shipping_Model_Rate_Request $request * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean @@ -136,26 +174,40 @@ abstract class Mage_Usa_Model_Shipping_Carrier_Abstract extends Mage_Shipping_Mo public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request) { //Skip by item validation if there is no items in request - if(!count($request->getAllItems())) { + if(!count($this->getAllItems($request))) { return $this; } - $maxAllowedWeight = (float) $this->getConfigData('max_package_weight'); - $errorMsg = ''; - $configErrorMsg = $this->getConfigData('specificerrmsg'); - $defaultErrorMsg = Mage::helper('shipping')->__('The shipping module is not available.'); - $showMethod = $this->getConfigData('showmethod'); + $maxAllowedWeight = (float) $this->getConfigData('max_package_weight'); + $errorMsg = ''; + $configErrorMsg = $this->getConfigData('specificerrmsg'); + $defaultErrorMsg = Mage::helper('shipping')->__('The shipping module is not available.'); + $showMethod = $this->getConfigData('showmethod'); - foreach ($request->getAllItems() as $item) { + foreach ($this->getAllItems($request) as $item) { if ($item->getProduct() && $item->getProduct()->getId()) { - if ($item->getProduct()->getWeight() > $maxAllowedWeight) { + $weight = $item->getProduct()->getWeight(); + $stockItem = $item->getProduct()->getStockItem(); + $doValidation = true; + + if ($stockItem->getIsQtyDecimal() && $stockItem->getIsDecimalDivided()) { + if ($stockItem->getEnableQtyIncrements() && $stockItem->getQtyIncrements()) { + $weight = $weight * $stockItem->getQtyIncrements(); + } else { + $doValidation = false; + } + } elseif ($stockItem->getIsQtyDecimal() && !$stockItem->getIsDecimalDivided()) { + $weight = $weight * $item->getQty(); + } + + if ($doValidation && $weight > $maxAllowedWeight) { $errorMsg = ($configErrorMsg) ? $configErrorMsg : $defaultErrorMsg; break; } } } - if (!$errorMsg && !$request->getDestPostcode() && $this->isZipCodeRequired()) { + if (!$errorMsg && !$request->getDestPostcode() && $this->isZipCodeRequired($request->getDestCountryId())) { $errorMsg = Mage::helper('shipping')->__('This shipping method is not available, please specify ZIP-code'); } diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract/Source/Mode.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract/Source/Mode.php new file mode 100644 index 0000000..18b97b9 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract/Source/Mode.php @@ -0,0 +1,49 @@ + + */ + +class Mage_Usa_Model_Shipping_Carrier_Abstract_Source_Mode +{ + /** + * Returns array to be used in packages request type on back-end + * + * @return array + */ + public function toOptionArray() + { + return array( + array('value' => '0', 'label' => Mage::helper('usa')->__('Development')), + array('value' => '1', 'label' => Mage::helper('usa')->__('Live')), + ); + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract/Source/Requesttype.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract/Source/Requesttype.php new file mode 100644 index 0000000..ce5bd74 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Abstract/Source/Requesttype.php @@ -0,0 +1,48 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Abstract_Source_Requesttype +{ + /** + * Returns array to be used in packages request type on back-end + * + * @return array + */ + public function toOptionArray() + { + return array( + array('value' => 0, 'label' => Mage::helper('shipping')->__('Divide to equal weight (one request)')), + array('value' => 1, 'label' => Mage::helper('shipping')->__('Use origin weight (few requests)')), + ); + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php index e261edb..1612648 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -381,6 +381,8 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl $r->setPackageId($request->getPackageId()); } + $r->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax()); + $this->_rawRequest = $r; return $this; } @@ -796,8 +798,7 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl $code = (string)$xml->Faults->Fault->Code; $description = $xml->Faults->Fault->Description; $context = $xml->Faults->Fault->Context; - $this->_errors[$code] = Mage::helper('usa')->__('Error #%s : %s (%s)', $code, $description, - $context); + $this->_errors[$code] = Mage::helper('usa')->__('Error #%s : %s (%s)', $code, $description, $context); } else { if ($r->getDestCountryId() == self::USA_COUNTRY_ID) { if ($xml->Shipment) { @@ -855,14 +856,12 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl $rate->setPrice($data['price_total']); $result->append($rate); } - } else { - foreach ($this->_errors as $errorText) { - $error = Mage::getModel('shipping/rate_result_error'); - $error->setCarrier('dhl'); - $error->setCarrierTitle($this->getConfigData('title')); - $error->setErrorMessage($this->getConfigData('specificerrmsg')); - $result->append($error); - } + } else if (!empty($this->_errors)) { + $error = Mage::getModel('shipping/rate_result_error'); + $error->setCarrier('dhl'); + $error->setCarrierTitle($this->getConfigData('title')); + $error->setErrorMessage($this->getConfigData('specificerrmsg')); + $result->append($error); } return $result; } @@ -1198,15 +1197,9 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl } else { $description = (string)$txml->Result->Desc; if ($description) - $errorArr[$tracknum] = Mage::helper('usa')->__( - 'Error #%s: %s', - $code, - $description - ); + $errorArr[$tracknum] = Mage::helper('usa')->__('Error #%s: %s', $code, $description); else - $errorArr[$tracknum] = Mage::helper('usa')->__( - 'Unable to retrieve tracking' - ); + $errorArr[$tracknum] = Mage::helper('usa')->__('Unable to retrieve tracking'); } } else { $errorArr[$tracknum] = Mage::helper('usa')->__('Unable to retrieve tracking'); @@ -1371,6 +1364,8 @@ class Mage_Usa_Model_Shipping_Carrier_Dhl $request->setPackageCustomsValue($customsValue); $request->setFreeMethodWeight(0); $request->setDhlShipmentType($request->getPackagingType()); + + $request->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax()); } /** diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php new file mode 100644 index 0000000..26e7771 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -0,0 +1,1731 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International + extends Mage_Usa_Model_Shipping_Carrier_Abstract + implements Mage_Shipping_Model_Carrier_Interface +{ + /** + * Carrier Product indicator + */ + const DHL_CONTENT_TYPE_DOC = 'D'; + const DHL_CONTENT_TYPE_NON_DOC = 'N'; + + /** + * Minimum allowed values for shipping package dimensions + */ + const DIMENSION_MIN_CM = 3; + const DIMENSION_MIN_IN = 1; + + /** + * Container types that could be customized + * + * @var array + */ + protected $_customizableContainerTypes = array(self::DHL_CONTENT_TYPE_NON_DOC); + + /** + * Code of the carrier + */ + const CODE = 'dhlint'; + + /** + * Rate request data + * + * @var Mage_Shipping_Model_Rate_Request|null + */ + protected $_request = null; + + /** + * Raw rate request data + * + * @var Varien_Object|null + */ + protected $_rawRequest = null; + + /** + * Rate result data + * + * @var Mage_Shipping_Model_Rate_Result|null + */ + protected $_result = null; + + /** + * Countries parameters data + * + * @var SimpleXMLElement|null + */ + protected $_countryParams = null; + + /** + * Errors placeholder + * + * @var array + */ + protected $_errors = array(); + + /** + * Dhl rates result + * + * @var array + */ + protected $_rates = array(); + + /** + * Carrier's code + * + * @var string + */ + protected $_code = self::CODE; + + /** + * Free Method config path + * + * @var string + */ + protected $_freeMethod = 'free_method_nondoc'; + + /** + * Max weight without fee + * + * @var int + */ + protected $_maxWeight = 70; + + /** + * Flag if response is for shipping label creating + * + * @var bool + */ + protected $_isShippingLabelFlag = false; + + /** + * Request variables array + * + * @var array + */ + protected $_requestVariables = array( + 'id' => array('code' => 'dhl_id', 'setCode' => 'id'), + 'password' => array('code' => 'dhl_password', 'setCode' => 'password'), + 'account' => array('code' => 'dhl_account', 'setCode' => 'account_nbr'), + 'shipping_key' => array('code' => 'dhl_shipping_key', 'setCode' => 'shipping_key'), + 'shipping_intlkey' => array('code' => 'dhl_shipping_intl_key', 'setCode' => 'shipping_intl_key'), + 'shipment_type' => array('code' => 'dhl_shipment_type', 'setCode' => 'shipment_type'), + 'dutiable' => array('code' => 'dhl_dutiable', 'setCode' => 'dutiable'), + 'dutypaymenttype' => array('code' => 'dhl_duty_payment_type', 'setCode' => 'duty_payment_type'), + 'contentdesc' => array('code' => 'dhl_content_desc', 'setCode' => 'content_desc') + ); + + /** + * Flag that shows if shipping is domestic + * + * @var bool + */ + protected $_isDomestic = false; + + /** + * Dhl International Class constructor + * + * Sets necessary data + */ + protected function _construct() + { + if ($this->getConfigData('content_type') == self::DHL_CONTENT_TYPE_DOC) { + $this->_freeMethod = 'free_method_doc'; + } + } + + /** + * Returns value of given variable + * + * @param mixed $origValue + * @param string $pathToValue + * @return mixed + */ + protected function _getDefaultValue($origValue, $pathToValue) + { + if (!$origValue) { + $origValue = Mage::getStoreConfig( + $pathToValue, + $this->getStore() + ); + } + + return $origValue; + } + + /** + * Collect and get rates + * + * @param Mage_Shipping_Model_Rate_Request $request + * @return bool|Mage_Shipping_Model_Rate_Result|null + */ + public function collectRates(Mage_Shipping_Model_Rate_Request $request) + { + if (!$this->getConfigFlag($this->_activeFlag)) { + return false; + } + + $requestDhl = clone $request; + $this->setStore($requestDhl->getStoreId()); + + $origCompanyName = $this->_getDefaultValue( + $requestDhl->getOrigCompanyName(), + Mage_Core_Model_Store::XML_PATH_STORE_STORE_NAME + ); + $origCountryId = $this->_getDefaultValue( + $requestDhl->getOrigCountryId(), + Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID + ); + $origState = $this->_getDefaultValue( + $requestDhl->getOrigState(), + Mage_Shipping_Model_Shipping::XML_PATH_STORE_REGION_ID + ); + $origCity = $this->_getDefaultValue( + $requestDhl->getOrigCity(), + Mage_Shipping_Model_Shipping::XML_PATH_STORE_CITY + ); + $origPostcode = $this->_getDefaultValue( + $requestDhl->getOrigPostcode(), + Mage_Shipping_Model_Shipping::XML_PATH_STORE_ZIP + ); + + $requestDhl->setOrigCompanyName($origCompanyName) + ->setCountryId($origCountryId) + ->setOrigState($origState) + ->setOrigCity($origCity) + ->setOrigPostal($origPostcode); + $this->setRequest($requestDhl); + + $this->_result = $this->_getQuotes(); + + $this->_updateFreeMethodQuote($request); + + return $this->_result; + } + + /** + * Set Free Method Request + * + * @param string $freeMethod + * @return void + */ + protected function _setFreeMethodRequest($freeMethod) + { + $rawRequest = $this->_rawRequest; + + $rawRequest->setFreeMethodRequest(true); + $freeWeight = $this->getTotalNumOfBoxes($rawRequest->getFreeMethodWeight()); + $rawRequest->setWeight($freeWeight); + $rawRequest->setService($freeMethod); + } + + /** + * Returns request result + * + * @return Mage_Shipping_Model_Rate_Result|null + */ + public function getResult() + { + return $this->_result; + } + + protected function _addParams($requestObject) + { + $request = $this->_request; + foreach ($this->_requestVariables as $code => $objectCode) { + if ($request->getDhlId()) { + $value = $request->getData($objectCode['code']); + } else { + $value = $this->getConfigData($code); + } + $requestObject->setData($objectCode['setCode'], $value); + } + return $requestObject; + } + + /** + * Prepare and set request in property of current instance + * + * @param Varien_Object $request + * @return Mage_Usa_Model_Shipping_Carrier_Dhl + */ + public function setRequest(Varien_Object $request) + { + $this->_request = $request; + $this->setStore($request->getStoreId()); + + $requestObject = new Varien_Object(); + + $requestObject->setIsGenerateLabelReturn($request->getIsGenerateLabelReturn()); + + $requestObject->setStoreId($request->getStoreId()); + + if ($request->getLimitMethod()) { + $requestObject->setService($request->getLimitMethod()); + } + + $requestObject = $this->_addParams($requestObject); + + if ($request->getDestPostcode()) { + $requestObject->setDestPostal($request->getDestPostcode()); + } + + $requestObject->setOrigCountry( + $this->_getDefaultValue( + $request->getOrigCountry(), Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID) + ) + ->setOrigCountryId( + $this->_getDefaultValue( + $request->getOrigCountryId(), Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID) + ); + + $shippingWeight = $request->getPackageWeight(); + + $requestObject->setValue(round($request->getPackageValue(), 2)) + ->setValueWithDiscount($request->getPackageValueWithDiscount()) + ->setCustomsValue($request->getPackageCustomsValue()) + ->setDestStreet( + Mage::helper('core/string')->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35)) + ->setDestStreetLine2($request->getDestStreetLine2()) + ->setDestCity($request->getDestCity()) + ->setOrigCompanyName($request->getOrigCompanyName()) + ->setOrigCity($request->getOrigCity()) + ->setOrigPhoneNumber($request->getOrigPhoneNumber()) + ->setOrigPersonName($request->getOrigPersonName()) + ->setOrigEmail(Mage::getStoreConfig('trans_email/ident_general/email', $requestObject->getStoreId())) + ->setOrigCity($request->getOrigCity()) + ->setOrigPostal($request->getOrigPostal()) + ->setOrigStreetLine2($request->getOrigStreetLine2()) + ->setDestPhoneNumber($request->getDestPhoneNumber()) + ->setDestPersonName($request->getDestPersonName()) + ->setDestCompanyName($request->getDestCompanyName()); + + $originStreet2 = Mage::getStoreConfig( + Mage_Shipping_Model_Shipping::XML_PATH_STORE_ADDRESS2, $requestObject->getStoreId()); + + $requestObject->setOrigStreet($request->getOrigStreet() ? $request->getOrigStreet() : $originStreet2); + + if (is_numeric($request->getOrigState())) { + $requestObject->setOrigState(Mage::getModel('directory/region')->load($request->getOrigState())->getCode()); + } else { + $requestObject->setOrigState($request->getOrigState()); + } + + if ($request->getDestCountryId()) { + $destCountry = $request->getDestCountryId(); + } else { + $destCountry = self::USA_COUNTRY_ID; + } + + // for DHL, Puerto Rico state for US will assume as Puerto Rico country + // for Puerto Rico, dhl will ship as international + if ($destCountry == self::USA_COUNTRY_ID && ($request->getDestPostcode() == '00912' + || $request->getDestRegionCode() == self::PUERTORICO_COUNTRY_ID) + ) { + $destCountry = self::PUERTORICO_COUNTRY_ID; + } + + $requestObject->setDestCountryId($destCountry) + ->setDestState($request->getDestRegionCode()) + ->setWeight($shippingWeight) + ->setFreeMethodWeight($request->getFreeMethodWeight()) + ->setOrderShipment($request->getOrderShipment()); + + if ($request->getPackageId()) { + $requestObject->setPackageId($request->getPackageId()); + } + + $requestObject->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax()); + + $this->_rawRequest = $requestObject; + return $this; + } + + /** + * Get allowed shipping methods + * + * @return array + */ + public function getAllowedMethods() + { + $contentType = $this->getConfigData('content_type'); + $allowedMethods = array(); + if ($this->_isDomestic) { + $allowedMethods = array_merge(explode(',', $this->getConfigData('doc_methods')), + explode(',', $this->getConfigData('nondoc_methods')) + ); + } else { + switch ($contentType) { + case self::DHL_CONTENT_TYPE_DOC: + $allowedMethods = explode(',', $this->getConfigData('doc_methods')); + break; + case self::DHL_CONTENT_TYPE_NON_DOC: + $allowedMethods = explode(',', $this->getConfigData('nondoc_methods')); + break; + default: + Mage::throwException(Mage::helper('usa')->__('Wrong Content Type.')); + } + } + $methods = array(); + foreach ($allowedMethods as $method) { + $methods[$method] = $this->getDhlProductTitle($method); + } + return $methods; + } + + /** + * Get configuration data of carrier + * + * @param strin $type + * @param string $code + * @return array|bool + */ + public function getCode($type, $code = '') + { + $codes = array( + 'unit_of_measure' => array( + 'L' => Mage::helper('usa')->__('Pounds'), + 'K' => Mage::helper('usa')->__('Kilograms'), + ), + 'unit_of_dimension' => array( + 'I' => Mage::helper('usa')->__('Inches'), + 'C' => Mage::helper('usa')->__('Centimeters'), + ), + 'unit_of_dimension_cut' => array( + 'I' => Mage::helper('usa')->__('inch'), + 'C' => Mage::helper('usa')->__('cm'), + ), + 'dimensions' => array( + 'HEIGHT' => Mage::helper('usa')->__('Height'), + 'DEPTH' => Mage::helper('usa')->__('Depth'), + 'WIDTH' => Mage::helper('usa')->__('Width'), + ), + 'size' => array( + '0' => Mage::helper('usa')->__('Regular'), + '1' => Mage::helper('usa')->__('Specific'), + ), + 'dimensions_variables' => array( + 'L' => Zend_Measure_Weight::POUND, + 'LB' => Zend_Measure_Weight::POUND, + 'POUND' => Zend_Measure_Weight::POUND, + 'K' => Zend_Measure_Weight::KILOGRAM, + 'KG' => Zend_Measure_Weight::KILOGRAM, + 'KILOGRAM' => Zend_Measure_Weight::KILOGRAM, + 'I' => Zend_Measure_Length::INCH, + 'IN' => Zend_Measure_Length::INCH, + 'INCH' => Zend_Measure_Length::INCH, + 'C' => Zend_Measure_Length::CENTIMETER, + 'CM' => Zend_Measure_Length::CENTIMETER, + 'CENTIMETER'=> Zend_Measure_Length::CENTIMETER, + + ) + ); + + if (!isset($codes[$type])) { + return false; + } elseif ('' === $code) { + return $codes[$type]; + } + + $code = strtoupper($code); + if (!isset($codes[$type][$code])) { + return false; + } else { + return $codes[$type][$code]; + } + } + + /** + * Returns DHL shipment methods (depending on package content type, if necessary) + * + * @param string $doc Package content type (doc/non-doc) see DHL_CONTENT_TYPE_* constants + * @return array + */ + public function getDhlProducts($doc) + { + $docType = array( + '2' => Mage::helper('usa')->__('Easy shop'), + '5' => Mage::helper('usa')->__('Sprintline'), + '6' => Mage::helper('usa')->__('Secureline'), + '7' => Mage::helper('usa')->__('Express easy'), + '9' => Mage::helper('usa')->__('Europack'), + 'B' => Mage::helper('usa')->__('Break bulk express'), + 'C' => Mage::helper('usa')->__('Medical express'), + 'D' => Mage::helper('usa')->__('Express worldwide'), // product content code: DOX + 'U' => Mage::helper('usa')->__('Express worldwide'), // product content code: ECX + 'K' => Mage::helper('usa')->__('Express 9:00'), + 'L' => Mage::helper('usa')->__('Express 10:30'), + 'G' => Mage::helper('usa')->__('Domestic economy select'), + 'W' => Mage::helper('usa')->__('Economy select'), + 'I' => Mage::helper('usa')->__('Break bulk economy'), + 'N' => Mage::helper('usa')->__('Domestic express'), + 'O' => Mage::helper('usa')->__('Others'), + 'R' => Mage::helper('usa')->__('Globalmail business'), + 'S' => Mage::helper('usa')->__('Same day'), + 'T' => Mage::helper('usa')->__('Express 12:00'), + 'X' => Mage::helper('usa')->__('Express envelope'), + ); + + $nonDocType = array( + '1' => Mage::helper('usa')->__('Customer services'), + '3' => Mage::helper('usa')->__('Easy shop'), + '4' => Mage::helper('usa')->__('Jetline'), + '8' => Mage::helper('usa')->__('Express easy'), + 'P' => Mage::helper('usa')->__('Express worldwide'), + 'Q' => Mage::helper('usa')->__('Medical express'), + 'E' => Mage::helper('usa')->__('Express 9:00'), + 'F' => Mage::helper('usa')->__('Freight worldwide'), + 'H' => Mage::helper('usa')->__('Economy select'), + 'J' => Mage::helper('usa')->__('Jumbo box'), + 'M' => Mage::helper('usa')->__('Express 10:30'), + 'V' => Mage::helper('usa')->__('Europack'), + 'Y' => Mage::helper('usa')->__('Express 12:00'), + ); + + if ($this->_isDomestic) { + return $docType + $nonDocType; + } + if ($doc == self::DHL_CONTENT_TYPE_DOC) { + // Documents shipping + return $docType; + } else { + // Services for shipping non-documents cargo + return $nonDocType; + } + } + + /** + * Returns title of DHL shipping method by its code + * + * @param string $code One-symbol code (see getDhlProducts()) + * @return bool + */ + public function getDhlProductTitle($code) + { + $contentType = $this->getConfigData('content_type'); + $dhlProducts = $this->getDhlProducts($contentType); + return isset($dhlProducts[$code]) ? $dhlProducts[$code] : false; + } + + /** + * Convert item weight to needed weight based on config weight unit dimensions + * + * @param float $weight + * @param bool $maxWeight + * @param string|bool $configWeightUnit + * @return float + */ + protected function _getWeight($weight, $maxWeight = false, $configWeightUnit = false) + { + if ($maxWeight) { + $configWeightUnit = Zend_Measure_Weight::KILOGRAM; + } elseif ($configWeightUnit) { + $configWeightUnit = $this->getCode('dimensions_variables', $configWeightUnit); + } else { + $configWeightUnit = $this->getCode('dimensions_variables', (string)$this->getConfigData('unit_of_measure')); + } + + $countryWeightUnit = $this->getCode('dimensions_variables', $this->_getWeightUnit()); + + if ($configWeightUnit != $countryWeightUnit) { + $weight = Mage::helper('usa')->convertMeasureWeight( + round($weight,3), + $configWeightUnit, + $countryWeightUnit + ); + } + + return round($weight, 3); + } + + /** + * Prepare items to pieces + * + * @return array + */ + protected function _getAllItems() + { + $allItems = $this->_request->getAllItems(); + $fullItems = array(); + + foreach ($allItems as $item) { + if ($item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE + && $item->getProduct()->getShipmentType() + ) { + continue; + } + + $qty = $item->getQty(); + $changeQty = true; + $checkWeight = true; + $decimalItems = array(); + + if ($item->getParentItem()) { + if (!$item->getParentItem()->getProduct()->getShipmentType()) { + continue; + } + $qty = $item->getIsQtyDecimal() + ? $item->getParentItem()->getQty() + : $item->getParentItem()->getQty() * $item->getQty(); + } + + $itemWeight = $item->getWeight(); + if ($item->getIsQtyDecimal() && $item->getProductType() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) { + $stockItem = $item->getProduct()->getStockItem(); + if ($stockItem->getIsDecimalDivided()) { + if ($stockItem->getEnableQtyIncrements() && $stockItem->getQtyIncrements()) { + $itemWeight = $itemWeight * $stockItem->getQtyIncrements(); + $qty = round(($item->getWeight() / $itemWeight) * $qty); + $changeQty = false; + } else { + $itemWeight = $this->_getWeight($itemWeight * $item->getQty()); + $maxWeight = $this->_getWeight($this->_maxWeight, true); + if ($itemWeight > $maxWeight) { + $qtyItem = floor($itemWeight / $maxWeight); + $decimalItems[] = array('weight' => $maxWeight, 'qty' => $qtyItem); + $weightItem = Mage::helper('core')->getExactDivision($itemWeight, $maxWeight); + if ($weightItem) { + $decimalItems[] = array('weight' => $weightItem, 'qty' => 1); + } + $checkWeight = false; + } else { + $itemWeight = $itemWeight * $item->getQty(); + } + } + } else { + $itemWeight = $itemWeight * $item->getQty(); + } + } + + if ($checkWeight && $this->_getWeight($itemWeight) > $this->_getWeight($this->_maxWeight, true)) { + return array(); + } + + if ($changeQty && !$item->getParentItem() && $item->getIsQtyDecimal() + && $item->getProductType() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE + ) { + $qty = 1; + } + + if (!empty($decimalItems)) { + foreach ($decimalItems as $decimalItem) { + $fullItems = array_merge($fullItems, + array_fill(0, $decimalItem['qty'] * $qty, $decimalItem['weight']) + ); + } + } else { + $fullItems = array_merge($fullItems, array_fill(0, $qty, $this->_getWeight($itemWeight))); + } + } + sort($fullItems); + + return $fullItems; + } + + /** + * Make pieces + * + * @param SimpleXMLElement $nodeBkgDetails + * @return void + */ + protected function _makePieces(SimpleXMLElement $nodeBkgDetails) + { + $divideOrderWeight = (string)$this->getConfigData('divide_order_weight'); + $nodePieces = $nodeBkgDetails->addChild('Pieces', '', ''); + $items = $this->_getAllItems(); + $numberOfPieces = 0; + + if ($divideOrderWeight && !empty($items)) { + $maxWeight = $this->_getWeight($this->_maxWeight, true); + $sumWeight = 0; + + $reverseOrderItems = $items; + arsort($reverseOrderItems); + + foreach ($reverseOrderItems as $key => $weight) { + if (!isset($items[$key])) { + continue; + } + unset($items[$key]); + $sumWeight = $weight; + foreach ($items as $key => $weight) { + if (($sumWeight + $weight) < $maxWeight) { + unset($items[$key]); + $sumWeight += $weight; + } elseif (($sumWeight + $weight) > $maxWeight) { + $numberOfPieces++; + $nodePiece = $nodePieces->addChild('Piece', '', ''); + $nodePiece->addChild('PieceID', $numberOfPieces); + $this->_addDimension($nodePiece); + $nodePiece->addChild('Weight', $sumWeight); + break; + } else { + unset($items[$key]); + $numberOfPieces++; + $sumWeight += $weight; + $nodePiece = $nodePieces->addChild('Piece', '', ''); + $nodePiece->addChild('PieceID', $numberOfPieces); + $this->_addDimension($nodePiece); + $nodePiece->addChild('Weight', $sumWeight); + $sumWeight = 0; + break; + } + } + } + if ($sumWeight > 0) { + $numberOfPieces++; + $nodePiece = $nodePieces->addChild('Piece', '', ''); + $nodePiece->addChild('PieceID', $numberOfPieces); + $this->_addDimension($nodePiece); + $nodePiece->addChild('Weight', $sumWeight); + } + } else { + $nodePiece = $nodePieces->addChild('Piece', '', ''); + $nodePiece->addChild('PieceID', 1); + $this->_addDimension($nodePiece); + $nodePiece->addChild('Weight', $this->_getWeight($this->_rawRequest->getWeight())); + } + + $handlingAction = $this->getConfigData('handling_action'); + if ($handlingAction == Mage_Shipping_Model_Carrier_Abstract::HANDLING_ACTION_PERORDER || !$numberOfPieces) { + $numberOfPieces = 1; + } + $this->_numBoxes = $numberOfPieces; + } + + /** + * Convert item dimension to needed dimension based on config dimension unit of measure + * + * @param float $dimension + * @param string|bool $configWeightUnit + * @return float + */ + protected function _getDimension($dimension, $configWeightUnit = false) + { + if (!$configWeightUnit) { + $configWeightUnit = $this->getCode('dimensions_variables', (string)$this->getConfigData('unit_of_measure')); + } else { + $configWeightUnit = $this->getCode('dimensions_variables', $configWeightUnit); + } + + if ($configWeightUnit == Zend_Measure_Weight::POUND) { + $configDimensionUnit = Zend_Measure_Length::INCH; + } else { + $configDimensionUnit = Zend_Measure_Length::CENTIMETER; + } + + $countryDimensionUnit = $this->getCode('dimensions_variables', $this->_getDimensionUnit()); + + if ($configDimensionUnit != $countryDimensionUnit) { + $dimension = Mage::helper('usa')->convertMeasureDimension( + round($dimension, 3), + $configDimensionUnit, + $countryDimensionUnit + ); + } + + return round($dimension, 3); + } + + /** + * Add dimension to piece + * + * @param SimpleXMLElement $nodePiece + * @return void + */ + protected function _addDimension($nodePiece) + { + $sizeChecker = (string)$this->getConfigData('size'); + + $height = $this->_getDimension((string)$this->getConfigData('height')); + $depth = $this->_getDimension((string)$this->getConfigData('depth')); + $width = $this->_getDimension((string)$this->getConfigData('width')); + + if ($sizeChecker && $height && $depth && $width) { + $nodePiece->addChild('Height', $height); + $nodePiece->addChild('Depth', $depth); + $nodePiece->addChild('Width', $width); + } + } + + /** + * Get shipping quotes + * + * @return Mage_Core_Model_Abstract|Mage_Shipping_Model_Rate_Result + */ + protected function _getQuotes() + { + $rawRequest = $this->_rawRequest; + $xmlStr = '' + . ''; + $xml = new SimpleXMLElement($xmlStr); + $nodeGetQuote = $xml->addChild('GetQuote', '', ''); + $nodeRequest = $nodeGetQuote->addChild('Request'); + + $nodeServiceHeader = $nodeRequest->addChild('ServiceHeader'); + $nodeServiceHeader->addChild('SiteID', (string)$this->getConfigData('id')); + $nodeServiceHeader->addChild('Password', (string)$this->getConfigData('password')); + + $nodeFrom = $nodeGetQuote->addChild('From'); + $nodeFrom->addChild('CountryCode', $rawRequest->getOrigCountryId()); + $nodeFrom->addChild('Postalcode', $rawRequest->getOrigPostal()); + $nodeFrom->addChild('City', $rawRequest->getOrigCity()); + + $nodeBkgDetails = $nodeGetQuote->addChild('BkgDetails'); + $nodeBkgDetails->addChild('PaymentCountryCode', $rawRequest->getOrigCountryId()); + $nodeBkgDetails->addChild('Date', Varien_Date::now(true)); + $nodeBkgDetails->addChild('ReadyTime', 'PT' . (int)(string)$this->getConfigData('ready_time') . 'H00M'); + + $nodeBkgDetails->addChild('DimensionUnit', $this->_getDimensionUnit()); + $nodeBkgDetails->addChild('WeightUnit', $this->_getWeightUnit()); + + $this->_makePieces($nodeBkgDetails); + + $nodeBkgDetails->addChild('PaymentAccountNumber', (string)$this->getConfigData('account')); + + $nodeTo = $nodeGetQuote->addChild('To'); + $nodeTo->addChild('CountryCode', $rawRequest->getDestCountryId()); + $nodeTo->addChild('Postalcode', $rawRequest->getDestPostal()); + $nodeTo->addChild('City', $rawRequest->getDestCity()); + + $this->_checkDomesticStatus($rawRequest->getOrigCountryId(), $rawRequest->getDestCountryId()); + + if ($this->getConfigData('content_type') == self::DHL_CONTENT_TYPE_NON_DOC && !$this->_isDomestic) { + // IsDutiable flag and Dutiable node indicates that cargo is not a documentation + $nodeBkgDetails->addChild('IsDutiable', 'Y'); + $nodeDutiable = $nodeGetQuote->addChild('Dutiable'); + $baseCurrencyCode = Mage::app()->getWebsite($this->_request->getWebsiteId())->getBaseCurrencyCode(); + $nodeDutiable->addChild('DeclaredCurrency', $baseCurrencyCode); + $nodeDutiable->addChild('DeclaredValue', sprintf("%.2F", $rawRequest->getValue())); + } + + $request = $xml->asXML(); + $request = utf8_encode($request); + $responseBody = $this->_getCachedQuotes($request); + if ($responseBody === null) { + $debugData = array('request' => $request); + try { + $client = new Varien_Http_Client(); + $client->setUri((string)$this->getConfigData('gateway_url')); + $client->setConfig(array('maxredirects' => 0, 'timeout' => 30)); + $client->setRawData($request); + $responseBody = $client->request(Varien_Http_Client::POST)->getBody(); + $debugData['result'] = $responseBody; + $this->_setCachedQuotes($request, $responseBody); + } catch (Exception $e) { + $this->_errors[$e->getCode()] = $e->getMessage(); + $responseBody = ''; + } + $this->_debug($debugData); + } + + return $this->_parseResponse($responseBody); + } + + /** + * Parse response from DHL web service + * + * @param string $response + * @return Mage_Shipping_Model_Rate_Result + */ + protected function _parseResponse($response) + { + $htmlTranslationTable = get_html_translation_table(HTML_ENTITIES); + unset($htmlTranslationTable['<'], $htmlTranslationTable['>'], $htmlTranslationTable['"']); + $response = str_replace(array_keys($htmlTranslationTable), array_values($htmlTranslationTable), $response); + + $responseError = Mage::helper('usa')->__('The response is in wrong format.'); + + if (strlen(trim($response)) > 0) { + if (strpos(trim($response), 'getName(), array('ErrorResponse', 'ShipmentValidateErrorResponse')) + || isset($xml->GetQuoteResponse->Note->Condition) + ) { + $code = null; + $data = null; + if (isset($xml->Response->Status->Condition)) { + $nodeCondition = $xml->Response->Status->Condition; + } else { + $nodeCondition = $xml->GetQuoteResponse->Note->Condition; + } + + if ($this->_isShippingLabelFlag) { + foreach ($nodeCondition as $condition) { + $code = isset($condition->ConditionCode) ? (string)$condition->ConditionCode : 0; + $data = isset($condition->ConditionData) ? (string)$condition->ConditionData : ''; + if (!empty($code) && !empty($data)) { + break; + } + } + Mage::throwException(Mage::helper('usa')->__('Error #%s : %s', trim($code), trim($data))); + } + + $code = isset($nodeCondition->ConditionCode) ? (string)$nodeCondition->ConditionCode : 0; + $data = isset($nodeCondition->ConditionData) ? (string)$nodeCondition->ConditionData : ''; + $this->_errors[$code] = Mage::helper('usa')->__('Error #%s : %s', trim($code), trim($data)); + } else { + if (isset($xml->GetQuoteResponse->BkgDetails->QtdShp)) { + foreach ($xml->GetQuoteResponse->BkgDetails->QtdShp as $quotedShipment) { + $this->_addRate($quotedShipment); + } + } elseif (isset($xml->AirwayBillNumber)) { + $result = new Varien_Object(); + $result->setTrackingNumber((string)$xml->AirwayBillNumber); + try { + /* @var $pdf Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf */ + $pdf = Mage::getModel( + 'usa/shipping_carrier_dhl_label_pdf', + array('info' => $xml, 'request' => $this->_request) + ); + $result->setShippingLabelContent($pdf->render()); + } catch (Exception $e) { + Mage::throwException(Mage::helper('usa')->__($e->getMessage())); + } + return $result; + } else { + $this->_errors[] = $responseError; + } + } + } + } else { + $this->_errors[] = $responseError; + } + } else { + $this->_errors[] = $responseError; + } + + /* @var $result Mage_Shipping_Model_Rate_Result */ + $result = Mage::getModel('shipping/rate_result'); + if ($this->_rates) { + foreach ($this->_rates as $rate) { + $method = $rate['service']; + $data = $rate['data']; + /* @var $rate Mage_Shipping_Model_Rate_Result_Method */ + $rate = Mage::getModel('shipping/rate_result_method'); + $rate->setCarrier(self::CODE); + $rate->setCarrierTitle($this->getConfigData('title')); + $rate->setMethod($method); + $rate->setMethodTitle($data['term']); + $rate->setCost($data['price_total']); + $rate->setPrice($data['price_total']); + $result->append($rate); + } + } else if (!empty($this->_errors)) { + if ($this->_isShippingLabelFlag) { + Mage::throwException($responseError); + } + return $this->_showError(); + } + return $result; + } + + /** + * Add rate to DHL rates array + * + * @param SimpleXMLElement $shipmentDetails + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_International + */ + protected function _addRate(SimpleXMLElement $shipmentDetails) + { + if (isset($shipmentDetails->ProductShortName) + && isset($shipmentDetails->ShippingCharge) + && isset($shipmentDetails->GlobalProductCode) + && isset($shipmentDetails->CurrencyCode) + && array_key_exists((string)$shipmentDetails->GlobalProductCode, $this->getAllowedMethods()) + ) { + // DHL product code, e.g. '3', 'A', 'Q', etc. + $dhlProduct = (string)$shipmentDetails->GlobalProductCode; + $totalEstimate = (float)(string)$shipmentDetails->ShippingCharge; + $currencyCode = (string)$shipmentDetails->CurrencyCode; + $baseCurrencyCode = Mage::app()->getWebsite($this->_request->getWebsiteId())->getBaseCurrencyCode(); + $dhlProductDescription = $this->getDhlProductTitle($dhlProduct); + + if ($currencyCode != $baseCurrencyCode) { + /* @var $currency Mage_Directory_Model_Currency */ + $currency = Mage::getModel('directory/currency'); + $rates = $currency->getCurrencyRates($currencyCode, array($baseCurrencyCode)); + if (!empty($rates) && isset($rates[$baseCurrencyCode])) { + // Convert to store display currency using store exchange rate + $totalEstimate = $totalEstimate * $rates[$baseCurrencyCode]; + } else { + $rates = $currency->getCurrencyRates($baseCurrencyCode, array($currencyCode)); + if (!empty($rates) && isset($rates[$currencyCode])) { + $totalEstimate = $totalEstimate/$rates[$currencyCode]; + } + if (!isset($rates[$currencyCode]) || !$totalEstimate) { + $totalEstimate = false; + $this->_errors[] = Mage::helper('usa')->__("Exchange rate %s (Base Currency) -> %s not found. DHL method %s skipped", $currencyCode, $baseCurrencyCode, $dhlProductDescription); + } + } + } + if ($totalEstimate) { + $data = array('term' => $dhlProductDescription, + 'price_total' => $this->getMethodPrice($totalEstimate, $dhlProduct)); + if (!empty($this->_rates)) { + foreach ($this->_rates as $product) { + if ($product['data']['term'] == $data['term'] + && $product['data']['price_total'] == $data['price_total'] + ) { + return $this; + } + } + } + $this->_rates[] = array('service' => $dhlProduct, 'data' => $data); + } else { + $this->_errors[] = Mage::helper('usa')->__("Zero shipping charge for '%s'", $dhlProductDescription); + } + } else { + $dhlProductDescription = false; + if (isset($shipmentDetails->GlobalProductCode)) { + $dhlProductDescription = $this->getDhlProductTitle((string)$shipmentDetails->GlobalProductCode); + } + $dhlProductDescription = $dhlProductDescription ? $dhlProductDescription : Mage::helper('usa')->__("DHL"); + $this->_errors[] = Mage::helper('usa')->__("Zero shipping charge for '%s'", $dhlProductDescription); + } + return $this; + } + + /** + * Returns dimension unit (cm or inch) + * + * @return string + */ + protected function _getDimensionUnit() + { + $countryId = $this->_rawRequest->getOrigCountryId(); + $measureUnit = $this->getCountryParams($countryId)->getMeasureUnit(); + if (empty($measureUnit)) { + Mage::throwException(Mage::helper('usa')->__("Cannot identify measure unit for %s", $countryId)); + } + return $measureUnit; + } + + /** + * Returns weight unit (kg or pound) + * + * @return string + */ + protected function _getWeightUnit() + { + $countryId = $this->_rawRequest->getOrigCountryId(); + $weightUnit = $this->getCountryParams($countryId)->getWeightUnit(); + if (empty($weightUnit)) { + Mage::throwException(Mage::helper('usa')->__("Cannot identify weight unit for %s", $countryId)); + } + return $weightUnit; + } + + /** + * Get Country Params by Country Code + * + * @param string $countryCode + * @return Varien_Object + * + * @see $countryCode ISO 3166 Codes (Countries) A2 + */ + protected function getCountryParams($countryCode) + { + if (empty($this->_countryParams)) { + $dhlConfigPath = Mage::getModuleDir('etc', 'Mage_Usa') . DS . 'dhl' . DS; + $countriesXml = file_get_contents($dhlConfigPath . 'international' . DS . 'countries.xml'); + $this->_countryParams = new Varien_Simplexml_Element($countriesXml); + } + if (isset($this->_countryParams->$countryCode)) { + $countryParams = new Varien_Object($this->_countryParams->$countryCode->asArray()); + } + return isset($countryParams) ? $countryParams : new Varien_Object(); + } + + /** + * Do shipment request to carrier web service, obtain Print Shipping Labels and process errors in response + * + * @param Varien_Object $request + * @return Varien_Object + */ + protected function _doShipmentRequest(Varien_Object $request) + { + $this->_prepareShipmentRequest($request); + $this->_mapRequestToShipment($request); + $this->setRequest($request); + + return $this->_doRequest(); + } + + /** + * Processing additional validation to check is carrier applicable. + * + * @param Mage_Shipping_Model_Rate_Request $request + * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean + */ + public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request) + { + //Skip by item validation if there is no items in request + if (!count($this->getAllItems($request))) { + $this->_errors[] = Mage::helper('usa')->__('There is no items in this order'); + } + + $countryParams = $this->getCountryParams( + Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $request->getStoreId()) + ); + if (!$countryParams->getData()) { + $this->_errors[] = Mage::helper('usa')->__('Please, specify origin country'); + } + + if (!empty($this->_errors)) { + return $this->_showError(); + } + + return $this; + } + + /** + * Show default error + * + * @return bool|Mage_Shipping_Model_Rate_Result_Error + */ + protected function _showError() + { + $showMethod = $this->getConfigData('showmethod'); + + if ($showMethod) { + /* @var $error Mage_Shipping_Model_Rate_Result_Error */ + $error = Mage::getModel('shipping/rate_result_error'); + $error->setCarrier(self::CODE); + $error->setCarrierTitle($this->getConfigData('title')); + $error->setErrorMessage($this->getConfigData('specificerrmsg')); + $this->_debug($this->_errors); + return $error; + } else { + return false; + } + } + + /** + * Return container types of carrier + * + * @param Varien_Object|null $params + * @return array + */ + public function getContainerTypes(Varien_Object $params = null) + { + return array( + self::DHL_CONTENT_TYPE_DOC => Mage::helper('usa')->__('Documents'), + self::DHL_CONTENT_TYPE_NON_DOC => Mage::helper('usa')->__('Non Documents') + ); + } + + /** + * Map request to shipment + * + * @param Varien_Object $request + * @return null + */ + protected function _mapRequestToShipment(Varien_Object $request) + { + + $request->setOrigCountryId($request->getShipperAddressCountryCode()); + $this->_rawRequest = $request; + $customsValue = 0; + $packageWeight = 0; + $packages = $request->getPackages(); + foreach ($packages as &$piece) { + $params = $piece['params']; + if ($params['width'] || $params['length'] || $params['height']) { + $minValue = $this->_getMinDimension($params['dimension_units']); + if ($params['width'] < $minValue || $params['length'] < $minValue || $params['height'] < $minValue) { + $message = Mage::helper('usa')->__('Height, width and length should be equal or greater than %s', $minValue); + Mage::throwException($message); + } + } + + $weightUnits = $piece['params']['weight_units']; + $piece['params']['height'] = $this->_getDimension($piece['params']['height'], $weightUnits); + $piece['params']['length'] = $this->_getDimension($piece['params']['length'], $weightUnits); + $piece['params']['width'] = $this->_getDimension($piece['params']['width'], $weightUnits); + $piece['params']['dimension_units'] = $this->_getDimensionUnit(); + $piece['params']['weight'] = $this->_getWeight($piece['params']['weight'], false, $weightUnits); + $piece['params']['weight_units'] = $this->_getWeightUnit(); + + $customsValue += $piece['params']['customs_value']; + $packageWeight += $piece['params']['weight']; + } + + $request->setPackages($packages) + ->setPackageWeight($packageWeight) + ->setPackageValue($customsValue) + ->setValueWithDiscount($customsValue) + ->setPackageCustomsValue($customsValue) + ->setFreeMethodWeight(0); + } + + /** + * Retrieve minimum allowed value for dimensions in given dimension unit + * + * @param string $dimensionUnit + * @return int + */ + protected function _getMinDimension($dimensionUnit) + { + return $dimensionUnit == "CENTIMETER" ? self::DIMENSION_MIN_CM : self::DIMENSION_MIN_IN; + } + + /** + * Do rate request and handle errors + * + * @return Mage_Shipping_Model_Rate_Result|Varien_Object + */ + protected function _doRequest() + { + $rawRequest = $this->_request; + + $originRegion = (string)$this->getCountryParams( + Mage::getStoreConfig(Mage_Shipping_Model_Shipping::XML_PATH_STORE_COUNTRY_ID, $this->getStore()) + )->region; + + if (!$originRegion) { + Mage::throwException(Mage::helper('usa')->__('Wrong Region.')); + } + + if ($originRegion == 'AM') { + $originRegion = ''; + } + + $xmlStr = '' + . ''; + $xml = new SimpleXMLElement($xmlStr); + + $nodeRequest = $xml->addChild('Request', '', ''); + $nodeServiceHeader = $nodeRequest->addChild('ServiceHeader'); + $nodeServiceHeader->addChild('SiteID', (string)$this->getConfigData('id')); + $nodeServiceHeader->addChild('Password', (string)$this->getConfigData('password')); + + if (!$originRegion) { + $xml->addChild('RequestedPickupTime', 'N', ''); + } + $xml->addChild('NewShipper', 'N', ''); + $xml->addChild('LanguageCode', 'EN', ''); + $xml->addChild('PiecesEnabled', 'Y', ''); + + /* Billing */ + $nodeBilling = $xml->addChild('Billing', '', ''); + $nodeBilling->addChild('ShipperAccountNumber', (string)$this->getConfigData('account')); + /* + * Method of Payment: + * S (Shipper) + * R (Receiver) + * T (Third Party) + */ + $nodeBilling->addChild('ShippingPaymentType', 'S'); + + /* + * Shipment bill to account – required if Shipping PaymentType is other than 'S' + */ + $nodeBilling->addChild('BillingAccountNumber', (string)$this->getConfigData('account')); + $nodeBilling->addChild('DutyPaymentType', 'S'); + $nodeBilling->addChild('DutyAccountNumber', (string)$this->getConfigData('account')); + + /* Receiver */ + $nodeConsignee = $xml->addChild('Consignee', '', ''); + + $companyName = ($rawRequest->getRecipientContactCompanyName()) + ? $rawRequest->getRecipientContactCompanyName() + : $rawRequest->getRecipientContactPersonName(); + + $nodeConsignee->addChild('CompanyName', substr($companyName, 0, 35)); + + $address = $rawRequest->getRecipientAddressStreet1(). ' ' . $rawRequest->getRecipientAddressStreet2(); + $address = Mage::helper('core/string')->str_split($address, 35, false, true); + if (is_array($address)) { + foreach ($address as $addressLine) { + $nodeConsignee->addChild('AddressLine', $addressLine); + } + } else { + $nodeConsignee->addChild('AddressLine', $address); + } + + $nodeConsignee->addChild('City', $rawRequest->getRecipientAddressCity()); + $nodeConsignee->addChild('Division', $rawRequest->getRecipientAddressStateOrProvinceCode()); + $nodeConsignee->addChild('PostalCode', $rawRequest->getRecipientAddressPostalCode()); + $nodeConsignee->addChild('CountryCode', $rawRequest->getRecipientAddressCountryCode()); + $nodeConsignee->addChild('CountryName', + (string)$this->getCountryParams($rawRequest->getRecipientAddressCountryCode())->name + ); + $nodeContact = $nodeConsignee->addChild('Contact'); + $nodeContact->addChild('PersonName', substr($rawRequest->getRecipientContactPersonName(), 0, 34)); + $nodeContact->addChild('PhoneNumber', substr($rawRequest->getRecipientContactPhoneNumber(), 0, 24)); + + /* Commodity + * The CommodityCode element contains commodity code for shipment contents. Its + * value should lie in between 1 to 9999.This field is mandatory. + */ + $nodeCommodity = $xml->addChild('Commodity', '', ''); + $nodeCommodity->addChild('CommodityCode', '1'); + + $this->_checkDomesticStatus($rawRequest->getShipperAddressCountryCode(), + $rawRequest->getRecipientAddressCountryCode() + ); + + /* Dutiable */ + if ($this->getConfigData('content_type') == self::DHL_CONTENT_TYPE_NON_DOC && !$this->_isDomestic) { + $nodeDutiable = $xml->addChild('Dutiable', '', ''); + $nodeDutiable->addChild('DeclaredValue', + sprintf("%.2F", $rawRequest->getOrderShipment()->getOrder()->getSubtotal()) + ); + $baseCurrencyCode = Mage::app()->getWebsite($rawRequest->getWebsiteId())->getBaseCurrencyCode(); + $nodeDutiable->addChild('DeclaredCurrency', $baseCurrencyCode); + } + + /* Reference + * This element identifies the reference information. It is an optional field in the + * shipment validation request. Only the first reference will be taken currently. + */ + $nodeReference = $xml->addChild('Reference', '', ''); + $nodeReference->addChild('ReferenceID', 'shipment reference'); + $nodeReference->addChild('ReferenceType', 'St'); + + /* Shipment Details */ + $this->_shipmentDetails($xml, $rawRequest, $originRegion); + + /* Shipper */ + $nodeShipper = $xml->addChild('Shipper', '', ''); + $nodeShipper->addChild('ShipperID', (string)$this->getConfigData('account')); + $nodeShipper->addChild('CompanyName', $rawRequest->getShipperContactCompanyName()); + $nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account')); + + $address = $rawRequest->getShipperAddressStreet1(). ' ' . $rawRequest->getShipperAddressStreet2(); + $address = Mage::helper('core/string')->str_split($address, 35, false, true); + if (is_array($address)) { + foreach ($address as $addressLine) { + $nodeShipper->addChild('AddressLine', $addressLine); + } + } else { + $nodeShipper->addChild('AddressLine', $address); + } + + $nodeShipper->addChild('City', $rawRequest->getShipperAddressCity()); + $nodeShipper->addChild('Division', $rawRequest->getShipperAddressStateOrProvinceCode()); + $nodeShipper->addChild('PostalCode', $rawRequest->getShipperAddressPostalCode()); + $nodeShipper->addChild('CountryCode', $rawRequest->getShipperAddressCountryCode()); + $nodeShipper->addChild('CountryName', + (string)$this->getCountryParams($rawRequest->getShipperAddressCountryCode())->name + ); + $nodeContact = $nodeShipper->addChild('Contact', '', ''); + $nodeContact->addChild('PersonName', substr($rawRequest->getShipperContactPersonName(), 0, 34)); + $nodeContact->addChild('PhoneNumber', substr($rawRequest->getShipperContactPhoneNumber(), 0, 24)); + + $request = $xml->asXML(); + $request = utf8_encode($request); + + $responseBody = $this->_getCachedQuotes($request); + if ($responseBody === null) { + $debugData = array('request' => $request); + try { + $client = new Varien_Http_Client(); + $client->setUri((string)$this->getConfigData('gateway_url')); + $client->setConfig(array('maxredirects' => 0, 'timeout' => 30)); + $client->setRawData($request); + $responseBody = $client->request(Varien_Http_Client::POST)->getBody(); + $debugData['result'] = $responseBody; + $this->_setCachedQuotes($request, $responseBody); + } catch (Exception $e) { + $this->_errors[$e->getCode()] = $e->getMessage(); + $responseBody = ''; + } + $this->_debug($debugData); + } + $this->_isShippingLabelFlag = true; + return $this->_parseResponse($responseBody); + } + + /** + * Generation Shipment Details Node according to origin region + * + * @param SimpleXMLElement $xml + * @param Mage_Shipping_Model_Rate_Request $rawRequest + * @param string $originRegion + * @return void + */ + protected function _shipmentDetails($xml, $rawRequest, $originRegion = '') + { + $nodeShipmentDetails = $xml->addChild('ShipmentDetails', '', ''); + $nodeShipmentDetails->addChild('NumberOfPieces', count($rawRequest->getPackages())); + + if ($originRegion) { + $nodeShipmentDetails->addChild('CurrencyCode', + Mage::app()->getWebsite($this->_request->getWebsiteId())->getBaseCurrencyCode() + ); + } + + $nodePieces = $nodeShipmentDetails->addChild('Pieces', '', ''); + + /* + * Package type + * EE (DHL Express Envelope), OD (Other DHL Packaging), CP (Custom Packaging) + * DC (Document), DM (Domestic), ED (Express Document), FR (Freight) + * BD (Jumbo Document), BP (Jumbo Parcel), JD (Jumbo Junior Document) + * JP (Jumbo Junior Parcel), PA (Parcel), DF (DHL Flyer) + */ + $i = 0; + foreach ($rawRequest->getPackages() as $package) { + $nodePiece = $nodePieces->addChild('Piece', '', ''); + $packageType = 'EE'; + if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) { + $packageType = 'CP'; + } + $nodePiece->addChild('PieceID', ++$i); + $nodePiece->addChild('PackageType', $packageType); + $nodePiece->addChild('Weight', round($package['params']['weight'],1)); + $params = $package['params']; + if ($params['width'] && $params['length'] && $params['height']) { + if (!$originRegion) { + $nodePiece->addChild('Width', round($params['width'])); + $nodePiece->addChild('Height', round($params['height'])); + $nodePiece->addChild('Depth', round($params['length'])); + } else { + $nodePiece->addChild('Depth', round($params['length'])); + $nodePiece->addChild('Width', round($params['width'])); + $nodePiece->addChild('Height', round($params['height'])); + } + } + $content = array(); + foreach ($package['items'] as $item) { + $content[] = $item['name']; + } + $nodePiece->addChild('PieceContents', substr(implode(',', $content), 0, 34)); + } + + if (!$originRegion) { + $nodeShipmentDetails->addChild('Weight', round($rawRequest->getPackageWeight(),1)); + + $nodeShipmentDetails->addChild('WeightUnit', substr($this->_getWeightUnit(),0,1)); + + $nodeShipmentDetails->addChild('GlobalProductCode', $rawRequest->getShippingMethod()); + $nodeShipmentDetails->addChild('LocalProductCode', $rawRequest->getShippingMethod()); + + $nodeShipmentDetails->addChild('Date', Mage::getModel('core/date')->date('Y-m-d')); + $nodeShipmentDetails->addChild('Contents', 'DHL Parcel'); + /* + * The DoorTo Element defines the type of delivery service that applies to the shipment. + * The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to + * Door non-compliant) + */ + $nodeShipmentDetails->addChild('DoorTo', 'DD'); + $nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(),0,1)); + if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) { + $packageType = 'CP'; + } + $nodeShipmentDetails->addChild('PackageType', $packageType); + if ($this->getConfigData('content_type') == self::DHL_CONTENT_TYPE_NON_DOC) { + $nodeShipmentDetails->addChild('IsDutiable', 'Y'); + } + $nodeShipmentDetails->addChild('CurrencyCode', + Mage::app()->getWebsite($this->_request->getWebsiteId())->getBaseCurrencyCode() + ); + } else { + if ($package['params']['container'] == self::DHL_CONTENT_TYPE_NON_DOC) { + $packageType = 'CP'; + } + $nodeShipmentDetails->addChild('PackageType', $packageType); + $nodeShipmentDetails->addChild('Weight', $rawRequest->getPackageWeight()); + + $nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(),0,1)); + $nodeShipmentDetails->addChild('WeightUnit', substr($this->_getWeightUnit(),0,1)); + + $nodeShipmentDetails->addChild('GlobalProductCode', $rawRequest->getShippingMethod()); + $nodeShipmentDetails->addChild('LocalProductCode', $rawRequest->getShippingMethod()); + + /* + * The DoorTo Element defines the type of delivery service that applies to the shipment. + * The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to + * Door non-compliant) + */ + $nodeShipmentDetails->addChild('DoorTo', 'DD'); + $nodeShipmentDetails->addChild('Date', Mage::getModel('core/date')->date('Y-m-d')); + $nodeShipmentDetails->addChild('Contents', 'DHL Parcel'); + } + } + + /** + * Get tracking + * + * @param mixed $trackings + * @return mixed + */ + public function getTracking($trackings) + { + if (!is_array($trackings)) { + $trackings = array($trackings); + } + $this->_getXMLTracking($trackings); + + return $this->_result; + } + + /** + * Send request for tracking + * + * @param array $trackings + * @return void + */ + protected function _getXMLTracking($trackings) + { + $xmlStr = '' + . ''; + + $xml = new SimpleXMLElement($xmlStr); + + $requestNode = $xml->addChild('Request', '', ''); + $serviceHeaderNode = $requestNode->addChild('ServiceHeader', '', ''); + $serviceHeaderNode->addChild('SiteID', (string)$this->getConfigData('id')); + $serviceHeaderNode->addChild('Password', (string)$this->getConfigData('password')); + + $xml->addChild('LanguageCode', 'EN', ''); + foreach ($trackings as $tracking) { + $xml->addChild('AWBNumber', $tracking, ''); + } + /* + * Checkpoint details selection flag + * LAST_CHECK_POINT_ONLY + * ALL_CHECK_POINTS + */ + $xml->addChild('LevelOfDetails', 'ALL_CHECK_POINTS', ''); + + /* + * Value that indicates for getting the tracking details with the additional + * piece details and its respective Piece Details, Piece checkpoints along with + * Shipment Details if queried. + * + * S-Only Shipment Details + * B-Both Shipment & Piece Details + * P-Only Piece Details + * Default is ‘S’ + */ + //$xml->addChild('PiecesEnabled', 'ALL_CHECK_POINTS'); + + $request = $xml->asXML(); + $request = utf8_encode($request); + + $responseBody = $this->_getCachedQuotes($request); + if ($responseBody === null) { + $debugData = array('request' => $request); + try { + $client = new Varien_Http_Client(); + $client->setUri((string)$this->getConfigData('gateway_url')); + $client->setConfig(array('maxredirects' => 0, 'timeout' => 30)); + $client->setRawData($request); + $responseBody = $client->request(Varien_Http_Client::POST)->getBody(); + $debugData['result'] = $responseBody; + $this->_setCachedQuotes($request, $responseBody); + } catch (Exception $e) { + $this->_errors[$e->getCode()] = $e->getMessage(); + $responseBody = ''; + } + $this->_debug($debugData); + } + + $this->_parseXmlTrackingResponse($trackings, $responseBody); + } + + /** + * Parse xml tracking response + * + * @param array $trackings + * @param string $response + * @return void + */ + protected function _parseXmlTrackingResponse($trackings, $response) + { + $errorTitle = Mage::helper('usa')->__('Unable to retrieve tracking'); + $resultArr = array(); + + $htmlTranslationTable = get_html_translation_table(HTML_ENTITIES); + unset($htmlTranslationTable['<'], $htmlTranslationTable['>'], $htmlTranslationTable['"']); + $response = str_replace(array_keys($htmlTranslationTable), array_values($htmlTranslationTable), $response); + + if (strlen(trim($response)) > 0) { + $xml = simplexml_load_string($response); + if (!is_object($xml)) { + $errorTitle = Mage::helper('usa')->__('Response is in the wrong format'); + } + if (is_object($xml) && ((isset($xml->Response->Status->ActionStatus) + && $xml->Response->Status->ActionStatus == 'Failure') + || isset($xml->GetQuoteResponse->Note->Condition)) + ) { + if (isset($xml->Response->Status->Condition)) { + $nodeCondition = $xml->Response->Status->Condition; + } + + $code = isset($nodeCondition->ConditionCode) ? (string)$nodeCondition->ConditionCode : 0; + $data = isset($nodeCondition->ConditionData) ? (string)$nodeCondition->ConditionData : ''; + $this->_errors[$code] = Mage::helper('usa')->__('Error #%s : %s', $code, $data); + } elseif (is_object($xml) && is_object($xml->AWBInfo)) { + foreach ($xml->AWBInfo as $awbinfo) { + $awbinfoData = array(); + $trackNum = isset($awbinfo->AWBNumber) ? (string)$awbinfo->AWBNumber : ''; + if (!is_object($awbinfo) || !$awbinfo->ShipmentInfo) { + $this->_errors[$trackNum] = Mage::helper('usa')->__('Unable to retrieve tracking'); + continue; + } + $shipmentInfo = $awbinfo->ShipmentInfo; + + if ($shipmentInfo->ShipmentDesc) { + $awbinfoData['service'] = (string)$shipmentInfo->ShipmentDesc; + } + + $awbinfoData['weight'] = (string)$shipmentInfo->Weight . ' ' . (string)$shipmentInfo->WeightUnit; + + $packageProgress = array(); + if (isset($shipmentInfo->ShipmentEvent)) { + foreach ($shipmentInfo->ShipmentEvent as $shipmentEvent) { + $shipmentEventArray = array(); + $shipmentEventArray['activity'] = (string)$shipmentEvent->ServiceEvent->EventCode + . ' ' . (string)$shipmentEvent->ServiceEvent->Description; + $shipmentEventArray['deliverydate'] = (string)$shipmentEvent->Date; + $shipmentEventArray['deliverytime'] = (string)$shipmentEvent->Time; + $shipmentEventArray['deliverylocation'] = (string)$shipmentEvent->ServiceArea->Description + . ' [' . (string)$shipmentEvent->ServiceArea->ServiceAreaCode . ']'; + $packageProgress[] = $shipmentEventArray; + } + $awbinfoData['progressdetail'] = $packageProgress; + } + $resultArr[$trackNum] = $awbinfoData; + } + } + } + + $result = Mage::getModel('shipping/tracking_result'); + + if (!empty($resultArr)) { + foreach ($resultArr as $trackNum => $data) { + $tracking = Mage::getModel('shipping/tracking_result_status'); + $tracking->setCarrier($this->_code); + $tracking->setCarrierTitle($this->getConfigData('title')); + $tracking->setTracking($trackNum); + $tracking->addData($data); + $result->append($tracking); + } + } + + if (!empty($this->_errors) || empty($resultArr)) { + $resultArr = !empty($this->_errors) ? $this->_errors : $trackings; + foreach ($resultArr as $trackNum => $err) { + $error = Mage::getModel('shipping/tracking_result_error'); + $error->setCarrier($this->_code); + $error->setCarrierTitle($this->getConfigData('title')); + $error->setTracking(!empty($this->_errors) ? $trackNum : $err); + $error->setErrorMessage(!empty($this->_errors) ? $err : $errorTitle); + $result->append($error); + } + } + + $this->_result = $result; + } + + /** + * Get final price for shipping method with handling fee per package + * + * @param float $cost + * @param string $handlingType + * @param float $handlingFee + * @return float + */ + protected function _getPerpackagePrice($cost, $handlingType, $handlingFee) + { + if ($handlingType == Mage_Shipping_Model_Carrier_Abstract::HANDLING_TYPE_PERCENT) { + return $cost + ($cost * $this->_numBoxes * $handlingFee / 100); + } + + return $cost + $this->_numBoxes * $handlingFee; + } + + /** + * Do request to shipment + * + * @param Mage_Shipping_Model_Shipment_Request $request + * @return Varien_Object + */ + public function requestToShipment(Mage_Shipping_Model_Shipment_Request $request) + { + $packages = $request->getPackages(); + if (!is_array($packages) || !$packages) { + Mage::throwException(Mage::helper('usa')->__('No packages for request')); + } + $result = $this->_doShipmentRequest($request); + + $response = new Varien_Object(array( + 'info' => array(array( + 'tracking_number' => $result->getTrackingNumber(), + 'label_content' => $result->getShippingLabelContent() + )) + )); + + $request->setMasterTrackingId($result->getTrackingNumber()); + + return $response; + } + + /** + * Check if shipping is domestic + * + * @param string $origCountryCode + * @param string $destCountryCode + * @return bool + */ + protected function _checkDomesticStatus($origCountryCode, $destCountryCode) + { + $this->_isDomestic = false; + + $origCountry = (string)$this->getCountryParams($origCountryCode)->name; + $destCountry = (string)$this->getCountryParams($destCountryCode)->name; + $isDomestic = (string)$this->getCountryParams($destCountryCode)->domestic; + + if ($origCountry == $destCountry && $isDomestic) { + $this->_isDomestic = true; + } + + return $this->_isDomestic; + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php new file mode 100644 index 0000000..288bedd --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Contenttype.php @@ -0,0 +1,50 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Contenttype +{ + /** + * Returns array to be used in multiselect on back-end + * + * @return array + */ + public function toOptionArray() + { + return array( + array('label' => Mage::helper('usa')->__('Documents'), + 'value' => Mage_Usa_Model_Shipping_Carrier_Dhl_International::DHL_CONTENT_TYPE_DOC), + array('label' => Mage::helper('usa')->__('Non documents'), + 'value' => Mage_Usa_Model_Shipping_Carrier_Dhl_International::DHL_CONTENT_TYPE_NON_DOC), + ); + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Abstract.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Abstract.php new file mode 100644 index 0000000..8fe3137 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Abstract.php @@ -0,0 +1,72 @@ + + */ +abstract class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Abstract +{ + /** + * Carrier Product Type Indicator + * + * @var string $_contentType + */ + protected $_contentType; + + /** + * Show 'none' in methods list or not; + * + * @var bool + */ + protected $_noneMethod = false; + + /** + * Returns array to be used in multiselect on back-end + * + * @return array + */ + public function toOptionArray() + { + /* @var $carrierModel Mage_Usa_Model_Shipping_Carrier_Dhl_International */ + $carrierModel = Mage::getSingleton('usa/shipping_carrier_dhl_international'); + $dhlProducts = $carrierModel->getDhlProducts($this->_contentType); + + $options = array(); + foreach ($dhlProducts as $code => $title) { + $options[] = array('value' => $code, 'label' => $title); + } + + if ($this->_noneMethod) { + array_unshift($options, array('value' => '', 'label' => Mage::helper('usa')->__('None'))); + } + + return $options; + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Doc.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Doc.php new file mode 100644 index 0000000..2fc825d --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Doc.php @@ -0,0 +1,43 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Doc + extends Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Abstract +{ + /** + * Carrier Product Type Indicator + * + * @var string $_contentType + */ + protected $_contentType = Mage_Usa_Model_Shipping_Carrier_Dhl_International::DHL_CONTENT_TYPE_DOC; +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Freedoc.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Freedoc.php new file mode 100644 index 0000000..577024e --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Freedoc.php @@ -0,0 +1,50 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Freedoc + extends Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Abstract +{ + /** + * Carrier Product Type Indicator + * + * @var string $_contentType + */ + protected $_contentType = Mage_Usa_Model_Shipping_Carrier_Dhl_International::DHL_CONTENT_TYPE_DOC; + + /** + * Show 'none' in methods list or not; + * + * @var bool + */ + protected $_noneMethod = true; +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Freenondoc.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Freenondoc.php new file mode 100644 index 0000000..10cffcf --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Freenondoc.php @@ -0,0 +1,50 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Freenondoc + extends Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Abstract +{ + /** + * Carrier Product Type Indicator + * + * @var string $_contentType + */ + protected $_contentType = Mage_Usa_Model_Shipping_Carrier_Dhl_International::DHL_CONTENT_TYPE_NON_DOC; + + /** + * Show 'none' in methods list or not; + * + * @var bool + */ + protected $_noneMethod = true; +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Nondoc.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Nondoc.php new file mode 100644 index 0000000..e370db4 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Nondoc.php @@ -0,0 +1,43 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Nondoc + extends Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Abstract +{ + /** + * Carrier Product Type Indicator + * + * @var string $_contentType + */ + protected $_contentType = Mage_Usa_Model_Shipping_Carrier_Dhl_International::DHL_CONTENT_TYPE_NON_DOC; +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Size.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Size.php new file mode 100644 index 0000000..88402b5 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Size.php @@ -0,0 +1,51 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Size +{ + /** + * Returns array to be used in multiselect on back-end + * + * @return array + */ + public function toOptionArray() + { + $unitArr = Mage::getSingleton('usa/shipping_carrier_dhl_international')->getCode('size'); + + $returnArr = array(); + foreach ($unitArr as $key => $val) { + $returnArr[] = array('value' => $key, 'label' => $val); + } + return $returnArr; + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Unitofmeasure.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Unitofmeasure.php new file mode 100644 index 0000000..b319955 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/International/Source/Method/Unitofmeasure.php @@ -0,0 +1,51 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_International_Source_Method_Unitofmeasure +{ + /** + * Returns array to be used in multiselect on back-end + * + * @return array + */ + public function toOptionArray() + { + $unitArr = Mage::getSingleton('usa/shipping_carrier_dhl_international')->getCode('unit_of_measure'); + + $returnArr = array(); + foreach ($unitArr as $key => $val) { + $returnArr[] = array('value' => $key, 'label' => $val); + } + return $returnArr; + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php new file mode 100644 index 0000000..be9fbcf --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf.php @@ -0,0 +1,118 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf +{ + /** + * Label Information + * + * @var SimpleXMLElement + */ + protected $_info; + + /** + * Shipment Request + * + * @var Mage_Shipping_Model_Shipment_Request + */ + protected $_request; + + /** + * Dhl International Label Creation Class constructor + * + * @param array $arguments + */ + public function __construct(array $arguments) + { + $this->_info = $arguments['info']; + $this->_request = $arguments['request']; + } + + /** + * Create Label + * + * @return string + * @throws Zend_Pdf_Exception + * @throws InvalidArgumentException + */ + public function render() + { + $pdf = new Zend_Pdf(); + + $pdfBuilder = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder(); + + $template = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page(Zend_Pdf_Page::SIZE_A4_LANDSCAPE); + $pdfBuilder->setPage($template) + ->addProductName((string)$this->_info->ProductShortName) + ->addProductContentCode((string)$this->_info->ProductContentCode) + //->addUnitId({unitId}) + //->addReferenceData({referenceData}) + ->addSenderInfo($this->_info->Shipper) + ->addOriginInfo((string)$this->_info->OriginServiceArea->ServiceAreaCode) + ->addReceiveInfo($this->_info->Consignee) + ->addDestinationFacilityCode( + (string)$this->_info->Consignee->CountryCode, + (string)$this->_info->DestinationServiceArea->ServiceAreaCode, + (string)$this->_info->DestinationServiceArea->FacilityCode + ) + ->addServiceFeaturesCodes() + ->addDeliveryDateCode() + ->addShipmentInformation($this->_request->getOrderShipment()) + ->addDateInfo($this->_info->ShipmentDate) + ->addWeightInfo((string)$this->_info->ChargeableWeight, (string)$this->_info->WeightUnit) + ->addWaybillBarcode((string)$this->_info->AirwayBillNumber, (string)$this->_info->Barcodes->AWBBarCode) + ->addRoutingBarcode( + (string)$this->_info->DHLRoutingCode, + (string)$this->_info->DHLRoutingDataId, + (string)$this->_info->Barcodes->DHLRoutingBarCode + ) + ->addBorder(); + + $packages = array_values($this->_request->getPackages()); + $i = 0; + foreach ($this->_info->Pieces->Piece as $piece) { + $page = new Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page($template); + $pdfBuilder->setPage($page) + ->addPieceNumber((int)$piece->PieceNumber, (int)$this->_info->Piece) + ->addContentInfo($packages[$i]) + ->addPieceIdBarcode( + (string)$piece->DataIdentifier, + (string)$piece->LicensePlate, + (string)$piece->LicensePlateBarCode + ); + array_push($pdf->pages, $page); + $i++; + } + return $pdf->render(); + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php new file mode 100644 index 0000000..254ae7b --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/Page.php @@ -0,0 +1,150 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page extends Zend_Pdf_Page +{ + /** + * Text align constants + */ + const ALIGN_RIGHT = 'right'; + const ALIGN_LEFT = 'left'; + const ALIGN_CENTER = 'center'; + + /** + * Dhl International Label Creation Class Pdf Page constructor + * Create/Make a copy of pdf page + * + * @param Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page|string $param1 + * @param null $param2 + * @param null $param3 + */ + public function __construct($param1, $param2 = null, $param3 = null) + { + if ($param1 instanceof Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page + && $param2 === null && $param3 === null + ) { + $this->_contents = $param1->getContents(); + } + parent::__construct($param1, $param2, $param3); + } + + /** + * Get PDF Page contents + * + * @return string + */ + public function getContents() + { + return $this->_contents; + } + + /** + * Calculate the width of given text in points taking into account current font and font-size + * + * @param string $text + * @param Zend_Pdf_Resource_Font $font + * @param float $font_size + * @return float + */ + public function getTextWidth($text, Zend_Pdf_Resource_Font $font, $font_size) + { + $drawing_text = iconv('', 'UTF-16BE', $text); + $characters = array(); + for ($i = 0; $i < strlen($drawing_text); $i++) { + $characters[] = (ord($drawing_text[$i++]) << 8) | ord($drawing_text[$i]); + } + $glyphs = $font->glyphNumbersForCharacters($characters); + $widths = $font->widthsForGlyphs($glyphs); + $text_width = (array_sum($widths) / $font->getUnitsPerEm()) * $font_size; + return $text_width; + } + + /** + * Draw a line of text at the specified position. + * + * @param string $text + * @param float $x + * @param float $y + * @param string $charEncoding (optional) Character encoding of source text. + * Defaults to current locale. + * @param $align + * @throws Zend_Pdf_Exception + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page + */ + public function drawText($text, $x, $y, $charEncoding = '', $align = self::ALIGN_LEFT) + { + $left = null; + switch ($align) { + case self::ALIGN_LEFT: + $left = $x; + break; + + case self::ALIGN_CENTER: + $textWidth = $this->getTextWidth($text, $this->getFont(), $this->getFontSize()); + $left = $x - ($textWidth / 2); + break; + + case self::ALIGN_RIGHT: + $textWidth = $this->getTextWidth($text, $this->getFont(), $this->getFontSize()); + $left = $x - $textWidth; + break; + } + return parent::drawText($text, $left, $y, $charEncoding); + } + + /** + * Draw a text paragraph taking into account the maximum number of symbols in a row. + * If line is longer - spit it. + * + * @param array $lines + * @param int $x + * @param int $y + * @param int $maxWidth - number of symbols + * @param string $align + * @throws Zend_Pdf_Exception + * @return float + */ + public function drawLines($lines, $x, $y, $maxWidth, $align = self::ALIGN_LEFT) + { + foreach ($lines as $line) { + if (strlen($line) > $maxWidth) { + $subLines = Mage::helper('core/string')->str_split($line, $maxWidth, true, true); + $y = $this->drawLines(array_filter($subLines), $x, $y, $maxWidth, $align); + continue; + } + $this->drawText($line, $x, $y, null, $align); + $y -= ceil($this->getFontSize()); + } + return $y; + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php new file mode 100644 index 0000000..0bf6537 --- /dev/null +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Label/Pdf/PageBuilder.php @@ -0,0 +1,666 @@ + + */ +class Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder +{ + /** + * X coordinate of a block + */ + const X_INDENT = 60; + + /** + * Y coordinate of a block + */ + const Y_INDENT = 15; + + /** + * Pdf Page Instance + * + * @var Zend_Pdf_Page + */ + protected $_page; + + /** + * Create font instances + */ + public function __construct() + { + $this->_fontNormal = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA); + $this->_fontBold = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA_BOLD); + } + + /** + * Get Page + * + * @return Zend_Pdf_Page + */ + public function getPage() + { + return $this->_page; + } + + /** + * Set Page + * + * @param Zend_Pdf_Page $page + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + */ + public function setPage(Zend_Pdf_Page $page) + { + $this->_page = $page; + return $this; + } + + /** + * Calculate x coordinate with identation + * + * @param int $pt + * @return int + */ + protected function _x($pt) + { + return $pt + self::X_INDENT; + } + + /** + * Calculate y coordinate with identation + * + * @param int $pt + * @return int + */ + protected function _y($pt) + { + return 595 - self::Y_INDENT - $pt; + } + + /** + * Add Border + * + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page + * @throws Zend_Pdf_Exception + */ + public function addBorder() + { + $x = $this->_x(0); + $y = $this->_y(0); + + $image = new Zend_Pdf_Resource_Image_Jpeg(Mage::getBaseDir('media') . DS . 'dhl' . DS . 'logo.jpg'); + $this->_page->drawImage($image, $x + 191, $this->_y(27), $x + 287, $this->_y(1)); + + /* Vertical borders */ + $this->_page->drawLine($x, $y, $x, $this->_y(568)); + $this->_page->drawLine($x + 287.5, $y, $x + 287.5, $this->_y(568)); + $this->_page->drawLine($x + 139.5, $y, $x + 139.5, $this->_y(28)); + $this->_page->drawLine($x + 190.5, $y, $x + 190.5, $this->_y(28)); + + /* Horisontal borders */ + $this->_page->drawLine($x, $y, $x + 288, $y); + $this->_page->drawLine($x, $this->_y(28), $x + 288, $this->_y(28)); + $this->_page->drawLine($x, $this->_y(80.5), $x + 288, $this->_y(80.5)); + $this->_page->drawLine($x, $this->_y(164), $x + 288, $this->_y(164)); + $this->_page->drawLine($x, $this->_y(194), $x + 288, $this->_y(194)); + $this->_page->drawLine($x, $this->_y(217.5), $x + 288, $this->_y(217.5)); + $this->_page->drawLine($x, $this->_y(245.5), $x + 288, $this->_y(245.5)); + $this->_page->drawLine($x, $this->_y(568.5), $x + 288, $this->_y(568.5)); + + $this->_page->setLineWidth(0.3); + $x = $this->_x(3); + $y = $this->_y(83); + $this->_page->drawLine($x, $y, $x + 10, $y); + $this->_page->drawLine($x, $y, $x, $y - 10); + + $x = $this->_x(3); + $y = $this->_y(161); + $this->_page->drawLine($x, $y, $x + 10, $y); + $this->_page->drawLine($x, $y, $x, $y + 10); + + $x = $this->_x(285); + $y = $this->_y(83); + $this->_page->drawLine($x, $y, $x - 10, $y); + $this->_page->drawLine($x, $y, $x, $y - 10); + + $x = $this->_x(285); + $y = $this->_y(161); + $this->_page->drawLine($x, $y, $x - 10, $y); + $this->_page->drawLine($x, $y, $x, $y + 10); + + return $this; + } + + /** + * Add Product Name + * + * @param string $name + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addProductName($name) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontBold, 9); + if (!strlen($name)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Product name is missing')); + } + $this->_page->drawText($name, $this->_x(8), $this->_y(12)); + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Product Content Code + * + * @param string $code + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws Zend_Pdf_Exception + * @throws InvalidArgumentException + */ + public function addProductContentCode($code) + { + $this->_page->saveGS(); + $codes = array( + 'TDK' => 0, 'TDE' => 1, 'TDL' => 0, 'TDM' => 1, 'TDT' => 0, + 'TDY' => 1, 'XPD' => 0, 'DOX' => 0, 'WPX' => 1, 'ECX' => 0, + 'DOM' => 0 + ); + if (!key_exists($code, $codes)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Product content code is invalid')); + } + $font = null; + if ($codes[$code]) { + $this->_page->drawRectangle( + $this->_x(140), + $this->_y(0), + $this->_x(190), + $this->_y(28), + Zend_Pdf_Page::SHAPE_DRAW_FILL + ); + $this->_page->setFillColor(new Zend_Pdf_Color_Html("#ffffff")); + $font = $this->_fontBold; + } else { + $font = $this->_fontNormal; + } + $this->_page->setFont($font, 17); + $this->_page->drawText($code, $this->_x(146), $this->_y(21)); + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Unit Id + * + * @param int $id + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page + * @throws Zend_Pdf_Exception + */ + public function addUnitId($id) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 6); + + $this->_page->drawText('Unit ID', $this->_x(8), $this->_y(20)); + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Reference Data + * + * @param $data + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page + * @throws Zend_Pdf_Exception + */ + public function addReferenceData($data) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('GREF', $this->_x(80), $this->_y(20)); + //TODO: Add reference data rendering + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Sender Info + * + * @param SimpleXMLElement $sender + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addSenderInfo(SimpleXMLElement $sender) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('From:', $this->_x(8), $this->_y(36)); + $contactName = implode(' ', array_filter(array((string)$sender->CompanyName, + (string)$sender->Contact->PersonName)) + ); + if (!$contactName) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Sender contact name is missing')); + } + $this->_page->drawText($contactName, $this->_x(25), $this->_y(36)); + + $phoneNumber = implode(' ', array_filter(array((string)$sender->Contact->PhoneNumber, + (string)$sender->Contact->PhoneExtension)) + ); + $phoneNumber = $phoneNumber ? "Phone: " . $phoneNumber : null; + $pageY = $this->_drawSenderAddress($sender->AddressLine, $phoneNumber); + + $divisionCode = (string)(strlen($sender->DivisionCode) ? $sender->DivisionCode . ' ' : null); + $cityInfo = implode(' ', array_filter(array($sender->City, $divisionCode, $sender->PostalCode))); + if (!strlen($cityInfo)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Sender city info is missing')); + } + $this->_page->drawText($cityInfo, $this->_x(25), $pageY); + + $this->_page->setFont($this->_fontBold, 6); + $countryInfo = (string)(($sender->CountryName) ? $sender->CountryName : $sender->CountryCode); + if (!strlen($countryInfo)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Sender country info is missing')); + } + $this->_page->drawText($countryInfo, $this->_x(25), $pageY - $this->_page->getFontSize()); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Draw Sender Address + * + * @param SimpleXMLElement $addressLines + * @param string $phoneNumber + * @return float + * @throws Zend_Pdf_Exception + */ + protected function _drawSenderAddress(SimpleXMLElement $addressLines, $phoneNumber) + { + $lines = array(); + foreach ($addressLines as $line) { + $lines [] = $line; + } + + $pageY = 0; + if (strlen($lines[0]) > 28) { + $firstLine = array_shift($lines); + $pageY = $this->_page->drawLines(array($firstLine), $this->_x(25), $this->_y(42), 28); + $this->_page->drawText($phoneNumber, $this->_x(103), $this->_y(42)); + } else { + $pageY = $this->_y(42); + $lineLength = $this->_page->getTextWidth( + $lines[0] . ' ', $this->_page->getFont(), $this->_page->getFontSize() + ); + $this->_page->drawText($phoneNumber, $this->_x(25 + $lineLength), $this->_y(42)); + } + + return $this->_page->drawLines($lines, $this->_x(25), $pageY, 49); + } + + /** + * Add Origin Info + * + * @param string $serviceAreaCode + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addOriginInfo($serviceAreaCode) + { + if (strlen(!$serviceAreaCode)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Origin serviceAreaCode is missing')); + } + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText("Origin:", $this->_x(260), $this->_y(36)); + $this->_page->setFont($this->_fontBold, 9); + $this->_page->drawText($serviceAreaCode, $this->_x(260), $this->_y(45)); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Receive Info + * + * @param SimpleXMLElement $consignee + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws Zend_Pdf_Exception + */ + public function addReceiveInfo(SimpleXMLElement $consignee) + { + $this->_page->saveGS(); + + $this->_page->setFont($this->_fontNormal, 9); + $this->_page->drawText("To:", $this->_x(5), $this->_y(92)); + $this->_page->drawText($consignee->CompanyName, $this->_x(20), $this->_y(90)); + $y = $this->_page->drawLines($consignee->AddressLine, $this->_x(19), $this->_y(100), 50); + + $this->_page->setFont($this->_fontBold, 11); + $cityInfo = implode(' ', array_filter(array($consignee->PostalCode, $consignee->City, + $consignee->DivisionCode)) + ); + $y = min($y - 3, 460); + $this->_page->drawLines(array($cityInfo, $consignee->CountryName), $this->_x(20), $y, 44); + + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('Contact:', $this->_x(260), $this->_y(90)); + + $y = $this->_page->drawLines(array($consignee->Contact->PersonName), $this->_x(283), $this->_y(98), 25, + Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page::ALIGN_RIGHT + ); + $phoneNumber = implode(' ', array_filter(array($consignee->Contact->PhoneNumber, + $consignee->Contact->PhoneExtension)) + ); + $this->_page->drawText($phoneNumber, $this->_x(283), $y, null, + Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page::ALIGN_RIGHT + ); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Destination Facility Code + * + * @param string $countryCode + * @param string $serviceAreaCode + * @param string $facilityCode + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addDestinationFacilityCode($countryCode, $serviceAreaCode, $facilityCode) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 20); + $code = implode('-', array_filter(array($countryCode, $serviceAreaCode, $facilityCode))); + + if (!strlen($code)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Destination facility code is empty')); + } + $this->_page->drawText($code, $this->_x(144), $this->_y(186), null, + Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page::ALIGN_CENTER + ); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Service Features Codes + * + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws Zend_Pdf_Exception + */ + public function addServiceFeaturesCodes() + { + $this->_page->saveGS(); + $this->_page->drawRectangle($this->_x(0), $this->_y(195), $this->_x(218), $this->_y(217), + Zend_Pdf_Page::SHAPE_DRAW_FILL + ); + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Delivery Date Code + * + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws Zend_Pdf_Exception + */ + public function addDeliveryDateCode() + { + $this->_page->saveGS(); + + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('Day:', $this->_x(220), $this->_y(201)); + $this->_page->drawText('Time:', $this->_x(250), $this->_y(201)); + + $this->_page->setFont($this->_fontNormal, 20); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Shipment Information + * + * @param Mage_Sales_Model_Order_Shipment $data + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page + * @throws Exception + */ + public function addShipmentInformation($data) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 6); + + $refCode = $data->getOrder()->getIncrementId(); + if (!$refCode) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Reference code is missing')); + } + $this->_page->drawText('Ref Code: ' . Mage::helper('usa')->__('Order #%s', $refCode), $this->_x(8), + $this->_y(224) + ); + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Date Info + * @param string $date + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws Zend_Pdf_Exception + */ + public function addDateInfo($date) + { + $this->_page->saveGS(); + + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('Date:', $this->_x(160), $this->_y(224)); + $this->_page->drawText($date, $this->_x(150), $this->_y(231)); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Weight Info + * + * @param string $weight + * @param string $unit + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addWeightInfo($weight, $unit) + { + $this->_page->saveGS(); + + $units = array("K" => 'kg', "L" => 'lb'); + if (!isset($units[$unit])) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Weight unit is invalid')); + } + $unit = $units[$unit]; + + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('Shpt Weight:', $this->_x(196), $this->_y(224)); + $this->_page->setFont($this->_fontBold, 11); + $this->_page->drawText($weight . ' ' . $unit, $this->_x(195), $this->_y(234)); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Content: Shipment Description + * + * @param array $package + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws Exception + */ + public function addContentInfo($package) + { + $this->_page->saveGS(); + $this->_page->setFont($this->_fontNormal, 6); + if (empty($package)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Package content is missing')); + } + + $x = 225; + $y = 300; + $this->_page->drawText('Content: ', $this->_x($x), $this->_y($y)); + $i = 0; + foreach ($package['items'] as $item) { + $i++; + $this->_page->drawText(substr($item['name'], 0, 20), $this->_x($x), $this->_y($y += 6)); + if ($i == 12) { + break; + } + } + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Waybill Barcode + * + * @param string $number + * @param string $barCode + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addWaybillBarcode($number, $barCode) + { + $this->_page->saveGS(); + + if(!strlen($number) || !strlen($barCode)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Waybill barcode information is missing')); + } + $image = new Zend_Pdf_Resource_Image_Png("data://image/png;base64," . $barCode); + $this->_page->drawImage($image, $this->_x(0), $this->_y(296), $this->_x(232), $this->_y(375)); + + $this->_page->setFont($this->_fontNormal, 9); + $number = substr($number, 0, 2) . ' ' . substr($number, 2, 4) . ' ' . substr($number, 6, 4); + $this->_page->drawText("WAYBILL " . $number, $this->_x(13.5), $this->_y(382)); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Routing Barcode + * + * @param string $routingCode + * @param string $id + * @param string $barCode + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addRoutingBarcode($routingCode, $id, $barCode) + { + $this->_page->saveGS(); + + if(!$barCode) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Routing barcode is missing')); + } + + $image = new Zend_Pdf_Resource_Image_Png("data://image/png;base64," . $barCode); + $this->_page->drawImage($image, $this->_x(0), $this->_y(386), $this->_x(232), $this->_y(465)); + + $this->_page->setFont($this->_fontNormal, 9); + $routingText = '(' . $id . ')' . $routingCode; + $this->_page->drawText($routingText, $this->_x(12), $this->_y(472)); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Piece Id Barcode + * + * @param string $dataIdentifier + * @param string $licensePlate + * @param string $barCode + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addPieceIdBarcode($dataIdentifier, $licensePlate, $barCode) + { + $this->_page->saveGS(); + + if (!strlen($barCode)) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Piece Id barcode is missing')); + } + + $image = new Zend_Pdf_Resource_Image_Png('data://image/png;base64,' . $barCode); + $this->_page->drawImage($image, $this->_x(29), $this->_y(476), $this->_x(261), $this->_y(555)); + + $this->_page->setFont($this->_fontNormal, 9); + $routingText = '(' . $dataIdentifier . ')' . $licensePlate; + $this->_page->drawText($routingText, $this->_x(144), $this->_y(563), '', + Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_Page::ALIGN_CENTER + ); + + $this->_page->restoreGS(); + return $this; + } + + /** + * Add Piece Number + * + * @param int $pieceNumber + * @param int $piecesTotal + * @return Mage_Usa_Model_Shipping_Carrier_Dhl_Label_Pdf_PageBuilder + * @throws InvalidArgumentException + * @throws Zend_Pdf_Exception + */ + public function addPieceNumber($pieceNumber, $piecesTotal) + { + $this->_page->saveGS(); + + if (!$pieceNumber || !$piecesTotal) { + throw new InvalidArgumentException(Mage::helper('usa')->__('Piece number information is missing')); + } + + $this->_page->setFont($this->_fontNormal, 6); + $this->_page->drawText('Piece:', $this->_x(256), $this->_y(224)); + $this->_page->setFont($this->_fontBold, 11); + $this->_page->drawText($pieceNumber . '/' . $piecesTotal, $this->_x(256), $this->_y(234)); + + $this->_page->restoreGS(); + return $this; + } +} diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Dutypaymenttype.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Dutypaymenttype.php index cc15f1d..2926728 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Dutypaymenttype.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Dutypaymenttype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Freemethod.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Freemethod.php index 5520b0d..7817103 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Freemethod.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Freemethod.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Method.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Method.php index 5eb462b..859066e 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Method.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Method.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Rounding.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Rounding.php index 9e6ad9d..c268165 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Rounding.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Rounding.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Value.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Value.php index 3715f52..d906a8c 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Value.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Protection/Value.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Shipmenttype.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Shipmenttype.php index 466ee36..e2f832c 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Shipmenttype.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Dhl/Source/Shipmenttype.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php index 03d8a99..0025939 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -29,7 +29,7 @@ * * @category Mage * @package Mage_Usa - * @author Magento Core Team + * @author Magento Core Team */ class Mage_Usa_Model_Shipping_Carrier_Fedex extends Mage_Usa_Model_Shipping_Carrier_Abstract @@ -44,6 +44,20 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex const CODE = 'fedex'; /** + * Purpose of rate request + * + * @var string + */ + const RATE_REQUEST_GENERAL = 'general'; + + /** + * Purpose of rate request + * + * @var string + */ + const RATE_REQUEST_SMARTPOST = 'SMART_POST'; + + /** * Code of the carrier * * @var string @@ -103,8 +117,8 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex { parent::__construct(); $wsdlBasePath = Mage::getModuleDir('etc', 'Mage_Usa') . DS . 'wsdl' . DS . 'FedEx' . DS; - $this->_shipServiceWsdl = $wsdlBasePath . 'ShipService_v9.wsdl'; - $this->_rateServiceWsdl = $wsdlBasePath . 'RateService_v9.wsdl'; + $this->_shipServiceWsdl = $wsdlBasePath . 'ShipService_v10.wsdl'; + $this->_rateServiceWsdl = $wsdlBasePath . 'RateService_v10.wsdl'; $this->_trackServiceWsdl = $wsdlBasePath . 'TrackService_v5.wsdl'; } @@ -167,10 +181,9 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex if (!$this->getConfigFlag($this->_activeFlag)) { return false; } - $this->setRequest($request); - $this->_result = $this->_getQuotes(); + $this->_getQuotes(); $this->_updateFreeMethodQuote($request); @@ -261,6 +274,8 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex $r->setIsReturn($request->getIsReturn()); + $r->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax()); + $this->_rawRequest = $r; return $this; @@ -285,18 +300,19 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex { return array( 'ServiceId' => 'crs', - 'Major' => '9', + 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0' ); } /** - * Do remote request for and handle errors + * Forming request for rate estimation depending to the purpose * - * @return Mage_Shipping_Model_Rate_Result + * @param string $purpose + * @return array */ - protected function _getQuotes() + protected function _formRateRequest($purpose) { $r = $this->_rawRequest; $ratesRequest = array( @@ -316,7 +332,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'ShipTimestamp' => date('c'), 'PackagingType' => $r->getPackaging(), 'TotalInsuredValue' => array( - 'Ammount' => $r->getValue(), + 'Amount' => $r->getValue(), 'Currency' => $this->getCurrencyCode() ), 'Shipper' => array( @@ -339,6 +355,12 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'CountryCode' => $r->getOrigCountry() ) ), + 'CustomsClearanceDetail' => array( + 'CustomsValue' => array( + 'Amount' => $r->getValue(), + 'Currency' => $this->getCurrencyCode() + ) + ), 'RateRequestTypes' => 'LIST', 'PackageCount' => '1', 'PackageDetail' => 'INDIVIDUAL_PACKAGES', @@ -347,11 +369,38 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'Weight' => array( 'Value' => (float)$r->getWeight(), 'Units' => 'LB' - ) + ), + 'GroupPackageCount' => 1, ) ) ) ); + + if ($purpose == self::RATE_REQUEST_GENERAL) { + $ratesRequest['RequestedShipment']['RequestedPackageLineItems'][0]['InsuredValue'] = array( + 'Amount' => $r->getValue(), + 'Currency' => $this->getCurrencyCode() + ); + } else if ($purpose == self::RATE_REQUEST_SMARTPOST) { + $ratesRequest['RequestedShipment']['ServiceType'] = self::RATE_REQUEST_SMARTPOST; + $ratesRequest['RequestedShipment']['SmartPostDetail'] = array( + 'Indicia' => ((float)$r->getWeight() >= 1) ? 'PARCEL_SELECT' : 'PRESORTED_STANDARD', + 'HubId' => $this->getConfigData('smartpost_hubid') + ); + } + + return $ratesRequest; + } + + /** + * Makes remote request to the carrier and returns a response + * + * @param string $purpose + * @return mixed + */ + protected function _doRatesRequest($purpose) + { + $ratesRequest = $this->_formRateRequest($purpose); $requestString = serialize($ratesRequest); $response = $this->_getCachedQuotes($requestString); $debugData = array('request' => $ratesRequest); @@ -370,7 +419,33 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex $debugData['result'] = $response; } $this->_debug($debugData); - return $this->_prepareRateResponse($response); + return $response; + } + + /** + * Do remote request for and handle errors + * + * @return Mage_Shipping_Model_Rate_Result + */ + protected function _getQuotes() + { + $this->_result = Mage::getModel('shipping/rate_result'); + // make separate request for Smart Post method + $allowedMethods = explode(',', $this->getConfigData('allowed_methods')); + if (in_array(self::RATE_REQUEST_SMARTPOST, $allowedMethods)) { + $response = $this->_doRatesRequest(self::RATE_REQUEST_SMARTPOST); + $preparedSmartpost = $this->_prepareRateResponse($response); + if (!$preparedSmartpost->getError()) { + $this->_result->append($preparedSmartpost); + } + } + // make general request for all methods + $response = $this->_doRatesRequest(self::RATE_REQUEST_GENERAL); + $preparedGeneral = $this->_prepareRateResponse($response); + if (!$preparedGeneral->getError() || ($this->_result->getError() && $preparedGeneral->getError())) { + $this->_result->append($preparedGeneral); + } + return $this->_result; } /** @@ -395,8 +470,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex foreach ($response->RateReplyDetails as $rate) { $serviceName = (string)$rate->ServiceType; if (in_array($serviceName, $allowedMethods)) { - $amount = (string)$rate->RatedShipmentDetails[0] - ->ShipmentRateDetail->TotalNetCharge->Amount; + $amount = $this->_getRateAmountOriginBased($rate); $costArr[$serviceName] = $amount; $priceArr[$serviceName] = $this->getMethodPrice($amount, $serviceName); } @@ -406,7 +480,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex $rate = $response->RateReplyDetails; $serviceName = (string)$rate->ServiceType; if (in_array($serviceName, $allowedMethods)) { - $amount = (string)$rate->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; + $amount = $this->_getRateAmountOriginBased($rate); $costArr[$serviceName] = $amount; $priceArr[$serviceName] = $this->getMethodPrice($amount, $serviceName); } @@ -415,10 +489,9 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex } $result = Mage::getModel('shipping/rate_result'); - $defaults = $this->getDefaults(); if (empty($priceArr)) { $error = Mage::getModel('shipping/rate_result_error'); - $error->setCarrier('fedex'); + $error->setCarrier($this->_code); $error->setCarrierTitle($this->getConfigData('title')); $error->setErrorMessage($errorTitle); $error->setErrorMessage($this->getConfigData('specificerrmsg')); @@ -426,7 +499,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex } else { foreach ($priceArr as $method=>$price) { $rate = Mage::getModel('shipping/rate_result_method'); - $rate->setCarrier('fedex'); + $rate->setCarrier($this->_code); $rate->setCarrierTitle($this->getConfigData('title')); $rate->setMethod($method); $rate->setMethodTitle($this->getCode('method', $method)); @@ -439,6 +512,51 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex } /** + * Get origin based amount form response of rate estimation + * + * @param stdClass $rate + * @return null|float + */ + protected function _getRateAmountOriginBased($rate) + { + $amount = null; + $rateTypeAmounts = array(); + + if (is_object($rate)) { + // The "RATED..." rates are expressed in the currency of the origin country + foreach ($rate->RatedShipmentDetails as $ratedShipmentDetail) { + $netAmount = (string)$ratedShipmentDetail->ShipmentRateDetail->TotalNetCharge->Amount; + $rateType = (string)$ratedShipmentDetail->ShipmentRateDetail->RateType; + $rateTypeAmounts[$rateType] = $netAmount; + } + + // Order is important + $ratesOrder = array( + 'RATED_ACCOUNT_PACKAGE', + 'PAYOR_ACCOUNT_PACKAGE', + 'RATED_ACCOUNT_SHIPMENT', + 'PAYOR_ACCOUNT_SHIPMENT', + 'RATED_LIST_PACKAGE', + 'PAYOR_LIST_PACKAGE', + 'RATED_LIST_SHIPMENT', + 'PAYOR_LIST_SHIPMENT' + ); + foreach ($ratesOrder as $rateType) { + if (!empty($rateTypeAmounts[$rateType])) { + $amount = $rateTypeAmounts[$rateType]; + break; + } + } + + if (is_null($amount)) { + $amount = (string)$rate->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount; + } + } + + return $amount; + } + + /** * Set free method request * * @param $freeMethod @@ -496,7 +614,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex if ($this->getConfigData('residence_delivery')) { $specialServices = $xml->addChild('SpecialServices'); - $specialServices->addChild('ResidentialDelivery', 'true'); + $specialServices->addChild('ResidentialDelivery', 'true'); } $xml->addChild('PackageCount', '1'); @@ -577,7 +695,6 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex } $result = Mage::getModel('shipping/rate_result'); - $defaults = $this->getDefaults(); if (empty($priceArr)) { $error = Mage::getModel('shipping/rate_result_error'); $error->setCarrier('fedex'); @@ -634,6 +751,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'FEDEX_1_DAY_FREIGHT' => Mage::helper('usa')->__('1 Day Freight'), 'FEDEX_2_DAY_FREIGHT' => Mage::helper('usa')->__('2 Day Freight'), 'FEDEX_2_DAY' => Mage::helper('usa')->__('2 Day'), + 'FEDEX_2_DAY_AM' => Mage::helper('usa')->__('2 Day AM'), 'FEDEX_3_DAY_FREIGHT' => Mage::helper('usa')->__('3 Day Freight'), 'FEDEX_EXPRESS_SAVER' => Mage::helper('usa')->__('Express Saver'), 'FEDEX_GROUND' => Mage::helper('usa')->__('Ground'), @@ -675,6 +793,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'method' => array( 'FEDEX_EXPRESS_SAVER', 'FEDEX_2_DAY', + 'FEDEX_2_DAY_AM', 'STANDARD_OVERNIGHT', 'PRIORITY_OVERNIGHT', 'FIRST_OVERNIGHT', @@ -695,9 +814,15 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'within_us' => array( 'method' => array( 'FEDEX_2_DAY', + 'FEDEX_2_DAY_AM', 'STANDARD_OVERNIGHT', 'PRIORITY_OVERNIGHT', 'FIRST_OVERNIGHT', + 'FEDEX_FREIGHT', + 'FEDEX_1_DAY_FREIGHT', + 'FEDEX_2_DAY_FREIGHT', + 'FEDEX_3_DAY_FREIGHT', + 'FEDEX_NATIONAL_FREIGHT', ) ), 'from_us' => array( @@ -726,6 +851,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex 'SMART_POST', 'FEDEX_EXPRESS_SAVER', 'FEDEX_2_DAY', + 'FEDEX_2_DAY_AM', 'STANDARD_OVERNIGHT', 'PRIORITY_OVERNIGHT', 'FIRST_OVERNIGHT', @@ -765,7 +891,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex if (!isset($codes[$type])) { return false; - } elseif (''===$code) { + } elseif ('' === $code) { return $codes[$type]; } @@ -982,11 +1108,11 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex } } - if(!$this->_result){ + if (!$this->_result) { $this->_result = Mage::getModel('shipping/tracking_result'); } - if(isset($resultArray)) { + if (isset($resultArray)) { $tracking = Mage::getModel('shipping/tracking_result_status'); $tracking->setCarrier('fedex'); $tracking->setCarrierTitle($this->getConfigData('title')); @@ -1068,19 +1194,18 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex $errorTitle = false; } - if(!$this->_result){ + if (!$this->_result) { $this->_result = Mage::getModel('shipping/tracking_result'); } - $defaults = $this->getDefaults(); - if($resultArr){ + if ($resultArr) { $tracking = Mage::getModel('shipping/tracking_result_status'); $tracking->setCarrier('fedex'); $tracking->setCarrierTitle($this->getConfigData('title')); $tracking->setTracking($trackingvalue); $tracking->addData($resultArr); $this->_result->append($tracking); - }else{ + } else { $error = Mage::getModel('shipping/tracking_result_error'); $error->setCarrier('fedex'); $error->setCarrierTitle($this->getConfigData('title')); @@ -1098,14 +1223,14 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex public function getResponse() { $statuses = ''; - if ($this->_result instanceof Mage_Shipping_Model_Tracking_Result){ + if ($this->_result instanceof Mage_Shipping_Model_Tracking_Result) { if ($trackings = $this->_result->getAllTrackings()) { foreach ($trackings as $tracking){ if($data = $tracking->getAllData()){ if (!empty($data['status'])) { - $statuses .= Mage::helper('usa')->__($data['status'])."\n
"; + $statuses .= Mage::helper('usa')->__($data['status']) . "\n
"; } else { - $statuses .= Mage::helper('usa')->__('Empty response')."\n
"; + $statuses .= Mage::helper('usa')->__('Empty response') . "\n
"; } } } @@ -1155,7 +1280,7 @@ class Mage_Usa_Model_Shipping_Carrier_Fedex ), 'Version' => array( 'ServiceId' => 'ship', - 'Major' => '9', + 'Major' => '10', 'Intermediate' => '0', 'Minor' => '0' ) diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Dropoff.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Dropoff.php index 25eb4ca..7c15c34 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Dropoff.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Dropoff.php @@ -20,19 +20,25 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * Fedex dropoff source implementation + * + * @category Mage + * @package Mage_Usa + * @author Magento Core Team + */ class Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Dropoff { public function toOptionArray() { $fedex = Mage::getSingleton('usa/shipping_carrier_fedex'); $arr = array(); - foreach ($fedex->getCode('dropoff') as $k=>$v) { - $arr[] = array('value'=>$k, 'label'=>$v); + foreach ($fedex->getCode('dropoff') as $k => $v) { + $arr[] = array('value' => $k, 'label' => $v); } return $arr; } diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Freemethod.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Freemethod.php index 6e1541b..e5d26d4 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Freemethod.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Freemethod.php @@ -20,17 +20,24 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -class Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Freemethod extends Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Method +/** + * Fedex freemethod source implementation + * + * @category Mage + * @package Mage_Usa + * @author Magento Core Team + */ +class Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Freemethod + extends Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Method { public function toOptionArray() { $arr = parent::toOptionArray(); - array_unshift($arr, array('value'=>'', 'label'=>Mage::helper('shipping')->__('None'))); + array_unshift($arr, array('value' => '', 'label' => Mage::helper('shipping')->__('None'))); return $arr; } } diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Method.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Method.php index d7f3d34..7e7716c 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Method.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Method.php @@ -20,19 +20,25 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * Fedex method source implementation + * + * @category Mage + * @package Mage_Usa + * @author Magento Core Team + */ class Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Method { public function toOptionArray() { $fedex = Mage::getSingleton('usa/shipping_carrier_fedex'); $arr = array(); - foreach ($fedex->getCode('method') as $k=>$v) { - $arr[] = array('value'=>$k, 'label'=>$v); + foreach ($fedex->getCode('method') as $k => $v) { + $arr[] = array('value' => $k, 'label' => $v); } return $arr; } diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Packaging.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Packaging.php index 3922fa6..e77d0af 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Packaging.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Fedex/Source/Packaging.php @@ -20,19 +20,25 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +/** + * Fedex packaging source implementation + * + * @category Mage + * @package Mage_Usa + * @author Magento Core Team + */ class Mage_Usa_Model_Shipping_Carrier_Fedex_Source_Packaging { public function toOptionArray() { $fedex = Mage::getSingleton('usa/shipping_carrier_fedex'); $arr = array(); - foreach ($fedex->getCode('packaging') as $k=>$v) { - $arr[] = array('value'=>$k, 'label'=>$v); + foreach ($fedex->getCode('packaging') as $k => $v) { + $arr[] = array('value' => $k, 'label' => $v); } return $arr; } diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php index c365d86..c324af8 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -272,6 +272,8 @@ class Mage_Usa_Model_Shipping_Carrier_Ups $r->setIsReturn($request->getIsReturn()); + $r->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax()); + $this->_rawRequest = $r; return $this; @@ -487,7 +489,7 @@ class Mage_Usa_Model_Shipping_Carrier_Ups /** * Get configuration data of carrier * - * @param strin $type + * @param string $type * @param string $code * @return array|bool */ @@ -703,6 +705,7 @@ class Mage_Usa_Model_Shipping_Carrier_Ups '14', // Next Day Air Early AM '02', // 2nd Day Air '59', // 2nd Day Air AM + '13', // Next Day Air Saver ) ), 'from_us' => array( @@ -1006,10 +1009,7 @@ XMLRequest; if (in_array($responseCurrencyCode, $allowedCurrencies)) { $cost = (float) $cost * $this->_getBaseCurrencyRate($responseCurrencyCode); } else { - $errorTitle = Mage::helper('directory') - ->__('Can\'t convert rate from "%s-%s".', - $responseCurrencyCode, - $this->_request->getPackageCurrency()->getCode()); + $errorTitle = Mage::helper('directory')->__('Can\'t convert rate from "%s-%s".', $responseCurrencyCode, $this->_request->getPackageCurrency()->getCode()); $error = Mage::getModel('shipping/rate_result_error'); $error->setCarrier('ups'); $error->setCarrierTitle($this->getConfigData('title')); @@ -1733,7 +1733,7 @@ XMLAuth; return $result; } - + /** * Return structured data of containers witch related with shipping methods * diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Container.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Container.php index d8dd516..3c52bf0 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Container.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Container.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/DestType.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/DestType.php index afbc72e..ba066fd 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/DestType.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/DestType.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Freemethod.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Freemethod.php index 8ef7827..43c5fed 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Freemethod.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Freemethod.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Method.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Method.php index d3867ea..f4da816 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Method.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Method.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php index 4c2eb1a..1c2c0e5 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Mode.php @@ -20,15 +20,16 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** - * UPS (UPS XML) Modesource model + * UPS (UPS XML) mode source model * - * @category Mage - * @package Mage_Usa + * @deprecated since 1.7.0.0 + * @category Mage + * @package Mage_Usa * @author Magento Core Team */ class Mage_Usa_Model_Shipping_Carrier_Ups_Source_Mode diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/OriginShipment.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/OriginShipment.php index b3acb7f..874176d 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/OriginShipment.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/OriginShipment.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Pickup.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Pickup.php index 7a0c405..ca574fe 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Pickup.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Pickup.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php index 8275abd..8813e97 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Type.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Unitofmeasure.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Unitofmeasure.php index 88e1b48..6814edf 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Unitofmeasure.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Ups/Source/Unitofmeasure.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php index 0fd6f49..62173e8 100644 --- app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php +++ app/code/core/Mage/Usa/Model/Shipping/Carrier/Usps.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -53,7 +53,7 @@ class Mage_Usa_Model_Shipping_Carrier_Usps const SIZE_LARGE = 'LARGE'; /** - * Destination Zip Code required flag + * Default api revision * * @var int */ @@ -79,9 +79,10 @@ class Mage_Usa_Model_Shipping_Carrier_Usps protected $_code = self::CODE; /** - * Is zip code required + * Destination Zip Code required flag * - * @var bool + * @var boolean + * @deprecated since 1.7.0 functionality implemented in Mage_Usa_Model_Shipping_Carrier_Abstract */ protected $_isZipCodeRequired; @@ -121,34 +122,6 @@ class Mage_Usa_Model_Shipping_Carrier_Usps protected $_customizableContainerTypes = array('VARIABLE', 'RECTANGULAR', 'NONRECTANGULAR'); /** - * Check is Zip Code Required - * - * @return boolean - */ - public function isZipCodeRequired() - { - if (!is_null($this->_isZipCodeRequired)) { - return $this->_isZipCodeRequired; - } - - return parent::isZipCodeRequired(); - } - - /** - * Processing additional validation to check is carrier applicable. - * - * @param Mage_Shipping_Model_Rate_Request $request - * @return Mage_Shipping_Model_Carrier_Abstract|Mage_Shipping_Model_Rate_Result_Error|boolean - */ - public function proccessAdditionalValidation(Mage_Shipping_Model_Rate_Request $request) - { - // zip code required for US - $this->_isZipCodeRequired = $this->_isUSCountry($request->getDestCountryId()); - - return parent::proccessAdditionalValidation($request); - } - - /** * Collect and get rates * * @param Mage_Shipping_Model_Rate_Request $request @@ -287,6 +260,8 @@ class Mage_Usa_Model_Shipping_Carrier_Usps $r->setValue($request->getPackageValue()); $r->setValueWithDiscount($request->getPackageValueWithDiscount()); + $r->setBaseSubtotalInclTax($request->getBaseSubtotalInclTax()); + $this->_rawRequest = $r; return $this; @@ -588,6 +563,7 @@ class Mage_Usa_Model_Shipping_Carrier_Usps 'First-Class Mail International Large Envelope' => 'FIRST CLASS', 'First-Class Mail International Letter' => 'FIRST CLASS', 'First-Class Mail International Package' => 'FIRST CLASS', + 'First-Class Mail International Parcel' => 'FIRST CLASS', 'First-Class Mail' => 'FIRST CLASS', 'First-Class Mail Flat' => 'FIRST CLASS', 'First-Class Mail Large Envelope' => 'FIRST CLASS', @@ -672,6 +648,7 @@ class Mage_Usa_Model_Shipping_Carrier_Usps 'Priority Mail International', 'First-Class Mail International Package', 'First-Class Mail International Large Envelope', + 'First-Class Mail International Parcel', ) ) ) @@ -730,6 +707,7 @@ class Mage_Usa_Model_Shipping_Carrier_Usps 'Express Mail International', 'Priority Mail International', 'First-Class Mail International Package', + 'First-Class Mail International Parcel', ) ) ) @@ -752,6 +730,7 @@ class Mage_Usa_Model_Shipping_Carrier_Usps 'Express Mail International', 'Priority Mail International', 'First-Class Mail International Package', + 'First-Class Mail International Parcel', ) ) ) @@ -1221,7 +1200,9 @@ class Mage_Usa_Model_Shipping_Carrier_Usps */ protected function _filterServiceName($name) { - $name = (string)preg_replace(array('~<[^/!][^>]+>.*]+>~sU', '~\ @@ -59,6 +59,9 @@ Mage_Usa_Model_Shipping_Carrier_Dhl + + Mage_Usa_Model_Shipping_Carrier_Dhl_International + @@ -93,12 +96,19 @@ + + + + dhl + + + 0 0 - E,N,S,G,IE,E SAT,E 10:30AM + IE,E SAT,E 10:30AM,E,N,S,G Big Box R @@ -107,10 +117,11 @@ usa/shipping_carrier_dhl + 0 P - DHL + DHL (Deprecated) This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us. 150 F @@ -125,9 +136,10 @@ 0 + 0 0 0 - EUROPE_FIRST_INTERNATIONAL_PRIORITY,FEDEX_1_DAY_FREIGHT,FEDEX_2_DAY_FREIGHT,FEDEX_2_DAY,FEDEX_3_DAY_FREIGHT,FEDEX_EXPRESS_SAVER,FEDEX_GROUND,FIRST_OVERNIGHT,GROUND_HOME_DELIVERY,INTERNATIONAL_ECONOMY,INTERNATIONAL_ECONOMY_FREIGHT,INTERNATIONAL_FIRST,INTERNATIONAL_GROUNDINTERNATIONAL_PRIORITY,INTERNATIONAL_PRIORITY_FREIGHT,PRIORITY_OVERNIGHT,SMART_POSTSTANDARD_OVERNIGHT + EUROPE_FIRST_INTERNATIONAL_PRIORITY,FEDEX_1_DAY_FREIGHT,FEDEX_2_DAY_FREIGHT,FEDEX_2_DAY,FEDEX_2_DAY_AM,FEDEX_3_DAY_FREIGHT,FEDEX_EXPRESS_SAVER,FEDEX_GROUND,FIRST_OVERNIGHT,GROUND_HOME_DELIVERY,INTERNATIONAL_ECONOMY,INTERNATIONAL_ECONOMY_FREIGHT,INTERNATIONAL_FIRST,INTERNATIONAL_GROUND,INTERNATIONAL_PRIORITY,INTERNATIONAL_PRIORITY_FREIGHT,PRIORITY_OVERNIGHT,SMART_POST,STANDARD_OVERNIGHT,FEDEX_FREIGHT,FEDEX_NATIONAL_FREIGHT REGULAR_PICKUP FEDEX_GROUND @@ -144,8 +156,9 @@ 0 0 - 1DM,1DML,1DA,1DAL,1DAPI,1DP,1DPL,2DM,2DML,2DA,2DAL,3DS,GND,GNDCOM,GNDRES,STD,XPR,WXS,XPRL,XDM,XDML,XPD + 1DM,1DML,1DA,1DAL,1DAPI,1DP,1DPL,2DM,2DML,2DA,2DAL,3DS,GND,GNDCOM,GNDRES,STD,XPR,WXS,XPRL,XDM,XDML,XPD,01,02,03,07,08,11,12,14,54,59,65 Shipments Originating in United States + 0 CP RES @@ -172,25 +185,47 @@ 0 0 - Bound Printed Matter,Express Mail,Express Mail Flat Rate Envelope,Express Mail Flat Rate Envelope Hold For Pickup,Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee,Express Mail Hold For Pickup,Express Mail International,Express Mail International Flat Rate Envelope,Express Mail PO to PO,Express Mail Sunday/Holiday Guarantee,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes + Bound Printed Matter,Express Mail,Express Mail Flat Rate Envelope,Express Mail Flat Rate Envelope Hold For Pickup,Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee,Express Mail Hold For Pickup,Express Mail International,Express Mail International Flat Rate Envelope,Express Mail PO to PO,Express Mail Sunday/Holiday Guarantee,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class Mail International Parcel,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes VARIABLE http://production.shippingapis.com/ShippingAPI.dll https://secure.shippingapis.com/ShippingAPI.dll + 0 true - Bound Printed Matter,Express Mail,Express Mail Flat Rate Envelope,Express Mail Flat Rate Envelope Hold For Pickup,Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee,Express Mail Hold For Pickup,Express Mail International,Express Mail International Flat Rate Envelope,Express Mail PO to PO,Express Mail Sunday/Holiday Guarantee,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes + Bound Printed Matter,Express Mail,Express Mail Flat Rate Envelope,Express Mail Flat Rate Envelope Hold For Pickup,Express Mail Flat-Rate Envelope Sunday/Holiday Guarantee,Express Mail Hold For Pickup,Express Mail International,Express Mail International Flat Rate Envelope,Express Mail PO to PO,Express Mail Sunday/Holiday Guarantee,First-Class Mail International Large Envelope,First-Class Mail International Letters,First-Class Mail International Package,First-Class Mail International Parcel,First-Class,First-Class Mail,First-Class Mail Flat,First-Class Mail Large Envelope,First-Class Mail International,First-Class Mail Letter,First-Class Mail Parcel,First-Class Mail Package,Global Express Guaranteed (GXG),Global Express Guaranteed Non-Document Non-Rectangular,Global Express Guaranteed Non-Document Rectangular,Library Mail,Media Mail,Parcel Post,Priority Mail,Priority Mail Small Flat Rate Box,Priority Mail Medium Flat Rate Box,Priority Mail Large Flat Rate Box,Priority Mail Flat Rate Box,Priority Mail Flat Rate Envelope,Priority Mail International,Priority Mail International Flat Rate Box,Priority Mail International Flat Rate Envelope,Priority Mail International Small Flat Rate Box,Priority Mail International Medium Flat Rate Box,Priority Mail International Large Flat Rate Box,USPS GXG Envelopes usa/shipping_carrier_usps REGULAR United States Postal Service + 0 This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us. 70 F O + + usa/shipping_carrier_dhl_international + + 0 + DHL + 0 + 1,3,4,8,P,Q,E,F,H,J,M,V,Y + 2,5,6,7,9,B,C,D,U,K,L,G,W,I,N,O,R,S,T,X + G + https://xmlpi-ea.dhl.com/XMLShippingServlet + + + N + This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us. + 1 + K + R + F + O +
diff --git app/code/core/Mage/Usa/etc/dhl/international/countries.xml app/code/core/Mage/Usa/etc/dhl/international/countries.xml new file mode 100644 index 0000000..cc6b1f2 --- /dev/null +++ app/code/core/Mage/Usa/etc/dhl/international/countries.xml @@ -0,0 +1,1580 @@ + + + + + EUR + KG + CM + Andorra + + + AED + KG + CM + AP + United Arab Emirates + + + AFN + KG + CM + AP + Afghanistan + + + XCD + KG + CM + AM + Antigua + + + XCD + KG + CM + AM + Anguilla + + + EUR + KG + CM + AP + Albania + + + AMD + KG + CM + AP + Armenia + + + ANG + KG + CM + Netherlands Antilles + + + AOA + KG + CM + Angola + + + ARS + KG + CM + AM + Argentina + + + USD + LB + IN + American Samoa + + + EUR + KG + CM + EA + Austria + 1 + + + AUD + KG + CM + AP + Australia + + + AWG + KG + CM + AM + Aruba + + + AZM + KG + CM + Azerbaijan + + + BAM + KG + CM + AP + Bosnia and Herzegovina + + + BBD + KG + CM + AM + Barbados + + + BDT + KG + CM + AP + Bangladesh + + + EUR + KG + CM + EA + Belgium + 1 + + + XOF + KG + CM + Burkina Faso + + + BGN + KG + CM + EA + Bulgaria + 1 + + + BHD + KG + CM + AP + Bahrain + + + BIF + KG + CM + Burundi + + + XOF + KG + CM + Benin + + + BMD + KG + CM + AM + Bermuda + + + BND + KG + CM + Brunei + + + BOB + KG + CM + AM + Bolivia + +
+ BRL + KG + CM + AM + Brazil +
+ + BSD + KG + CM + AM + Bahamas + + + BTN + KG + CM + Bhutan + + + BWP + KG + CM + Botswana + + + BYR + KG + CM + AP + Belarus + + + BZD + KG + CM + Belize + + + CAD + KG + CM + AM + Canada + + + CDF + KG + CM + Congo, The Democratic Republic of + + + XAF + KG + CM + Central African Republic + + + XAF + KG + CM + Congo + + + CHF + KG + CM + EA + Switzerland + + + XOF + KG + CM + AP + Cote d'Ivoire + + + NZD + KG + CM + Cook Islands + + + CLP + KG + CM + AM + Chile + + + XAF + KG + CM + Cameroon + + + CNY + KG + CM + AP + China, People's Republic + + + COP + KG + CM + AM + Colombia + + + CRC + KG + CM + AM + Costa Rica + + + CUP + KG + CM + Cuba + + + CVE + KG + CM + Cape Verde + + + EUR + KG + CM + AP + Cyprus + 1 + + + CZK + KG + CM + EA + Czech Republic, The + 1 + + + EUR + KG + CM + EA + Germany + 1 + + + DJF + KG + CM + Djibouti + + + DKK + KG + CM + EA + Denmark + 1 + + + XCD + KG + CM + AM + Dominica + + + DOP + KG + CM + AM + Dominican Rep. + + + DZD + KG + CM + AP + Algeria + + + USD + KG + CM + AM + Ecuador + + + EEK + KG + CM + EA + Estonia + 1 + + + EGP + KG + CM + AP + Egypt + + + ERN + KG + CM + Eritrea + + + EUR + KG + CM + EA + Spain + 1 + + + ETB + KG + CM + Ethiopia + + + EUR + KG + CM + EA + Finland + 1 + + + FJD + KG + CM + AP + Fiji + + + FKP + KG + CM + Falkland Islands + + + USD + LB + IN + MICRONESIA, FEDERATED STATES OF + + + DKK + KG + CM + Faroe Islands + + + EUR + KG + CM + EA + France + 1 + + + XAF + KG + CM + Gabon + + + GBP + KG + CM + EA + United Kingdom + 1 + + + XCD + KG + CM + AM + Grenada + + + GEL + KG + CM + Georgia + + + EUR + KG + CM + AM + French Guyana + + + GBP + KG + CM + Guernsey + + + GHS + KG + CM + AP + Ghana + + + GIP + KG + CM + Gibraltar + + + DKK + KG + CM + Greenland + + + GMD + KG + CM + Gambia + + + GNF + KG + CM + Guinea Republic + + + EUR + KG + CM + AM + Guadeloupe + + + XAF + KG + CM + Guinea-Equatorial + + + EUR + KG + CM + EA + Greece + 1 + + + GTQ + KG + CM + AM + Guatemala + + + USD + LB + IN + AM + Guam + + + GWP + KG + CM + Guinea-Bissau + + + GYD + KG + CM + AM + Guyana (British) + + + HKD + KG + CM + AP + Hong Kong + + + HNL + KG + CM + AM + Honduras + +
+ HRK + KG + CM + AP + Croatia + + + HTG + KG + CM + AM + Haiti + + + HUF + KG + CM + EA + Hungary + 1 + + + EUR + KG + CM + Canary Islands, The + + + IDR + KG + CM + AP + Indonesia + + + EUR + KG + CM + EA + Ireland, Republic Of + 1 + + + ILS + KG + CM + AP + Israel + + + INR + KG + CM + AP + India + + + IQD + KG + CM + Iraq + + + IRR + KG + CM + AP + Iran (Islamic Republic of) + + + ISK + KG + CM + EA + Iceland + + + EUR + KG + CM + EA + Italy + 1 + + + GBP + KG + CM + Jersey + + + JMD + KG + CM + AM + Jamaica + + + JOD + KG + CM + AP + Jordan + + + JPY + KG + CM + AP + Japan + + + KES + KG + CM + AP + Kenya + + + KGS + KG + CM + AP + Kyrgyzstan + + + KHR + KG + CM + Cambodia + + + AUD + KG + CM + Kiribati + + + KMF + KG + CM + Comoros + + + XCD + KG + CM + AM + St. Kitts + + + KPW + KG + CM + Korea, The D.P.R of + + + KRW + KG + CM + AP + Korea, Republic Of + + + EUR + KG + CM + Kosovo + + + KWD + KG + CM + AP + Kuwait + + + KYD + KG + CM + AM + Cayman Islands + + + KZT + KG + CM + AP + Kazakhstan + + + LAK + KG + CM + Lao People's Democratic Republic + + + USD + KG + CM + AP + Lebanon + + + XCD + KG + CM + AM + St. Lucia + +
  • + CHF + KG + CM + Liechtenstein +
  • + + LKR + KG + CM + AP + Sri Lanka + + + LRD + KG + CM + Liberia + + + LSL + KG + CM + Lesotho + + + LTL + KG + CM + EA + Lithuania + 1 + + + EUR + KG + CM + EA + Luxembourg + 1 + + + LVL + KG + CM + EA + Latvia + 1 + + + LYD + KG + CM + Libya + + + MAD + KG + CM + AP + Morocco + + + EUR + KG + CM + Monaco + + + MDL + KG + CM + AP + Moldova, Republic Of + + + EUR + KG + CM + Montenegro, Republic of + + + MGA + KG + CM + Madagascar + + + USD + LB + IN + Marshall Islands + + + MKD + KG + CM + AP + Macedonia, Rep. of (FYROM) + + + XOF + KG + CM + Mali + + + USD + KG + CM + AP + Myanmar + + + MNT + KG + CM + Mongolia + + + MOP + KG + CM + Macau + + + USD + LB + IN + Saipan + + + EUR + KG + CM + AM + Martinique + + + MRO + KG + CM + Mauritania + + + XCD + KG + CM + Montserrat + + + EUR + KG + CM + AP + Malta + 1 + + + MUR + KG + CM + AP + Mauritius + + + MVR + KG + CM + Maldives + + + MWK + KG + CM + Malawi + + + MXN + KG + CM + AM + Mexico + + + MYR + KG + CM + AP + Malaysia + + + MZN + KG + CM + Mozambique + + + ZAR + KG + CM + AP + Namibia + + + XPF + KG + CM + New Caledonia + + + XOF + KG + CM + Niger + + + NGN + KG + CM + AP + Nigeria + + + NIO + KG + CM + AM + Nicaragua + + + EUR + KG + CM + EA + Netherlands, The + 1 + + + NOK + KG + CM + EA + Norway + + + NPR + KG + CM + AP + Nepal + + + AUD + KG + CM + Nauru, Republic Of + + + NZD + KG + CM + Niue + + + NZD + KG + CM + AP + New Zealand + + + OMR + KG + CM + AP + Oman + + + PAB + KG + CM + AM + Panama + + + PEN + KG + CM + AM + Peru + + + XPF + KG + CM + Tahiti + + + PGK + KG + CM + Papua New Guinea + + + PHP + KG + CM + AP + Philippines, The + + + PKR + KG + CM + AP + Pakistan + + + PLN + KG + CM + EA + Poland + 1 + + + USD + LB + IN + AM + Puerto Rico + + + EUR + KG + CM + EA + Portugal + 1 + + + USD + KG + CM + Palau + + + PYG + KG + CM + AM + Paraguay + + + QAR + KG + CM + AP + Qatar + + + EUR + KG + CM + AP + Reunion, Island Of + + + RON + KG + CM + EA + Romania + 1 + + + RSD + KG + CM + AP + Serbia, Republic of + + + RUB + KG + CM + AP + Russian Federation, The + + + RWF + KG + CM + Rwanda + + + SAR + KG + CM + AP + Saudi Arabia + + + SBD + KG + CM + Solomon Islands + + + SCR + KG + CM + Seychelles + + + SDG + KG + CM + AP + Sudan + + + SEK + KG + CM + EA + Sweden + 1 + + + SGD + KG + CM + AP + Singapore + + + EUR + KG + CM + EA + Slovenia + 1 + + + EUR + KG + CM + EA + Slovakia + 1 + + + SLL + KG + CM + Sierra Leone + + + EUR + KG + CM + San Marino + + + XOF + KG + CM + AP + Senegal + + + SOS + KG + CM + Somalia + + + SRD + KG + CM + AM + Suriname + + + STD + KG + CM + Sao Tome and Principe + + + USD + KG + CM + AM + El Salvador + + + SYP + KG + CM + Syria + + + SZL + KG + CM + Swaziland + + + USD + KG + CM + AM + Turks and Caicos Islands + + + XAF + KG + CM + Chad + + + XOF + KG + CM + Togo + + + THB + KG + CM + AP + Thailand + + + TJS + KG + CM + AP + Tajikistan + + + USD + KG + CM + East Timor + + + TND + KG + CM + Tunisia + + + TOP + KG + CM + Tonga + + + TRY + KG + CM + AP + Turkey + + + TTD + KG + CM + AM + Trinidad and Tobago + + + AUD + KG + CM + Tuvalu + + + TWD + KG + CM + AP + Taiwan + + + TZS + KG + CM + Tanzania + + + UAH + KG + CM + AP + Ukraine + + + UGX + KG + CM + Uganda + + + USD + LB + IN + AM + United States Of America + + + UYU + KG + CM + AM + Uruguay + + + UZS + KG + CM + AP + Uzbekistan + + + XCD + KG + CM + AM + St. Vincent + + + VEF + KG + CM + AM + Venezuela + + + USD + KG + CM + AM + Virgin Islands (British) + + + USD + LB + IN + Virgin Islands (US) + + + VND + KG + CM + AP + Vietnam + + + VUV + KG + CM + Vanuatu + + + WST + KG + CM + Samoa + + + EUR + KG + CM + Bonaire + + + EUR + KG + CM + AM + Curacao + + + ANG + KG + CM + St. Eustatius + + + EUR + KG + CM + AM + St. Maarten + + + XCD + KG + CM + AM + Nevis + + + SIS + KG + CM + Somaliland, Rep of (North Somalia) + + + ANG + KG + CM + AM + St. Barthelemy + + + YER + KG + CM + AP + Yemen, Republic of + + + EUR + KG + CM + Mayotte + + + ZAR + KG + CM + AP + South Africa + + + ZMK + KG + CM + Zambia + + + ZWD + KG + CM + Zimbabwe + +
    diff --git app/code/core/Mage/Usa/etc/system.xml app/code/core/Mage/Usa/etc/system.xml index c1936ab..8c642a1 100644 --- app/code/core/Mage/Usa/etc/system.xml +++ app/code/core/Mage/Usa/etc/system.xml @@ -21,7 +21,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> @@ -30,7 +30,7 @@ - + text 130 1 @@ -88,6 +88,7 @@ text + validate-number validate-zero-or-greater 1220 1 1 @@ -150,6 +151,7 @@ text + validate-number validate-zero-or-greater 120 1 1 @@ -158,6 +160,7 @@ text + validate-number validate-zero-or-greater 130 1 1 @@ -181,6 +184,15 @@ 1 0 + + + select + usa/shipping_carrier_abstract_source_requesttype + 85 + 1 + 1 + 0 + select @@ -215,7 +227,7 @@ 1 1 0 - 0 + <label>Title</label> <frontend_type>text</frontend_type> @@ -275,6 +287,7 @@ <additional_protection_min_value translate="label"> <label>Additional Protection Min Subtotal</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>1310</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -446,7 +459,16 @@ <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> - </sandbox_mode> + </sandbox_mode> + <shipment_requesttype translate="label"> + <label>Packages Request Type</label> + <frontend_type>select</frontend_type> + <source_model>usa/shipping_carrier_abstract_source_requesttype</source_model> + <sort_order>77</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + </shipment_requesttype> <packaging translate="label"> <label>Packaging</label> <frontend_type>select</frontend_type> @@ -468,6 +490,7 @@ <max_package_weight translate="label"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>100</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -494,6 +517,7 @@ <handling_fee translate="label"> <label>Handling Fee</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>130</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -518,6 +542,15 @@ <show_in_store>0</show_in_store> <can_be_empty>1</can_be_empty> </allowed_methods> + <smartpost_hubid translate="label comment"> + <label>Hub ID</label> + <frontend_type>text</frontend_type> + <sort_order>155</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + <comment>The field is applicable if the Smart Post method is selected.</comment> + </smartpost_hubid> <free_method translate="label"> <label>Free Method</label> <frontend_type>select</frontend_type> @@ -540,6 +573,7 @@ <free_shipping_subtotal translate="label"> <label>Minimum Order Amount for Free Shipping</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>180</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -638,6 +672,15 @@ <show_in_store>0</show_in_store> <can_be_empty>1</can_be_empty> </allowed_methods> + <shipment_requesttype translate="label"> + <label>Packages Request Type</label> + <frontend_type>select</frontend_type> + <source_model>usa/shipping_carrier_abstract_source_requesttype</source_model> + <sort_order>47</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + </shipment_requesttype> <container translate="label"> <label>Container</label> <frontend_type>select</frontend_type> @@ -659,6 +702,7 @@ <free_shipping_subtotal translate="label"> <label>Minimum Order Amount for Free Shipping</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>220</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -720,6 +764,7 @@ <handling_fee translate="label"> <label>Handling Fee</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>130</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -728,6 +773,7 @@ <max_package_weight translate="label"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>80</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -736,6 +782,7 @@ <min_package_weight translate="label"> <label>Minimum Package Weight (Please consult your shipping carrier for minimum supported shipping weight)</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>90</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -801,7 +848,7 @@ <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </type> - <unit_of_measure translate="label"> + <unit_of_measure translate="label comment"> <label>Weight Unit</label> <frontend_type>select</frontend_type> <source_model>usa/shipping_carrier_ups_source_unitofmeasure</source_model> @@ -811,7 +858,7 @@ <show_in_store>0</show_in_store> </unit_of_measure> <username translate="label"> - <label>UserId</label> + <label>User ID</label> <frontend_type>obscure</frontend_type> <backend_model>adminhtml/system_config_backend_encrypted</backend_model> <sort_order>30</sort_order> @@ -879,7 +926,7 @@ <label>Mode</label> <comment>Enables/Disables SSL verification of Magento server by UPS.</comment> <frontend_type>select</frontend_type> - <source_model>usa/shipping_carrier_ups_source_mode</source_model> + <source_model>usa/shipping_carrier_abstract_source_mode</source_model> <sort_order>30</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -950,11 +997,29 @@ <label>Password</label> <frontend_type>obscure</frontend_type> <backend_model>adminhtml/system_config_backend_encrypted</backend_model> - <sort_order>54</sort_order> + <sort_order>53</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </password> + <mode translate="label"> + <label>Mode</label> + <frontend_type>select</frontend_type> + <sort_order>54</sort_order> + <source_model>usa/shipping_carrier_abstract_source_mode</source_model> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + </mode> + <shipment_requesttype translate="label"> + <label>Packages Request Type</label> + <frontend_type>select</frontend_type> + <source_model>usa/shipping_carrier_abstract_source_requesttype</source_model> + <sort_order>55</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + </shipment_requesttype> <container translate="label"> <label>Container</label> <frontend_type>select</frontend_type> @@ -1021,6 +1086,7 @@ <max_package_weight translate="label"> <label>Maximum Package Weight (Please consult your shipping carrier for maximum supported shipping weight)</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>90</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -1047,6 +1113,7 @@ <handling_fee translate="label"> <label>Handling Fee</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>120</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -1084,6 +1151,7 @@ <free_shipping_subtotal translate="label"> <label>Minimum Order Amount for Free Shipping</label> <frontend_type>text</frontend_type> + <validate>validate-number validate-zero-or-greater</validate> <sort_order>160</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> @@ -1146,8 +1214,289 @@ 0</sort_order> </fields> </usps> + <dhlint translate="label" module="usa"> + <label>DHL</label> + <frontend_type>text</frontend_type> + <sort_order>140</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + <fields> + <active translate="label"> + <label>Enabled for Checkout</label> + <frontend_type>select</frontend_type> + <source_model>adminhtml/system_config_source_yesno</source_model> + <sort_order>10</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + </active> + <gateway_url translate="label"> + <label>Gateway URL</label> + <frontend_type>text</frontend_type> + <sort_order>20</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>0</show_in_store> + </gateway_url> + <title translate="label"> + <label>Title</label> + <frontend_type>text</frontend_type> + <sort_order>20</sort_order> + <show_in_default>1</show_in_default> + <show_in_website>1</show_in_website> + <show_in_store>1</show_in_store> + + + + obscure + adminhtml/system_config_backend_encrypted + 50 + 1 + 1 + 0 + + + + obscure + adminhtml/system_config_backend_encrypted + 60 + 1 + 1 + 0 + + + + text + 70 + 1 + 1 + 0 + + + + select + usa/shipping_carrier_dhl_international_source_contenttype + 90 + 1 + 1 + 0 + + + + select + shipping/source_handlingType + 100 + 1 + 1 + 0 + + + + "Per Order" allows single handling fee for entire order. "Per Package" allows individual handling fee for each package. + select + shipping/source_handlingAction + 110 + 1 + 1 + 0 + + + + text + validate-number validate-zero-or-greater + 120 + 1 + 1 + 0 + + + + Allows breaking total order weight into smaller pieces if it exeeds 70 kg to ensure accurate calculation of shipping charges. + select + adminhtml/system_config_source_yesno + 130 + 1 + 1 + 1 + + + + select + usa/shipping_carrier_dhl_international_source_method_unitofmeasure + usa/adminhtml_dhl_unitofmeasure + 140 + 1 + 1 + 1 + + + + select + usa/shipping_carrier_dhl_international_source_method_size + 150 + 1 + 1 + 1 + + + + text + 151 + 1 + 1 + 1 + 1 + + + + text + 152 + 1 + 1 + 1 + 1 + + + + text + 153 + 1 + 1 + 1 + 1 + + + + multiselect + usa/shipping_carrier_dhl_international_source_method_doc + 170 + 1 + 1 + 0 + D + + + + multiselect + usa/shipping_carrier_dhl_international_source_method_nondoc + 170 + 1 + 1 + 0 + N + + + + Package ready time after order submission (in hours) + text + 180 + 1 + 1 + 0 + + + + textarea + 800 + 1 + 1 + 1 + + + + + select + free-method + usa/shipping_carrier_dhl_international_source_method_freedoc + 1200 + 1 + 1 + 0 + D + + + + select + free-method + usa/shipping_carrier_dhl_international_source_method_freenondoc + 1200 + 1 + 1 + 0 + N + + + + select + adminhtml/system_config_source_enabledisable + 1210 + 1 + 1 + 0 + + + + text + validate-number validate-zero-or-greater + 1220 + 1 + 1 + 0 + + + + select + 1900 + shipping-applicable-country + adminhtml/system_config_source_shipping_allspecificcountries + 1 + 1 + 0 + + + + multiselect + 1910 + adminhtml/system_config_source_country + 1 + 1 + 0 + 1 + + + + select + 1940 + shipping-skip-hide + adminhtml/system_config_source_yesno + 1 + 1 + 0 + + + + text + 2000 + 1 + 1 + 0 + + + + select + adminhtml/system_config_source_yesno + 1950 + 1 + 1 + 0 + + + - diff --git app/code/core/Mage/Usa/etc/wsdl/FedEx/RateService_v10.wsdl app/code/core/Mage/Usa/etc/wsdl/FedEx/RateService_v10.wsdl new file mode 100644 index 0000000..d7e635a --- /dev/null +++ app/code/core/Mage/Usa/etc/wsdl/FedEx/RateService_v10.wsdl @@ -0,0 +1,4870 @@ + + + + + + + + Specifies additional labels to be produced. All required labels for shipments will be produced without the need to request additional labels. These are only available as thermal labels. + + + + + The type of additional labels to return. + + + + + The number of this type label to return + + + + + + + Identifies the type of additional labels. + + + + + + + + + + + + + + + Descriptive data for a physical location. May be used as an actual physical address (place to which one could go), or as a container of "address parts" which should be handled as a unit (such as a city-state-ZIP combination within the US). + + + + + Combination of number, street name, etc. At least one line is required for a valid physical address; empty lines should not be included. + + + + + Name of city, town, etc. + + + + + Identifying abbreviation for US state, Canada province, etc. Format and presence of this field will vary, depending on country. + + + + + Identification of a region (usually small) for mail/package delivery. Format and presence of this field will vary, depending on country. + + + + + Relevant only to addresses in Puerto Rico. + + + + + The two-letter code used to identify a country. + + + + + Indicates whether this address residential (as opposed to commercial). + + + + + + + + Specifies which filing option is being exercised by the customer. + Required for non-document shipments originating in Canada destined for any country other than Canada, the United States, Puerto Rico or the U.S. Virgin Islands. + + + + + + + + + + + + Identification of the type of barcode (symbology) used on FedEx documents and labels. + + + + + + + + + + + + + + + + + + Identification of a FedEx operating company (transportation). + + + + + + + + + + + + + The instructions indicating how to print the Certificate of Origin ( e.g. whether or not to include the instructions, image type, etc ...) + + + + + Specifies characteristics of a shipping document to be produced. + + + + + Specifies the usage and identification of customer supplied images to be used on this document. + + + + + + + + + + + + + Specifies the type of brokerage to be applied to a shipment. + + + + + + + + + + + + Descriptive data for the client submitting a transaction. + + + + + The FedEx account number associated with this transaction. + + + + + This number is assigned by FedEx and identifies the unique device from which the request is originating + + + + + Only used in transactions which require identification of the Fed Ex Office integrator. + + + + + Indicates the region from which the transaction is submitted. + + + + + The language to be used for human-readable Notification.localizedMessages in responses to the request containing this ClientDetail object. Different requests from the same client may contain different Localization data. (Contrast with TransactionDetail.localization, which governs data payload language/translation.) + + + + + + + + + + + + + + + + + + + + + + Identifies the type of funds FedEx should collect upon shipment delivery. + + + + + + + + + + Descriptive data required for a FedEx COD (Collect-On-Delivery) shipment. + + + + + + Specifies the details of the charges are to be added to the COD collect amount. + + + + + Identifies the type of funds FedEx should collect upon package delivery + + + + + For Express this is the descriptive data that is used for the recipient of the FedEx Letter containing the COD payment. For Ground this is the descriptive data for the party to receive the payment that prints the COD receipt. + + + + + Indicates which type of reference information to include on the COD return shipping label. + + + + + + + Indicates which type of reference information to include on the COD return shipping label. + + + + + + + + + + + CommercialInvoice element is required for electronic upload of CI data. It will serve to create/transmit an Electronic Commercial Invoice through the FedEx Systems. Customers are responsible for printing their own Commercial Invoice.If you would likeFedEx to generate a Commercial Invoice and transmit it to Customs. for clearance purposes, you need to specify that in the ShippingDocumentSpecification element. If you would like a copy of the Commercial Invoice that FedEx generated returned to you in reply it needs to be specified in the ETDDetail/RequestedDocumentCopies element. Commercial Invoice support consists of maximum of 99 commodity line items. + + + + + Any comments that need to be communicated about this shipment. + + + + + Any freight charges that are associated with this shipment. + + + + + Any taxes or miscellaneous charges(other than Freight charges or Insurance charges) that are associated with this shipment. + + + + + Specifies which kind of charge is being recorded in the preceding field. + + + + + Any packing costs that are associated with this shipment. + + + + + Any handling costs that are associated with this shipment. + + + + + Free-form text. + + + + + Free-form text. + + + + + Free-form text. + + + + + The reason for the shipment. Note: SOLD is not a valid purpose for a Proforma Invoice. + + + + + Customer assigned Invoice number + + + + + Name of the International Expert that completed the Commercial Invoice different from Sender. + + + + + Required for dutiable international Express or Ground shipment. This field is not applicable to an international PIB(document) or a non-document which does not require a Commercial Invoice + + + + + + + The instructions indicating how to print the Commercial Invoice( e.g. image type) Specifies characteristics of a shipping document to be produced. + + + + + + Specifies the usage and identification of a customer supplied image to be used on this document. + + + + + + + Information about the transit time and delivery commitment date and time. + + + + + The Commodity applicable to this commitment. + + + + + The FedEx service type applicable to this commitment. + + + + + Shows the specific combination of service options combined with the service type that produced this committment in the set returned to the caller. + + + + + Supporting detail for applied options identified in preceding field. + + + + + THe delivery commitment date/time. Express Only. + + + + + The delivery commitment day of the week. + + + + + The number of transit days; applies to Ground and LTL Freight; indicates minimum transit time for SmartPost. + + + + + Maximum number of transit days, for SmartPost shipments. + + + + + The service area code for the destination of this shipment. Express only. + + + + + The address of the broker to be used for this shipment. + + + + + The FedEx location identifier for the broker. + + + + + The delivery commitment date/time the shipment will arrive at the border. + + + + + The delivery commitment day of the week the shipment will arrive at the border. + + + + + The number of days it will take for the shipment to make it from broker to destination + + + + + The delivery commitment date for shipment served by GSP (Global Service Provider) + + + + + The delivery commitment day of the week for the shipment served by GSP (Global Service Provider) + + + + + Messages concerning the ability to provide an accurate delivery commitment on an International commit quote. These could be messages providing information about why a commitment could not be returned or a successful message such as "REQUEST COMPLETED" + + + + + Messages concerning the delivery commitment on an International commit quote such as "0:00 A.M. IF NO CUSTOMS DELAY" + + + + + Information about why a shipment delivery is delayed and at what level (country/service etc.). + + + + + + Required documentation for this shipment. + + + + + Freight origin and destination city center information and total distance between origin and destination city centers. + + + + + + + The type of delay this shipment will encounter. + + + + + + + + + + + + + + + + + + + For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction. + If this shipment cotains more than four commodities line items, the four highest valued should be included in the first 4 occurances for this request. + + + + + + total number of pieces of this commodity + + + + + total number of pieces of this commodity + + + + + Complete and accurate description of this commodity. + + 450 + + + + + + Country code where commodity contents were produced or manufactured in their final form. + + 2 + + + + + + + Unique alpha/numeric representing commodity item. + At least one occurrence is required for US Export shipments if the Customs Value is greater than $2500 or if a valid US Export license is required. + + + 14 + + + + + + Total weight of this commodity. 1 explicit decimal position. Max length 11 including decimal. + + + + + Number of units of a commodity in total number of pieces for this line item. Max length is 9 + + + + + Unit of measure used to express the quantity of this commodity line item. + + 3 + + + + + + Contains only additional quantitative information other than weight and quantity to calculate duties and taxes. + + + + + Value of each unit in Quantity. Six explicit decimal positions, Max length 18 including decimal. + + + + + + Total customs value for this line item. + It should equal the commodity unit quantity times commodity unit value. + Six explicit decimal positions, max length 18 including decimal. + + + + + + Defines additional characteristic of commodity used to calculate duties and taxes + + + + + Applicable to US export shipping only. + + 12 + + + + + + + + An identifying mark or number used on the packaging of a shipment to help customers identify a particular shipment. + + + 15 + + + + + + All data required for this commodity in NAFTA Certificate of Origin. + + + + + + + Defines additional data to print in the Configurable portion of the label, this allows you to print the same type information on the label that can also be printed on the doc tab. + + + + + 1 of 12 possible zones to position data. + + + + + The identifiying text for the data in this zone. + + + + + A reference to a field in either the request or reply to print in this zone following the header. + + + + + A literal value to print after the header in this zone. + + + + + + + The descriptive data for a point-of-contact person. + + + + + Client provided identifier corresponding to this contact information. + + + + + Identifies the contact person's name. + + + + + Identifies the contact person's title. + + + + + Identifies the company this contact is associated with. + + + + + Identifies the phone number associated with this contact. + + + + + Identifies the phone extension associated with this contact. + + + + + Identifies the pager number associated with this contact. + + + + + Identifies the fax number associated with this contact. + + + + + Identifies the email address associated with this contact. + + + + + + + + + + + + + + + + + + + + + Specifies the currency exchange performed on financial amounts for this rate. + + + + + The currency code for the original (converted FROM) currency. + + + + + The currency code for the final (converted INTO) currency. + + + + + Multiplier used to convert fromCurrency units to intoCurrency units. + + + + + + + + + Indicates the type of custom delivery being requested. + + + + + Time by which delivery is requested. + + + + + Range of dates for custom delivery request; only used if type is BETWEEN. + + + + + Date for custom delivery request; only used for types of ON, BETWEEN, or AFTER. + + + + + + + + + + + + + + + Data required to produce a custom-specified document, either at shipment or package level. + + + + + Common information controlling document production. + + + + + Applicable only to documents produced on thermal printers with roll stock. + + + + + Applicable only to documents produced on thermal printers with roll stock. + + + + + Identifies the formatting specification used to construct this custom document. + + + + + + + Constructed string, based on format and zero or more data fields, printed in specified barcode symbology. + + + + + + + + + Width of thinnest bar/space element in the barcode. + + + + + + + + Solid (filled) rectangular area on label. + + + + + + + + + + + + + + + + + + + + + + + + Image to be included from printer's memory, or from a local file for offline clients. + + + + + + Printer-specific index of graphic image to be printed. + + + + + Fully-qualified path and file name for graphic image to be printed. + + + + + + + + + Horizontal position, relative to left edge of custom area. + + + + + Vertical position, relative to top edge of custom area. + + + + + + + Constructed string, based on format and zero or more data fields, printed in specified printer font (for thermal labels) or generic font/size (for plain paper labels). + + + + + + + + Printer-specific font name for use with thermal printer labels. + + + + + Generic font name for use with plain paper labels. + + + + + Generic font size for use with plain paper labels. + + + + + + + + + + + + + + + + + + + Reference information to be associated with this package. + + + + + + + + + + + + + + + + + + + + + + + Allows customer-specified control of label content. + + + + + If omitted, no doc tab will be produced (i.e. default = former NONE type). + + + + + Defines any custom content to print on the label. + + + + + Defines additional data to print in the Configurable portion of the label, this allows you to print the same type information on the label that can also be printed on the doc tab. + + + + + Controls which data/sections will be suppressed. + + + + + For customers producing their own Ground labels, this field specifies which secondary barcode will be printed on the label; so that the primary barcode produced by FedEx has the corect SCNC. + + + + + The language to use when printing the terms and conditions on the label. + + + + + Controls the number of additional copies of supplemental labels. + + + + + This value reduces the default quantity of destination/consignee air waybill labels. A value of zero indicates no change to default. A minimum of one copy will always be produced. + + + + + + + + + + Descriptive data identifying the Broker responsible for the shipmet. + Required if BROKER_SELECT_OPTION is requested in Special Services. + + + + + + Interacts both with properties of the shipment and contractual relationship with the shipper. + + + + + + Applicable only for Commercial Invoice. If the consignee and importer are not the same, the Following importer fields are required. + Importer/Contact/PersonName + Importer/Contact/CompanyName + Importer/Contact/PhoneNumber + Importer/Address/StreetLine[0] + Importer/Address/City + Importer/Address/StateOrProvinceCode - if Importer Country Code is US or CA + Importer/Address/PostalCode - if Importer Country Code is US or CA + Importer/Address/CountryCode + + + + + + Specifies how the recipient is identified for customs purposes; the requirements on this information vary with destination country. + + + + + Indicates how payment of duties for the shipment will be made. + + + + + Indicates whether this shipment contains documents only or non-documents. + + + + + The total customs value for the shipment. This total will rrepresent th esum of the values of all commodities, and may include freight, miscellaneous, and insurance charges. Must contain 2 explicit decimal positions with a max length of 17 including the decimal. For Express International MPS, the Total Customs Value is in the master transaction and all child transactions + + + + + Identifies responsibilities with respect to loss, damage, etc. + + + + + Documents amount paid to third party for coverage of shipment content. + + + + + + CommercialInvoice element is required for electronic upload of CI data. It will serve to create/transmit an Electronic Commercial Invoice through FedEx System. Customers are responsible for printing their own Commercial Invoice. Commercial Invoice support consists of a maximum of 20 commodity line items. + + + + + + For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction. + If this shipment cotains more than four commodities line items, the four highest valued should be included in the first 4 occurances for this request. + + + + + + Country specific details of an International shipment. + + + + + FOOD_OR_PERISHABLE is required by FDA/BTA; must be true for food/perishable items coming to US or PR from non-US/non-PR origin. + + + + + + + Identifies whether or not the products being shipped are required to be accessible during delivery. + + + + + + + + + The descriptive data required for a FedEx shipment containing dangerous goods (hazardous materials). + + + + + Identifies whether or not the products being shipped are required to be accessible during delivery. + + + + + Shipment is packaged/documented for movement ONLY on cargo aircraft. + + + + + Indicates which kinds of hazardous content are in the current package. + + + + + Documents the kinds and quantities of all hazardous commodities in the current package. + + + + + Description of the packaging of this commodity, suitable for use on OP-900 and OP-950 forms. + + + + + Telephone number to use for contact in the event of an emergency. + + + + + Offeror's name or contract number, per DOT regulation. + + + + + + + + + + + + + + + + + + + + + + + + Information about why a shipment delivery is delayed and at what level( country/service etc.). + + + + + The date of the delay + + + + + + The attribute of the shipment that caused the delay(e.g. Country, City, LocationId, Zip, service area, special handling ) + + + + + The point where the delay is occurring (e.g. Origin, Destination, Broker location) + + + + + The reason for the delay (e.g. holiday, weekend, etc.). + + + + + The name of the holiday in that country that is causing the delay. + + + + + + + The attribute of the shipment that caused the delay(e.g. Country, City, LocationId, Zip, service area, special handling ) + + + + + + + + + + + + + + The point where the delay is occurring ( e.g. Origin, Destination, Broker location). + + + + + + + + + + + + Data required to complete the Destionation Control Statement for US exports. + + + + + + Comma-separated list of up to four country codes, required for DEPARTMENT_OF_STATE statement. + + + + + Name of end user, required for DEPARTMENT_OF_STATE statement. + + + + + + + Used to indicate whether the Destination Control Statement is of type Department of Commerce, Department of State or both. + + + + + + + + + The dimensions of this package and the unit type used for the measurements. + + + + + + + + + + + Driving or other transportation distances, distinct from dimension measurements. + + + + + Identifies the distance quantity. + + + + + Identifies the unit of measure for the distance value. + + + + + + + + + + + + + + + The DocTabContentType options available. + + + + + The DocTabContentType should be set to ZONE001 to specify additional Zone details. + + + + + The DocTabContentType should be set to BARCODED to specify additional BarCoded details. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zone number can be between 1 and 12. + + + + + Header value on this zone. + + + + + Reference path to the element in the request/reply whose value should be printed on this zone. + + + + + Free form-text to be printed in this zone. + + + + + Justification for the text printed on this zone. + + + + + + + Identifies the method by which the package is to be tendered to FedEx. This element does not dispatch a courier for package pickup. + + + + + + + + + + + + Specific information about the delivery of the email and options for the shipment. + + + + + Email address to send the URL to. + + + + + A message to be inserted into the email. + + + + + + + Information describing email notifications that will be sent in relation to events that occur during package movement + + + + + A message that will be included in the email notifications + + + + + Information describing the destination of the email, format of the email and events to be notified on + + + + + + + + + + + + + + + The format of the email + + + + + + + + + + The descriptive data for a FedEx email notification recipient. + + + + + Identifies the relationship this email recipient has to the shipment. + + + + + The email address to send the notification to + + + + + The types of email notifications being requested for this recipient. + + + + + The format of the email notification. + + + + + The language/locale to be used in this email notification. + + + + + + + Identifies the set of valid email notification recipient types. For SHIPPER, RECIPIENT and BROKER the email address asssociated with their definitions will be used, any email address sent with the email notification for these three email notification recipient types will be ignored. + + + + + + + + + + + + + + + + + + + + Customer-declared value, with data type and legal values depending on excise condition, used in defining the taxable value of the item. + + + + + + + Specifies the types of Estimated Duties and Taxes to be included in a rate quotation for an international shipment. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Electronic Trade document references used with the ETD special service. + + + + + Indicates the types of shipping documents produced for the shipper by FedEx (see ShippingDocumentSpecification) which should be copied back to the shipper in the shipment result data. + + + + + Currently not supported. + + + + + + + + Country specific details of an International shipment. + + + + + + Specifies which filing option is being exercised by the customer. + Required for non-document shipments originating in Canada destined for any country other than Canada, the United States, Puerto Rico or the U.S. Virgin Islands. + + + + + + General field for exporting-country-specific export data (e.g. B13A for CA, FTSR Exemption or AES Citation for US). + + + + + This field is applicable only to Canada export non-document shipments of any value to any destination. No special characters allowed. + + 10 + + + + + + Department of Commerce/Department of State information about this shipment. + + + + + + + Details specific to an Express freight shipment. + + + + + Indicates whether or nor a packing list is enclosed. + + + + + + Total shipment pieces. + ie. 3 boxes and 3 pallets of 100 pieces each = Shippers Load and Count of 303. + Applicable to International Priority Freight and International Economy Freight. + Values must be in the range of 1 - 99999 + + + + + + Required for International Freight shipping. Values must be 8- 12 characters in length. + + 12 + + + + + + Currently not supported. + + + + + Currently not supported. + + + + + Currently not supported. + + + + + + + Currently not supported. Delivery contact information for an Express freight shipment. + + + + + + + + + Indicates a FedEx Express operating region. + + + + + + + + + + + + Identifies a kind of FedEx facility. + + + + + + + + + + Specifies the optional features/characteristics requested for a Freight shipment utilizing a flatbed trailer. + + + + + + + + + + + + + + + + + + + + Individual charge which contributes to the total base charge for the shipment. + + + + + Freight class for this line item. + + + + + Effective freight class used for rating this line item. + + + + + NMFC Code for commodity. + + + + + Customer-provided description for this commodity or class line. + + + + + Weight for this commodity or class line. + + + + + Rate or factor applied to this line item. + + + + + Identifies the manner in which the chargeRate for this line item was applied. + + + + + The net or extended charge for this line item. + + + + + + + Specifies the way in which base charges for a Freight shipment or shipment leg are calculated. + + + + + + + + + + + + + + + + These values represent the industry-standard freight classes used for FedEx Freight and FedEx National Freight shipment description. (Note: The alphabetic prefixes are required to distinguish these values from decimal numbers on some client platforms.) + + + + + + + + + + + + + + + + + + + + + + + + + Information about the Freight Service Centers associated with this shipment. + + + + + Information about the origin Freight Service Center. + + + + + Information about the destination Freight Service Center. + + + + + The distance between the origin and destination FreightService Centers + + + + + + + + + + Date for all Freight guarantee types. + + + + + + + + + + + + + Identifies responsibilities with respect to loss, damage, etc. + + + + + + + + + Rate data specific to FedEx Freight or FedEx National Freight services. + + + + + A unique identifier for a specific rate quotation. + + + + + Specifies how total base charge is determined. + + + + + Freight charges which accumulate to the total base charge for the shipment. + + + + + Human-readable descriptions of additional information on this shipment rating. + + + + + + + Additional non-monetary data returned with Freight rates. + + + + + Unique identifier for notation. + + + + + Human-readable explanation of notation. + + + + + + + This class describes the relationship between a customer-specified address and the FedEx Freight / FedEx National Freight Service Center that supports that address. + + + + + Freight Industry standard non-FedEx carrier identification + + + + + The name of the Interline carrier. + + + + + Additional time it might take at the origin or destination to pickup or deliver the freight. This is usually due to the remoteness of the location. This time is included in the total transit time. + + + + + Service branding which may be used for local pickup or delivery, distinct from service used for line-haul of customer's shipment. + + + + + Distance between customer address (pickup or delivery) and the supporting Freight / National Freight service center. + + + + + Time to travel between customer address (pickup or delivery) and the supporting Freight / National Freight service center. + + + + + Specifies when/how the customer can arrange for pickup or delivery. + + + + + Specifies days of operation if localServiceScheduling is LIMITED. + + + + + Freight service center that is a gateway on the border of Canada or Mexico. + + + + + Alphabetical code identifying a Freight Service Center + + + + + Freight service center Contact and Address + + + + + + + Specifies the type of service scheduling offered from a Freight or National Freight Service Center to a customer-supplied address. + + + + + + + + + + Data applicable to shipments using FEDEX_FREIGHT and FEDEX_NATIONAL_FREIGHT services. + + + + + Account number used with FEDEX_FREIGHT service. + + + + + Used for validating FedEx Freight account number and (optionally) identifying third party payment on the bill of lading. + + + + + Account number used with FEDEX_NATIONAL_FREIGHT service. + + + + + Used for validating FedEx National Freight account number and (optionally) identifying third party payment on the bill of lading. + + + + + Indicates the role of the party submitting the transaction. + + + + + Designates which of the requester's tariffs will be used for rating. + + + + + Identifies the declared value for the shipment + + + + + Identifies the declared value units corresponding to the above defined declared value + + + + + + Identifiers for promotional discounts offered to customers. + + + + + Total number of individual handling units in the entire shipment (for unit pricing). + + + + + Estimated discount rate provided by client for unsecured rate quote. + + + + + Total weight of pallets used in shipment. + + + + + Overall shipment dimensions. + + + + + Description for the shipment. + + + + + Specifies which party will pay surcharges for any special services which support split billing. + + + + + Details of the commodities in the shipment. + + + + + + + Description of an individual commodity or class of content in a shipment. + + + + + Freight class for this line item. + + + + + Specification of handling-unit packaging for this commodity or class line. + + + + + Customer-provided description for this commodity or class line. + + + + + Weight for this commodity or class line. + + + + + FED EX INTERNAL USE ONLY - Individual line item dimensions. + + + + + Volume (cubic measure) for this commodity or class line. + + + + + + + Indicates the role of the party submitting the transaction. + + + + + + + + + + Specifies which party will be responsible for payment of any surcharges for Freight special services for which split billing is allowed. + + + + + Identifies the special service. + + + + + Indicates who will pay for the special service. + + + + + + + Data required to produce a General Agency Agreement document. Remaining content (business data) to be defined once requirements have been completed. + + + + + + + + Documents the kind and quantity of an individual hazardous commodity in a package. + + + + + Identifies and describes an individual hazardous commodity. + + + + + Specifies the amount of the commodity in alternate units. + + + + + Customer-provided specifications for handling individual commodities. + + + + + + + Identifies and describes an individual hazardous commodity. For 201001 load, this is based on data from the FedEx Ground Hazardous Materials Shipping Guide. + + + + + Regulatory identifier for a commodity (e.g. "UN ID" value). + + + + + + + + + + + + + Specifies how the commodity is to be labeled. + + + + + + + + + + Customer-provided specifications for handling individual commodities. + + + + + Specifies how the customer wishes the label text to be handled for this commodity in this package. + + + + + Text used in labeling the commodity under control of the labelTextOption field. + + + + + + + Indicates which kind of hazardous content (as defined by DOT) is being reported. + + + + + + + + + + + + Identifies number and type of packaging units for hazardous commodities. + + + + + Number of units of the type below. + + + + + Units in which the hazardous commodity is packaged. + + + + + + + Identifies DOT packing group for a hazardous commodity. + + + + + + + + + + Identifies amount and units for quantity of hazardous commodities. + + + + + Number of units of the type below. + + + + + Units by which the hazardous commodity is measured. + + + + + + + Descriptive data required for a FedEx shipment that is to be held at the destination FedEx location for pickup by the recipient. + + + + + Contact phone number for recipient of shipment. + + + + + Contact and address of FedEx facility at which shipment is to be held. + + + + + Type of facility at which package/shipment is to be held. + + + + + Location identification (for facilities identified by an alphanumeric location code). + + + + + Location identification (for facilities identified by an numeric location code). + + + + + + + The descriptive data required by FedEx for home delivery services. + + + + + + Required for Date Certain Home Delivery. + + + + + Required for Date Certain and Appointment Home Delivery. + + 15 + + + + + + + + + + + + + + + + + + + + + + + + The type of International shipment. + + + + + + + + + Specifies the type of label to be returned. + + + + + + + + + + + + + Names for data elements / areas which may be suppressed from printing on labels. + + + + + + + + + + + + + + + + + This indicates if the top or bottom of the label comes out of the printer first. + + + + + + + + + Relative to normal orientation for the printer. + + + + + + + + + + + Description of shipping label to be returned in the reply + + + + + Specify type of label to be returned + + + + + + The type of image or printer commands the label is to be formatted in. + DPL = Unimark thermal printer language + EPL2 = Eltron thermal printer language + PDF = a label returned as a pdf image + PNG = a label returned as a png image + ZPLII = Zebra thermal printer language + + + + + + For thermal printer lables this indicates the size of the label and the location of the doc tab if present. + + + + + This indicates if the top or bottom of the label comes out of the printer first. + + + + + Relative to normal orientation for the printer. RIGHT=90 degrees clockwise, UPSIDE_DOWN=180 degrees, LEFT=90 degrees counterclockwise. + + + + + If present, this contact and address information will replace the return address information on the label. + + + + + Allows customer-specified control of label content. + + + + + + + For thermal printer labels this indicates the size of the label and the location of the doc tab if present. + + + + + + + + + + + + + + + + + + + + + + Identifies the Liability Coverage Amount. For Jan 2010 this value represents coverage amount per pound + + + + + + + + + + + + + Represents a one-dimensional measurement in small units (e.g. suitable for measuring a package or document), contrasted with Distance, which represents a large one-dimensional measurement (e.g. distance between cities). + + + + + The numerical quantity of this measurement. + + + + + The units for this measurement. + + + + + + + CM = centimeters, IN = inches + + + + + + + + + Identifies the representation of human-readable text. + + + + + Two-letter code for language (e.g. EN, FR, etc.) + + + + + Two-letter code for the region (e.g. us, ca, etc..). + + + + + + + + + + + + + Internal FedEx use only. + + + + + + + + + + + + + + + + + + Data required to produce a Certificate of Origin document. Remaining content (business data) to be defined once requirements have been completed. + + + + + + + Indicates which Party (if any) from the shipment is to be used as the source of importer data on the NAFTA COO form. + + + + + Contact information for "Authorized Signature" area of form. + + + + + + + + + + + + Defined by NAFTA regulations. + + + + + Defined by NAFTA regulations. + + + + + Identification of which producer is associated with this commodity (if multiple producers are used in a single shipment). + + + + + + Date range over which RVC net cost was calculated. + + + + + + + + + + + + + + + + Net cost method used. + + + + + + + + + + See instructions for NAFTA Certificate of Origin for code definitions. + + + + + + + + + + + + + + + + + + + See instructions for NAFTA Certificate of Origin for code definitions. + + + + + + + + + + + + + + + + + + + + The descriptive data regarding the result of the submitted transaction. + + + + + The severity of this notification. This can indicate success or failure or some other information about the request. The values that can be returned are SUCCESS - Your transaction succeeded with no other applicable information. NOTE - Additional information that may be of interest to you about your transaction. WARNING - Additional information that you need to know about your transaction that you may need to take action on. ERROR - Information about an error that occurred while processing your transaction. FAILURE - FedEx was unable to process your transaction at this time due to a system failure. Please try again later + + + + + Indicates the source of this notification. Combined with the Code it uniquely identifies this notification + + + + + A code that represents this notification. Combined with the Source it uniquely identifies this notification. + + + + + Human-readable text that explains this notification. + + + + + The translated message. The language and locale specified in the ClientDetail. Localization are used to determine the representation. Currently only supported in a TrackReply. + + + + + A collection of name/value pairs that provide specific data to help the client determine the nature of an error (or warning, etc.) witout having to parse the message string. + + + + + + + + + Identifies the type of data contained in Value (e.g. SERVICE_TYPE, PACKAGE_SEQUENCE, etc..). + + + + + The value of the parameter (e.g. PRIORITY_OVERNIGHT, 2, etc..). + + + + + + + Identifies the set of severity values for a Notification. + + + + + + + + + + + + The instructions indicating how to print the OP-900 form for hazardous materials packages. + + + + + Specifies characteristics of a shipping document to be produced. + + + + + Identifies which reference type (from the package's customer references) is to be used as the source for the reference on this OP-900. + + + + + Specifies the usage and identification of customer supplied images to be used on this document. + + + + + Data field to be used when a name is to be printed in the document instead of (or in addition to) a signature image. + + + + + + + The Oversize classification for a package. + + + + + + + + + + Data for a package's rates, as calculated per a specific rate type. + + + + + Type used for this specific set of rate data. + + + + + Indicates which weight was used. + + + + + INTERNAL FEDEX USE ONLY. + + + + + The weight that was used to calculate the rate. + + + + + The dimensional weight of this package (if greater than actual). + + + + + The oversize weight of this package (if the package is oversize). + + + + + The transportation charge only (prior to any discounts applied) for this package. + + + + + The sum of all discounts on this package. + + + + + This package's baseCharge - totalFreightDiscounts. + + + + + The sum of all surcharges on this package. + + + + + This package's netFreight + totalSurcharges (not including totalTaxes). + + + + + The sum of all taxes on this package. + + + + + This package's netFreight + totalSurcharges + totalTaxes. + + + + + The total sum of all rebates applied to this package. + + + + + All rate discounts that apply to this package. + + + + + All rebates that apply to this package. + + + + + All surcharges that apply to this package (either because of characteristics of the package itself, or because it is carrying per-shipment surcharges for the shipment of which it is a part). + + + + + All taxes applicable (or distributed to) this package. + + + + + The variable handling charges calculated based on the type variable handling charges requested. + + + + + + + Identifies the collection of special services offered by FedEx. + + + + + + + + + + + + + + + These special services are available at the package level for some or all service types. If the shipper is requesting a special service which requires additional data, the package special service type must be present in the specialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object below. + + + + + The types of all special services requested for the enclosing shipment or package. + + + + + For use with FedEx Ground services only; COD must be present in shipment's special services. + + + + + Descriptive data required for a FedEx shipment containing dangerous materials. This element is required when SpecialServiceType.DANGEROUS_GOODS or HAZARDOUS_MATERIAL is present in the SpecialServiceTypes collection. + + + + + Descriptive data required for a FedEx shipment containing dry ice. This element is required when SpecialServiceType.DRY_ICE is present in the SpecialServiceTypes collection. + + + + + The descriptive data required for FedEx signature services. This element is required when SpecialServiceType.SIGNATURE_OPTION is present in the SpecialServiceTypes collection. + + + + + To be filled. + + + + + + + Identifies the packaging used by the requestor for the package. See PackagingType for list of valid enumerated values. + + + + + + + + + + + + + + The descriptive data for a person or company entitiy doing business with FedEx. + + + + + Identifies the FedEx account number assigned to the customer. + + 12 + + + + + + Descriptive data for taxpayer identification information. + + + + + Descriptive data identifying the point-of-contact person. + + + + + The descriptive data for a physical location. + + + + + + + The descriptive data for the monetary compensation given to FedEx for services rendered to the customer. + + + + + Identifies the method of payment for a service. See PaymentType for list of valid enumerated values. + + + + + Descriptive data identifying the party responsible for payment for a service. + + + + + + + Identifies the method of payment for a service. + + + + + + + + Descriptive data identifying the party responsible for payment for a service. + + + + + Identifies the FedEx account number assigned to the payor. + + 12 + + + + + + Identifies the country of the payor. + + + + + + + This information describes the kind of pending shipment being requested. + + + + + + Date after which the pending shipment will no longer be available for completion. + + + + + Only used with type of EMAIL. + + + + + + + + + + + + This enumeration rationalizes the former FedEx Express international "admissibility package" types (based on ANSI X.12) and the FedEx Freight packaging types. The values represented are those common to both carriers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes the pickup characteristics of a shipment (e.g. for use in a tag request). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Currently not supported. + + + + + + + + + + + + + + + + + + Indicates the reason that a dim divisor value was chose. + + + + + + + + + + + + Identifies a discount applied to the shipment. + + + + + Identifies the type of discount applied to the shipment. + + + + + + The amount of the discount applied to the shipment. + + + + + The percentage of the discount applied to the shipment. + + + + + + + Identifies the type of discount applied to the shipment. + + + + + + + + + + + + Selects the value from a set of rate data to which the percentage is applied. + + + + + + + + + + + The response to a RateRequest. The Notifications indicate whether the request was successful or not. + + + + + This indicates the highest level of severity of all the notifications returned in this reply. + + + + + The descriptive data regarding the results of the submitted transaction. + + + + + Contains the CustomerTransactionId that was sent in the request. + + + + + The version of this reply. + + + + + Each element contains all rate data for a single service. If service was specified in the request, there will be a single entry in this array; if service was omitted in the request, there will be a separate entry in this array for each service being compared. + + + + + + + + + Identifies the FedEx service to use in shipping the package. See ServiceType for list of valid enumerated values. + + + + + Identifies the packaging used by the requestor for the package. See PackagingType for list of valid enumerated values. + + + + + Shows the specific combination of service options combined with the service type that produced this committment in the set returned to the caller. + + + + + Supporting detail for applied options identified in preceding field. + + + + + + + + + Identification of an airport, using standard three-letter abbreviations. + + + + + Indicates whether or not this shipment is eligible for a money back guarantee. + + + + + Commitment code for the origin. + + + + + Commitment code for the destination. + + + + + Time in transit from pickup to delivery. + + + + + Maximum expected transit time + + + + + The signature option for this package. + + + + + The actual rate type of the charges for this package. + + + + + Each element contains all rate data for a single rate type. + + + + + + + Descriptive data sent to FedEx by a customer in order to rate a package/shipment. + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Allows the caller to specify that the transit time and commit data are to be returned in the reply. + + + + + Candidate carriers for rate-shopping use case. This field is only considered if requestedShipment/serviceType is omitted. + + + + + Contains zero or more service options whose combinations are to be considered when replying with available services. + + + + + The shipment for which a rate quote (or rate-shopping comparison) is desired. + + + + + + + Indicates the type of rates to be returned. + + + + + + + + + Select the type of rate from which the element is to be selected. + + + + + + + + + If requesting rates using the PackageDetails element (one package at a time) in the request, the rates for each package will be returned in this element. Currently total piece total weight rates are also retuned in this element. + + + + + Echoed from the corresponding package in the rate request (if provided). + + + + + Used with request containing PACKAGE_GROUPS, to identify which group of identical packages was used to produce a reply item. + + + + + The difference between "list" and "account" net charge. + + + + + Ground COD is shipment level. + + + + + + Rate data that are tied to a specific package and rate type combination. + + + + + + + This class groups the shipment and package rating data for a specific rate type for use in a rating reply, which groups result data by rate type. + + + + + The difference between "list" and "account" total net charge. + + + + + Express COD is shipment level. + + + + + The shipment-level totals for this rate type. + + + + + The package-level data for this rate type. + + + + + + + The method used to calculate the weight to be used in rating the package.. + + + + + + + + + + + + + + + + + + + Identifies a discount applied to the shipment. + + + + + + + The amount of the discount applied to the shipment. + + + + + The percentage of the discount applied to the shipment. + + + + + + + Identifies the type of discount applied to the shipment. + + + + + + + + + + Specifies how the recipient is identified for customs purposes; the requirements on this information vary with destination country. + + + + + Specifies the kind of identification being used. + + + + + Contains the actual ID value, of the type specified above. + + + + + + + Type of Brazilian taxpayer identifier provided in Recipient/TaxPayerIdentification/Number. For shipments bound for Brazil this overrides the value in Recipient/TaxPayerIdentification/TinType + + + + + + + + + + FOOD_OR_PERISHABLE is required by FDA/BTA; must be true for food/perishable items coming to US or PR from non-US/non-PR origin + + + + + + + + + + This class rationalizes RequestedPackage and RequestedPackageSummary from previous interfaces. The way in which it is uses within a RequestedShipment depends on the RequestedPackageDetailType value specified for that shipment. + + + + + Used only with INDIVIDUAL_PACKAGE, as a unique identifier of each requested package. + + + + + Used only with PACKAGE_GROUPS, as a unique identifier of each group of identical packages. + + + + + Used only with PACKAGE_GROUPS, as a count of packages within a group of identical packages. + + + + + + Only used for INDIVIDUAL_PACKAGES and PACKAGE_GROUPS. Ignored for PACKAGE_SUMMARY, in which case totalInsuredValue and packageCount on the shipment will be used to determine this value. + + + + + Only used for INDIVIDUAL_PACKAGES and PACKAGE_GROUPS. Ignored for PACKAGE_SUMMARY, in which case totalweight and packageCount on the shipment will be used to determine this value. + + + + + + Provides additional detail on how the customer has physically packaged this item. As of June 2009, required for packages moving under international and SmartPost services. + + + + + Human-readable text describing the package. + + + + + + + Only used for INDIVIDUAL_PACKAGES and PACKAGE_GROUPS. + + + + + + + The descriptive data for the shipment being tendered to FedEx. + + + + + Identifies the date and time the package is tendered to FedEx. Both the date and time portions of the string are expected to be used. The date should not be a past date or a date more than 10 days in the future. The time is the local time of the shipment based on the shipper's time zone. The date component must be in the format: YYYY-MM-DD (e.g. 2006-06-26). The time component must be in the format: HH:MM:SS using a 24 hour clock (e.g. 11:00 a.m. is 11:00:00, whereas 5:00 p.m. is 17:00:00). The date and time parts are separated by the letter T (e.g. 2006-06-26T17:00:00). There is also a UTC offset component indicating the number of hours/mainutes from UTC (e.g 2006-06-26T17:00:00-0400 is defined form June 26, 2006 5:00 pm Eastern Time). + + + + + Identifies the method by which the package is to be tendered to FedEx. This element does not dispatch a courier for package pickup. See DropoffType for list of valid enumerated values. + + + + + Identifies the FedEx service to use in shipping the package. See ServiceType for list of valid enumerated values. + + + + + Identifies the packaging used by the requestor for the package. See PackagingType for list of valid enumerated values. + + + + + Identifies the total weight of the shipment being conveyed to FedEx.This is only applicable to International shipments and should only be used on the first package of a mutiple piece shipment.This value contains 1 explicit decimal position + + + + + Total insured amount. + + + + + Descriptive data identifying the party responsible for shipping the package. Shipper and Origin should have the same address. + + + + + Descriptive data identifying the party receiving the package. + + + + + A unique identifier for a recipient location + + 10 + + + + + + Physical starting address for the shipment, if different from shipper's address. + + + + + Descriptive data indicating the method and means of payment to FedEx for providing shipping services. + + + + + Descriptive data regarding special services requested by the shipper for this shipment. If the shipper is requesting a special service which requires additional data (e.g. COD), the special service type must be present in the specialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object. For example, to request COD, "COD" must be included in the SpecialServiceTypes collection and the CodDetail object must contain the required data. + + + + + Details specific to an Express freight shipment. + + + + + Data applicable to shipments using FEDEX_FREIGHT and FEDEX_NATIONAL_FREIGHT services. + + + + + Used with Ground Home Delivery and Freight. + + + + + Details about how to calculate variable handling charges at the shipment level. + + + + + Customs clearance data, used for both international and intra-country shipping. + + + + + For use in "process tag" transaction. + + + + + Specifies the characteristics of a shipment pertaining to SmartPost services. + + + + + If true, only the shipper/payor will have visibility of this shipment. + + + + + Details about the image format and printer type the label is to returned in. + + + + + Contains data used to create additional (non-label) shipping documents. + + + + + Specifies whether and what kind of rates the customer wishes to have quoted on this shipment. The reply will also be constrained by other data on the shipment and customer. + + + + + Specifies whether the customer wishes to have Estimated Duties and Taxes provided with the rate quotation on this shipment. Only applies with shipments moving under international services. + + + + + The total number of packages in the entire shipment (even when the shipment spans multiple transactions.) + + + + + Specifies which package-level data values are provided at the shipment-level only. The package-level data values types specified here will not be provided at the package-level. + + + + + One or more package-attribute descriptions, each of which describes an individual package, a group of identical packages, or (for the total-piece-total-weight case) common characteristics all packages in the shipment. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These values are used to control the availability of certain special services at the time when a customer uses the e-mail label link to create a return shipment. + + + + + + + + + + + + Identifies the allowed (merchant-authorized) special services which may be selected when the subsequent shipment is created. Only services represented in EMailLabelAllowedSpecialServiceType will be controlled by this list. + + + + + + + Information relating to a return shipment. + + + + + The type of return shipment that is being requested. At present the only type of retrun shipment that is supported is PRINT_RETURN_LABEL. With this option you can print a return label to insert into the box of an outbound shipment. This option can not be used to print an outbound label. + + + + + Return Merchant Authorization + + + + + Specific information about the delivery of the email and options for the shipment. + + + + + + + The type of return shipment that is being requested. + + + + + + + + + + The "PAYOR..." rates are expressed in the currency identified in the payor's rate table(s). The "RATED..." rates are expressed in the currency of the origin country. Former "...COUNTER..." values have become "...RETAIL..." values, except for PAYOR_COUNTER and RATED_COUNTER, which have been removed. + + + + + + + + + + + + + + + Return Merchant Authorization + + + + + Return Merchant Authorization Number + + 20 + + + + + + The reason for the return. + + 60 + + + + + + + + + + + + + + + + These values control the optional features of service that may be combined in a commitment/rate comparision transaction. + + + + + + + + + + + Supporting detail for applied options identified in a rate quote. + + + + + Identifies the type of Freight Guarantee applied, if FREIGHT_GUARANTEE is applied to the rate quote. + + + + + Identifies the smartPostHubId used during rate quote, if SMART_POST_HUB_ID is a variable option on the rate request. + + + + + Identifies the indicia used during rate quote, if SMART_POST_ALLOWED_INDICIA is a variable option on the rate request. + + + + + + + Identifies the FedEx service to use in shipping the package. See ServiceType for list of valid enumerated values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shipment-level totals of dry ice data across all packages. + + + + + Total number of packages in the shipment that contain dry ice. + + + + + Total shipment dry ice weight for all packages. + + + + + + + Data for a single leg of a shipment's total/summary rates, as calculated per a specific rate type. + + + + + Human-readable text describing the shipment leg. + + + + + Origin for this leg. + + + + + Destination for this leg. + + + + + Type used for this specific set of rate data. + + + + + Indicates the rate scale used. + + + + + Indicates the rate zone used (based on origin and destination). + + + + + + Indicates which weight was used. + + + + + INTERNAL FEDEX USE ONLY. + + + + + Specifies the currency exchange performed on financial amounts for this rate. + + + + + Indicates which special rating cases applied to this shipment. + + + + + + Identifies the type of dim divisor that was applied. + + + + + + + Sum of dimensional weights for all packages. + + + + + + + + + This shipment's totalNetFreight + totalSurcharges (not including totalTaxes). + + + + + Total of the transportation-based taxes. + + + + + + + Total of all values under this shipment's dutiesAndTaxes; only provided if estimated duties and taxes were calculated for this shipment. + + + + + This shipment's totalNetCharge + totalDutiesAndTaxes; only provided if estimated duties and taxes were calculated for this shipment AND duties, taxes and transportation charges are all paid by the same sender's account. + + + + + Rate data specific to FedEx Freight and FedEx National Freight services. + + + + + All rate discounts that apply to this shipment. + + + + + All rebates that apply to this shipment. + + + + + All surcharges that apply to this shipment. + + + + + All transportation-based taxes applicable to this shipment. + + + + + All commodity-based duties and taxes applicable to this shipment. + + + + + The "order level" variable handling charges. + + + + + The total of all variable handling charges at both shipment (order) and package level. + + + + + + + These values identify which package-level data values will be provided at the shipment-level. + + + + + + + + + + Data for a shipment's total/summary rates, as calculated per a specific rate type. The "total..." fields may differ from the sum of corresponding package data for Multiweight or Express MPS. + + + + + Type used for this specific set of rate data. + + + + + Indicates the rate scale used. + + + + + Indicates the rate zone used (based on origin and destination). + + + + + Indicates the type of pricing used for this shipment. + + + + + Indicates which weight was used. + + + + + INTERNAL FEDEX USE ONLY. + + + + + Specifies the currency exchange performed on financial amounts for this rate. + + + + + Indicates which special rating cases applied to this shipment. + + + + + The value used to calculate the weight based on the dimensions. + + + + + Identifies the type of dim divisor that was applied. + + + + + + The weight used to calculate these rates. + + + + + Sum of dimensional weights for all packages. + + + + + + The total discounts used in the rate calculation. + + + + + The freight charge minus discounts. + + + + + The total amount of all surcharges applied to this shipment. + + + + + This shipment's totalNetFreight + totalSurcharges (not including totalTaxes). + + + + + Total of the transportation-based taxes. + + + + + The net charge after applying all discounts and surcharges. + + + + + The total sum of all rebates applied to this shipment. + + + + + Total of all values under this shipment's dutiesAndTaxes; only provided if estimated duties and taxes were calculated for this shipment. + + + + + This shipment's totalNetCharge + totalDutiesAndTaxes; only provided if estimated duties and taxes were calculated for this shipment AND duties, taxes and transportation charges are all paid by the same sender's account. + + + + + Identifies the Rate Details per each leg in a Freight Shipment + + + + + Rate data specific to FedEx Freight and FedEx National Freight services. + + + + + All rate discounts that apply to this shipment. + + + + + All rebates that apply to this shipment. + + + + + All surcharges that apply to this shipment. + + + + + All transportation-based taxes applicable to this shipment. + + + + + All commodity-based duties and taxes applicable to this shipment. + + + + + The "order level" variable handling charges. + + + + + The total of all variable handling charges at both shipment (order) and package level. + + + + + + + Identifies the collection of special service offered by FedEx. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These special services are available at the shipment level for some or all service types. If the shipper is requesting a special service which requires additional data (such as the COD amount), the shipment special service type must be present in the specialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object below. + + + + + The types of all special services requested for the enclosing shipment (or other shipment-level transaction). + + + + + Descriptive data required for a FedEx COD (Collect-On-Delivery) shipment. This element is required when SpecialServiceType.COD is present in the SpecialServiceTypes collection. + + + + + Descriptive data required for a FedEx shipment that is to be held at the destination FedEx location for pickup by the recipient. This element is required when SpecialServiceType.HOLD_AT_LOCATION is present in the SpecialServiceTypes collection. + + + + + Descriptive data required for FedEx to provide email notification to the customer regarding the shipment. This element is required when SpecialServiceType.EMAIL_NOTIFICATION is present in the SpecialServiceTypes collection. + + + + + The descriptive data required for FedEx Printed Return Label. This element is required when SpecialServiceType.PRINTED_RETURN_LABEL is present in the SpecialServiceTypes collection + + + + + This field should be populated for pending shipments (e.g. e-mail label) It is required by a PENDING_SHIPMENT special service type. + + + + + The number of packages with dry ice and the total weight of the dry ice. + + + + + The descriptive data required for FedEx Home Delivery options. This element is required when SpecialServiceType.HOME_DELIVERY_PREMIUM is present in the SpecialServiceTypes collection + + + + + + + Electronic Trade document references. + + + + + Specification for date or range of dates on which delivery is to be attempted. + + + + + + + Each occurrence of this class specifies a particular way in which a kind of shipping document is to be produced and provided. + + + + + Values in this field specify how to create and return the document. + + + + + Specifies how to organize all documents of this type. + + + + + Specifies how to e-mail document images. + + + + + Specifies how a queued document is to be printed. + + + + + + + Specifies how to return a shipping document to the caller. + + + + + + + + + + + + + + Specifies how to e-mail shipping documents. + + + + + Provides the roles and email addresses for e-mail recipients. + + + + + Identifies the convention by which documents are to be grouped as e-mail attachments. + + + + + + + + + + + + + Specifies an individual recipient of e-mailed shipping document(s). + + + + + Identifies the relationship of this recipient in the shipment. + + + + + Address to which the document is to be sent. + + + + + + + Specifies characteristics of a shipping document to be produced. + + + + + Specifies how to create, organize, and return the document. + + + + + Specifies how far down the page to move the beginning of the image; allows for printing on letterhead and other pre-printed stock. + + + + + + + For those shipping document types which have both a "form" and "instructions" component (e.g. NAFTA Certificate of Origin and General Agency Agreement), this field indicates whether to provide the instructions. + + + + + Governs the language to be used for this individual document, independently from other content returned for the same shipment. + + + + + + + Specifies how to organize all shipping documents of the same type. + + + + + + + + + Specifies the image format used for a shipping document. + + + + + + + + + + + + Specifies printing options for a shipping document. + + + + + Provides environment-specific printer identification. + + + + + + + Contains all data required for additional (non-label) shipping documents to be produced in conjunction with a specific shipment. + + + + + Indicates the types of shipping documents requested by the shipper. + + + + + + + Specifies the production of each package-level custom document (the same specification is used for all packages). + + + + + Specifies the production of a shipment-level custom document. + + + + + Details pertaining to the GAA. + + + + + Details pertaining to NAFTA COO. + + + + + Specifies the production of the OP-900 document for hazardous materials packages. + + + + + + + Specifies the type of paper (stock) on which a document will be printed. + + + + + + + + + + + + + + + + + The descriptive data required for FedEx delivery signature services. + + + + + Identifies the delivery signature services option selected by the customer for this shipment. See OptionType for the list of valid values. + + + + + Identifies the delivery signature release authorization number. + + 10 + + + + + + + + Identifies the delivery signature services options offered by FedEx. + + + + + + + + + + + + These values are mutually exclusive; at most one of them can be attached to a SmartPost shipment. + + + + + + + + + + + + + + + + + + + + + Data required for shipments handled under the SMART_POST and GROUND_SMART_POST service types. + + + + + + + + + + + Indicates which special rating cases applied to this shipment. + + + + + + + + + Identifies each surcharge applied to the shipment. + + + + + The type of surcharge applied to the shipment. + + + + + + + The amount of the surcharge applied to the shipment. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifies each tax applied to the shipment. + + + + + + + + + + + + + + + + + + + + + Specifice the kind of tax or miscellaneous charge being reported on a Commercial Invoice. + + + + + + + + + + + + + The descriptive data for taxpayer identification information. + + + + + Identifies the category of the taxpayer identification number. See TinType for the list of values. + + + + + Identifies the taxpayer identification number. + + 18 + + + + + + Identifies the usage of Tax Identification Number in Shipment processing + + + + + + + + Required for dutiable international express or ground shipment. This field is not applicable to an international PIB (document) or a non-document which does not require a commercial invoice express shipment. + CFR_OR_CPT (Cost and Freight/Carriage Paid TO) + CIF_OR_CIP (Cost Insurance and Freight/Carraige Insurance Paid) + DDP (Delivered Duty Paid) + DDU (Delivered Duty Unpaid) + EXW (Ex Works) + FOB_OR_FCA (Free On Board/Free Carrier) + + + + + + + + + + + + + + Identifies the category of the taxpayer identification number. + + + + + + + + + + + + + + + + + + + + + + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Free form text to be echoed back in the reply. Used to match requests and replies. + + + + + Governs data payload language/translations (contrasted with ClientDetail.localization, which governs Notification.localizedMessage language selection). + + + + + + + Time in transit from pickup to delivery. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This definition of variable handling charge detail is intended for use in Jan 2011 corp load. + + + + + Used with Variable handling charge type of FIXED_VALUE. Contains the amount to be added to the freight charge. Contains 2 explicit decimal positions with a total max length of 10 including the decimal. + + + + + Actual percentage (10 means 10%, which is a mutiplier of 0.1) + + + + + Select the value from a set of rate data to which the percentage is applied. + + + + + Select the type of rate from which the element is to be selected. + + + + + + + The variable handling charges calculated based on the type variable handling charges requested. + + + + + The variable handling charge amount calculated based on the requested variable handling charge detail. + + + + + The calculated varibale handling charge plus the net charge. + + + + + + + Three-dimensional volume/cubic measurement. + + + + + + + + + Units of three-dimensional volume/cubic measure. + + + + + + + + + The descriptive data for the heaviness of an object. + + + + + Identifies the unit of measure associated with a weight value. + + + + + Identifies the weight value of a package/shipment. + + + + + + + Identifies the unit of measure associated with a weight value. See WeightUnits for the list of valid enumerated values. + + + + + + + + + Used in authentication of the sender's identity. + + + + + Credential used to authenticate a specific software application. This value is provided by FedEx after registration. + + + + + + + Two part authentication string used for the sender's identity + + + + + Identifying part of authentication credential. This value is provided by FedEx after registration + + + + + Secret part of authentication key. This value is provided by FedEx after registration. + + + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Identifies a system or sub-system which performs an operation. + + + + + Identifies the service business level. + + + + + Identifies the service interface level. + + + + + Identifies the service code level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git app/code/core/Mage/Usa/etc/wsdl/FedEx/ShipService_v10.wsdl app/code/core/Mage/Usa/etc/wsdl/FedEx/ShipService_v10.wsdl new file mode 100644 index 0000000..6a35329 --- /dev/null +++ app/code/core/Mage/Usa/etc/wsdl/FedEx/ShipService_v10.wsdl @@ -0,0 +1,5472 @@ + + + + + + + + + + + + + + + + + + Specifies additional labels to be produced. All required labels for shipments will be produced without the need to request additional labels. These are only available as thermal labels. + + + + + The type of additional labels to return. + + + + + The number of this type label to return + + + + + + + Identifies the type of additional labels. + + + + + + + + + + + + + + + + Descriptive data for a physical location. May be used as an actual physical address (place to which one could go), or as a container of "address parts" which should be handled as a unit (such as a city-state-ZIP combination within the US). + + + + + Combination of number, street name, etc. At least one line is required for a valid physical address; empty lines should not be included. + + + + + Name of city, town, etc. + + + + + Identifying abbreviation for US state, Canada province, etc. Format and presence of this field will vary, depending on country. + + + + + Identification of a region (usually small) for mail/package delivery. Format and presence of this field will vary, depending on country. + + + + + Relevant only to addresses in Puerto Rico. + + + + + The two-letter code used to identify a country. + + + + + Indicates whether this address residential (as opposed to commercial). + + + + + + + + + Position of Astra element + + + + + Content corresponding to the Astra Element + + + + + + + + Specifies which filing option is being exercised by the customer. + Required for non-document shipments originating in Canada destined for any country other than Canada, the United States, Puerto Rico or the U.S. Virgin Islands. + + + + + + + + + + + + Identification of the type of barcode (symbology) used on FedEx documents and labels. + + + + + + + + + + Each instance of this data type represents a barcode whose content must be represented as binary data (i.e. not ASCII text). + + + + + The kind of barcode data in this instance. + + + + + The data content of this instance. + + + + + + + + + + + + + + + + + + + + Descriptive data sent to FedEx by a customer in order to Cancel a Pending shipment. + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + + + + Identification of a FedEx operating company (transportation). + + + + + + + + + + + + + The instructions indicating how to print the Certificate of Origin ( e.g. whether or not to include the instructions, image type, etc ...) + + + + + Specifies characteristics of a shipping document to be produced. + + + + + Specifies the usage and identification of customer supplied images to be used on this document. + + + + + + + Specifies the type of brokerage to be applied to a shipment. + + + + + + + + + + + + Descriptive data for the client submitting a transaction. + + + + + The FedEx account number associated with this transaction. + + + + + This number is assigned by FedEx and identifies the unique device from which the request is originating + + + + + Only used in transactions which require identification of the Fed Ex Office integrator. + + + + + The language to be used for human-readable Notification.localizedMessages in responses to the request containing this ClientDetail object. Different requests from the same client may contain different Localization data. (Contrast with TransactionDetail.localization, which governs data payload language/translation.) + + + + + + + Identifies what freight charges should be added to the COD collect amount. + + + + + + + + + + + + + + + + + + + Identifies the type of funds FedEx should collect upon shipment delivery. + + + + + + + + + + + + Descriptive data required for a FedEx COD (Collect-On-Delivery) shipment. + + + + + + Identifies if freight charges are to be added to the COD amount. This element determines which freight charges should be added to the COD collect amount. See CodAddTransportationChargesType for a list of valid enumerated values. + + + + + Identifies the type of funds FedEx should collect upon package delivery + + + + + For Express this is the descriptive data that is used for the recipient of the FedEx Letter containing the COD payment. For Ground this is the descriptive data for the party to receive the payment that prints the COD receipt. + + + + + Indicates which type of reference information to include on the COD return shipping label. + + + + + + + + + The COD amount (after any accumulations) that must be collected upon delivery of a package shipped using the COD special service. + + + + + + Contains the data which form the Astra and 2DCommon barcodes that print on the COD return label. + + + + + The label image or printer commands to print the label. + + + + + + + Indicates which type of reference information to include on the COD return shipping label. + + + + + + + + + + + + + The COD amount (after any accumulations) that must be collected upon delivery of a package shipped using the COD special service. + + + + + Currently not supported. + + TBD + + + + + + The description of the FedEx service type used for the COD return shipment. Currently not supported. + + 70 + + + + + + The description of the packaging used for the COD return shipment. + + 40 + + + + + + Currently not supported. + + TBD + + + + + + Currently not supported. + + + + + Currently not supported. + + + + + + The CodRoutingDetail element will contain the COD return tracking number and form id. In the case of a COD multiple piece shipment these will need to be inserted in the request for the last piece of the multiple piece shipment. + The service commitment is the only other element of the RoutingDetail that is used for a CodRoutingDetail. + + + + + + Contains the data which form the Astra and 2DCommon barcodes that print on the COD return label. + + + + + The label image or printer commands to print the label. + + + + + + + CommercialInvoice element is required for electronic upload of CI data. It will serve to create/transmit an Electronic Commercial Invoice through the FedEx Systems. Customers are responsible for printing their own Commercial Invoice.If you would likeFedEx to generate a Commercial Invoice and transmit it to Customs. for clearance purposes, you need to specify that in the ShippingDocumentSpecification element. If you would like a copy of the Commercial Invoice that FedEx generated returned to you in reply it needs to be specified in the ETDDetail/RequestedDocumentCopies element. Commercial Invoice support consists of maximum of 99 commodity line items. + + + + + Any comments that need to be communicated about this shipment. + + + + + Any freight charges that are associated with this shipment. + + + + + Any taxes or miscellaneous charges(other than Freight charges or Insurance charges) that are associated with this shipment. + + + + + Any packing costs that are associated with this shipment. + + + + + Any handling costs that are associated with this shipment. + + + + + Free-form text. + + + + + Free-form text. + + + + + Free-form text. + + + + + The reason for the shipment. Note: SOLD is not a valid purpose for a Proforma Invoice. + + + + + Customer assigned Invoice number + + + + + Name of the International Expert that completed the Commercial Invoice different from Sender. + + + + + Required for dutiable international Express or Ground shipment. This field is not applicable to an international PIB(document) or a non-document which does not require a Commercial Invoice + + + + + + + The instructions indicating how to print the Commercial Invoice( e.g. image type) Specifies characteristics of a shipping document to be produced. + + + + + + Specifies the usage and identification of a customer supplied image to be used on this document. + + + + + + + + For international multiple piece shipments, commodity information must be passed in the Master and on each child transaction. + If this shipment cotains more than four commodities line items, the four highest valued should be included in the first 4 occurances for this request. + + + + + + Name of this commodity. + + + + + Total number of pieces of this commodity + + + + + Complete and accurate description of this commodity. + + 450 + + + + + + Country code where commodity contents were produced or manufactured in their final form. + + 2 + + + + + + + Unique alpha/numeric representing commodity item. + At least one occurrence is required for US Export shipments if the Customs Value is greater than $2500 or if a valid US Export license is required. + + + 14 + + + + + + Total weight of this commodity. 1 explicit decimal position. Max length 11 including decimal. + + + + + Number of units of a commodity in total number of pieces for this line item. Max length is 9 + + + + + Unit of measure used to express the quantity of this commodity line item. + + 3 + + + + + + Contains only additional quantitative information other than weight and quantity to calculate duties and taxes. + + + + + Value of each unit in Quantity. Six explicit decimal positions, Max length 18 including decimal. + + + + + + Total customs value for this line item. + It should equal the commodity unit quantity times commodity unit value. + Six explicit decimal positions, max length 18 including decimal. + + + + + + Defines additional characteristic of commodity used to calculate duties and taxes + + + + + Applicable to US export shipping only. + + 12 + + + + + + + Date of expiration. Must be at least 1 day into future. + The date that the Commerce Export License expires. Export License commodities may not be exported from the U.S. on an expired license. + Applicable to US Export shipping only. + Required only if commodity is shipped on commerce export license, and Export License Number is supplied. + + + + + + + An identifying mark or number used on the packaging of a shipment to help customers identify a particular shipment. + + + 15 + + + + + + All data required for this commodity in NAFTA Certificate of Origin. + + + + + + + + + The identifier for all clearance documents associated with this shipment. + + + + + + + + + + Identifies the branded location name, the hold at location phone number and the address of the location. + + + + + Identifies the type of FedEx location. + + + + + + + + + The package sequence number of this package in a multiple piece shipment. + + + + + The Tracking number and form id for this package. + + + + + Used with request containing PACKAGE_GROUPS, to identify which group of identical packages was used to produce a reply item. + + + + + Oversize class for this package. + + + + + All package-level rating data for this package, which may include data for multiple rate types. + + + + + Associated with package, due to interaction with per-package hazardous materials presence/absence. + + + + + The data that is used to from the Astra and 2DCommon barcodes for the label.. + + + + + The textual description of the special service applied to the package. + + + + + + The label image or printer commands to print the label. + + + + + All package-level shipping documents (other than labels and barcodes). For use in loads after January, 2008. + + + + + Information about the COD return shipment. + + + + + Actual signature option applied, to allow for cases in which the original value conflicted with other service features in the shipment. + + + + + Documents the kinds and quantities of all hazardous commodities in the current package, using updated hazardous commodity description data. + + + + + + + + + Indicates whether or not this is a US Domestic shipment. + + + + + Indicates the carrier that will be used to deliver this shipment. + + + + + The master tracking number and form id of this multiple piece shipment. This information is to be provided for each subsequent of a multiple piece shipment. + + + + + Description of the FedEx service used for this shipment. Currently not supported. + + 70 + + + + + + Description of the packaging used for this shipment. Currently not supported. + + 40 + + + + + + Information about the routing, origin, destination and delivery of a shipment. + + + + + Only used with pending shipments. + + + + + Only used in the reply to tag requests. + + + + + Provides reply information specific to SmartPost shipments. + + + + + All shipment-level rating data for this shipment, which may include data for multiple rate types. + + + + + Information about the COD return shipment. + + + + + Returns the default holding location information when HOLD_AT_LOCATION special service is requested and the client does not specify the hold location address. + + + + + Indicates whether or not this shipment is eligible for a money back guarantee. + + + + + Returns any defaults or updates applied to RequestedShipment.exportDetail.exportComplianceStatement. + + + + + + All shipment-level shipping documents (other than labels and barcodes). + + + + + Package level details about this package. + + + + + + + Provides reply information specific to SmartPost shipments. + + + + + Identifies the carrier that will pick up the SmartPost shipment. + + + + + Indicates whether the shipment is deemed to be machineable, based on dimensions, weight, and packaging. + + + + + + + Provides reply information specific to a tag request. + + + + + . + + + + + As of June 2007, returned only for FedEx Express services. + + + + + As of June 2007, returned only for FedEx Express services. + + + + + As of June 2007, returned only for FedEx Express services. + + + + + As of June 2007, returned only for FedEx Express services. + + + + + FEDEX INTERNAL USE ONLY: for use by INET. + + + + + + + Defines additional data to print in the Configurable portion of the label, this allows you to print the same type information on the label that can also be printed on the doc tab. + + + + + 1 of 12 possible zones to position data. + + + + + The identifiying text for the data in this zone. + + + + + A reference to a field in either the request or reply to print in this zone following the header. + + + + + A literal value to print after the header in this zone. + + + + + + + The descriptive data for a point-of-contact person. + + + + + Client provided identifier corresponding to this contact information. + + + + + Identifies the contact person's name. + + + + + Identifies the contact person's title. + + + + + Identifies the company this contact is associated with. + + + + + Identifies the phone number associated with this contact. + + + + + Identifies the phone extension associated with this contact. + + + + + Identifies the pager number associated with this contact. + + + + + Identifies the fax number associated with this contact. + + + + + Identifies the email address associated with this contact. + + + + + + + + + + + + + Content Record. + + + + + Part Number. + + + + + Item Number. + + + + + Received Quantity. + + + + + Description. + + + + + + + Reply to the Close Request transaction. The Close Reply bring back the ASCII data buffer which will be used to print the Close Manifest. The Manifest is essential at the time of pickup. + + + + + Identifies the highest severity encountered when executing the request; in order from high to low: FAILURE, ERROR, WARNING, NOTE, SUCCESS. + + + + + The descriptive data detailing the status of a sumbitted transaction. + + + + + Descriptive data that governs data payload language/translations. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + The reply payload. All of the returned information about this shipment/package. + + + + + + + Create Pending Shipment Request + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + The descriptive data identifying the client submitting the transaction. + + + + + The descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Descriptive data about the shipment being sent by the requestor. + + + + + + + Currency exchange rate information. + + + + + The currency code for the original (converted FROM) currency. + + + + + The currency code for the final (converted INTO) currency. + + + + + Multiplier used to convert fromCurrency units to intoCurrency units. + + + + + + + + + Indicates the type of custom delivery being requested. + + + + + Time by which delivery is requested. + + + + + Range of dates for custom delivery request; only used if type is BETWEEN. + + + + + Date for custom delivery request; only used for types of ON, BETWEEN, or AFTER. + + + + + + + + + + + + + + + Data required to produce a custom-specified document, either at shipment or package level. + + + + + Common information controlling document production. + + + + + Applicable only to documents produced on thermal printers with roll stock. + + + + + Applicable only to documents produced on thermal printers with roll stock. + + + + + Identifies the formatting specification used to construct this custom document. + + + + + Identifies the individual document specified by the client. + + + + + If provided, thermal documents will include specified doc tab content. If omitted, document will be produced without doc tab content. + + + + + + + Constructed string, based on format and zero or more data fields, printed in specified barcode symbology. + + + + + + + + + Width of thinnest bar/space element in the barcode. + + + + + + + + Solid (filled) rectangular area on label. + + + + + + + + + Valid values for CustomLabelCoordinateUnits + + + + + + + + + + + + + + + + + + Image to be included from printer's memory, or from a local file for offline clients. + + + + + + Printer-specific index of graphic image to be printed. + + + + + Fully-qualified path and file name for graphic image to be printed. + + + + + + + + + Horizontal position, relative to left edge of custom area. + + + + + Vertical position, relative to top edge of custom area. + + + + + + + Constructed string, based on format and zero or more data fields, printed in specified printer font (for thermal labels) or generic font/size (for plain paper labels). + + + + + + + + Printer-specific font name for use with thermal printer labels. + + + + + Generic font name for use with plain paper labels. + + + + + Generic font size for use with plain paper labels. + + + + + + + + + + + + + + + + + + + Reference information to be associated with this package. + + + + + The reference type to be associated with this reference data. + + + + + + + + The types of references available for use. + + + + + + + + + + + + + + + + Allows customer-specified control of label content. + + + + + If omitted, no doc tab will be produced (i.e. default = former NONE type). + + + + + Defines any custom content to print on the label. + + + + + Defines additional data to print in the Configurable portion of the label, this allows you to print the same type information on the label that can also be printed on the doc tab. + + + + + Controls which data/sections will be suppressed. + + + + + Customer-provided SCNC for use with label-data-only processing of FedEx Ground shipments. + + + + + + Controls the number of additional copies of supplemental labels. + + + + + This value reduces the default quantity of destination/consignee air waybill labels. A value of zero indicates no change to default. A minimum of one copy will always be produced. + + + + + + + + + + Interacts both with properties of the shipment and contractual relationship with the shipper. + + + + + + Specifies how the recipient is identified for customs purposes; the requirements on this information vary with destination country. + + + + + + + + Identifies responsibilities with respect to loss, damage, etc. + + + + + Documents amount paid to third party for coverage of shipment content. + + + + + + + + + + + + + + + + + + The descriptive data required for a FedEx shipment containing dangerous goods (hazardous materials). + + + + + Identifies whether or not the products being shipped are required to be accessible during delivery. + + + + + Shipment is packaged/documented for movement ONLY on cargo aircraft. + + + + + Indicates which kinds of hazardous content are in the current package. + + + + + Documents the kinds and quantities of all hazardous commodities in the current package. + + + + + Description of the packaging of this commodity, suitable for use on OP-900 and OP-950 forms. + + + + + Telephone number to use for contact in the event of an emergency. + + + + + Offeror's name or contract number, per DOT regulation. + + + + + + + + + The beginning date in a date range. + + + + + The end date in a date range. + + + + + + + Valid values for DayofWeekType + + + + + + + + + + + + + + Descriptive data sent to FedEx by a customer in order to delete a package. + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + The timestamp of the shipment request. + + + + + Identifies the FedEx tracking number of the package being cancelled. + + + + + Determines the type of deletion to be performed in relation to package level vs shipment level. + + + + + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Only used for tags which had FedEx Express services. + + + + + Only used for tags which had FedEx Express services. + + + + + If the original ProcessTagRequest specified third-party payment, then the delete request must contain the same pay type and payor account number for security purposes. + + + + + Also known as Pickup Confirmation Number or Dispatch Number + + + + + + + Specifies the type of deletion to be performed on a shipment. + + + + + + + + + + Data required to complete the Destionation Control Statement for US exports. + + + + + List of applicable Statment types. + + + + + Comma-separated list of up to four country codes, required for DEPARTMENT_OF_STATE statement. + + + + + Name of end user, required for DEPARTMENT_OF_STATE statement. + + + + + + + Used to indicate whether the Destination Control Statement is of type Department of Commerce, Department of State or both. + + + + + + + + + The dimensions of this package and the unit type used for the measurements. + + + + + + + + + + + + + The DocTabContentType options available. + + + + + The DocTabContentType should be set to ZONE001 to specify additional Zone details. + + + + + The DocTabContentType should be set to BARCODED to specify additional BarCoded details. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Zone number can be between 1 and 12. + + + + + Header value on this zone. + + + + + Reference path to the element in the request/reply whose value should be printed on this zone. + + + + + Free form-text to be printed in this zone. + + + + + Justification for the text printed on this zone. + + + + + + + Identifies the method by which the package is to be tendered to FedEx. This element does not dispatch a courier for package pickup. + + + + + + + + + + + + Describes specific information about the email label shipment. + + + + + Notification email will be sent to this email address + + + + + Message to be sent in the notification email + + + + + + + + + + + + + Information describing email notifications that will be sent in relation to events that occur during package movement + + + + + Specifies whether/how email notifications are grouped. + + + + + A message that will be included in the email notifications + + + + + Information describing the destination of the email, format of the email and events to be notified on + + + + + + + The format of the email + + + + + + + + + + The descriptive data for a FedEx email notification recipient. + + + + + Identifies the relationship this email recipient has to the shipment. + + + + + The email address to send the notification to + + + + + Notify the email recipient when this shipment has been shipped. + + + + + Notify the email recipient if this shipment encounters a problem while in route + + + + + Notify the email recipient when this shipment has been delivered. + + + + + The format of the email notification. + + + + + The language/locale to be used in this email notification. + + + + + + + Identifies the set of valid email notification recipient types. For SHIPPER, RECIPIENT and BROKER the email address asssociated with their definitions will be used, any email address sent with the email notification for these three email notification recipient types will be ignored. + + + + + + + + + + + + + + + + + + + + + Customer-declared value, with data type and legal values depending on excise condition, used in defining the taxable value of the item. + + + + + + + Specifies the types of Estimated Duties and Taxes to be included in a rate quotation for an international shipment. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies the client-requested response in the event of errors within shipment. + PACKAGE_ERROR_LABELS : Return per-package error label in addition to error Notifications. + STANDARD : Return error Notifications only. + + + + + + + + + + Electronic Trade document references used with the ETD special service. + + + + + Indicates the types of shipping documents produced for the shipper by FedEx (see ShippingDocumentSpecification) which should be copied back to the shipper in the shipment result data. + + + + + + + + Country specific details of an International shipment. + + + + + + Specifies which filing option is being exercised by the customer. + Required for non-document shipments originating in Canada destined for any country other than Canada, the United States, Puerto Rico or the U.S. Virgin Islands. + + + + + + General field for exporting-country-specific export data (e.g. B13A for CA, FTSR Exemption or AES Citation for US). + + + + + This field is applicable only to Canada export non-document shipments of any value to any destination. No special characters allowed. + + 10 + + + + + + Department of Commerce/Department of State information about this shipment. + + + + + + + Details specific to an Express freight shipment. + + + + + Indicates whether or nor a packing list is enclosed. + + + + + + Total shipment pieces. + e.g. 3 boxes and 3 pallets of 100 pieces each = Shippers Load and Count of 303. + Applicable to International Priority Freight and International Economy Freight. + Values must be in the range of 1 - 99999 + + + + + + Required for International Freight shipping. Values must be 8- 12 characters in length. + + 12 + + + + + + + + Identifies a kind of FedEx facility. + + + + + + + + + + + + + + + + Data required to produce the Freight handling-unit-level address labels. Note that the number of UNIQUE labels (the N as in 1 of N, 2 of N, etc.) is determined by total handling units. + + + + + + Indicates the number of copies to be produced for each unique label. + + + + + If omitted, no doc tab will be produced (i.e. default = former NONE type). + + + + + + + Individual charge which contributes to the total base charge for the shipment. + + + + + Freight class for this line item. + + + + + Effective freight class used for rating this line item. + + + + + NMFC Code for commodity. + + + + + Customer-provided description for this commodity or class line. + + + + + Weight for this commodity or class line. + + + + + Rate or factor applied to this line item. + + + + + Identifies the manner in which the chargeRate for this line item was applied. + + + + + The net or extended charge for this line item. + + + + + + + + + + + + + + These values represent the industry-standard freight classes used for FedEx Freight and FedEx National Freight shipment description. (Note: The alphabetic prefixes are required to distinguish these values from decimal numbers on some client platforms.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifies responsibilities with respect to loss, damage, etc. + + + + + + + + + Rate data specific to FedEx Freight or FedEx National Freight services. + + + + + A unique identifier for a specific rate quotation. + + + + + Freight charges which accumulate to the total base charge for the shipment. + + + + + Human-readable descriptions of additional information on this shipment rating. + + + + + + + Additional non-monetary data returned with Freight rates. + + + + + Unique identifier for notation. + + + + + Human-readable explanation of notation. + + + + + + + Data applicable to shipments using FEDEX_FREIGHT and FEDEX_NATIONAL_FREIGHT services. + + + + + Account number used with FEDEX_FREIGHT service. + + + + + Used for validating FedEx Freight account number and (optionally) identifying third party payment on the bill of lading. + + + + + Identification values to be printed during creation of a Freight bill of lading. + + + + + Indicates the role of the party submitting the transaction. + + + + + Designates which of the requester's tariffs will be used for rating. + + + + + Designates the terms of the "collect" payment for a Freight Shipment. + + + + + Identifies the declared value for the shipment + + + + + Identifies the declared value units corresponding to the above defined declared value + + + + + + Identifiers for promotional discounts offered to customers. + + + + + Total number of individual handling units in the entire shipment (for unit pricing). + + + + + Estimated discount rate provided by client for unsecured rate quote. + + + + + Total weight of pallets used in shipment. + + + + + Overall shipment dimensions. + + + + + Description for the shipment. + + + + + Specifies which party will pay surcharges for any special services which support split billing. + + + + + Must be populated if any line items contain hazardous materials. + + + + + Details of the commodities in the shipment. + + + + + + + Description of an individual commodity or class of content in a shipment. + + + + + Freight class for this line item. + + + + + FEDEX INTERNAL USE ONLY: for FedEx system that estimate freight class from customer-provided dimensions and weight. + + + + + Number of individual handling units to which this line applies. (NOTE: Total of line-item-level handling units may not balance to shipment-level total handling units.) + + + + + Specification of handling-unit packaging for this commodity or class line. + + + + + Number of pieces for this commodity or class line. + + + + + NMFC Code for commodity. + + + + + Indicates the kind of hazardous material content in this line item. + + + + + For printed reference per line item. + + + + + For printed reference per line item. + + + + + Customer-provided description for this commodity or class line. + + + + + Weight for this commodity or class line. + + + + + FED EX INTERNAL USE ONLY - Individual line item dimensions. + + + + + Volume (cubic measure) for this commodity or class line. + + + + + + + Indicates the role of the party submitting the transaction. + + + + + + + + + + Specifies which party will be responsible for payment of any surcharges for Freight special services for which split billing is allowed. + + + + + Identifies the special service. + + + + + Indicates who will pay for the special service. + + + + + + + Data required to produce a General Agency Agreement document. Remaining content (business data) to be defined once requirements have been completed. + + + + + + + + Documents the kind and quantity of an individual hazardous commodity in a package. + + + + + Identifies and describes an individual hazardous commodity. + + + + + Specifies the amount of the commodity in alternate units. + + + + + Customer-provided specifications for handling individual commodities. + + + + + + + Identifies and describes an individual hazardous commodity. For 201001 load, this is based on data from the FedEx Ground Hazardous Materials Shipping Guide. + + + + + Regulatory identifier for a commodity (e.g. "UN ID" value). + + + + + + + + + + + + + Specifies how the commodity is to be labeled. + + + + + + + + + + Customer-provided specifications for handling individual commodities. + + + + + Specifies how the customer wishes the label text to be handled for this commodity in this package. + + + + + Text used in labeling the commodity under control of the labelTextOption field. + + + + + + + Indicates which kind of hazardous content (as defined by DOT) is being reported. + + + + + + + + + + + + Identifies number and type of packaging units for hazardous commodities. + + + + + Number of units of the type below. + + + + + Units in which the hazardous commodity is packaged. + + + + + + + Identifies DOT packing group for a hazardous commodity. + + + + + + + + + + Identifies amount and units for quantity of hazardous commodities. + + + + + Number of units of the type below. + + + + + Units by which the hazardous commodity is measured. + + + + + + + Descriptive data required for a FedEx shipment that is to be held at the destination FedEx location for pickup by the recipient. + + + + + Contact phone number for recipient of shipment. + + + + + Contact and address of FedEx facility at which shipment is to be held. + + + + + Type of facility at which package/shipment is to be held. + + + + + + + The descriptive data required by FedEx for home delivery services. + + + + + The type of Home Delivery Premium service being requested. + + + + + Required for Date Certain Home Delivery. + + + + + Required for Date Certain and Appointment Home Delivery. + + 15 + + + + + + + + The type of Home Delivery Premium service being requested. + + + + + + + + + + + + + + + + + + + The type of International shipment. + + + + + + + + + + Specifies the type of label to be returned. + + + + + + + + + + + Names for data elements / areas which may be suppressed from printing on labels. + + + + + + + + + + + + This indicates if the top or bottom of the label comes out of the printer first. + + + + + + + + + Relative to normal orientation for the printer. + + + + + + + + + + + Description of shipping label to be returned in the reply + + + + + Specifies how to create, organize, and return the document. + + + + + Specify type of label to be returned + + + + + Specifies the image format used for a shipping document. + + + + + For thermal printer lables this indicates the size of the label and the location of the doc tab if present. + + + + + This indicates if the top or bottom of the label comes out of the printer first. + + + + + If present, this contact and address information will replace the return address information on the label. + + + + + Allows customer-specified control of label content. + + + + + + + For thermal printer labels this indicates the size of the label and the location of the doc tab if present. + + + + + + + + + + + + + + + + + + + + + + + Identifies the Liability Coverage Amount. For Jan 2010 this value represents coverage amount per pound + + + + + + + + + + + + + Represents a one-dimensional measurement in small units (e.g. suitable for measuring a package or document), contrasted with Distance, which represents a large one-dimensional measurement (e.g. distance between cities). + + + + + The numerical quantity of this measurement. + + + + + The units for this measurement. + + + + + + + CM = centimeters, IN = inches + + + + + + + + + Identifies the representation of human-readable text. + + + + + Two-letter code for language (e.g. EN, FR, etc.) + + + + + Two-letter code for the region (e.g. us, ca, etc..). + + + + + + + + + + + + + Identifies which type minimum charge was applied. + + + + + + + + + + + + The descriptive data for the medium of exchange for FedEx services. + + + + + Identifies the currency of the monetary amount. + + 3 + + + + + + Identifies the monetary amount. + + + + + + + Data required to produce a Certificate of Origin document. Remaining content (business data) to be defined once requirements have been completed. + + + + + + + Indicates which Party (if any) from the shipment is to be used as the source of importer data on the NAFTA COO form. + + + + + Contact information for "Authorized Signature" area of form. + + + + + + + + + + This element is currently not supported and is for the future use. + + + + + Defined by NAFTA regulations. + + + + + Defined by NAFTA regulations. + + + + + Identification of which producer is associated with this commodity (if multiple producers are used in a single shipment). + + + + + + Date range over which RVC net cost was calculated. + + + + + + + + + + + + + + + Net cost method used. + + + + + + + + + See instructions for NAFTA Certificate of Origin for code definitions. + + + + + + + + + + + + + This element is currently not supported and is for the future use. + + + + + + + + + See instructions for NAFTA Certificate of Origin for code definitions. + + + + + + + + + + + This element is currently not supported and is for the future use. + + + + + + + + + + + + The descriptive data regarding the result of the submitted transaction. + + + + + The severity of this notification. This can indicate success or failure or some other information about the request. The values that can be returned are SUCCESS - Your transaction succeeded with no other applicable information. NOTE - Additional information that may be of interest to you about your transaction. WARNING - Additional information that you need to know about your transaction that you may need to take action on. ERROR - Information about an error that occurred while processing your transaction. FAILURE - FedEx was unable to process your transaction at this time due to a system failure. Please try again later + + + + + Indicates the source of this notification. Combined with the Code it uniquely identifies this notification + + + + + A code that represents this notification. Combined with the Source it uniquely identifies this notification. + + + + + Human-readable text that explains this notification. + + + + + The translated message. The language and locale specified in the ClientDetail. Localization are used to determine the representation. Currently only supported in a TrackReply. + + + + + A collection of name/value pairs that provide specific data to help the client determine the nature of an error (or warning, etc.) witout having to parse the message string. + + + + + + + + + Identifies the type of data contained in Value (e.g. SERVICE_TYPE, PACKAGE_SEQUENCE, etc..). + + + + + The value of the parameter (e.g. PRIORITY_OVERNIGHT, 2, etc..). + + + + + + + Identifies the set of severity values for a Notification. + + + + + + + + + + + + The instructions indicating how to print the OP-900 form for hazardous materials packages. + + + + + Specifies characteristics of a shipping document to be produced. + + + + + Identifies which reference type (from the package's customer references) is to be used as the source for the reference on this OP-900. + + + + + Specifies the usage and identification of customer supplied images to be used on this document. + + + + + Data field to be used when a name is to be printed in the document instead of (or in addition to) a signature image. + + + + + + + The oversize class types. + + + + + + + + + + Each instance of this data type represents the set of barcodes (of all types) which are associated with a specific package. + + + + + Binary-style barcodes for this package. + + + + + String-style barcodes for this package. + + + + + + + Data for a package's rates, as calculated per a specific rate type. + + + + + Type used for this specific set of rate data. + + + + + Indicates which weight was used. + + + + + INTERNAL FEDEX USE ONLY. + + + + + The weight that was used to calculate the rate. + + + + + The dimensional weight of this package (if greater than actual). + + + + + The oversize weight of this package (if the package is oversize). + + + + + The transportation charge only (prior to any discounts applied) for this package. + + + + + The sum of all discounts on this package. + + + + + This package's baseCharge - totalFreightDiscounts. + + + + + The sum of all surcharges on this package. + + + + + This package's netFreight + totalSurcharges (not including totalTaxes). + + + + + The sum of all taxes on this package. + + + + + This package's netFreight + totalSurcharges + totalTaxes. + + + + + The total sum of all rebates applied to this package. + + + + + All rate discounts that apply to this package. + + + + + All rebates that apply to this package. + + + + + All surcharges that apply to this package (either because of characteristics of the package itself, or because it is carrying per-shipment surcharges for the shipment of which it is a part). + + + + + All taxes applicable (or distributed to) this package. + + + + + The variable handling charges calculated based on the type variable handling charges requested. + + + + + + + This class groups together for a single package all package-level rate data (across all rate types) as part of the response to a shipping request, which groups shipment-level data together and groups package-level data by package. + + + + + This rate type identifies which entry in the following array is considered as presenting the "actual" rates for the package. + + + + + The "list" net charge minus "actual" net charge. + + + + + Each element of this field provides package-level rate data for a specific rate type. + + + + + + + Identifies the collection of special service offered by FedEx. BROKER_SELECT_OPTION should be used for Ground shipments only. + + + + + + + + + + + + + + These special services are available at the package level for some or all service types. If the shipper is requesting a special service which requires additional data, the package special service type must be present in the specialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object below. + + + + + The types of all special services requested for the enclosing shipment or package. + + + + + For use with FedEx Ground services only; COD must be present in shipment's special services. + + + + + Descriptive data required for a FedEx shipment containing dangerous materials. This element is required when SpecialServiceType.DANGEROUS_GOODS or HAZARDOUS_MATERIAL is present in the SpecialServiceTypes collection. + + + + + Descriptive data required for a FedEx shipment containing dry ice. This element is required when SpecialServiceType.DRY_ICE is present in the SpecialServiceTypes collection. + + + + + The descriptive data required for FedEx signature services. This element is required when SpecialServiceType.SIGNATURE_OPTION is present in the SpecialServiceTypes collection. + + + + + The descriptive data required for FedEx Priority Alert service. This element is required when SpecialServiceType.PRIORITY_ALERT is present in the SpecialServiceTypes collection. + + + + + + + Identifies the collection of available FedEx or customer packaging options. + + + + + + + + + + + + + + The descriptive data for a person or company entitiy doing business with FedEx. + + + + + Identifies the FedEx account number assigned to the customer. + + 12 + + + + + + + Descriptive data identifying the point-of-contact person. + + + + + The descriptive data for a physical location. + + + + + + + The descriptive data for the monetary compensation given to FedEx for services rendered to the customer. + + + + + Identifies the method of payment for a service. See PaymentType for list of valid enumerated values. + + + + + Descriptive data identifying the party responsible for payment for a service. + + + + + + + Identifies the method of payment for a service. + + + + + + + + + + + The descriptive data identifying the party responsible for payment for a service. + + + + + Identifies the FedEx account number assigned to the payor. + + 12 + + + + + + Identifies the country of the payor. + + 2 + + + + + + + + This information describes how and when a pending shipment may be accessed for completion. + + + + + Only for pending shipment type of "EMAIL" + + + + + Only for pending shipment type of "EMAIL" + + + + + Only for pending shipment type of "EMAIL" + + + + + This element is currently not supported and is for the future use. + + + + + + + This information describes the kind of pending shipment being requested. + + + + + Identifies the type of FedEx pending shipment + + + + + Date after which the pending shipment will no longer be available for completion. + + + + + Only used with type of EMAIL. + + + + + + + Identifies the type of service for a pending shipment. + + + + + + + + This enumeration rationalizes the former FedEx Express international "admissibility package" types (based on ANSI X.12) and the FedEx Freight packaging types. The values represented are those common to both carriers. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This class describes the pickup characteristics of a shipment (e.g. for use in a tag request). + + + + + + + + Identifies the type of Pickup request + + + + + Identifies the type of source for Pickup request + + + + + + + Identifies the type of source for pickup request service. + + + + + + + + + Identifies the type of pickup request service. + + + + + + + + + Identifies the type of pricing used for this shipment. + + + + + + + + + + + + + + + + + + + + Represents a reference identifier printed on Freight bills of lading + + + + + + + + + Identifies a particular reference identifier printed on a Freight bill of lading. + + + + + + + + + + + + + + + + This indicates the highest level of severity of all the notifications returned in this reply + + + + + The descriptive data regarding the results of the submitted transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + The reply payload. All of the returned information about this shipment/package. + + + + + Empty unless error label behavior is PACKAGE_ERROR_LABELS and one or more errors occured during transaction processing. + + + + + + + Descriptive data sent to FedEx by a customer in order to ship a package. + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Descriptive data about the shipment being sent by the requestor. + + + + + + + + + + + + + + + + Descriptive data sent to FedEx by a customer in order to ship a package. + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Descriptive data about the shipment being sent by the requestor. + + + + + + + Test for the Commercial Invoice. Note that Sold is not a valid Purpose for a Proforma Invoice. + + + + + + + + + + + + + Indicates the reason that a dim divisor value was chose. + + + + + + + + + + + + Identifies a discount applied to the shipment. + + + + + Identifies the type of discount applied to the shipment. + + + + + + The amount of the discount applied to the shipment. + + + + + The percentage of the discount applied to the shipment. + + + + + + + The type of the discount. + + + + + + + + + + + + + Identifies the type(s) of rates to be returned in the reply. + + + + + + + + + + The weight method used to calculate the rate. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies how the recipient is identified for customs purposes; the requirements on this information vary with destination country. + + + + + Specifies the kind of identification being used. + + + + + Contains the actual ID value, of the type specified above. + + + + + + + Type of Brazilian taxpayer identifier provided in Recipient/TaxPayerIdentification/Number. For shipments bound for Brazil this overrides the value in Recipient/TaxPayerIdentification/TinType + + + + + + + + + + FOOD_OR_PERISHABLE is required by FDA/BTA; must be true for food/perishable items coming to US or PR from non-US/non-PR origin + + + + + + + + + + + + + + + + + This class rationalizes RequestedPackage and RequestedPackageSummary from previous interfaces. The way in which it is uses within a RequestedShipment depends on the RequestedPackageDetailType value specified for that shipment. + + + + + Used only with INDIVIDUAL_PACKAGE, as a unique identifier of each requested package. + + + + + Used only with PACKAGE_GROUPS, as a unique identifier of each group of identical packages. + + + + + Used only with PACKAGE_GROUPS, as a count of packages within a group of identical packages. + + + + + + Only used for INDIVIDUAL_PACKAGES and PACKAGE_GROUPS. Ignored for PACKAGE_SUMMARY, in which case totalInsuredValue and packageCount on the shipment will be used to determine this value. + + + + + Only used for INDIVIDUAL_PACKAGES and PACKAGE_GROUPS. Ignored for PACKAGE_SUMMARY, in which case totalweight and packageCount on the shipment will be used to determine this value. + + + + + + Provides additional detail on how the customer has physically packaged this item. As of June 2009, required for packages moving under international and SmartPost services. + + + + + Human-readable text describing the package. + + + + + + + Only used for INDIVIDUAL_PACKAGES and PACKAGE_GROUPS. + + + + + + + The descriptive data for the shipment being tendered to FedEx. + + + + + Identifies the date and time the package is tendered to FedEx. Both the date and time portions of the string are expected to be used. The date should not be a past date or a date more than 10 days in the future. The time is the local time of the shipment based on the shipper's time zone. The date component must be in the format: YYYY-MM-DD (e.g. 2006-06-26). The time component must be in the format: HH:MM:SS using a 24 hour clock (e.g. 11:00 a.m. is 11:00:00, whereas 5:00 p.m. is 17:00:00). The date and time parts are separated by the letter T (e.g. 2006-06-26T17:00:00). There is also a UTC offset component indicating the number of hours/mainutes from UTC (e.g 2006-06-26T17:00:00-0400 is defined form June 26, 2006 5:00 pm Eastern Time). + + + + + Identifies the method by which the package is to be tendered to FedEx. This element does not dispatch a courier for package pickup. See DropoffType for list of valid enumerated values. + + + + + Identifies the FedEx service to use in shipping the package. See ServiceType for list of valid enumerated values. + + + + + Identifies the packaging used by the requestor for the package. See PackagingType for list of valid enumerated values. + + + + + Identifies the total weight of the shipment being conveyed to FedEx.This is only applicable to International shipments and should only be used on the first package of a mutiple piece shipment.This value contains 1 explicit decimal position + + + + + Total insured amount. + + + + + + Descriptive data identifying the party responsible for shipping the package. Shipper and Origin should have the same address. + + + + + Descriptive data identifying the party receiving the package. + + + + + A unique identifier for a recipient location + + 10 + + + + + + Physical starting address for the shipment, if different from shipper's address. + + + + + Descriptive data indicating the method and means of payment to FedEx for providing shipping services. + + + + + Descriptive data regarding special services requested by the shipper for this shipment. If the shipper is requesting a special service which requires additional data (e.g. COD), the special service type must be present in the specialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object. For example, to request COD, "COD" must be included in the SpecialServiceTypes collection and the CodDetail object must contain the required data. + + + + + Details specific to an Express freight shipment. + + + + + Data applicable to shipments using FEDEX_FREIGHT and FEDEX_NATIONAL_FREIGHT services. + + + + + Used with Ground Home Delivery and Freight. + + + + + Details about how to calculate variable handling charges at the shipment level. + + + + + Customs clearance data, used for both international and intra-country shipping. + + + + + For use in "process tag" transaction. + + + + + + If true, only the shipper/payor will have visibility of this shipment. + + + + + Specifies the client-requested response in the event of errors within shipment. + + + + + Details about the image format and printer type the label is to returned in. + + + + + Contains data used to create additional (non-label) shipping documents. + + + + + Specifies whether and what kind of rates the customer wishes to have quoted on this shipment. The reply will also be constrained by other data on the shipment and customer. + + + + + Specifies the type of rate the customer wishes to have used as the actual rate type. + + + + + Specifies whether the customer wishes to have Estimated Duties and Taxes provided with the rate quotation on this shipment. Only applies with shipments moving under international services. + + + + + Only used with multiple-transaction shipments. + + + + + Only used with multi-piece COD shipments sent in multiple transactions. Required on last transaction only. + + + + + The total number of packages in the entire shipment (even when the shipment spans multiple transactions.) + + + + + Specifies whether packages are described individually, in groups, or summarized in a single description for total-piece-total-weight. This field controls which fields of the RequestedPackageLineItem will be used, and how many occurrences are expected. + + + + + One or more package-attribute descriptions, each of which describes an individual package, a group of identical packages, or (for the total-piece-total-weight case) common characteristics all packages in the shipment. + + + + + + + + + + + + + + + + + + + + + + + These values are used to control the availability of certain special services at the time when a customer uses the e-mail label link to create a return shipment. + + + + + + + + + Return Email Details + + + + + Phone number of the merchant + + + + + Identifies the allowed (merchant-authorized) special services which may be selected when the subsequent shipment is created. Only services represented in EMailLabelAllowedSpecialServiceType will be controlled by this list. + + + + + + + Information relating to a return shipment. + + + + + The type of return shipment that is being requested. + + + + + Return Merchant Authorization + + + + + Describes specific information about the email label for return shipment. + + + + + + + The type of return shipment that is being requested. + + + + + + + + + + The "PAYOR..." rates are expressed in the currency identified in the payor's rate table(s). The "RATED..." rates are expressed in the currency of the origin country. Former "...COUNTER..." values have become "...RETAIL..." values, except for PAYOR_COUNTER and RATED_COUNTER, which have been removed. + + + + + + + + + + + + + + + + Shipping document type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + Return Merchant Authorization + + + + + The RMA number. + + 20 + + + + + + The reason for the return. + + 60 + + + + + + + + The tracking number information and the data to form the Astra barcode for the label. + + + + + The tracking number information for the shipment. + + + + + + The textual description of the special service applied to the package. + + + + + + + + Information about the routing, origin, destination and delivery of a shipment. + + + + + The routing information detail for this shipment. + + + + + The tracking number information and the data to form the Astra barcode for the label. + + + + + + + Identifies the collection of available FedEx service options. + + + + + + + + + + + + + + + + + + + + + + + + + Shipment-level totals of dry ice data across all packages. + + + + + Total number of packages in the shipment that contain dry ice. + + + + + Total shipment dry ice weight for all packages. + + + + + + + Data for a shipment's total/summary rates, as calculated per a specific rate type. The "total..." fields may differ from the sum of corresponding package data for Multiweight or Express MPS. + + + + + Type used for this specific set of rate data. + + + + + Indicates the rate scale used. + + + + + Indicates the rate zone used (based on origin and destination). + + + + + Identifies the type of pricing used for this shipment. + + + + + Indicates which weight was used. + + + + + INTERNAL FEDEX USE ONLY. + + + + + Specifies the currency exchange performed on financial amounts for this rate. + + + + + Indicates which special rating cases applied to this shipment. + + + + + The value used to calculate the weight based on the dimensions. + + + + + Identifies the type of dim divisor that was applied. + + + + + Specifies a fuel surcharge percentage. + + + + + The weight used to calculate these rates. + + + + + Sum of dimensional weights for all packages. + + + + + The total freight charge that was calculated for this package before surcharges, discounts and taxes. + + + + + The total discounts used in the rate calculation. + + + + + The freight charge minus discounts. + + + + + The total amount of all surcharges applied to this shipment. + + + + + This shipment's totalNetFreight + totalSurcharges (not including totalTaxes). + + + + + Total of the transportation-based taxes. + + + + + The net charge after applying all discounts and surcharges. + + + + + The total sum of all rebates applied to this shipment. + + + + + Total of all values under this shipment's dutiesAndTaxes; only provided if estimated duties and taxes were calculated for this shipment. + + + + + This shipment's totalNetCharge + totalDutiesAndTaxes; only provided if estimated duties and taxes were calculated for this shipment AND duties, taxes and transportation charges are all paid by the same sender's account. + + + + + Rate data specific to FedEx Freight and FedEx National Freight services. + + + + + All rate discounts that apply to this shipment. + + + + + All rebates that apply to this shipment. + + + + + All surcharges that apply to this shipment. + + + + + All transportation-based taxes applicable to this shipment. + + + + + All commodity-based duties and taxes applicable to this shipment. + + + + + The "order level" variable handling charges. + + + + + The total of all variable handling charges at both shipment (order) and package level. + + + + + + + This class groups together all shipment-level rate data (across all rate types) as part of the response to a shipping request, which groups shipment-level data together and groups package-level data by package. + + + + + This rate type identifies which entry in the following array is considered as presenting the "actual" rates for the shipment. + + + + + The "list" total net charge minus "actual" total net charge. + + + + + Each element of this field provides shipment-level rate totals for a specific rate type. + + + + + + + + + This indicates the highest level of severity of all the notifications returned in this reply + + + + + The descriptive data regarding the results of the submitted transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + + + Information about the routing, origin, destination and delivery of a shipment. + + + + + The prefix portion of the URSA (Universal Routing and Sort Aid) code. + + 2 + + + + + + The suffix portion of the URSA code. + + 5 + + + + + + The identifier of the origin location of the shipment. Express only. + + 5 + + + + + + + The identifier of the destination location of the shipment. Express only. + + 5 + + + + + + + This is the state of the destination location ID, and is not necessarily the same as the postal state. + + + + + Expected/estimated date of delivery. + + + + + Expected/estimated day of week of delivery. + + + + + Committed date of delivery. + + + + + Committed day of week of delivery. + + + + + Standard transit time per origin, destination, and service. + + + + + Maximum expected transit time + + + + + Text describing planned delivery. + + + + + Currently not supported. + + TBD + + + + + + The postal code of the destination of the shipment. + + 16 + + + + + + The state or province code of the destination of the shipment. + + 14 + + + + + + The country code of the destination of the shipment. + + 2 + + + + + + The identifier for the airport of the destination of the shipment. + + 4 + + + + + + + + Identifies the collection of special service offered by FedEx. BROKER_SELECT_OPTION should be used for Express shipments only. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + These special services are available at the shipment level for some or all service types. If the shipper is requesting a special service which requires additional data (such as the COD amount), the shipment special service type must be present in the specialServiceTypes collection, and the supporting detail must be provided in the appropriate sub-object below. + + + + + The types of all special services requested for the enclosing shipment (or other shipment-level transaction). + + + + + Descriptive data required for a FedEx COD (Collect-On-Delivery) shipment. This element is required when SpecialServiceType.COD is present in the SpecialServiceTypes collection. + + + + + Descriptive data required for a FedEx shipment that is to be held at the destination FedEx location for pickup by the recipient. This element is required when SpecialServiceType.HOLD_AT_LOCATION is present in the SpecialServiceTypes collection. + + + + + Descriptive data required for FedEx to provide email notification to the customer regarding the shipment. This element is required when SpecialServiceType.EMAIL_NOTIFICATION is present in the SpecialServiceTypes collection. + + + + + The descriptive data required for FedEx Printed Return Label. This element is required when SpecialServiceType.PRINTED_RETURN_LABEL is present in the SpecialServiceTypes collection + + + + + This field should be populated for pending shipments (e.g. e-mail label) It is required by a PENDING_SHIPMENT special service type. + + + + + Number of packages in this shipment which contain dry ice and the total weight of the dry ice for this shipment. + + + + + The descriptive data required for FedEx Home Delivery options. This element is required when SpecialServiceType.HOME_DELIVERY_PREMIUM is present in the SpecialServiceTypes collection + + + + + Electronic Trade document references. + + + + + Specification for date or range of dates on which delivery is to be attempted. + + + + + + + All package-level shipping documents (other than labels and barcodes). + + + + + Shipping Document Type + + + + + Specifies how this document image/file is organized. + + + + + + The name under which a STORED or DEFERRED document is written. + + + + + Specifies the image resolution in DPI (dots per inch). + + + + + Can be zero for documents whose disposition implies that no content is included. + + + + + One or more document parts which make up a single logical document, such as multiple pages of a single form. + + + + + + + Each occurrence of this class specifies a particular way in which a kind of shipping document is to be produced and provided. + + + + + Values in this field specify how to create and return the document. + + + + + Specifies how to organize all documents of this type. + + + + + Specifies how to e-mail document images. + + + + + Specifies how a queued document is to be printed. + + + + + + + Specifies how to return a shipping document to the caller. + + + + + + + + + + + + + + Specifies how to e-mail shipping documents. + + + + + Provides the roles and email addresses for e-mail recipients. + + + + + Identifies the convention by which documents are to be grouped as e-mail attachments. + + + + + + + + + + + + + Specifies an individual recipient of e-mailed shipping document(s). + + + + + Identifies the relationship of this recipient in the shipment. + + + + + Address to which the document is to be sent. + + + + + + + Specifies characteristics of a shipping document to be produced. + + + + + Specifies how to create, organize, and return the document. + + + + + Specifies how far down the page to move the beginning of the image; allows for printing on letterhead and other pre-printed stock. + + + + + + + For those shipping document types which have both a "form" and "instructions" component (e.g. NAFTA Certificate of Origin and General Agency Agreement), this field indicates whether to provide the instructions. + + + + + Governs the language to be used for this individual document, independently from other content returned for the same shipment. + + + + + Identifies the individual document specified by the client. + + + + + + + Specifies how to organize all shipping documents of the same type. + + + + + + + + + Specifies the image format used for a shipping document. + + + + + + + + + + + + + + + A single part of a shipping document, such as one page of a multiple-page document whose format requires a separate image per page. + + + + + The one-origin position of this part within a document. + + + + + Graphic or printer commands for this image within a document. + + + + + + + Specifies printing options for a shipping document. + + + + + Provides environment-specific printer identification. + + + + + + + Contains all data required for additional (non-label) shipping documents to be produced in conjunction with a specific shipment. + + + + + Indicates the types of shipping documents requested by the shipper. + + + + + + + Specifies the production of each package-level custom document (the same specification is used for all packages). + + + + + Specifies the production of a shipment-level custom document. + + + + + This element is currently not supported and is for the future use. (Details pertaining to the GAA.) + + + + + + Specifies the production of the OP-900 document for hazardous materials packages. + + + + + Specifies the production of the OP-900 document for hazardous materials. + + + + + + + Specifies the type of paper (stock) on which a document will be printed. + + + + + + + + + + + + + + + + + + The descriptive data required for FedEx delivery signature services. + + + + + Identifies the delivery signature services option selected by the customer for this shipment. See OptionType for the list of valid values. + + + + + Identifies the delivery signature release authorization number. + + 10 + + + + + + + + Identifies the delivery signature services options offered by FedEx. + + + + + + + + + + + + These values are mutually exclusive; at most one of them can be attached to a SmartPost shipment. + + + + + + + + + + + + + + + + + + + + + Data required for shipments handled under the SMART_POST and GROUND_SMART_POST service types. + + + + + + + + + The CustomerManifestId is used to group Smart Post packages onto a manifest for each trailer that is being prepared. If you do not have multiple trailers this field can be omitted. If you have multiple trailers, you + must assign the same Manifest Id to each SmartPost package as determined by its trailer. In other words, all packages on a trailer must have the same Customer Manifest Id. The manifest Id must be unique to your account number for a minimum of 6 months + and cannot exceed 8 characters in length. We recommend you use the day of year + the trailer id (this could simply be a sequential number for that trailer). So if you had 3 trailers that you started loading on Feb 10 + the 3 manifest ids would be 041001, 041002, 041003 (in this case we used leading zeros on the trailer numbers). + + + + + + + + Special circumstance rating used for this shipment. + + + + + + + + + Each instance of this data type represents a barcode whose content must be represented as ASCII text (i.e. not binary data). + + + + + The kind of barcode data in this instance. + + + + + The data content of this instance. + + + + + + + + + + + + + + + + + Identifies each surcharge applied to the shipment. + + + + + The type of surcharge applied to the shipment. + + + + + + + The amount of the surcharge applied to the shipment. + + + + + + + + + + + + + The type of the surcharge. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifies each tax applied to the shipment. + + + + + The type of tax applied to the shipment. + + + + + + The amount of the tax applied to the shipment. + + + + + + + The type of the tax. + + + + + + + + + + + + + + The descriptive data for taxpayer identification information. + + + + + Identifies the category of the taxpayer identification number. See TinType for the list of values. + + + + + Identifies the taxpayer identification number. + + 15 + + + + + + Identifies the usage of Tax Identification Number in Shipment processing + + + + + + + + Required for dutiable international express or ground shipment. This field is not applicable to an international PIB (document) or a non-document which does not require a commercial invoice express shipment. + CFR_OR_CPT (Cost and Freight/Carriage Paid TO) + CIF_OR_CIP (Cost Insurance and Freight/Carraige Insurance Paid) + DDP (Delivered Duty Paid) + DDU (Delivered Duty Unpaid) + EXW (Ex Works) + FOB_OR_FCA (Free On Board/Free Carrier) + + + + + + + + + + + + + + Identifies the category of the taxpayer identification number. + + + + + + + + + + + + + + + For use with SmartPost tracking IDs only + + + + + + + + TrackingIdType + + + + + + + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Free form text to be echoed back in the reply. Used to match requests and replies. + + + + + Governs data payload language/translations (contrasted with ClientDetail.localization, which governs Notification.localizedMessage language selection). + + + + + + + Identifies the set of valid shipment transit time values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Descriptive data sent to FedEx by a customer in order to validate a shipment. + + + + + Descriptive data to be used in authentication of the sender's identity (and right to use FedEx web services). + + + + + Descriptive data identifying the client submitting the transaction. + + + + + Descriptive data for this customer transaction. The TransactionDetail from the request is echoed back to the caller in the corresponding reply. + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Descriptive data about the shipment being sent by the requestor. + + + + + + + Documents the kind and quantity of an individual hazardous commodity in a package. + + + + + Identifies and describes an individual hazardous commodity. + + + + + Specifies the amount of the commodity in alternate units. + + + + + Customer-provided specifications for handling individual commodities. + + + + + + + Identifies and describes an individual hazardous commodity. For 201001 load, this is based on data from the FedEx Ground Hazardous Materials Shipping Guide. + + + + + Regulatory identifier for a commodity (e.g. "UN ID" value). + + + + + + + Fully-expanded descriptive text for a hazardous commodity. + + + + + + + + Coded indications for special requirements or constraints. + + + + + + + + Details about how to calculate variable handling charges at the shipment level. + + + + + The type of handling charge to be calculated and returned in the reply. + + + + + + Used with Variable handling charge type of FIXED_VALUE. + Contains the amount to be added to the freight charge. + Contains 2 explicit decimal positions with a total max length of 10 including the decimal. + + + + + + Actual percentage (10 means 10%, which is a mutiplier of 0.1) + + + + + + + The type of handling charge to be calculated and returned in the reply. + + + + + + + + + + + The variable handling charges calculated based on the type variable handling charges requested. + + + + + The variable handling charge amount calculated based on the requested variable handling charge detail. + + + + + The calculated varibale handling charge plus the net charge. + + + + + + + Three-dimensional volume/cubic measurement. + + + + + + + + + Units of three-dimensional volume/cubic measure. + + + + + + + + + The descriptive data for the heaviness of an object. + + + + + Identifies the unit of measure associated with a weight value. + + + + + Identifies the weight value of a package/shipment. + + + + + + + Identifies the unit of measure associated with a weight value. See the list of enumerated types for valid values. + + + + + + + + + Used in authentication of the sender's identity. + + + + + Credential used to authenticate a specific software application. This value is provided by FedEx after registration. + + + + + + + Two part authentication string used for the sender's identity + + + + + Identifying part of authentication credential. This value is provided by FedEx after registration + + + + + Secret part of authentication key. This value is provided by FedEx after registration. + + + + + + + Identifies the version/level of a service operation expected by a caller (in each request) and performed by the callee (in each reply). + + + + + Identifies a system or sub-system which performs an operation. + + + + + Identifies the service business level. + + + + + Identifies the service interface level. + + + + + Identifies the service code level. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git app/code/core/Mage/Usa/sql/usa_setup/install-1.6.0.0.php app/code/core/Mage/Usa/sql/usa_setup/install-1.6.0.0.php index 643acfc..8ce1063 100644 --- app/code/core/Mage/Usa/sql/usa_setup/install-1.6.0.0.php +++ app/code/core/Mage/Usa/sql/usa_setup/install-1.6.0.0.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/sql/usa_setup/mysql4-upgrade-0.7.0-0.7.1.php app/code/core/Mage/Usa/sql/usa_setup/mysql4-upgrade-0.7.0-0.7.1.php index 9207076..d61b2c1 100644 --- app/code/core/Mage/Usa/sql/usa_setup/mysql4-upgrade-0.7.0-0.7.1.php +++ app/code/core/Mage/Usa/sql/usa_setup/mysql4-upgrade-0.7.0-0.7.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.0-1.6.0.1.php app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.0-1.6.0.1.php index 3b6d519..a1faae9 100644 --- app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.0-1.6.0.1.php +++ app/code/core/Mage/Usa/sql/usa_setup/upgrade-1.6.0.0-1.6.0.1.php @@ -20,7 +20,7 @@ * * @category Mage * @package Mage_Usa - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml index d1cb641..740ccc5 100644 --- app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml +++ app/design/adminhtml/default/default/template/catalog/product/tab/inventory.phtml @@ -107,6 +107,15 @@ __('[GLOBAL]') ?> + + + + + __('[GLOBAL]') ?> + @@ -227,6 +236,22 @@ Event.observe($('inventory_enable_qty_increments'), 'change', applyEnableQtyIncrements); Event.observe($('inventory_use_config_enable_qty_increments'), 'change', applyEnableQtyIncrements); applyEnableQtyIncrements(); + + function applyEnableDecimalDivided() { + $('inventory_is_decimal_divided').up('tr').hide(); + $('inventory_qty_increments').removeClassName('validate-digits').removeClassName('validate-number'); + $('inventory_min_sale_qty').removeClassName('validate-digits').removeClassName('validate-number'); + if ($('inventory_is_qty_decimal').value == 1) { + $('inventory_is_decimal_divided').up('tr').show(); + $('inventory_qty_increments').addClassName('validate-number'); + $('inventory_min_sale_qty').addClassName('validate-number'); + } else { + $('inventory_qty_increments').addClassName('validate-digits'); + $('inventory_min_sale_qty').addClassName('validate-digits'); + } + } + Event.observe($('inventory_is_qty_decimal'), 'change', applyEnableDecimalDivided); + applyEnableDecimalDivided(); //]]> diff --git app/design/adminhtml/default/default/template/system/shipping/ups.phtml app/design/adminhtml/default/default/template/system/shipping/ups.phtml index 9218600..4603978 100644 --- app/design/adminhtml/default/default/template/system/shipping/ups.phtml +++ app/design/adminhtml/default/default/template/system/shipping/ups.phtml @@ -20,203 +20,176 @@ * * @category design * @package default_default - * @copyright Copyright (c) 2011 Magento Inc. (http://www.magentocommerce.com) + * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ +/** @var $upsModel Mage_Usa_Model_Shipping_Carrier_Ups */ +$upsModel = Mage::getSingleton('usa/shipping_carrier_ups'); +$orShipArr = $upsModel->getCode('originShipment'); +$defShipArr = $upsModel->getCode('method'); -$orShipArr = Mage::getSingleton('usa/shipping_carrier_ups')->getCode('originShipment'); - -$defShipArr = Mage::getSingleton('usa/shipping_carrier_ups')->getCode('method'); - +/** @var $this Mage_Adminhtml_Block_Template */ $sectionCode = $this->getRequest()->getParam('section'); $websiteCode = $this->getRequest()->getParam('website'); $storeCode = $this->getRequest()->getParam('store'); - -if(!$storeCode && $websiteCode){ +if (!$storeCode && $websiteCode) { + /** @var $web Mage_Core_Model_Website */ $web = Mage::getModel('Mage_Core_Model_Website')->load($websiteCode); - $stroredAllowedMethods = $web->getConfig('carriers/ups/allowed_methods'); - $stroredAllowedMethods = explode(',',$stroredAllowedMethods); - $stroredOriginShipment = $web->getConfig('carriers/ups/origin_shipment'); - $stroredFreeShipment = $web->getConfig('carriers/ups/free_method'); + $storedAllowedMethods = explode(',', $web->getConfig('carriers/ups/allowed_methods')); + $storedOriginShipment = $web->getConfig('carriers/ups/origin_shipment'); + $storedFreeShipment = $web->getConfig('carriers/ups/free_method'); + $storedUpsType = $web->getConfig('carriers/ups/type'); } elseif ($storeCode) { - $stroredAllowedMethods = Mage::getStoreConfig('carriers/ups/allowed_methods',$storeCode); - $stroredAllowedMethods = explode(',',$stroredAllowedMethods); - $stroredOriginShipment = Mage::getStoreConfig('carriers/ups/origin_shipment',$storeCode); - $stroredFreeShipment = Mage::getStoreConfig('carriers/ups/free_method',$storeCode); + $storedAllowedMethods = explode(',', Mage::getStoreConfig('carriers/ups/allowed_methods', $storeCode)); + $storedOriginShipment = Mage::getStoreConfig('carriers/ups/origin_shipment', $storeCode); + $storedFreeShipment = Mage::getStoreConfig('carriers/ups/free_method', $storeCode); + $storedUpsType = Mage::getStoreConfig('carriers/ups/type', $storeCode); } else { - $stroredAllowedMethods = Mage::getStoreConfig('carriers/ups/allowed_methods'); - $stroredAllowedMethods = explode(',',$stroredAllowedMethods); - $stroredOriginShipment = Mage::getStoreConfig('carriers/ups/origin_shipment'); - $stroredFreeShipment = Mage::getStoreConfig('carriers/ups/free_method'); + $storedAllowedMethods = explode(',', Mage::getStoreConfig('carriers/ups/allowed_methods')); + $storedOriginShipment = Mage::getStoreConfig('carriers/ups/origin_shipment'); + $storedFreeShipment = Mage::getStoreConfig('carriers/ups/free_method'); + $storedUpsType = Mage::getStoreConfig('carriers/ups/type'); } ?> diff --git app/design/adminhtml/default/default/template/usa/dhl/unitofmeasure.phtml app/design/adminhtml/default/default/template/usa/dhl/unitofmeasure.phtml new file mode 100644 index 0000000..29ed62f --- /dev/null +++ app/design/adminhtml/default/default/template/usa/dhl/unitofmeasure.phtml @@ -0,0 +1,53 @@ + + + diff --git media/dhl/logo.jpg media/dhl/logo.jpg new file mode 100644 index 0000000..4f80976 --- /dev/null +++ media/dhl/logo.jpg @@ -0,0 +1,29 @@ +JFIFHHC  +   $.' ",#(7),01444'9=82<.342C  2!!22222222222222222222222222222222222222222222222222v"E QT!1ARUa"Sq#24Br3$bCE8 +R!1QS2Aaq"#Bb$3r ?&IDǒI%a͡?gQ+q~gc6-Vkm"&ym+Xshg6p "lgL8-VkmD2p[a͡56kbz3muKRoW=݂hMDc2<Ya͡9 XCum,x~΋YVuTya͡9 XCum,x~cSUI.aͣpέ8gVLJ-f>5Tya͡9 XCum,x~cSUI.aͣpέziUI:h?0k1)Jkm VJnZcDXRp 6+Xsh3iclԇDʜYRoԡ𷏐]#?93ZÛFd͔o]J⿰d3"#3;L<׶YU/kaͣ픢 {<>Tj3ic[MXE2" 6+Xsh3icմtZ}JUI.aͣ5k/&V̒|^JZT+mR3l6VkmG]*DdJs%f*3ic\kwV4 .aͣpέ8gVLJ$k1*MU'^+Xshg6i:}OO[a?;ϐl5q8,/ct̯0̯0}A#Q} čZBk!Dw!ΜqnQj35(L48((iIvq`_ 6 1CwՓj#ci{66;䦬7h2Q/Ii\."Q 4RgDC*զٙEk!Y6S{ر#c&v{tT&9%^'11, }ӏAŞJR\:u"4W^!dhyEQp'SZ}VYͷpX9g6g,DDD?./T˵ U>11j?*@. +ϐNW=gMY}?%'JƩaҼ16j;=Hmo%':YOZв&7$)N<[X1YJarCeřRD\gtuK%H"ZWq*hOp' Jĭ~L`X-Zi\.$-1Z.b.nTʽJb3v}T'$3#1΢w"(ٔ\.~6e /΢w+:/9{?!D ]T$OJs]j:}{f#(I%$D+gUg~Bd;3%#_VKh+ϷG.^N\)JyZm4ZVI2E$է`gQW};…Dܷ8\w% bnpQ%1YUNgQW};Ɔ~,CWb@ ~ VuwӼ81YUNňs Kb΢w~,CLX5_E] VuwӼ3bg9*xpb់?!i)T7W̔P#qNKh+u&8Vm +RWd5]F~@Ɲz ;=U_\|gu;0L*Vֵ-p֥(35= VuwӼi`ØZp!`hp@ ~ VuwӼ81YUN6~,CR9`LJ^pڲ|dZ>ZF(R!w)jRLZxt(q'%)V5ɌܕRfLf0"""" kk*B  +v_h궂=Hn9.{(UEB/^ujD&dvU~`?4^cvAڎsUq[ mn 9rs^cvAڎsUq[ mn ag4YyڎsU *T8(7JKIXW}TMħ-${ +])H`IE)kO r=?,̕!eOafyպKYޥ)۫TݫO\8:)!/SYyޯSYyހ-hyaVmqW^ XEx,8BC+ XCum,x~!4Xpa[Kفi+)5KόA)28?ŸHGmS\j?.N, :Oh.[%JVR1\TR?Ey$$v Ӹ_s]qV55)Gb .p6* .plS3icմ M!jh +:VnO*:ut ~䰍%i-jDh +~Ey$έA>[Ψԥ9cv*(.VTQ18\ XCum,x~M!IÄ+ XEJNr RIu7)2ё}/RII$"&M?Ƌ/W.D]) ω9_1nsďyY&֬)WWEy+ܪw\V 2 +FUE"ִX-CE WP WP:uBYɄ.aU#Zq$!3Nf + y +o +E[;GUwEy}YZSKeONЀsO>dr2r\SoYɄ+zL!r?lګ! Gqic^Z a7R\gΣ3@9.7+9ĸܨRi4-{n*ORY +umhQ;Eb +anf!nNVIpɼyug'fUUL!r? ?LYɄ&\Sra Y780hJ_[Mgՙu 8O$o|g$x8Wb6U_B)[WZS|N#kuUWiMښS|N#kuUWiMښS|N#kuU:Ng\c7P$4)hdV[o.>1 v +״ۿt%״Gg ЭU67\nHA>O$qr h;|26>ƚa*2 WJڨZe-zWJLH$fg@fT.1(v+qe6D[$i1.mtz%],^JJ[w^Ewj &i%2u$O. k~ި!#2))o\w^ewj "K-I&ɖ#?1. MaG D@Q 'vt[z /9zOq-;K^Uwao n7A݅4_QZ?=Z:jm(#3%&s'ٳvrrY9^[ @@hR{-JTY@[[}RkV&ܔ5EeI1@ktSezC)I]!62Iq"Q9q(sirRPO[Mwd\Ua=6[Q-k'oW݈RIiʴ5-iY[3W\DD_#1Je dy8m:>b\}jݬZ-MJI4nCq{L2WGj>"R˴̈hg@ٽO&aɔKME jf.UJ<[%{22Q+o3!MVuau\f}#/?YZFTa F2T QGJ?DXS}363)em%*2"_}%nŋӮI *4=~C΀Z2ٳꯍa9Xk2͍7ir\9ͥƨiu+Eܧw5a ǧQbD}>rՖwey*hPhxX˭:R35Z4?6sEIh$%ffw5 L*{zo3g! 8}~6wXkAÅB?R Jg=l6|;5! +~o */[dC!B?RIEq 3@u `&']lwxj~wtϿ |']3az=|'wLlwxaz=>`&']lwxj~wtϿ |0=beﳓ~{W]fjpr6%2 ^RHRI"-n#R];/XP)ӝG}Ex$"è`q}\϶Q +bf1Sxܑ~U軔1Mt'-> +ۈzh;{]Pd{MJǝZlwuޛP@7\2VGgYFZ 9DGy^WiM-PϷj7 ^D\\}C=׭gvQ&6Wk(VAdĵ2ɽLCn]ffvX,A{2 9etjgԴ&>33<=JbRT"YHQ)&wIŜ3..;( 3Nd4\{.Eoǒ⤫>gDgGxK}e-|']# lwxaz=>`&']lwxj~wtϿ |']3az=|'wLlwxaz=>`&']lwxj~wtϿ |']3az=|'wLlwxBM(JL3CM$ R|~ \ No newline at end of file