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: use Worldline\Connect\Sdk\Domain\DataObject;
10:
11: /**
12: * @package Worldline\Connect\Sdk\V1\Domain
13: */
14: class CreatePayoutRequest extends DataObject
15: {
16: /**
17: * @var AmountOfMoney|null
18: *
19: * @deprecated Moved to PayoutDetails
20: */
21: public ?AmountOfMoney $amountOfMoney = null;
22:
23: /**
24: * @var BankAccountBban|null
25: *
26: * @deprecated Moved to BankTransferPayoutMethodSpecificInput
27: */
28: public ?BankAccountBban $bankAccountBban = null;
29:
30: /**
31: * @var BankAccountIban|null
32: *
33: * @deprecated Moved to BankTransferPayoutMethodSpecificInput
34: */
35: public ?BankAccountIban $bankAccountIban = null;
36:
37: /**
38: * @var BankTransferPayoutMethodSpecificInput|null
39: */
40: public ?BankTransferPayoutMethodSpecificInput $bankTransferPayoutMethodSpecificInput = null;
41:
42: /**
43: * @var CardPayoutMethodSpecificInput|null
44: */
45: public ?CardPayoutMethodSpecificInput $cardPayoutMethodSpecificInput = null;
46:
47: /**
48: * @var PayoutCustomer|null
49: *
50: * @deprecated Moved to PayoutDetails
51: */
52: public ?PayoutCustomer $customer = null;
53:
54: /**
55: * @var PayoutMerchant|null
56: */
57: public ?PayoutMerchant $merchant = null;
58:
59: /**
60: * @var string|null
61: *
62: * @deprecated Moved to BankTransferPayoutMethodSpecificInput
63: */
64: public ?string $payoutDate = null;
65:
66: /**
67: * @var PayoutDetails|null
68: */
69: public ?PayoutDetails $payoutDetails = null;
70:
71: /**
72: * @var string|null
73: *
74: * @deprecated Moved to BankTransferPayoutMethodSpecificInput
75: */
76: public ?string $payoutText = null;
77:
78: /**
79: * @var PayoutReferences|null
80: *
81: * @deprecated Moved to PayoutDetails
82: */
83: public ?PayoutReferences $references = null;
84:
85: /**
86: * @var string|null
87: *
88: * @deprecated Moved to BankTransferPayoutMethodSpecificInput
89: */
90: public ?string $swiftCode = null;
91:
92: /**
93: * @return object
94: */
95: public function toObject(): object
96: {
97: $object = parent::toObject();
98: if (!is_null($this->amountOfMoney)) {
99: $object->amountOfMoney = $this->amountOfMoney->toObject();
100: }
101: if (!is_null($this->bankAccountBban)) {
102: $object->bankAccountBban = $this->bankAccountBban->toObject();
103: }
104: if (!is_null($this->bankAccountIban)) {
105: $object->bankAccountIban = $this->bankAccountIban->toObject();
106: }
107: if (!is_null($this->bankTransferPayoutMethodSpecificInput)) {
108: $object->bankTransferPayoutMethodSpecificInput = $this->bankTransferPayoutMethodSpecificInput->toObject();
109: }
110: if (!is_null($this->cardPayoutMethodSpecificInput)) {
111: $object->cardPayoutMethodSpecificInput = $this->cardPayoutMethodSpecificInput->toObject();
112: }
113: if (!is_null($this->customer)) {
114: $object->customer = $this->customer->toObject();
115: }
116: if (!is_null($this->merchant)) {
117: $object->merchant = $this->merchant->toObject();
118: }
119: if (!is_null($this->payoutDate)) {
120: $object->payoutDate = $this->payoutDate;
121: }
122: if (!is_null($this->payoutDetails)) {
123: $object->payoutDetails = $this->payoutDetails->toObject();
124: }
125: if (!is_null($this->payoutText)) {
126: $object->payoutText = $this->payoutText;
127: }
128: if (!is_null($this->references)) {
129: $object->references = $this->references->toObject();
130: }
131: if (!is_null($this->swiftCode)) {
132: $object->swiftCode = $this->swiftCode;
133: }
134: return $object;
135: }
136:
137: /**
138: * @param object $object
139: *
140: * @return $this
141: * @throws UnexpectedValueException
142: */
143: public function fromObject(object $object): CreatePayoutRequest
144: {
145: parent::fromObject($object);
146: if (property_exists($object, 'amountOfMoney')) {
147: if (!is_object($object->amountOfMoney)) {
148: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
149: }
150: $value = new AmountOfMoney();
151: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
152: }
153: if (property_exists($object, 'bankAccountBban')) {
154: if (!is_object($object->bankAccountBban)) {
155: throw new UnexpectedValueException('value \'' . print_r($object->bankAccountBban, true) . '\' is not an object');
156: }
157: $value = new BankAccountBban();
158: $this->bankAccountBban = $value->fromObject($object->bankAccountBban);
159: }
160: if (property_exists($object, 'bankAccountIban')) {
161: if (!is_object($object->bankAccountIban)) {
162: throw new UnexpectedValueException('value \'' . print_r($object->bankAccountIban, true) . '\' is not an object');
163: }
164: $value = new BankAccountIban();
165: $this->bankAccountIban = $value->fromObject($object->bankAccountIban);
166: }
167: if (property_exists($object, 'bankTransferPayoutMethodSpecificInput')) {
168: if (!is_object($object->bankTransferPayoutMethodSpecificInput)) {
169: throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPayoutMethodSpecificInput, true) . '\' is not an object');
170: }
171: $value = new BankTransferPayoutMethodSpecificInput();
172: $this->bankTransferPayoutMethodSpecificInput = $value->fromObject($object->bankTransferPayoutMethodSpecificInput);
173: }
174: if (property_exists($object, 'cardPayoutMethodSpecificInput')) {
175: if (!is_object($object->cardPayoutMethodSpecificInput)) {
176: throw new UnexpectedValueException('value \'' . print_r($object->cardPayoutMethodSpecificInput, true) . '\' is not an object');
177: }
178: $value = new CardPayoutMethodSpecificInput();
179: $this->cardPayoutMethodSpecificInput = $value->fromObject($object->cardPayoutMethodSpecificInput);
180: }
181: if (property_exists($object, 'customer')) {
182: if (!is_object($object->customer)) {
183: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
184: }
185: $value = new PayoutCustomer();
186: $this->customer = $value->fromObject($object->customer);
187: }
188: if (property_exists($object, 'merchant')) {
189: if (!is_object($object->merchant)) {
190: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
191: }
192: $value = new PayoutMerchant();
193: $this->merchant = $value->fromObject($object->merchant);
194: }
195: if (property_exists($object, 'payoutDate')) {
196: $this->payoutDate = $object->payoutDate;
197: }
198: if (property_exists($object, 'payoutDetails')) {
199: if (!is_object($object->payoutDetails)) {
200: throw new UnexpectedValueException('value \'' . print_r($object->payoutDetails, true) . '\' is not an object');
201: }
202: $value = new PayoutDetails();
203: $this->payoutDetails = $value->fromObject($object->payoutDetails);
204: }
205: if (property_exists($object, 'payoutText')) {
206: $this->payoutText = $object->payoutText;
207: }
208: if (property_exists($object, 'references')) {
209: if (!is_object($object->references)) {
210: throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object');
211: }
212: $value = new PayoutReferences();
213: $this->references = $value->fromObject($object->references);
214: }
215: if (property_exists($object, 'swiftCode')) {
216: $this->swiftCode = $object->swiftCode;
217: }
218: return $this;
219: }
220: }
221: