create new method in PaymentModuleInterface for verifying is the module
is valid
This commit is contained in:
@@ -54,6 +54,10 @@ class Payment extends BaseSpecificModule implements PropelSearchLoopInterface
|
||||
throw new \RuntimeException(sprintf("payment module %s is not a Thelia\Module\PaymentModuleInterface", $paymentModule->getCode()));
|
||||
}
|
||||
|
||||
if (false === $moduleInstance->isValidPayment()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$loopResultRow
|
||||
->set('ID', $paymentModule->getId())
|
||||
->set('TITLE', $paymentModule->getVirtualColumn('i18n_TITLE'))
|
||||
|
||||
@@ -31,4 +31,15 @@ interface PaymentModuleInterface extends BaseModuleInterface
|
||||
* @return mixed
|
||||
*/
|
||||
public function pay(Order $order);
|
||||
|
||||
/**
|
||||
*
|
||||
* This method is call on Payment loop.
|
||||
*
|
||||
* If you return true, the payment method will de display
|
||||
* If you return false, the payment method will not be display
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidPayment();
|
||||
}
|
||||
|
||||
@@ -61,6 +61,20 @@ class Cheque extends BaseModule implements PaymentModuleInterface
|
||||
// no special process, waiting for the cheque.
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* This method is call on Payment loop.
|
||||
*
|
||||
* If you return true, the payment method will de display
|
||||
* If you return false, the payment method will not be display
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isValidPayment()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function postActivation(ConnectionInterface $con = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user