Completed
Push — master ( abb491...352f9f )
by Olivier
01:38
created

Intent::isSucceeded()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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;
11
12
abstract class Intent
13
{
14
    const STATUS_REQUIRES_PAYMENT_METHOD = 'requires_payment_method';
15
    const STATUS_REQUIRES_CONFIRMATION = 'requires_confirmation';
16
    const STATUS_REQUIRES_ACTION = 'requires_action';
17
    const STATUS_PROCESSING = 'processing';
18
    const STATUS_REQUIRES_CAPTURE = 'requires_capture';
19
    const STATUS_CANCELED = 'canceled';
20
    const STATUS_SUCCEEDED = 'succeeded';
21
22
    /**
23
     * @var ?IntentNextAction
24
     */
25
    protected $nextAction;
26
27
    /**
28
     * @var string
29
     */
30
    protected $status;
31
32
    public function requiresAction(): bool
33
    {
34
        return self::STATUS_REQUIRES_ACTION === $this->status;
35
    }
36
37
    public function requiresPaymentMethod(): bool
38
    {
39
        return self::STATUS_REQUIRES_PAYMENT_METHOD === $this->status;
40
    }
41
42
    public function isSucceeded()
43
    {
44
        return self::STATUS_SUCCEEDED === $this->status;
45
    }
46
47 2
    public function getNextAction(): ?IntentNextAction
48
    {
49 2
        return $this->nextAction;
50
    }
51
52 2
    public function getStatus(): string
53
    {
54 2
        return $this->status;
55
    }
56
}
57