Issues (4)

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/Message/Response.php (2 issues)

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 Omnipay\Ebanx\Message;
4
5
use Omnipay\Common\Message\AbstractResponse;
6
use Omnipay\Common\Message\RequestInterface;
7
8
/**
9
 * Ebanx Response
10
 *
11
 * This is the response class for all Ebanx requests.
12
 *
13
 * @see \Omnipay\Ebanx\Gateway
14
 */
15
class Response extends AbstractResponse
16
{
17 75
    public function __construct(RequestInterface $request, $data)
18
    {
19 75
        $this->request = $request;
20 75
        $this->data = $data;
21 75
    }
22
23
    /**
24
     * Is the transaction a redirect?
25
     *
26
     * @return bool
27
     */
28 15
    public function isRedirect()
29
    {
30 15
        return isset($this->data['redirect_url']);
31
    }
32
33
    /**
34
     * Get the redirect url from the response.
35
     *
36
     * Returns null if the request was not a redirect.
37
     *
38
     * @return string|null
39
     */
40 9
    public function getRedirectUrl()
41
    {
42 9
        if (isset($this->data['redirect_url'])) {
43 6
            return $this->data['redirect_url'];
44
        }
45
46 3
        return null;
47
    }
48
49
    /**
50
     * Is the transaction successful?
51
     *
52
     * @return bool
53
     */
54 30
    public function isSuccessful()
55
    {
56
57 30
        return $this->data['status'] == "SUCCESS";
58
    }
59
60
    /**
61
     * Get the transaction reference.
62
     *
63
     * @return string|null
64
     */
65 12 View Code Duplication
    public function getTransactionReference()
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...
66
    {
67 12
        if (isset($this->data['payment']['hash'])) {
68 9
            return $this->data['payment']['hash'];
69
        }
70
71 3
        return null;
72
    }
73
    /**
74
     * Get the transaction id.
75
     *
76
     * @return string|null
77
     */
78 12 View Code Duplication
    public function getTransactionId()
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...
79
    {
80 12
        if (isset($this->data['payment']['merchant_payment_code'])) {
81 9
            return $this->data['payment']['merchant_payment_code'];
82
        }
83
84 3
        return null;
85
    }
86
87
    /**
88
     * Get the error message from the response.
89
     *
90
     * Returns null if the request was successful.
91
     *
92
     * @return string|null
93
     */
94 15
    public function getMessage()
95
    {
96 15
        if (!$this->isSuccessful()) {
97 6
            return '[' . $this->data['status_code'] . '] ' . $this->data['status_message'];
98 9
        } elseif ($boletoData = $this->getBoleto()) {
99 3
            return $boletoData['boleto_barcode'];
100 6
        } elseif ($transactionStatus = $this->getTransactionStatus()) {
101 3
            return '[' . $transactionStatus['code'] . '] ' .$transactionStatus['description'];
102
        }
103
104 3
        return null;
105
    }
106
107
    /**
108
     * Get a cardReference, from the createCard requests.
109
     *
110
     * @return string|null
111
     */
112 6
    public function getCardReference()
113
    {
114 6
        if (isset($this->data['token'])) {
115 3
            return $this->data['token'];
116
        }
117
118 3
        return null;
119
    }
120
121
    /**
122
     * Get all paymentData, from the requests.
123
     *
124
     * @return string|null
125
     */
126 27
    public function getPaymentData($key = null)
127
    {
128 27
        if (isset($this->data['payment'])) {
129 24
            if ($key) {
130 24
                if (isset($this->data['payment'][$key])) {
131 21
                    return $this->data['payment'][$key];
132
                } else {
133 6
                    return null;
134
                }
135
            }
136
137 3
            return $this->data['payment'];
138
        }
139
140 3
        return null;
141
    }
142
143
    /**
144
     * Get the boleto_url, boleto_barcode and boleto_expiration_date in the
145
     * transaction object.
146
     *
147
     * @return array|null the boleto_url, boleto_barcode and boleto_expiration_date
148
     */
149 12
    public function getBoleto()
150
    {
151 12
        $data = null;
152
153 12
        if (isset($this->data['payment']['boleto_url'])) {
154
            $data = array(
155 6
                'boleto_url'             => $this->data['payment']['boleto_url'],
156 6
                'boleto_barcode'         => $this->data['payment']['boleto_barcode'],
157 6
                'boleto_expiration_date' => $this->data['payment']['due_date'],
158
            );
159
        }
160
161 12
        return $data;
162
    }
163
164
    /**
165
     * Get the payment status out of the response array
166
     *
167
     * @return string
168
     */
169 9
    public function getPaymentStatus()
170
    {
171
172 9
        return $this->getPaymentData('status');
173
    }
174
175
    /**
176
     * Get the transaction status out of the response array
177
     *
178
     * @return array|null
179
     */
180 9
    public function getTransactionStatus()
181
    {
182
183 9
        return $this->getPaymentData('transaction_status');
184
    }
185
186
    /**
187
     * Get the refunds propeties out of the response array
188
     *
189
     * @return array|null
190
     */
191 3
    public function getRefunds()
192
    {
193
194 3
        return $this->getPaymentData('refunds');
195
    }
196
197
198
    /**
199
     * Get the risk analysis in the transaction object.
200
     *
201
     * @return array|null the boleto_url, boleto_barcode and boleto_expiration_date
202
     */
203 6
    public function getRiskAnalysis()
204
    {
205 6
        $data = null;
206
207 6
        if (isset($this->data['payment']['risk_analysis'])) {
208 3
            $data = $this->data['payment']['risk_analysis'];
209
        }
210
211 6
        return $data;
212
    }
213
214
}
215