Issues (10)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Getnet/API/Transaction.php (1 issue)

Upgrade to new PHP Analysis Engine

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 Getnet\API;
4
5
/**
6
 * Class Transaction
7
 *
8
 * @package Getnet\API
9
 */
10
class Transaction
11
{
12
    const STATUS_AUTHORIZED = "AUTHORIZED";
13
    const STATUS_CONFIRMED  = "CONFIRMED";
14
    const STATUS_PENDING    = "PENDING";
15
    const STATUS_APPROVED   = "APPROVED";
16
    const STATUS_CANCELED   = "CANCELED";
17
    const STATUS_DENIED     = "DENIED";
18
    const STATUS_ERROR      = "ERROR";
19
20
    /** @var */
21
    private $seller_id;
22
23
    /** @var */
24
    private $amount;
25
26
    /** @var string */
27
    private $currency = "BRL";
28
29
    /** @var */
30
    private $order;
31
32
    /** @var */
33
    private $customer;
34
35
    /** @var */
36
    private $device;
37
38
    /** @var */
39
    private $shippings;
40
41
    /** @var */
42
    private $credit;
43
44
    /** @var */
45
    private $debit;
46
47
    /** @var */
48
    private $boleto;
49
50
    /**
51
     * @return false|string
52
     */
53 View Code Duplication
    public function toJSON()
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.

Loading history...
54
    {
55
        $vars = get_object_vars($this);
56
        $vars_clear = array_filter($vars, function ($value) {
57
            return null !== $value;
58
        });
59
60
        return json_encode($vars_clear, JSON_PRETTY_PRINT);
61
    }
62
63
    /**
64
     * @return mixed
65
     */
66
    public function getSellerId()
67
    {
68
        return $this->seller_id;
69
    }
70
71
    /**
72
     * @param $seller_id
73
     * @return $this
74
     */
75
    public function setSellerId($seller_id)
76
    {
77
        $this->seller_id = (string)$seller_id;
78
79
        return $this;
80
    }
81
82
    /**
83
     * @return mixed
84
     */
85
    public function getAmount()
86
    {
87
        return $this->amount;
88
    }
89
90
    /**
91
     * @param $amount
92
     * @return $this
93
     */
94
    public function setAmount($amount)
95
    {
96
        $this->amount = (int)($amount * 100);
97
98
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104
    public function getCurrency()
105
    {
106
        return $this->currency;
107
    }
108
109
    /**
110
     * @param $currency
111
     * @return $this
112
     */
113
    public function setCurrency($currency)
114
    {
115
        $this->currency = (string)$currency;
116
117
        return $this;
118
    }
119
120
    /**
121
     * @param $order_id
122
     * @return Order
123
     */
124
    public function order($order_id)
125
    {
126
        $order = new Order($order_id);
127
        $this->setOrder($order);
128
129
        return $order;
130
    }
131
132
    /**
133
     * @return Order
134
     */
135
    public function getOrder()
136
    {
137
        return $this->order;
138
    }
139
140
    /**
141
     * @param Order $order
142
     * @return $this
143
     */
144
    public function setOrder(Order $order)
145
    {
146
        $this->order = $order;
147
148
        return $this;
149
    }
150
151
    /**
152
     * @param null $id
153
     * @return Customer
154
     */
155
    public function customer($id = null)
156
    {
157
        $customer = new Customer($id);
158
159
        $this->setCustomer($customer);
160
161
        return $customer;
162
    }
163
164
    /**
165
     * @return mixed
166
     */
167
    public function getCustomer()
168
    {
169
        return $this->customer;
170
    }
171
172
    /**
173
     * @param Customer $customer
174
     * @return $this
175
     */
176
    public function setCustomer(Customer $customer)
177
    {
178
        $this->customer = $customer;
179
180
        return $this;
181
    }
182
183
    /**
184
     * @param $device_id
185
     * @return Device
186
     */
187
    public function device($device_id)
188
    {
189
        $device = new Device($device_id);
190
191
        $this->device = $device;
192
193
        return $device;
194
    }
195
196
    /**
197
     * @return Device
198
     */
199
    public function getDevice()
200
    {
201
        return $this->device;
202
    }
203
204
    /**
205
     * @param Device $device
206
     * @return $this
207
     */
208
    public function setDevice(Device $device)
209
    {
210
        $this->device = $device;
211
212
        return $this;
213
    }
214
215
    /**
216
     * @return mixed
217
     */
218
    public function getShippings()
219
    {
220
        return $this->shippings;
221
    }
222
223
    /**
224
     * @param $shippings
225
     * @return $this
226
     */
227
    public function setShippings($shippings)
228
    {
229
        $this->shippings = $shippings;
230
231
        return $this;
232
    }
233
234
    /**
235
     * @return Shipping
236
     */
237
    public function shipping()
238
    {
239
        $shipping = new Shipping();
240
241
        $this->addShipping($shipping);
242
243
        return $shipping;
244
    }
245
246
    /**
247
     * @param Shipping $shipping
248
     */
249
    public function addShipping(Shipping $shipping)
250
    {
251
        if (!is_array($this->shippings)) {
252
            $this->shippings = [];
253
        }
254
255
        $this->shippings[] = $shipping;
256
    }
257
258
    /**
259
     * @param Customer $customer
260
     * @return Shipping
261
     */
262
    public function addShippingByCustomer(Customer $customer)
263
    {
264
        $shipping = new Shipping();
265
266
        $this->addShipping($shipping->populateByCustomer($customer));
267
268
        return $shipping;
269
    }
270
271
    /**
272
     * @param null $brand
273
     * @return Credit
274
     */
275
    public function credit($brand = null)
276
    {
277
        $credit = new Credit($brand);
278
        $this->setCredit($credit);
279
280
        return $credit;
281
    }
282
283
    /**
284
     * @return Credit
285
     */
286
    public function getCredit()
287
    {
288
        return $this->credit;
289
    }
290
291
    /**
292
     * @param Credit $credit
293
     * @return $this
294
     */
295
    public function setCredit(Credit $credit)
296
    {
297
        $this->credit = $credit;
298
299
        return $this;
300
    }
301
302
    /**
303
     * @param null $brand
304
     * @return Credit
305
     */
306
    public function debit($brand = null)
307
    {
308
        $debit = new Credit($brand);
309
310
        $this->setDebit($debit);
311
312
        return $debit;
313
    }
314
315
    /**
316
     * @return mixed
317
     */
318
    public function getDebit()
319
    {
320
        return $this->debit;
321
    }
322
323
    /**
324
     * @param Credit $debit
325
     * @return $this
326
     */
327
    public function setDebit(Credit $debit)
328
    {
329
        $this->debit = $debit;
330
331
        return $this;
332
    }
333
334
    /**
335
     * @param $our_number
336
     * @return Boleto
337
     */
338
    public function boleto($our_number)
339
    {
340
        $boleto = new Boleto($our_number);
341
        $this->boleto = $boleto;
342
343
        return $boleto;
344
    }
345
346
    /**
347
     * @return mixed
348
     */
349
    public function getBoleto()
350
    {
351
        return $this->boleto;
352
    }
353
354
    /**
355
     * @param Boleto $boleto
356
     * @return $this
357
     */
358
    public function setBoleto(Boleto $boleto)
359
    {
360
        $this->boleto = $boleto;
361
362
        return $this;
363
    }
364
}
365