1
|
|
|
<?php |
2
|
|
|
/*************************************************************************************/ |
3
|
|
|
/* This file is part of the Thelia package. */ |
4
|
|
|
/* */ |
5
|
|
|
/* Copyright (c) OpenStudio */ |
6
|
|
|
/* email : [email protected] */ |
7
|
|
|
/* web : http://www.thelia.net */ |
8
|
|
|
/* */ |
9
|
|
|
/* For the full copyright and license information, please view the LICENSE.txt */ |
10
|
|
|
/* file that was distributed with this source code. */ |
11
|
|
|
/*************************************************************************************/ |
12
|
|
|
|
13
|
|
|
|
14
|
|
|
namespace Thelia\Core\Event\Payment; |
15
|
|
|
|
16
|
|
|
use Thelia\Model\Cart; |
17
|
|
|
use Thelia\Module\AbstractPaymentModule; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Class IsValidPaymentEvent |
21
|
|
|
* @package Thelia\Core\Event\Payment |
22
|
|
|
* @author Julien Chanséaume <[email protected]> |
23
|
|
|
*/ |
24
|
|
|
class IsValidPaymentEvent extends BasePaymentEvent |
25
|
|
|
{ |
26
|
|
|
/** @var Cart */ |
27
|
|
|
protected $cart = null; |
28
|
|
|
|
29
|
|
|
/** @var bool */ |
30
|
|
|
protected $validModule = false; |
31
|
|
|
|
32
|
|
|
/** @var float */ |
33
|
|
|
protected $minimumAmount = null; |
34
|
|
|
|
35
|
|
|
/** @var float */ |
36
|
|
|
protected $maximumAmount = null; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* IsValidPaymentEvent constructor. |
40
|
|
|
* |
41
|
|
|
* @param AbstractPaymentModule $module |
42
|
|
|
* @param Cart $cart |
43
|
|
|
*/ |
44
|
|
|
public function __construct(AbstractPaymentModule $module, Cart $cart) |
45
|
|
|
{ |
46
|
|
|
parent::__construct($module); |
47
|
|
|
$this->cart = $cart; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return Cart |
52
|
|
|
*/ |
53
|
|
|
public function getCart() |
54
|
|
|
{ |
55
|
|
|
return $this->cart; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param Cart $cart |
60
|
|
|
*/ |
61
|
|
|
public function setCart($cart) |
62
|
|
|
{ |
63
|
|
|
$this->cart = $cart; |
64
|
|
|
return $this; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return boolean |
69
|
|
|
*/ |
70
|
|
|
public function isValidModule() |
71
|
|
|
{ |
72
|
|
|
return $this->validModule; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param boolean $validModule |
77
|
|
|
*/ |
78
|
|
|
public function setValidModule($validModule) |
79
|
|
|
{ |
80
|
|
|
$this->validModule = $validModule; |
81
|
|
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @return float |
86
|
|
|
*/ |
87
|
|
|
public function getMinimumAmount() |
88
|
|
|
{ |
89
|
|
|
return $this->minimumAmount; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param float $minimumAmount |
94
|
|
|
*/ |
95
|
|
|
public function setMinimumAmount($minimumAmount) |
96
|
|
|
{ |
97
|
|
|
$this->minimumAmount = $minimumAmount; |
98
|
|
|
return $this; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @return float |
103
|
|
|
*/ |
104
|
|
|
public function getMaximumAmount() |
105
|
|
|
{ |
106
|
|
|
return $this->maximumAmount; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @param float $maximumAmount |
111
|
|
|
*/ |
112
|
|
|
public function setMaximumAmount($maximumAmount) |
113
|
|
|
{ |
114
|
|
|
$this->maximumAmount = $maximumAmount; |
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|