Passed
Push — master ( 334bd1...de40e6 )
by
unknown
05:09
created

MollieApiClient::isRefunded()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 3
nc 2
nop 1
1
<?php
2
3
/*
4
 * This file has been created by developers from BitBag.
5
 * Feel free to contact us once you face any issues or want to start
6
 * another great project.
7
 * You can find more information about us on https://bitbag.shop and write us
8
 * an email on [email protected].
9
 */
10
11
declare(strict_types=1);
12
13
namespace BitBag\SyliusMolliePlugin\Client;
14
15
use Mollie\Api\Resources\Payment;
16
17
class MollieApiClient extends \Mollie\Api\MollieApiClient
18
{
19
    /**
20
     * @var array
21
     */
22
    protected $config = [];
23
24
    /**
25
     * @var bool
26
     */
27
    protected $isRecurringSubscription = false;
28
29
    /**
30
     * @param array $config
31
     */
32
    public function setConfig(array $config): void
33
    {
34
        $this->config = $config;
35
    }
36
37
    /**
38
     * @return array
39
     */
40
    public function getConfig(): array
41
    {
42
        return $this->config;
43
    }
44
45
    /**
46
     * @param bool $isRecurringSubscription
47
     */
48
    public function setIsRecurringSubscription(bool $isRecurringSubscription): void
49
    {
50
        $this->isRecurringSubscription = $isRecurringSubscription;
51
    }
52
53
    /**
54
     * @return bool
55
     */
56
    public function isRecurringSubscription(): bool
57
    {
58
        return $this->isRecurringSubscription;
59
    }
60
61
    /**
62
     * @param Payment $payment
63
     *
64
     * @return bool
65
     */
66
    public function isRefunded(Payment $payment): bool
67
    {
68
        if (null === $payment->amount || null === $payment->amountRefunded) {
69
            return false;
70
        }
71
72
        return $payment->amount->value === $payment->amountRefunded->value;
73
    }
74
}
75