Issues (93)

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/Model/PaymentIntent/PaymentIntent.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
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Model\PaymentIntent;
11
12
use Money\Currency;
13
use Money\Money;
14
use Shapin\Stripe\Model\Charge\ChargeCollection;
15
use Shapin\Stripe\Model\ContainsMetadata;
16
use Shapin\Stripe\Model\CreatableFromArray;
17
use Shapin\Stripe\Model\Intent;
18
use Shapin\Stripe\Model\IntentNextAction;
19
use Shapin\Stripe\Model\LivemodeTrait;
20
use Shapin\Stripe\Model\MetadataCollection;
21
use Shapin\Stripe\Model\MetadataTrait;
22
23
final class PaymentIntent extends Intent implements CreatableFromArray, ContainsMetadata
24
{
25
    use LivemodeTrait;
26
    use MetadataTrait;
27
28
    const CAPTURE_METHOD_AUTOMATIC = 'automatic';
29
    const CAPTURE_METHOD_MANUAL = 'manual';
30
31
    const CONFIRMATION_METHOD_AUTOMATIC = 'automatic';
32
    const CONFIRMATION_METHOD_MANUAL = 'manual';
33
34
    /**
35
     * @var ?string
36
     */
37
    private $id;
38
39
    /**
40
     * @var Money
41
     */
42
    private $amount;
43
44
    /**
45
     * @var Money
46
     */
47
    private $amountCapturable;
48
49
    /**
50
     * @var Money
51
     */
52
    private $amountReceived;
53
54
    /**
55
     * @var ?string
56
     */
57
    private $applicationId;
58
59
    /**
60
     * @var ?Money
61
     */
62
    private $applicationFeeAmount;
63
64
    /**
65
     * @var ?\DateTimeImmutable
66
     */
67
    private $canceledAt;
68
69
    /**
70
     * @var ?string
71
     */
72
    private $cancellationReason;
73
74
    /**
75
     * @var string
76
     */
77
    private $captureMethod;
78
79
    /**
80
     * @var ChargeCollection
81
     */
82
    private $charges;
83
84
    /**
85
     * @var string
86
     */
87
    private $clientSecret;
88
89
    /**
90
     * @var string
91
     */
92
    private $confirmationMethod;
93
94
    /**
95
     * @var \DateTimeImmutable
96
     */
97
    private $createdAt;
98
99
    /**
100
     * @var Currency
101
     */
102
    private $currency;
103
104
    /**
105
     * @var string
106
     */
107
    private $customerId;
108
109
    /**
110
     * @var string
111
     */
112
    private $description;
113
114
    /**
115
     * @var string
116
     */
117
    private $invoiceId;
118
119
    /**
120
     * @var ?LastPaymentError
121
     */
122
    private $lastPaymentError;
123
124
    /**
125
     * @var ?string
126
     */
127
    private $onBehalfOfId;
128
129
    /**
130
     * @var ?string
131
     */
132
    private $paymentMethodId;
133
134
    /**
135
     * @var array
136
     */
137
    private $paymentMethodTypes;
138
139
    /**
140
     * @var ?string
141
     */
142
    private $receiptEmail;
143
144
    /**
145
     * @var ?string
146
     */
147
    private $reviewId;
148
149
    /**
150
     * @var ?Shipping
151
     */
152
    private $shipping;
153
154
    /**
155
     * @var ?string
156
     */
157
    private $statementDescriptor;
158
159
    /**
160
     * @var ?TransferData
161
     */
162
    private $transferData;
163
164
    /**
165
     * @var ?string
166
     */
167
    private $transferGroup;
168
169 3
    public static function createFromArray(array $data): self
170
    {
171 3
        $currency = new Currency(strtoupper($data['currency']));
172
173 3
        $model = new self();
174 3
        $model->id = $data['id'];
175 3
        $model->amount = new Money($data['amount'], $currency);
176 3
        $model->amountCapturable = new Money($data['amount_capturable'], $currency);
177 3
        $model->amountReceived = new Money($data['amount_received'], $currency);
178 3
        $model->applicationId = $data['application'];
179 3
        $model->canceledAt = isset($data['canceled_at']) ? new \DateTimeImmutable('@'.$data['canceled_at']) : null;
180 3
        $model->cancellationReason = $data['cancellation_reason'];
181 3
        $model->captureMethod = $data['capture_method'];
182 3
        $model->charges = ChargeCollection::createFromArray($data['charges']);
0 ignored issues
show
Documentation Bug introduced by
It seems like \Shapin\Stripe\Model\Cha...Array($data['charges']) of type object<self> is incompatible with the declared type object<Shapin\Stripe\Mod...harge\ChargeCollection> of property $charges.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
183 3
        $model->clientSecret = $data['client_secret'];
184 3
        $model->confirmationMethod = $data['confirmation_method'];
185 3
        $model->createdAt = new \DateTimeImmutable('@'.$data['created']);
186 3
        $model->currency = $currency;
187 3
        $model->customerId = $data['customer'];
188 3
        $model->description = $data['description'];
189 3
        $model->invoiceId = $data['invoice'];
190 3
        $model->lastPaymentError = isset($data['last_payment_error']) ? LastPaymentError::createFromArray($data['last_payment_error']) : null;
191 3
        $model->live = $data['livemode'];
192 3
        $model->metadata = MetadataCollection::createFromArray($data['metadata']);
0 ignored issues
show
Documentation Bug introduced by
It seems like \Shapin\Stripe\Model\Met...rray($data['metadata']) of type object<self> is incompatible with the declared type object<Shapin\Stripe\Model\MetadataCollection> of property $metadata.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
193 3
        $model->nextAction = isset($data['next_action']) ? IntentNextAction::createFromArray($data['next_action']) : null;
194 3
        $model->onBehalfOfId = $data['on_behalf_of'];
195 3
        $model->paymentMethodId = $data['payment_method'];
196 3
        $model->paymentMethodTypes = $data['payment_method_types'];
197 3
        $model->receiptEmail = $data['receipt_email'];
198 3
        $model->reviewId = $data['review'];
199 3
        $model->shipping = isset($data['shipping']) ? Shipping::createFromArray($data['shipping']) : null;
200 3
        $model->statementDescriptor = $data['statement_descriptor'];
201 3
        $model->status = $data['status'];
202 3
        $model->transferData = isset($data['transfer_data']) ? TransferData::createFromArray($data['transfer_data']) : null;
203 3
        $model->transferGroup = $data['transfer_group'];
204
205 3
        return $model;
206
    }
207
208 1
    public function getId(): string
209
    {
210 1
        return $this->id;
211
    }
212
213 1
    public function getAmount(): Money
214
    {
215 1
        return $this->amount;
216
    }
217
218 1
    public function getAmountCapturable(): Money
219
    {
220 1
        return $this->amountCapturable;
221
    }
222
223 1
    public function getAmountReceived(): Money
224
    {
225 1
        return $this->amountReceived;
226
    }
227
228 1
    public function getApplicationId(): ?string
229
    {
230 1
        return $this->applicationId;
231
    }
232
233 1
    public function getApplicationFeeAmount(): ?Money
234
    {
235 1
        return $this->applicationFeeAmount;
236
    }
237
238 1
    public function getCanceledAt(): \DateTimeInterface
239
    {
240 1
        return $this->canceledAt;
241
    }
242
243 1
    public function getCancellationReason(): ?string
244
    {
245 1
        return $this->cancellationReason;
246
    }
247
248 1
    public function getCaptureMethod(): string
249
    {
250 1
        return $this->captureMethod;
251
    }
252
253 1
    public function getCharges(): ChargeCollection
254
    {
255 1
        return $this->charges;
256
    }
257
258 1
    public function getClientSecret(): string
259
    {
260 1
        return $this->clientSecret;
261
    }
262
263 1
    public function getConfirmationMethod(): string
264
    {
265 1
        return $this->confirmationMethod;
266
    }
267
268 1
    public function getCreatedAt(): \DateTimeInterface
269
    {
270 1
        return $this->createdAt;
271
    }
272
273 1
    public function getCurrency(): Currency
274
    {
275 1
        return $this->currency;
276
    }
277
278 1
    public function getCustomerId(): ?string
279
    {
280 1
        return $this->customerId;
281
    }
282
283 1
    public function getDescription(): ?string
284
    {
285 1
        return $this->description;
286
    }
287
288 1
    public function getInvoiceId(): ?string
289
    {
290 1
        return $this->invoiceId;
291
    }
292
293 1
    public function getLastPaymentError(): ?LastPaymentError
294
    {
295 1
        return $this->lastPaymentError;
296
    }
297
298 1
    public function getOnBehalfOfId(): ?string
299
    {
300 1
        return $this->onBehalfOfId;
301
    }
302
303 1
    public function getPaymentMethodId(): ?string
304
    {
305 1
        return $this->paymentMethodId;
306
    }
307
308 1
    public function getPaymentMethodTypes(): array
309
    {
310 1
        return $this->paymentMethodTypes;
311
    }
312
313 1
    public function getReceiptEmail(): ?string
314
    {
315 1
        return $this->receiptEmail;
316
    }
317
318 1
    public function getReviewId(): ?string
319
    {
320 1
        return $this->reviewId;
321
    }
322
323 1
    public function getShipping(): ?Shipping
324
    {
325 1
        return $this->shipping;
326
    }
327
328 1
    public function getStatementDescriptor(): ?string
329
    {
330 1
        return $this->statementDescriptor;
331
    }
332
333 1
    public function getTransferData(): ?TransferData
334
    {
335 1
        return $this->transferData;
336
    }
337
338 1
    public function getTransferGroup(): ?string
339
    {
340 1
        return $this->transferGroup;
341
    }
342
}
343