15
15
use Woocommerce \Pagarme \Helper \Utils ;
16
16
use Woocommerce \Pagarme \Model \CardInstallments ;
17
17
use Woocommerce \Pagarme \Model \Subscription ;
18
- use Woocommerce \Pagarme \View \Checkouts ;
18
+ use Woocommerce \Pagarme \Model \Config ;
19
+ use Woocommerce \Pagarme \Model \Gateway as GatewayModel ;
20
+ use Woocommerce \Pagarme \Model \Serialize \Serializer \Json ;
19
21
20
22
defined ('ABSPATH ' ) || exit;
21
23
@@ -33,15 +35,20 @@ class Installments extends Gateway
33
35
/** @var int */
34
36
protected $ sequence = 1 ;
35
37
36
- /** @var int */
38
+ /** @var CardInstallments */
37
39
protected $ cardInstallments ;
38
40
39
41
/** @var Subscription */
40
42
protected $ subscription ;
41
43
42
- public function __construct ()
44
+ public function __construct (
45
+ Json $ jsonSerialize = null ,
46
+ array $ data = [],
47
+ GatewayModel $ gateway = null ,
48
+ Config $ config = null
49
+ )
43
50
{
44
- parent ::__construct ();
51
+ parent ::__construct ($ jsonSerialize , $ data , $ gateway , $ config );
45
52
$ this ->cardInstallments = new CardInstallments ();
46
53
$ this ->subscription = new Subscription ();
47
54
}
@@ -115,15 +122,17 @@ public function render()
115
122
/**
116
123
* @return bool
117
124
*/
118
- public function isCcInstallmentTypeByFlag () {
125
+ public function isCcInstallmentTypeByFlag ()
126
+ {
119
127
$ type = intval ($ this ->cardInstallments ->config ->getCcInstallmentType ()) ?? 1 ;
120
128
return $ type === CardInstallments::INSTALLMENTS_BY_FLAG ;
121
129
}
122
130
123
131
/**
124
132
* @return int
125
133
*/
126
- public function getConfiguredMaxCcInstallments (): int {
134
+ public function getConfiguredMaxCcInstallments ()
135
+ {
127
136
if ($ this ->isCcInstallmentTypeByFlag ()) {
128
137
$ flag = Utils::get ('flag ' , false , 'esc_html ' );
129
138
$ configByFlags = $ this ->cardInstallments ->config ->getCcInstallmentsByFlag ();
0 commit comments