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
18: */
19: public $fraudFields = null;
20:
21: /**
22: * @var MerchantRiskAssessment
23: */
24: public $merchant = null;
25:
26: /**
27: * @var OrderRiskAssessment
28: */
29: public $order = null;
30:
31: /**
32: * @var int
33: */
34: public $paymentProductId = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject()
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: * @return $this
60: * @throws UnexpectedValueException
61: */
62: public function fromObject($object)
63: {
64: parent::fromObject($object);
65: if (property_exists($object, 'fraudFields')) {
66: if (!is_object($object->fraudFields)) {
67: throw new UnexpectedValueException('value \'' . print_r($object->fraudFields, true) . '\' is not an object');
68: }
69: $value = new FraudFields();
70: $this->fraudFields = $value->fromObject($object->fraudFields);
71: }
72: if (property_exists($object, 'merchant')) {
73: if (!is_object($object->merchant)) {
74: throw new UnexpectedValueException('value \'' . print_r($object->merchant, true) . '\' is not an object');
75: }
76: $value = new MerchantRiskAssessment();
77: $this->merchant = $value->fromObject($object->merchant);
78: }
79: if (property_exists($object, 'order')) {
80: if (!is_object($object->order)) {
81: throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object');
82: }
83: $value = new OrderRiskAssessment();
84: $this->order = $value->fromObject($object->order);
85: }
86: if (property_exists($object, 'paymentProductId')) {
87: $this->paymentProductId = $object->paymentProductId;
88: }
89: return $this;
90: }
91: }
92: