1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class OrderRiskAssessment extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $additionalInput = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $amountOfMoney = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $customer = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $shipping = null; |
35: | |
36: | |
37: | |
38: | |
39: | public function toObject() |
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: | |
59: | |
60: | |
61: | |
62: | public function fromObject($object) |
63: | { |
64: | parent::fromObject($object); |
65: | if (property_exists($object, 'additionalInput')) { |
66: | if (!is_object($object->additionalInput)) { |
67: | throw new UnexpectedValueException('value \'' . print_r($object->additionalInput, true) . '\' is not an object'); |
68: | } |
69: | $value = new AdditionalOrderInputAirlineData(); |
70: | $this->additionalInput = $value->fromObject($object->additionalInput); |
71: | } |
72: | if (property_exists($object, 'amountOfMoney')) { |
73: | if (!is_object($object->amountOfMoney)) { |
74: | throw new UnexpectedValueException('value \'' . print_r($object->amountOfMoney, true) . '\' is not an object'); |
75: | } |
76: | $value = new AmountOfMoney(); |
77: | $this->amountOfMoney = $value->fromObject($object->amountOfMoney); |
78: | } |
79: | if (property_exists($object, 'customer')) { |
80: | if (!is_object($object->customer)) { |
81: | throw new UnexpectedValueException('value \'' . print_r($object->customer, true) . '\' is not an object'); |
82: | } |
83: | $value = new CustomerRiskAssessment(); |
84: | $this->customer = $value->fromObject($object->customer); |
85: | } |
86: | if (property_exists($object, 'shipping')) { |
87: | if (!is_object($object->shipping)) { |
88: | throw new UnexpectedValueException('value \'' . print_r($object->shipping, true) . '\' is not an object'); |
89: | } |
90: | $value = new ShippingRiskAssessment(); |
91: | $this->shipping = $value->fromObject($object->shipping); |
92: | } |
93: | return $this; |
94: | } |
95: | } |
96: | |