-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCheque.php
More file actions
77 lines (65 loc) · 2.14 KB
/
Copy pathCheque.php
File metadata and controls
77 lines (65 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/*
* This file is part of the Thelia package.
* http://www.thelia.net
*
* (c) OpenStudio <info@thelia.net>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cheque;
use Propel\Runtime\Connection\ConnectionInterface;
use Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator;
use Symfony\Component\HttpFoundation\Response;
use Thelia\Core\Install\Database;
use Thelia\Model\MessageQuery;
use Thelia\Model\Order;
use Thelia\Module\AbstractPaymentModule;
class Cheque extends AbstractPaymentModule
{
public const MESSAGE_DOMAIN = 'cheque';
public function pay(Order $order): ?Response
{
return null;
}
/**
* 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 displayed
*/
public function isValidPayment(): bool
{
return $this->getCurrentOrderTotalAmount() > 0;
}
public function postActivation(?ConnectionInterface $con = null): void
{
$database = new Database($con);
// Insert email message
$database->insertSql(null, [__DIR__.'/Config/setup.sql']);
}
public function destroy(?ConnectionInterface $con = null, $deleteModuleData = false): void
{
// Delete our message
if (null !== $message = MessageQuery::create()->findOneByName('order_confirmation_cheque')) {
$message->delete($con);
}
parent::destroy($con, $deleteModuleData);
}
/**
* if you want, you can manage stock in your module instead of an order process.
* Return false if you want to manage yourself the stock.
*/
public function manageStockOnCreation(): bool
{
return false;
}
public static function configureServices(ServicesConfigurator $servicesConfigurator): void
{
$servicesConfigurator->load(self::getModuleCode().'\\', __DIR__)
->exclude([__DIR__.'/I18n/*', __DIR__.'/tests/*'])
->autowire(true)
->autoconfigure(true);
}
}