Inital commit

This commit is contained in:
2020-11-19 15:36:28 +01:00
parent 71f32f83d3
commit 66ce4ee218
18077 changed files with 2166122 additions and 35184 deletions

View File

@@ -13,41 +13,19 @@
namespace Cheque;
use Propel\Runtime\Connection\ConnectionInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\Request;
use Thelia\Model\ModuleImageQuery;
use Thelia\Install\Database;
use Thelia\Model\MessageQuery;
use Thelia\Model\Order;
use Thelia\Module\BaseModule;
use Thelia\Module\PaymentModuleInterface;
class Cheque extends BaseModule implements PaymentModuleInterface
{
protected $request;
protected $dispatcher;
public function setRequest(Request $request)
{
$this->request = $request;
}
public function getRequest()
{
return $this->request;
}
public function setDispatcher(EventDispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
public function getDispatcher()
{
return $this->dispatcher;
}
const MESSAGE_DOMAIN = "cheque";
public function pay(Order $order)
{
// no special process, waiting for the cheque.
// Nothing special to to.
}
/**
@@ -61,32 +39,35 @@ class Cheque extends BaseModule implements PaymentModuleInterface
*/
public function isValidPayment()
{
return true;
return $this->getCurrentOrderTotalAmount() > 0;
}
public function postActivation(ConnectionInterface $con = null)
{
/* insert the images from image folder if first module activation */
$module = $this->getModuleModel();
if(ModuleImageQuery::create()->filterByModule($module)->count() == 0) {
$this->deployImageFolder($module, sprintf('%s/images', __DIR__), $con);
$database = new Database($con);
// Insert email message
$database->insertSql(null, array(__DIR__ . "/Config/setup.sql"));
}
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
{
// Delete our message
if (null !== $message = MessageQuery::create()->findOneByName('order_confirmation_cheque')) {
$message->delete($con);
}
/* set module title */
$this->setTitle(
$module,
array(
"en_US" => "Cheque",
"fr_FR" => "Cheque",
)
);
parent::destroy($con, $deleteModuleData);
}
public function getCode()
/**
* if you want, you can manage stock in your module instead of order process.
* Return false if you want to manage yourself the stock
*
* @return bool
*/
public function manageStockOnCreation()
{
return 'Cheque';
return false;
}
}