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