Issues (33)

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/Api/Invoice.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
declare(strict_types=1);
4
5
namespace Billogram\Api;
6
7
use Billogram\Model\Invoice\Invoice as Model;
8
use Billogram\Model\Invoice\InvoiceCollection;
9
use Psr\Http\Message\ResponseInterface;
10
11
/**
12
 * @author Ibrahim Hizeoui <[email protected]>
13
 */
14
class Invoice extends HttpApi
15
{
16
    /**
17
     * @param array $param
18
     *
19
     * @return InvoiceCollection|ResponseInterface
20
     *
21
     * @see https://billogram.com/api/documentation#billogram_call_list
22
     */
23 1 View Code Duplication
    public function search(array $param = [])
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...
24
    {
25 1
        $param = array_merge(['page' => 1, 'page_size' => 100], $param);
26 1
        $response = $this->httpGet('/billogram', $param);
27
28 1
        return $this->handleResponse($response, InvoiceCollection::class);
29
    }
30
31
    /**
32
     * @param string $invoiceId
33
     *
34
     * @return Model|ResponseInterface
35
     *
36
     * @see https://billogram.com/api/documentation#billogram_call_fetch
37
     */
38 2
    public function fetch(string $invoiceId)
39
    {
40 2
        $response = $this->httpGet('/billogram/'.$invoiceId);
41
42 2
        return $this->handleResponse($response, Model::class);
43
    }
44
45
    /**
46
     * @param array $invoice
47
     *
48
     * @return Model|ResponseInterface
49
     *
50
     * @see https://billogram.com/api/documentation#billogram_call_create
51
     *
52
     * @throws \Billogram\Exception
53
     */
54 1
    public function create(array $invoice)
55
    {
56 1
        $response = $this->httpPost('/billogram', $invoice);
57
58 1
        return $this->handleResponse($response, Model::class);
59
    }
60
61
    /**
62
     * @param string $invoiceId
63
     * @param array  $invoice
64
     *
65
     * @return Model|ResponseInterface
66
     *
67
     * @see https://billogram.com/api/documentation#billogram_call_update
68
     *
69
     * @throws \Billogram\Exception
70
     */
71 1
    public function update(string $invoiceId, array $invoice)
72
    {
73 1
        $response = $this->httpPut('/billogram/'.$invoiceId, $invoice);
74
75 1
        return $this->handleResponse($response, Model::class);
76
    }
77
78
    /**
79
     * @param string $invoiceId
80
     * @param string $method
81
     *
82
     * @return Model|ResponseInterface
83
     *
84
     * @see https://billogram.com/api/documentation#billogram_call_send
85
     *
86
     * @throws \Billogram\Exception
87
     */
88 View Code Duplication
    public function send(string $invoiceId, $method = null)
89
    {
90
        $params = [];
91
        if (null !== $method) {
92
            $params = ['method' => $method];
93
        }
94
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/send', $params);
95
96
        return $this->handleResponse($response, Model::class);
97
    }
98
99
    /**
100
     * @param string $invoiceId
101
     * @param string $method
102
     *
103
     * @return Model|ResponseInterface
104
     *
105
     * @see https://billogram.com/api/documentation#billogram_call_resend
106
     *
107
     * @throws \Billogram\Exception
108
     */
109 View Code Duplication
    public function resend(string $invoiceId, $method = null)
110
    {
111
        $params = [];
112
        if (null !== $method) {
113
            $params = ['method' => $method];
114
        }
115
116
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/resend', $params);
117
118
        return $this->handleResponse($response, Model::class);
119
    }
120
121
    /**
122
     * @param string $invoiceId
123
     *
124
     * @return Model|ResponseInterface
125
     *
126
     * @see https://billogram.com/api/documentation#billogram_call_collect
127
     *
128
     * @throws \Billogram\Exception
129
     */
130
    public function collect(string $invoiceId)
131
    {
132
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/collect', []);
133
134
        return $this->handleResponse($response, Model::class);
135
    }
136
137
    /**
138
     * @param string $invoiceId
139
     * @param float  $amount
140
     *
141
     * @return Model|ResponseInterface
142
     *
143
     * @see https://billogram.com/api/documentation#billogram_call_payment
144
     *
145
     * @throws \Billogram\Exception
146
     */
147 View Code Duplication
    public function manualRegister(string $invoiceId, float $amount)
148
    {
149
        $params = ['amount' => $amount];
150
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/payment', $params);
151
152
        return $this->handleResponse($response, Model::class);
153
    }
154
155
    /**
156
     * @param string $invoiceId
157
     * @param string $mode
158
     * @param float  $amount
159
     * @param string $method
160
     *
161
     * @return Model|ResponseInterface
162
     *
163
     * @see https://billogram.com/api/documentation#billogram_call_credit
164
     *
165
     * @throws \Billogram\Exception
166
     */
167
    public function credit(string $invoiceId, string $mode, float $amount, string $method)
168
    {
169
        $params = [
170
            'mode' => $mode,
171
            'amount' => $amount,
172
            'method' => $method,
173
        ];
174
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/credit', $params);
175
176
        return $this->handleResponse($response, Model::class);
177
    }
178
179
    /**
180
     * @param string $invoiceId
181
     *
182
     * @return Model|ResponseInterface
183
     *
184
     * @see https://billogram.com/api/documentation#billogram_call_writeoff
185
     *
186
     * @throws \Billogram\Exception
187
     */
188
    public function writeOff(string $invoiceId)
189
    {
190
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/writeoff');
191
192
        return $this->handleResponse($response, Model::class);
193
    }
194
195
    /**
196
     * @param string $invoiceId
197
     *
198
     * @return Model|ResponseInterface
199
     *
200
     * @see https://billogram.com/api/documentation#billogram_call_writedown
201
     *
202
     * @throws \Billogram\Exception
203
     */
204
    public function writeDown(string $invoiceId)
205
    {
206
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/writedown');
207
208
        return $this->handleResponse($response, Model::class);
209
    }
210
211
    /**
212
     * @param string $invoiceId
213
     *
214
     * @return Model|ResponseInterface
215
     *
216
     * @see https://billogram.com/api/documentation#billogram_call_writedown
217
     *
218
     * @throws \Billogram\Exception
219
     */
220
    public function writeDownRevert(string $invoiceId)
221
    {
222
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/revert-writedown');
223
224
        return $this->handleResponse($response, Model::class);
225
    }
226
227
    /**
228
     * @param string $invoiceId
229
     * @param string $message
230
     *
231
     * @return Model|ResponseInterface
232
     *
233
     * @see https://billogram.com/api/documentation#billogram_call_writedown
234
     *
235
     * @throws \Billogram\Exception
236
     */
237 View Code Duplication
    public function addMessage(string $invoiceId, string $message)
238
    {
239
        $params = ['message' => $message];
240
        $response = $this->httpPost('/billogram/'.$invoiceId.'/command/message', $params);
241
242
        return $this->handleResponse($response, Model::class);
243
    }
244
}
245