1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Ticketpark\SaferpayJson\Request\Transaction; |
6
|
|
|
|
7
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
8
|
|
|
use Ticketpark\SaferpayJson\Request\Container\CaptureReference; |
9
|
|
|
use Ticketpark\SaferpayJson\Request\Container\PendingNotification; |
10
|
|
|
use Ticketpark\SaferpayJson\Request\Container\Refund; |
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\RefundResponse; |
16
|
|
|
|
17
|
|
|
final class RefundRequest extends Request |
18
|
|
|
{ |
19
|
|
|
use RequestCommonsTrait; |
20
|
|
|
public const API_PATH = '/Payment/v1/Transaction/Refund'; |
21
|
|
|
public const RESPONSE_CLASS = RefundResponse::class; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var Refund |
25
|
|
|
* @SerializedName("Refund") |
26
|
|
|
*/ |
27
|
|
|
private $refund; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var CaptureReference |
31
|
|
|
* @SerializedName("CaptureReference") |
32
|
|
|
*/ |
33
|
|
|
private $captureReference; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var PendingNotification|null |
37
|
|
|
* @SerializedName("PendingNotification") |
38
|
|
|
*/ |
39
|
|
|
private $pendingNotification; |
40
|
|
|
|
41
|
|
|
public function __construct( |
42
|
|
|
RequestConfig $requestConfig, |
43
|
|
|
Refund $refund, |
44
|
|
|
CaptureReference $captureReference |
45
|
|
|
) { |
46
|
|
|
$this->refund = $refund; |
47
|
|
|
$this->captureReference = $captureReference; |
48
|
|
|
|
49
|
|
|
parent::__construct($requestConfig); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function getRefund(): ?Refund |
53
|
|
|
{ |
54
|
|
|
return $this->refund; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function setRefund(Refund $refund): self |
58
|
|
|
{ |
59
|
|
|
$this->refund = $refund; |
60
|
|
|
|
61
|
|
|
return $this; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function getCaptureReference(): ?CaptureReference |
65
|
|
|
{ |
66
|
|
|
return $this->captureReference; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function setCaptureReference(CaptureReference $captureReference): self |
70
|
|
|
{ |
71
|
|
|
$this->captureReference = $captureReference; |
72
|
|
|
|
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
public function getPendingNotification(): ?PendingNotification |
77
|
|
|
{ |
78
|
|
|
return $this->pendingNotification; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function setPendingNotification(?PendingNotification $pendingNotification): self |
82
|
|
|
{ |
83
|
|
|
$this->pendingNotification = $pendingNotification; |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
public function execute(): RefundResponse |
89
|
|
|
{ |
90
|
|
|
/** @var RefundResponse $response */ |
91
|
|
|
$response = $this->doExecute(); |
92
|
|
|
|
93
|
|
|
return $response; |
94
|
|
|
} |
95
|
|
|
} |
96
|
|
|
|