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 RiskAssessment extends DataObject
15: {
16: /**
17: * @var FraudFields|null
18: */
19: public ?FraudFields $fraudFields = null;
20:
21: /**
22: * @var MerchantRiskAssessment|null
23: */
24: public ?MerchantRiskAssessment $merchant = null;
25:
26: /**
27: * @var OrderRiskAssessment|null
28: */
29: public ?OrderRiskAssessment $order = null;
30:
31: /**
32: * @var int|null
33: */
34: public ?int $paymentProductId = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject(): object
40: {
41: $object = parent::toObject();
42: if (!is_null($this->fraudFields)) {
43: $object->fraudFields = $this->fraudFields->toObject();
44: }
45: if (!is_null($this->merchant)) {
46: $object->merchant = $this->merchant->toObject();
47: }
48: if (!is_null($this->order)) {
49: $object->order = $this->order->toObject();
50: }
51: if (!is_null($this->paymentProductId)) {
52: $object->paymentProductId = $this->paymentProductId;
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): RiskAssessment
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'fraudFields')) {
67: if (!is_object($object->fraudFields)) {
68: throw new UnexpectedValueException('value \'' . print_r($object->fraudFields, true) . '\' is not an object');
69: }
70: $value = new FraudFields();
71: $this->fraudFields = $value->fromObject($object->fraudFields);
72: }
73: if (property_exists($object, 'merchant')) {
74: if (!is_object($object->merchant)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
76: }
77: $value = new MerchantRiskAssessment();
78: $this->merchant = $value->fromObject($object->merchant);
79: }
80: if (property_exists($object, 'order')) {
81: if (!is_object($object->order)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object');
83: }
84: $value = new OrderRiskAssessment();
85: $this->order = $value->fromObject($object->order);
86: }
87: if (property_exists($object, 'paymentProductId')) {
88: $this->paymentProductId = $object->paymentProductId;
89: }
90: return $this;
91: }
92: }
93: