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 CustomerRiskAssessment extends DataObject
15: {
16: /**
17: * @var CustomerAccountRiskAssessment
18: */
19: public $account = null;
20:
21: /**
22: * @var string
23: */
24: public $accountType = null;
25:
26: /**
27: * @var Address
28: */
29: public $billingAddress = null;
30:
31: /**
32: * @var ContactDetailsRiskAssessment
33: */
34: public $contactDetails = null;
35:
36: /**
37: * @var CustomerDeviceRiskAssessment
38: */
39: public $device = null;
40:
41: /**
42: * @var bool
43: */
44: public $isPreviousCustomer = null;
45:
46: /**
47: * @var string
48: */
49: public $locale = null;
50:
51: /**
52: * @var PersonalInformationRiskAssessment
53: */
54: public $personalInformation = null;
55:
56: /**
57: * @var AddressPersonal
58: * @deprecated Use Order.shipping.address instead
59: */
60: public $shippingAddress = null;
61:
62: /**
63: * @return object
64: */
65: public function toObject()
66: {
67: $object = parent::toObject();
68: if (!is_null($this->account)) {
69: $object->account = $this->account->toObject();
70: }
71: if (!is_null($this->accountType)) {
72: $object->accountType = $this->accountType;
73: }
74: if (!is_null($this->billingAddress)) {
75: $object->billingAddress = $this->billingAddress->toObject();
76: }
77: if (!is_null($this->contactDetails)) {
78: $object->contactDetails = $this->contactDetails->toObject();
79: }
80: if (!is_null($this->device)) {
81: $object->device = $this->device->toObject();
82: }
83: if (!is_null($this->isPreviousCustomer)) {
84: $object->isPreviousCustomer = $this->isPreviousCustomer;
85: }
86: if (!is_null($this->locale)) {
87: $object->locale = $this->locale;
88: }
89: if (!is_null($this->personalInformation)) {
90: $object->personalInformation = $this->personalInformation->toObject();
91: }
92: if (!is_null($this->shippingAddress)) {
93: $object->shippingAddress = $this->shippingAddress->toObject();
94: }
95: return $object;
96: }
97:
98: /**
99: * @param object $object
100: * @return $this
101: * @throws UnexpectedValueException
102: */
103: public function fromObject($object)
104: {
105: parent::fromObject($object);
106: if (property_exists($object, 'account')) {
107: if (!is_object($object->account)) {
108: throw new UnexpectedValueException('value \'' . print_r($object->account, true) . '\' is not an object');
109: }
110: $value = new CustomerAccountRiskAssessment();
111: $this->account = $value->fromObject($object->account);
112: }
113: if (property_exists($object, 'accountType')) {
114: $this->accountType = $object->accountType;
115: }
116: if (property_exists($object, 'billingAddress')) {
117: if (!is_object($object->billingAddress)) {
118: throw new UnexpectedValueException('value \'' . print_r($object->billingAddress, true) . '\' is not an object');
119: }
120: $value = new Address();
121: $this->billingAddress = $value->fromObject($object->billingAddress);
122: }
123: if (property_exists($object, 'contactDetails')) {
124: if (!is_object($object->contactDetails)) {
125: throw new UnexpectedValueException('value \'' . print_r($object->contactDetails, true) . '\' is not an object');
126: }
127: $value = new ContactDetailsRiskAssessment();
128: $this->contactDetails = $value->fromObject($object->contactDetails);
129: }
130: if (property_exists($object, 'device')) {
131: if (!is_object($object->device)) {
132: throw new UnexpectedValueException('value \'' . print_r($object->device, true) . '\' is not an object');
133: }
134: $value = new CustomerDeviceRiskAssessment();
135: $this->device = $value->fromObject($object->device);
136: }
137: if (property_exists($object, 'isPreviousCustomer')) {
138: $this->isPreviousCustomer = $object->isPreviousCustomer;
139: }
140: if (property_exists($object, 'locale')) {
141: $this->locale = $object->locale;
142: }
143: if (property_exists($object, 'personalInformation')) {
144: if (!is_object($object->personalInformation)) {
145: throw new UnexpectedValueException('value \'' . print_r($object->personalInformation, true) . '\' is not an object');
146: }
147: $value = new PersonalInformationRiskAssessment();
148: $this->personalInformation = $value->fromObject($object->personalInformation);
149: }
150: if (property_exists($object, 'shippingAddress')) {
151: if (!is_object($object->shippingAddress)) {
152: throw new UnexpectedValueException('value \'' . print_r($object->shippingAddress, true) . '\' is not an object');
153: }
154: $value = new AddressPersonal();
155: $this->shippingAddress = $value->fromObject($object->shippingAddress);
156: }
157: return $this;
158: }
159: }
160: