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 OrderRiskAssessment extends DataObject
15: {
16: /**
17: * @var AdditionalOrderInputAirlineData|null
18: */
19: public ?AdditionalOrderInputAirlineData $additionalInput = null;
20:
21: /**
22: * @var AmountOfMoney|null
23: */
24: public ?AmountOfMoney $amountOfMoney = null;
25:
26: /**
27: * @var CustomerRiskAssessment|null
28: */
29: public ?CustomerRiskAssessment $customer = null;
30:
31: /**
32: * @var ShippingRiskAssessment|null
33: */
34: public ?ShippingRiskAssessment $shipping = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
40: {
41: $object = parent::toObject();
42: if (!is_null($this->additionalInput)) {
43: $object->additionalInput = $this->additionalInput->toObject();
44: }
45: if (!is_null($this->amountOfMoney)) {
46: $object->amountOfMoney = $this->amountOfMoney->toObject();
47: }
48: if (!is_null($this->customer)) {
49: $object->customer = $this->customer->toObject();
50: }
51: if (!is_null($this->shipping)) {
52: $object->shipping = $this->shipping->toObject();
53: }
54: return $object;
55: }
56:
57: /**
58: * @param object $object
59: *
60: * @return $this
61: * @throws UnexpectedValueException
62: */
63: public function fromObject(object $object): OrderRiskAssessment
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'additionalInput')) {
67: if (!is_object($object->additionalInput)) {
68: throw new UnexpectedValueException('value \'' . print_r($object->additionalInput, true) . '\' is not an object');
69: }
70: $value = new AdditionalOrderInputAirlineData();
71: $this->additionalInput = $value->fromObject($object->additionalInput);
72: }
73: if (property_exists($object, 'amountOfMoney')) {
74: if (!is_object($object->amountOfMoney)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object');
76: }
77: $value = new AmountOfMoney();
78: $this->amountOfMoney = $value->fromObject($object->amountOfMoney);
79: }
80: if (property_exists($object, 'customer')) {
81: if (!is_object($object->customer)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object');
83: }
84: $value = new CustomerRiskAssessment();
85: $this->customer = $value->fromObject($object->customer);
86: }
87: if (property_exists($object, 'shipping')) {
88: if (!is_object($object->shipping)) {
89: throw new UnexpectedValueException('value \'' . print_r($object->shipping, true) . '\' is not an object');
90: }
91: $value = new ShippingRiskAssessment();
92: $this->shipping = $value->fromObject($object->shipping);
93: }
94: return $this;
95: }
96: }
97: