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