Passed
Push — master ( 5addfc...e8c424 )
by Manuel
59s queued 11s
created

AuthorizeDirectRequest   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 135
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 34
dl 0
loc 135
rs 10
c 0
b 0
f 0
wmc 14

14 Methods

Rating   Name   Duplication   Size   Complexity  
A getPayment() 0 3 1
A getPaymentMeans() 0 3 1
A __construct() 0 11 1
A setPaymentMeans() 0 5 1
A setTerminalId() 0 5 1
A getTerminalId() 0 3 1
A setPayment() 0 5 1
A execute() 0 6 1
A getRegisterAlias() 0 3 1
A setPayer() 0 5 1
A getAuthentication() 0 3 1
A setAuthentication() 0 5 1
A setRegisterAlias() 0 5 1
A getPayer() 0 3 1
1
<?php declare(strict_types=1);
2
namespace Ticketpark\SaferpayJson\Request\Transaction;
3
4
use JMS\Serializer\Annotation\SerializedName;
5
use JMS\Serializer\Annotation\Type;
6
use Ticketpark\SaferpayJson\Request\Container\Authentication;
7
use Ticketpark\SaferpayJson\Request\Container\Payer;
8
use Ticketpark\SaferpayJson\Request\Container\RegisterAlias;
9
use Ticketpark\SaferpayJson\Request\Request;
10
use Ticketpark\SaferpayJson\Request\Container\Payment;
11
use Ticketpark\SaferpayJson\Request\Container\PaymentMeans;
12
use Ticketpark\SaferpayJson\Request\RequestCommonsTrait;
13
use Ticketpark\SaferpayJson\Request\RequestConfig;
14
use Ticketpark\SaferpayJson\Response\Transaction\AuthorizeDirectResponse;
15
16
final class AuthorizeDirectRequest extends Request
17
{
18
    const API_PATH = '/Payment/v1/Transaction/AuthorizeDirect';
19
    const RESPONSE_CLASS = AuthorizeDirectResponse::class;
20
21
    use RequestCommonsTrait;
22
23
    /**
24
     * @var string
25
     * @SerializedName("TerminalId")
26
     */
27
    private $terminalId;
28
29
    /**
30
     * @var Payment
31
     * @SerializedName("Payment")
32
     */
33
    private $payment;
34
35
    /**
36
     * @var PaymentMeans
37
     * @SerializedName("PaymentMeans")
38
     */
39
    private $paymentMeans;
40
41
    /**
42
     * @var Authentication|null
43
     * @SerializedName("Authentication")
44
     */
45
    private $authentication;
46
47
    /**
48
     * @var RegisterAlias|null
49
     * @SerializedName("RegisterAlias")
50
     */
51
    private $registerAlias;
52
53
    /**
54
     * @var Payer|null
55
     * @SerializedName("Payer")
56
     */
57
    private $payer;
58
59
60
    public function __construct(
61
        RequestConfig $requestConfig,
62
        string $terminalId,
63
        Payment $payment,
64
        PaymentMeans $paymentMeans
65
    ) {
66
        $this->terminalId = $terminalId;
67
        $this->payment = $payment;
68
        $this->paymentMeans = $paymentMeans;
69
70
        parent::__construct($requestConfig);
71
    }
72
73
    public function getTerminalId(): string
74
    {
75
        return $this->terminalId;
76
    }
77
78
    public function setTerminalId(string $terminalId): self
79
    {
80
        $this->terminalId = $terminalId;
81
82
        return $this;
83
    }
84
85
    public function getPayment(): Payment
86
    {
87
        return $this->payment;
88
    }
89
90
    public function setPayment(Payment $payment): self
91
    {
92
        $this->payment = $payment;
93
94
        return $this;
95
    }
96
97
    public function getPaymentMeans(): PaymentMeans
98
    {
99
        return $this->paymentMeans;
100
    }
101
102
    public function setPaymentMeans(PaymentMeans $paymentMeans): self
103
    {
104
        $this->paymentMeans = $paymentMeans;
105
106
        return $this;
107
    }
108
109
    public function getAuthentication(): ?Authentication
110
    {
111
        return $this->authentication;
112
    }
113
114
    public function setAuthentication(?Authentication $authentication): self
115
    {
116
        $this->authentication = $authentication;
117
118
        return $this;
119
    }
120
121
    public function getRegisterAlias(): ?RegisterAlias
122
    {
123
        return $this->registerAlias;
124
    }
125
126
    public function setRegisterAlias(?RegisterAlias $registerAlias): self
127
    {
128
        $this->registerAlias = $registerAlias;
129
130
        return $this;
131
    }
132
133
    public function getPayer(): ?Payer
134
    {
135
        return $this->payer;
136
    }
137
138
    public function setPayer(?Payer $payer): self
139
    {
140
        $this->payer = $payer;
141
142
        return $this;
143
    }
144
145
    public function execute(): AuthorizeDirectResponse
146
    {
147
        /** @var AuthorizeDirectResponse $response */
148
        $response = $this->doExecute();
149
150
        return $response;
151
    }
152
}
153