1: <?php
2: /*
3: * This class was auto-generated from the API references found at
4: * https://apireference.connect.worldline-solutions.com/
5: */
6: namespace Worldline\Connect\Sdk\V1\Domain;
7:
8: use UnexpectedValueException;
9:
10: /**
11: * @package Worldline\Connect\Sdk\V1\Domain
12: */
13: class CaptureOutput extends OrderOutput
14: {
15: /**
16: * @var int|null
17: */
18: public ?int $amountPaid = null;
19:
20: /**
21: * @var int|null
22: */
23: public ?int $amountReversed = null;
24:
25: /**
26: * @var BankTransferPaymentMethodSpecificOutput|null
27: */
28: public ?BankTransferPaymentMethodSpecificOutput $bankTransferPaymentMethodSpecificOutput = null;
29:
30: /**
31: * @var CardPaymentMethodSpecificOutput|null
32: */
33: public ?CardPaymentMethodSpecificOutput $cardPaymentMethodSpecificOutput = null;
34:
35: /**
36: * @var CashPaymentMethodSpecificOutput|null
37: */
38: public ?CashPaymentMethodSpecificOutput $cashPaymentMethodSpecificOutput = null;
39:
40: /**
41: * @var string|null
42: */
43: public ?string $paymentMethod = null;
44:
45: /**
46: * @var RedirectPaymentMethodSpecificOutput|null
47: */
48: public ?RedirectPaymentMethodSpecificOutput $redirectPaymentMethodSpecificOutput = null;
49:
50: /**
51: * @var string|null
52: */
53: public ?string $reversalReason = null;
54:
55: /**
56: * @var SepaDirectDebitPaymentMethodSpecificOutput|null
57: */
58: public ?SepaDirectDebitPaymentMethodSpecificOutput $sepaDirectDebitPaymentMethodSpecificOutput = null;
59:
60: /**
61: * @return object
62: */
63: public function toObject(): object
64: {
65: $object = parent::toObject();
66: if (!is_null($this->amountPaid)) {
67: $object->amountPaid = $this->amountPaid;
68: }
69: if (!is_null($this->amountReversed)) {
70: $object->amountReversed = $this->amountReversed;
71: }
72: if (!is_null($this->bankTransferPaymentMethodSpecificOutput)) {
73: $object->bankTransferPaymentMethodSpecificOutput = $this->bankTransferPaymentMethodSpecificOutput->toObject();
74: }
75: if (!is_null($this->cardPaymentMethodSpecificOutput)) {
76: $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject();
77: }
78: if (!is_null($this->cashPaymentMethodSpecificOutput)) {
79: $object->cashPaymentMethodSpecificOutput = $this->cashPaymentMethodSpecificOutput->toObject();
80: }
81: if (!is_null($this->paymentMethod)) {
82: $object->paymentMethod = $this->paymentMethod;
83: }
84: if (!is_null($this->redirectPaymentMethodSpecificOutput)) {
85: $object->redirectPaymentMethodSpecificOutput = $this->redirectPaymentMethodSpecificOutput->toObject();
86: }
87: if (!is_null($this->reversalReason)) {
88: $object->reversalReason = $this->reversalReason;
89: }
90: if (!is_null($this->sepaDirectDebitPaymentMethodSpecificOutput)) {
91: $object->sepaDirectDebitPaymentMethodSpecificOutput = $this->sepaDirectDebitPaymentMethodSpecificOutput->toObject();
92: }
93: return $object;
94: }
95:
96: /**
97: * @param object $object
98: *
99: * @return $this
100: * @throws UnexpectedValueException
101: */
102: public function fromObject(object $object): CaptureOutput
103: {
104: parent::fromObject($object);
105: if (property_exists($object, 'amountPaid')) {
106: $this->amountPaid = $object->amountPaid;
107: }
108: if (property_exists($object, 'amountReversed')) {
109: $this->amountReversed = $object->amountReversed;
110: }
111: if (property_exists($object, 'bankTransferPaymentMethodSpecificOutput')) {
112: if (!is_object($object->bankTransferPaymentMethodSpecificOutput)) {
113: throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificOutput, true) . '\' is not an object');
114: }
115: $value = new BankTransferPaymentMethodSpecificOutput();
116: $this->bankTransferPaymentMethodSpecificOutput = $value->fromObject($object->bankTransferPaymentMethodSpecificOutput);
117: }
118: if (property_exists($object, 'cardPaymentMethodSpecificOutput')) {
119: if (!is_object($object->cardPaymentMethodSpecificOutput)) {
120: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object');
121: }
122: $value = new CardPaymentMethodSpecificOutput();
123: $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput);
124: }
125: if (property_exists($object, 'cashPaymentMethodSpecificOutput')) {
126: if (!is_object($object->cashPaymentMethodSpecificOutput)) {
127: throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificOutput, true) . '\' is not an object');
128: }
129: $value = new CashPaymentMethodSpecificOutput();
130: $this->cashPaymentMethodSpecificOutput = $value->fromObject($object->cashPaymentMethodSpecificOutput);
131: }
132: if (property_exists($object, 'paymentMethod')) {
133: $this->paymentMethod = $object->paymentMethod;
134: }
135: if (property_exists($object, 'redirectPaymentMethodSpecificOutput')) {
136: if (!is_object($object->redirectPaymentMethodSpecificOutput)) {
137: throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificOutput, true) . '\' is not an object');
138: }
139: $value = new RedirectPaymentMethodSpecificOutput();
140: $this->redirectPaymentMethodSpecificOutput = $value->fromObject($object->redirectPaymentMethodSpecificOutput);
141: }
142: if (property_exists($object, 'reversalReason')) {
143: $this->reversalReason = $object->reversalReason;
144: }
145: if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificOutput')) {
146: if (!is_object($object->sepaDirectDebitPaymentMethodSpecificOutput)) {
147: throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificOutput, true) . '\' is not an object');
148: }
149: $value = new SepaDirectDebitPaymentMethodSpecificOutput();
150: $this->sepaDirectDebitPaymentMethodSpecificOutput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificOutput);
151: }
152: return $this;
153: }
154: }
155: