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

AuthorizeReferencedRequest   A

Complexity

Total Complexity 12

Size/Duplication

Total Lines 116
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 30
dl 0
loc 116
rs 10
c 0
b 0
f 0
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getTransactionReference() 0 3 1
A setAuthentication() 0 5 1
A getAuthentication() 0 3 1
A __construct() 0 11 1
A setSuppressDcc() 0 5 1
A execute() 0 6 1
A isSuppressDcc() 0 3 1
A getTerminalId() 0 3 1
A setPayment() 0 5 1
A getPayment() 0 3 1
A setTransactionReference() 0 5 1
A setTerminalId() 0 5 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\Authentication;
7
use Ticketpark\SaferpayJson\Request\Container\Payment;
8
use Ticketpark\SaferpayJson\Request\Container\TransactionReference;
9
use Ticketpark\SaferpayJson\Request\Request;
10
use Ticketpark\SaferpayJson\Request\RequestCommonsTrait;
11
use Ticketpark\SaferpayJson\Request\RequestConfig;
12
use Ticketpark\SaferpayJson\Response\Transaction\AuthorizeReferencedResponse;
13
14
final class AuthorizeReferencedRequest extends Request
15
{
16
    const API_PATH = '/Payment/v1/Transaction/AuthorizeReferenced';
17
    const RESPONSE_CLASS = AuthorizeReferencedResponse::class;
18
19
    use RequestCommonsTrait;
20
21
    /**
22
     * @var string
23
     * @SerializedName("TerminalId")
24
     */
25
    private $terminalId;
26
27
    /**
28
     * @var Payment
29
     * @SerializedName("Payment")
30
     */
31
    private $payment;
32
33
    /**
34
     * @var TransactionReference
35
     * @SerializedName("TransactionReference")
36
     */
37
    private $transactionReference;
38
39
    /**
40
     * @var Authentication|null
41
     * @SerializedName("Authentication")
42
     */
43
    private $authentication;
44
45
    /**
46
     * @var bool|null
47
     * @SerializedName("SuppressDcc")
48
     */
49
    private $suppressDcc;
50
51
    public function __construct(
52
        RequestConfig $requestConfig,
53
        string $terminalId,
54
        Payment $payment,
55
        TransactionReference $transactionReference
56
    ) {
57
        $this->terminalId = $terminalId;
58
        $this->payment = $payment;
59
        $this->transactionReference = $transactionReference;
60
61
        parent::__construct($requestConfig);
62
    }
63
64
    public function getTerminalId(): string
65
    {
66
        return $this->terminalId;
67
    }
68
69
    public function setTerminalId(string $terminalId): self
70
    {
71
        $this->terminalId = $terminalId;
72
73
        return $this;
74
    }
75
76
    public function getPayment(): Payment
77
    {
78
        return $this->payment;
79
    }
80
81
    public function setPayment(Payment $payment): self
82
    {
83
        $this->payment = $payment;
84
85
        return $this;
86
    }
87
88
    public function getTransactionReference(): TransactionReference
89
    {
90
        return $this->transactionReference;
91
    }
92
93
    public function setTransactionReference(TransactionReference $transactionReference): self
94
    {
95
        $this->transactionReference = $transactionReference;
96
97
        return $this;
98
    }
99
100
    public function getAuthentication(): ?Authentication
101
    {
102
        return $this->authentication;
103
    }
104
105
    public function setAuthentication(?Authentication $authentication): self
106
    {
107
        $this->authentication = $authentication;
108
109
        return $this;
110
    }
111
112
    public function isSuppressDcc(): ?bool
113
    {
114
        return $this->suppressDcc;
115
    }
116
117
    public function setSuppressDcc(?bool $suppressDcc): self
118
    {
119
        $this->suppressDcc = $suppressDcc;
120
121
        return $this;
122
    }
123
124
    public function execute(): AuthorizeReferencedResponse
125
    {
126
        /** @var AuthorizeReferencedResponse $response */
127
        $response = $this->doExecute();
128
129
        return $response;
130
    }
131
}
132