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 RefundOutput extends OrderOutput
14: {
15: /**
16: * @var int|null
17: */
18: public ?int $amountPaid = null;
19:
20: /**
21: * @var RefundBankMethodSpecificOutput|null
22: */
23: public ?RefundBankMethodSpecificOutput $bankRefundMethodSpecificOutput = null;
24:
25: /**
26: * @var RefundCardMethodSpecificOutput|null
27: */
28: public ?RefundCardMethodSpecificOutput $cardRefundMethodSpecificOutput = null;
29:
30: /**
31: * @var RefundCashMethodSpecificOutput|null
32: */
33: public ?RefundCashMethodSpecificOutput $cashRefundMethodSpecificOutput = null;
34:
35: /**
36: * @var RefundEInvoiceMethodSpecificOutput|null
37: */
38: public ?RefundEInvoiceMethodSpecificOutput $eInvoiceRefundMethodSpecificOutput = null;
39:
40: /**
41: * @var RefundEWalletMethodSpecificOutput|null
42: */
43: public ?RefundEWalletMethodSpecificOutput $eWalletRefundMethodSpecificOutput = null;
44:
45: /**
46: * @var RefundMobileMethodSpecificOutput|null
47: */
48: public ?RefundMobileMethodSpecificOutput $mobileRefundMethodSpecificOutput = null;
49:
50: /**
51: * @var string|null
52: */
53: public ?string $paymentMethod = null;
54:
55: /**
56: * @return object
57: */
58: public function toObject(): object
59: {
60: $object = parent::toObject();
61: if (!is_null($this->amountPaid)) {
62: $object->amountPaid = $this->amountPaid;
63: }
64: if (!is_null($this->bankRefundMethodSpecificOutput)) {
65: $object->bankRefundMethodSpecificOutput = $this->bankRefundMethodSpecificOutput->toObject();
66: }
67: if (!is_null($this->cardRefundMethodSpecificOutput)) {
68: $object->cardRefundMethodSpecificOutput = $this->cardRefundMethodSpecificOutput->toObject();
69: }
70: if (!is_null($this->cashRefundMethodSpecificOutput)) {
71: $object->cashRefundMethodSpecificOutput = $this->cashRefundMethodSpecificOutput->toObject();
72: }
73: if (!is_null($this->eInvoiceRefundMethodSpecificOutput)) {
74: $object->eInvoiceRefundMethodSpecificOutput = $this->eInvoiceRefundMethodSpecificOutput->toObject();
75: }
76: if (!is_null($this->eWalletRefundMethodSpecificOutput)) {
77: $object->eWalletRefundMethodSpecificOutput = $this->eWalletRefundMethodSpecificOutput->toObject();
78: }
79: if (!is_null($this->mobileRefundMethodSpecificOutput)) {
80: $object->mobileRefundMethodSpecificOutput = $this->mobileRefundMethodSpecificOutput->toObject();
81: }
82: if (!is_null($this->paymentMethod)) {
83: $object->paymentMethod = $this->paymentMethod;
84: }
85: return $object;
86: }
87:
88: /**
89: * @param object $object
90: *
91: * @return $this
92: * @throws UnexpectedValueException
93: */
94: public function fromObject(object $object): RefundOutput
95: {
96: parent::fromObject($object);
97: if (property_exists($object, 'amountPaid')) {
98: $this->amountPaid = $object->amountPaid;
99: }
100: if (property_exists($object, 'bankRefundMethodSpecificOutput')) {
101: if (!is_object($object->bankRefundMethodSpecificOutput)) {
102: throw new UnexpectedValueException('value \'' . print_r($object->bankRefundMethodSpecificOutput, true) . '\' is not an object');
103: }
104: $value = new RefundBankMethodSpecificOutput();
105: $this->bankRefundMethodSpecificOutput = $value->fromObject($object->bankRefundMethodSpecificOutput);
106: }
107: if (property_exists($object, 'cardRefundMethodSpecificOutput')) {
108: if (!is_object($object->cardRefundMethodSpecificOutput)) {
109: throw new UnexpectedValueException('value \'' . print_r($object->cardRefundMethodSpecificOutput, true) . '\' is not an object');
110: }
111: $value = new RefundCardMethodSpecificOutput();
112: $this->cardRefundMethodSpecificOutput = $value->fromObject($object->cardRefundMethodSpecificOutput);
113: }
114: if (property_exists($object, 'cashRefundMethodSpecificOutput')) {
115: if (!is_object($object->cashRefundMethodSpecificOutput)) {
116: throw new UnexpectedValueException('value \'' . print_r($object->cashRefundMethodSpecificOutput, true) . '\' is not an object');
117: }
118: $value = new RefundCashMethodSpecificOutput();
119: $this->cashRefundMethodSpecificOutput = $value->fromObject($object->cashRefundMethodSpecificOutput);
120: }
121: if (property_exists($object, 'eInvoiceRefundMethodSpecificOutput')) {
122: if (!is_object($object->eInvoiceRefundMethodSpecificOutput)) {
123: throw new UnexpectedValueException('value \'' . print_r($object->eInvoiceRefundMethodSpecificOutput, true) . '\' is not an object');
124: }
125: $value = new RefundEInvoiceMethodSpecificOutput();
126: $this->eInvoiceRefundMethodSpecificOutput = $value->fromObject($object->eInvoiceRefundMethodSpecificOutput);
127: }
128: if (property_exists($object, 'eWalletRefundMethodSpecificOutput')) {
129: if (!is_object($object->eWalletRefundMethodSpecificOutput)) {
130: throw new UnexpectedValueException('value \'' . print_r($object->eWalletRefundMethodSpecificOutput, true) . '\' is not an object');
131: }
132: $value = new RefundEWalletMethodSpecificOutput();
133: $this->eWalletRefundMethodSpecificOutput = $value->fromObject($object->eWalletRefundMethodSpecificOutput);
134: }
135: if (property_exists($object, 'mobileRefundMethodSpecificOutput')) {
136: if (!is_object($object->mobileRefundMethodSpecificOutput)) {
137: throw new UnexpectedValueException('value \'' . print_r($object->mobileRefundMethodSpecificOutput, true) . '\' is not an object');
138: }
139: $value = new RefundMobileMethodSpecificOutput();
140: $this->mobileRefundMethodSpecificOutput = $value->fromObject($object->mobileRefundMethodSpecificOutput);
141: }
142: if (property_exists($object, 'paymentMethod')) {
143: $this->paymentMethod = $object->paymentMethod;
144: }
145: return $this;
146: }
147: }
148: