Passed
Pull Request — master (#28)
by Manuel
02:51
created

CaptureRequest   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 130
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 32
dl 0
loc 130
rs 10
c 0
b 0
f 0
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getMastercardIssuerInstallments() 0 3 1
A __construct() 0 7 1
A setTransactionReference() 0 5 1
A getMarketplace() 0 3 1
A getBillpay() 0 3 1
A execute() 0 6 1
A getAmount() 0 3 1
A setAmount() 0 5 1
A setBillpay() 0 5 1
A setPendingNotification() 0 5 1
A getTransactionReference() 0 3 1
A setMarketplace() 0 5 1
A setMastercardIssuerInstallments() 0 5 1
A getPendingNotification() 0 3 1
1
<?php declare(strict_types=1);
2
3
namespace Ticketpark\SaferpayJson\Request\Transaction;
4
5
use JMS\Serializer\Annotation\SerializedName;
6
use Ticketpark\SaferpayJson\Request\Container\Amount;
7
use Ticketpark\SaferpayJson\Request\Container\Billpay;
8
use Ticketpark\SaferpayJson\Request\Container\Marketplace;
9
use Ticketpark\SaferpayJson\Request\Container\MastercardIssuerInstallments;
10
use Ticketpark\SaferpayJson\Request\Container\PendingNotification;
11
use Ticketpark\SaferpayJson\Request\Container\TransactionReference;
12
use Ticketpark\SaferpayJson\Request\Request;
13
use Ticketpark\SaferpayJson\Request\RequestCommonsTrait;
14
use Ticketpark\SaferpayJson\Request\RequestConfig;
15
use Ticketpark\SaferpayJson\Response\Transaction\CaptureResponse;
16
17
final class CaptureRequest extends Request
18
{
19
    const API_PATH = '/Payment/v1/Transaction/Capture';
20
    const RESPONSE_CLASS = CaptureResponse::class;
21
22
    use RequestCommonsTrait;
23
24
    /**
25
     * @var TransactionReference
26
     * @SerializedName("TransactionReference")
27
     */
28
    private $transactionReference;
29
30
    /**
31
     * @var Amount|null
32
     * @SerializedName("Amount")
33
     */
34
    private $amount;
35
36
    /**
37
     * @var Billpay|null
38
     * @SerializedName("Billpay")
39
     */
40
    private $billpay;
41
42
    /**
43
     * @var PendingNotification|null
44
     * @SerializedName("PendingNotification")
45
     */
46
    private $pendingNotification;
47
48
    /**
49
     * @var Marketplace|null
50
     * @SerializedName("Marketplace")
51
     */
52
    private $marketplace;
53
54
    /**
55
     * @var MastercardIssuerInstallments|null
56
     * @SerializedName("MastercardIssuerInstallments")
57
     */
58
    private $mastercardIssuerInstallments;
59
60
    public function __construct(
61
        RequestConfig $requestConfig,
62
        TransactionReference $transactionReference
63
    ) {
64
        $this->transactionReference = $transactionReference;
65
66
        parent::__construct($requestConfig);
67
    }
68
69
    public function getTransactionReference(): TransactionReference
70
    {
71
        return $this->transactionReference;
72
    }
73
74
    public function setTransactionReference(TransactionReference $transactionReference): self
75
    {
76
        $this->transactionReference = $transactionReference;
77
78
        return $this;
79
    }
80
81
    public function getAmount(): ?Amount
82
    {
83
        return $this->amount;
84
    }
85
86
    public function setAmount(?Amount $amount): self
87
    {
88
        $this->amount = $amount;
89
90
        return $this;
91
    }
92
93
    public function getBillpay(): ?Billpay
94
    {
95
        return $this->billpay;
96
    }
97
98
    public function setBillpay(?Billpay $billpay): self
99
    {
100
        $this->billpay = $billpay;
101
102
        return $this;
103
    }
104
105
    public function getPendingNotification(): ?PendingNotification
106
    {
107
        return $this->pendingNotification;
108
    }
109
110
    public function setPendingNotification(?PendingNotification $pendingNotification): self
111
    {
112
        $this->pendingNotification = $pendingNotification;
113
114
        return $this;
115
    }
116
117
    public function getMarketplace(): ?Marketplace
118
    {
119
        return $this->marketplace;
120
    }
121
122
    public function setMarketplace(?Marketplace $marketplace): self
123
    {
124
        $this->marketplace = $marketplace;
125
126
        return $this;
127
    }
128
129
    public function getMastercardIssuerInstallments(): ?MastercardIssuerInstallments
130
    {
131
        return $this->mastercardIssuerInstallments;
132
    }
133
134
    public function setMastercardIssuerInstallments(?MastercardIssuerInstallments $mastercardIssuerInstallments): self
135
    {
136
        $this->mastercardIssuerInstallments = $mastercardIssuerInstallments;
137
138
        return $this;
139
    }
140
141
    public function execute(): CaptureResponse
142
    {
143
        /** @var CaptureResponse $response */
144
        $response = $this->doExecute();
145
146
        return $response;
147
    }
148
}
149