This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Moip\Tests\Resource; |
||
4 | |||
5 | use Moip\Tests\TestCase; |
||
6 | |||
7 | class RefundTest extends TestCase |
||
8 | { |
||
9 | public function testRefundOrderCreditCardFull() |
||
10 | { |
||
11 | $order = $this->paymentCreditCard(false); |
||
12 | |||
13 | $this->mockHttpSession($this->body_order_refund_full_cc); |
||
0 ignored issues
–
show
|
|||
14 | $refund = $order->refunds()->creditCardFull(); |
||
15 | |||
16 | $this->assertNotEmpty($refund->getId()); |
||
17 | $this->assertEquals('FULL', $refund->getType()); |
||
18 | } |
||
19 | |||
20 | public function testRefundOrderCreditCardPartial() |
||
21 | { |
||
22 | $order = $this->paymentCreditCard(false); |
||
23 | |||
24 | $this->mockHttpSession($this->body_order_refund_partial_cc); |
||
0 ignored issues
–
show
The property
body_order_refund_partial_cc does not seem to exist. Did you mean body_order ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
25 | $refund = $order->refunds()->creditCardPartial(5000); |
||
26 | |||
27 | $this->assertNotEmpty($refund->getId()); |
||
28 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
29 | } |
||
30 | |||
31 | View Code Duplication | public function testRefundOrderBankAccountFull() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
32 | { |
||
33 | $order = $this->paymentBoleto(false); |
||
34 | |||
35 | $this->mockHttpSession($this->body_order_refund_full_bankaccount); |
||
0 ignored issues
–
show
The property
body_order_refund_full_bankaccount does not seem to exist. Did you mean body_order ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
36 | $refund = $order->refunds() |
||
37 | ->bankAccountFull('CHECKING', '001', '1584', '9', '00210169', '6', $order->getCustomer()); |
||
38 | |||
39 | $this->assertNotEmpty($refund->getId()); |
||
40 | $this->assertEquals('FULL', $refund->getType()); |
||
41 | } |
||
42 | |||
43 | View Code Duplication | public function testRefundOrderBankAccountPartial() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
44 | { |
||
45 | $order = $this->paymentBoleto(false); |
||
46 | |||
47 | $this->mockHttpSession($this->body_payment_refund_partial_bankaccount); |
||
0 ignored issues
–
show
The property
body_payment_refund_partial_bankaccount does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
48 | $refund = $order->refunds() |
||
49 | ->bankAccountPartial(20000, 'SAVING', '001', '1584', '9', '00210169', '6', $order->getCustomer()); |
||
50 | |||
51 | $this->assertNotEmpty($refund->getId()); |
||
52 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
53 | } |
||
54 | |||
55 | View Code Duplication | public function testRefundPaymentCreditCardFull() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
56 | { |
||
57 | $payment = $this->paymentCreditCard(); |
||
58 | |||
59 | $this->mockHttpSession($this->body_payment_refund_full_cc); |
||
0 ignored issues
–
show
The property
body_payment_refund_full_cc does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
60 | $refund = $payment->refunds()->creditCardFull(); |
||
61 | |||
62 | $this->assertNotEmpty($refund->getId()); |
||
63 | $this->assertEquals('FULL', $refund->getType()); |
||
64 | } |
||
65 | |||
66 | public function testRefundPaymentCreditCardPartial() |
||
67 | { |
||
68 | $payment = $this->paymentCreditCard(); |
||
69 | |||
70 | $this->mockHttpSession($this->body_payment_refund_partial_cc); |
||
0 ignored issues
–
show
The property
body_payment_refund_partial_cc does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
71 | $refund = $payment->refunds()->creditCardPartial(5000); |
||
72 | |||
73 | $this->assertNotEmpty($refund->getId()); |
||
74 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
75 | } |
||
76 | |||
77 | View Code Duplication | public function testRefundPaymentBankAccountFull() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
78 | { |
||
79 | $payment = $this->paymentBoleto(); |
||
80 | |||
81 | $this->mockHttpSession($this->body_payment_refund_full_bankaccount); |
||
0 ignored issues
–
show
The property
body_payment_refund_full_bankaccount does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
![]() |
|||
82 | $refund = $payment->refunds() |
||
83 | ->bankAccountFull('CHECKING', '001', '1584', '9', '00210169', '6', $payment->getOrder()->getCustomer()); |
||
84 | |||
85 | $this->assertNotEmpty($refund->getId()); |
||
86 | $this->assertEquals('FULL', $refund->getType()); |
||
87 | } |
||
88 | |||
89 | View Code Duplication | public function testRefundPaymentBankAccountPartial() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
90 | { |
||
91 | $payment = $this->paymentBoleto(); |
||
92 | |||
93 | $this->mockHttpSession($this->body_payment_refund_partial_bankaccount); |
||
94 | $refund = $payment->refunds() |
||
95 | ->bankAccountPartial(20000, 'SAVING', '001', '1584', '9', '00210169', '6', $payment->getOrder()->getCustomer()); |
||
96 | |||
97 | $this->assertNotEmpty($refund->getId()); |
||
98 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
99 | } |
||
100 | |||
101 | View Code Duplication | public function testRefundCCFullWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
102 | { |
||
103 | $payment = $this->paymentCreditCard(); |
||
104 | |||
105 | $this->mockHttpSession($this->body_payment_refund_full_cc); |
||
106 | $refund = $this->moip->refunds()->creditCard($payment->getId()); |
||
107 | |||
108 | $this->assertNotEmpty($refund->getId()); |
||
109 | $this->assertEquals('FULL', $refund->getType()); |
||
110 | } |
||
111 | |||
112 | View Code Duplication | public function testRefundCCPartialWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
113 | { |
||
114 | $payment = $this->paymentCreditCard(); |
||
115 | |||
116 | $this->mockHttpSession($this->body_payment_refund_partial_cc); |
||
117 | $refund = $this->moip->refunds()->creditCard($payment->getId(), 5000); |
||
118 | |||
119 | $this->assertNotEmpty($refund->getId()); |
||
120 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
121 | } |
||
122 | |||
123 | View Code Duplication | public function testRefundBankAccountFullWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
124 | { |
||
125 | $payment = $this->paymentBoleto(); |
||
126 | |||
127 | $this->mockHttpSession($this->body_payment_refund_full_bankaccount); |
||
128 | $refund = $this->moip->refunds()->bankAccount($payment->getId(), $this->bankAccount()); |
||
129 | |||
130 | $this->assertNotEmpty($refund->getId()); |
||
131 | $this->assertEquals('FULL', $refund->getType()); |
||
132 | } |
||
133 | |||
134 | View Code Duplication | public function testRefundBankAccountPartialWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
135 | { |
||
136 | $payment = $this->paymentBoleto(); |
||
137 | |||
138 | $this->mockHttpSession($this->body_payment_refund_partial_bankaccount); |
||
139 | $refund = $this->moip->refunds()->bankAccount($payment->getId(), $this->bankAccount(), 5000); |
||
140 | |||
141 | $this->assertNotEmpty($refund->getId()); |
||
142 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
143 | } |
||
144 | |||
145 | View Code Duplication | public function testRefundOrderCCFullWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
146 | { |
||
147 | $order = $this->paymentCreditCard(false); |
||
148 | |||
149 | $this->mockHttpSession($this->body_order_refund_full_cc); |
||
0 ignored issues
–
show
The property
body_order_refund_full_cc does not seem to exist. Did you mean body_order ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
150 | $refund = $this->moip->refunds()->creditCard($order->getId()); |
||
151 | |||
152 | $this->assertNotEmpty($refund->getId()); |
||
153 | $this->assertEquals('FULL', $refund->getType()); |
||
154 | } |
||
155 | |||
156 | View Code Duplication | public function testRefundOrderCCPartialWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
157 | { |
||
158 | $order = $this->paymentCreditCard(false); |
||
159 | |||
160 | $this->mockHttpSession($this->body_order_refund_partial_cc); |
||
0 ignored issues
–
show
The property
body_order_refund_partial_cc does not seem to exist. Did you mean body_order ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
161 | $refund = $this->moip->refunds()->creditCard($order->getId(), 5000); |
||
162 | |||
163 | $this->assertNotEmpty($refund->getId()); |
||
164 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
165 | } |
||
166 | |||
167 | View Code Duplication | public function testRefundOrderBankAccountFullWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
168 | { |
||
169 | $order = $this->paymentBoleto(false); |
||
170 | |||
171 | $this->mockHttpSession($this->body_order_refund_full_bankaccount); |
||
0 ignored issues
–
show
The property
body_order_refund_full_bankaccount does not seem to exist. Did you mean body_order ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
172 | $refund = $this->moip->refunds()->bankAccount($order->getId(), $this->bankAccount()); |
||
173 | |||
174 | $this->assertNotEmpty($refund->getId()); |
||
175 | $this->assertEquals('FULL', $refund->getType()); |
||
176 | } |
||
177 | |||
178 | View Code Duplication | public function testRefundOrderBankAccountPartialWithResourceId() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
179 | { |
||
180 | $order = $this->paymentBoleto(false); |
||
181 | |||
182 | $this->mockHttpSession($this->body_order_refund_partial_bankaccount); |
||
0 ignored issues
–
show
The property
body_order_refund_partial_bankaccount does not seem to exist. Did you mean body_order ?
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name. If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading. ![]() |
|||
183 | $refund = $this->moip->refunds()->bankAccount($order->getId(), $this->bankAccount(), 5000); |
||
184 | |||
185 | $this->assertNotEmpty($refund->getId()); |
||
186 | $this->assertEquals('PARTIAL', $refund->getType()); |
||
187 | } |
||
188 | |||
189 | public function testShouldGetRefund() |
||
190 | { |
||
191 | $payment = $this->paymentCreditCard(); |
||
192 | |||
193 | $this->mockHttpSession($this->body_payment_refund_full_cc); |
||
194 | $refund_id = $payment->refunds()->creditCardFull()->getId(); |
||
195 | |||
196 | $this->mockHttpSession($this->body_payment_refund_full_cc); |
||
197 | $refund = $payment->refunds()->get($refund_id); |
||
198 | |||
199 | $this->assertEquals($refund_id, $refund->getId()); |
||
200 | $this->assertEquals('FULL', $refund->getType()); |
||
201 | $this->assertEquals('COMPLETED', $refund->getStatus()); |
||
202 | } |
||
203 | |||
204 | private function bankAccount() |
||
205 | { |
||
206 | return $this->moip->bankaccount() |
||
207 | ->setType('CHECKING') |
||
208 | ->setBankNumber('237') |
||
209 | ->setAgencyNumber('12346') |
||
210 | ->setAgencyCheckNumber('0') |
||
211 | ->setAccountNumber('12345679') |
||
212 | ->setAccountCheckNumber('7') |
||
213 | ->setHolder('Jose Silva', '22222222222', 'CPF'); |
||
214 | } |
||
215 | |||
216 | View Code Duplication | private function paymentBoleto($returnPayment = true) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
217 | { |
||
218 | $this->mockHttpSession($this->body_order); |
||
219 | $order = $this->createOrder()->create(); |
||
220 | $this->mockHttpSession($this->body_billet_pay); |
||
221 | $payment = $order->payments() |
||
0 ignored issues
–
show
The method
payments does only exist in Moip\Resource\Orders , but not in stdClass .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
222 | ->setBoleto(new \DateTime('today +1day'), 'http://dev.moip.com.br/images/logo-header-moip.png') |
||
223 | ->execute(); |
||
224 | $this->mockHttpSession(''); |
||
225 | $payment->authorize(); |
||
226 | |||
227 | return $returnPayment ? $payment : $order; |
||
228 | } |
||
229 | |||
230 | View Code Duplication | private function paymentCreditCard($returnPayment = true) |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
231 | { |
||
232 | $this->mockHttpSession($this->body_order); |
||
233 | $order = $this->createOrder()->create(); |
||
234 | $this->mockHttpSession($this->body_cc_pay_pci); |
||
235 | $payment = ($order->payments()->setCreditCard(5, 2018, '5555666677778884', 123, $this->createHolder())->execute()); |
||
0 ignored issues
–
show
The method
payments does only exist in Moip\Resource\Orders , but not in stdClass .
It seems like the method you are trying to call exists only in some of the possible types. Let’s take a look at an example: class A
{
public function foo() { }
}
class B extends A
{
public function bar() { }
}
/**
* @param A|B $x
*/
function someFunction($x)
{
$x->foo(); // This call is fine as the method exists in A and B.
$x->bar(); // This method only exists in B and might cause an error.
}
Available Fixes
![]() |
|||
236 | |||
237 | return $returnPayment ? $payment : $order; |
||
238 | } |
||
239 | } |
||
240 |
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.