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 AdditionalOrderInput extends DataObject
15: {
16: /**
17: * @var AccountFundingRecipient|null
18: */
19: public ?AccountFundingRecipient $accountFundingRecipient = null;
20:
21: /**
22: * @var AirlineData|null
23: */
24: public ?AirlineData $airlineData = null;
25:
26: /**
27: * @var Installments|null
28: */
29: public ?Installments $installments = null;
30:
31: /**
32: * @var Level3SummaryData|null
33: *
34: * @deprecated Use Order.shoppingCart.amountBreakdown instead
35: */
36: public ?Level3SummaryData $level3SummaryData = null;
37:
38: /**
39: * @var LoanRecipient|null
40: *
41: * @deprecated No replacement
42: */
43: public ?LoanRecipient $loanRecipient = null;
44:
45: /**
46: * @var LodgingData|null
47: */
48: public ?LodgingData $lodgingData = null;
49:
50: /**
51: * @var int|null
52: *
53: * @deprecated Use installments.numberOfInstallments instead
54: */
55: public ?int $numberOfInstallments = null;
56:
57: /**
58: * @var string|null
59: */
60: public ?string $orderDate = null;
61:
62: /**
63: * @var OrderTypeInformation|null
64: */
65: public ?OrderTypeInformation $typeInformation = null;
66:
67: /**
68: * @return object
69: */
70: public function toObject(): object
71: {
72: $object = parent::toObject();
73: if (!is_null($this->accountFundingRecipient)) {
74: $object->accountFundingRecipient = $this->accountFundingRecipient->toObject();
75: }
76: if (!is_null($this->airlineData)) {
77: $object->airlineData = $this->airlineData->toObject();
78: }
79: if (!is_null($this->installments)) {
80: $object->installments = $this->installments->toObject();
81: }
82: if (!is_null($this->level3SummaryData)) {
83: $object->level3SummaryData = $this->level3SummaryData->toObject();
84: }
85: if (!is_null($this->loanRecipient)) {
86: $object->loanRecipient = $this->loanRecipient->toObject();
87: }
88: if (!is_null($this->lodgingData)) {
89: $object->lodgingData = $this->lodgingData->toObject();
90: }
91: if (!is_null($this->numberOfInstallments)) {
92: $object->numberOfInstallments = $this->numberOfInstallments;
93: }
94: if (!is_null($this->orderDate)) {
95: $object->orderDate = $this->orderDate;
96: }
97: if (!is_null($this->typeInformation)) {
98: $object->typeInformation = $this->typeInformation->toObject();
99: }
100: return $object;
101: }
102:
103: /**
104: * @param object $object
105: *
106: * @return $this
107: * @throws UnexpectedValueException
108: */
109: public function fromObject(object $object): AdditionalOrderInput
110: {
111: parent::fromObject($object);
112: if (property_exists($object, 'accountFundingRecipient')) {
113: if (!is_object($object->accountFundingRecipient)) {
114: throw new UnexpectedValueException('value \'' . print_r($object->accountFundingRecipient, true) . '\' is not an object');
115: }
116: $value = new AccountFundingRecipient();
117: $this->accountFundingRecipient = $value->fromObject($object->accountFundingRecipient);
118: }
119: if (property_exists($object, 'airlineData')) {
120: if (!is_object($object->airlineData)) {
121: throw new UnexpectedValueException('value \'' . print_r($object->airlineData, true) . '\' is not an object');
122: }
123: $value = new AirlineData();
124: $this->airlineData = $value->fromObject($object->airlineData);
125: }
126: if (property_exists($object, 'installments')) {
127: if (!is_object($object->installments)) {
128: throw new UnexpectedValueException('value \'' . print_r($object->installments, true) . '\' is not an object');
129: }
130: $value = new Installments();
131: $this->installments = $value->fromObject($object->installments);
132: }
133: if (property_exists($object, 'level3SummaryData')) {
134: if (!is_object($object->level3SummaryData)) {
135: throw new UnexpectedValueException('value \'' . print_r($object->level3SummaryData, true) . '\' is not an object');
136: }
137: $value = new Level3SummaryData();
138: $this->level3SummaryData = $value->fromObject($object->level3SummaryData);
139: }
140: if (property_exists($object, 'loanRecipient')) {
141: if (!is_object($object->loanRecipient)) {
142: throw new UnexpectedValueException('value \'' . print_r($object->loanRecipient, true) . '\' is not an object');
143: }
144: $value = new LoanRecipient();
145: $this->loanRecipient = $value->fromObject($object->loanRecipient);
146: }
147: if (property_exists($object, 'lodgingData')) {
148: if (!is_object($object->lodgingData)) {
149: throw new UnexpectedValueException('value \'' . print_r($object->lodgingData, true) . '\' is not an object');
150: }
151: $value = new LodgingData();
152: $this->lodgingData = $value->fromObject($object->lodgingData);
153: }
154: if (property_exists($object, 'numberOfInstallments')) {
155: $this->numberOfInstallments = $object->numberOfInstallments;
156: }
157: if (property_exists($object, 'orderDate')) {
158: $this->orderDate = $object->orderDate;
159: }
160: if (property_exists($object, 'typeInformation')) {
161: if (!is_object($object->typeInformation)) {
162: throw new UnexpectedValueException('value \'' . print_r($object->typeInformation, true) . '\' is not an object');
163: }
164: $value = new OrderTypeInformation();
165: $this->typeInformation = $value->fromObject($object->typeInformation);
166: }
167: return $this;
168: }
169: }
170: