Fixes #308
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user