This commit is contained in:
Franck Allimant
2014-04-17 19:46:21 +02:00
parent 61fc6720fd
commit 12c21b1239
7 changed files with 871 additions and 833 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -30,6 +30,7 @@ use Thelia\Model\CountryQuery;
use Thelia\Model\Module;
use Thelia\Module\BaseModule;
use Thelia\Module\DeliveryModuleInterface;
use Thelia\Module\Exception\DeliveryException;
/**
* Class Delivery
@@ -76,7 +77,7 @@ class Delivery extends BaseSpecificModule
try {
// Check if module is valid, by calling isValidDelivery(),
// or catching a DELIVERY_MODULE_UNAVAILABLE OrderException.
// or catching a DeliveryException.
if ($moduleInstance->isValidDelivery($country)) {
@@ -93,11 +94,8 @@ class Delivery extends BaseSpecificModule
$loopResult->addRow($loopResultRow);
}
} catch (OrderException $ex) {
// Re-throw an unknown exception
if ($ex->getCode() !== OrderException::DELIVERY_MODULE_UNAVAILABLE) {
throw $ex;
}
} catch (DeliveryException $ex) {
// Module is not available
}
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Module;
use Thelia\Model\Country;
use Thelia\Module\Exception\DeliveryException;
abstract class AbstractDeliveryModule extends BaseModule implements DeliveryModuleInterface
{
@@ -46,6 +47,7 @@ abstract class AbstractDeliveryModule extends BaseModule implements DeliveryModu
* @param Country $country the country to deliver to.
*
* @return float the delivery price
* @throws DeliveryException if the postage price cannot be calculated.
*/
public abstract function getPostage(Country $country);
}

View File

@@ -24,6 +24,7 @@
namespace Thelia\Module;
use Thelia\Model\Country;
use Thelia\Module\Exception\DeliveryException;
interface DeliveryModuleInterface extends BaseModuleInterface
{
@@ -46,6 +47,7 @@ interface DeliveryModuleInterface extends BaseModuleInterface
* @param Country $country the country to deliver to.
*
* @return float the delivery price
* @throws DeliveryException if the postage price cannot be calculated.
*/
public function getPostage(Country $country);
}