. */ /* */ /*************************************************************************************/ namespace WireTransfer; use Propel\Runtime\Connection\ConnectionInterface; use Thelia\Core\Translation\Translator; use Thelia\Install\Database; use Thelia\Log\Tlog; use Thelia\Model\MessageQuery; use Thelia\Model\Order; use Thelia\Module\AbstractPaymentModule; /** * Class WireTransfer * @package WireTransfer * author Thelia */ class WireTransfer extends AbstractPaymentModule { const MESSAGE_DOMAIN = 'wiretransfer'; /** * @param Order $order */ public function pay(Order $order) { // Nothing special to do. } /** * @return boolean true if all parameters have been entered. */ public function isValidPayment() { // Check that all parameters have been entered. $valid = $this->getConfigValue('name', '') != '' && $this->getConfigValue('bic', '') != '' && $this->getConfigValue('iban', '') != '' ; if (! $valid) { Tlog::getInstance()->addError( Translator::getInstance()->trans( "Bank information parameters have not been defined.", [], self::MESSAGE_DOMAIN ) ); } return $valid; } public function install(ConnectionInterface $con = null) { $database = new Database($con->getWrappedConnection()); // Insert email message $database->insertSql(null, array(__DIR__ . "/Config/setup.sql")); /* insert the images from image folder if not already done */ $moduleModel = $this->getModuleModel(); if (! $moduleModel->isModuleImageDeployed($con)) { $this->deployImageFolder($moduleModel, sprintf('%s/images', __DIR__), $con); } } public function destroy(ConnectionInterface $con = null, $deleteModuleData = false) { // Delete our message if (null !== $message = MessageQuery::create()->findOneByName('order_confirmation_wiretransfer')) { $message->delete($con); } parent::destroy($con, $deleteModuleData); } /** * if you want, you can manage stock in your module instead of order process. * Return false to decrease the stock when order status switch to pay * * @return bool */ public function manageStockOnCreation() { return false; } }