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 OrderReferences extends DataObject
15: {
16: /**
17: * @var string|null
18: */
19: public ?string $descriptor = null;
20:
21: /**
22: * @var OrderInvoiceData|null
23: */
24: public ?OrderInvoiceData $invoiceData = null;
25:
26: /**
27: * @var int|null
28: */
29: public ?int $merchantOrderId = null;
30:
31: /**
32: * @var string|null
33: */
34: public ?string $merchantReference = null;
35:
36: /**
37: * @var string|null
38: */
39: public ?string $providerId = null;
40:
41: /**
42: * @var string|null
43: */
44: public ?string $providerMerchantId = null;
45:
46: /**
47: * @return object
48: */
49: public function toObject(): object
50: {
51: $object = parent::toObject();
52: if (!is_null($this->descriptor)) {
53: $object->descriptor = $this->descriptor;
54: }
55: if (!is_null($this->invoiceData)) {
56: $object->invoiceData = $this->invoiceData->toObject();
57: }
58: if (!is_null($this->merchantOrderId)) {
59: $object->merchantOrderId = $this->merchantOrderId;
60: }
61: if (!is_null($this->merchantReference)) {
62: $object->merchantReference = $this->merchantReference;
63: }
64: if (!is_null($this->providerId)) {
65: $object->providerId = $this->providerId;
66: }
67: if (!is_null($this->providerMerchantId)) {
68: $object->providerMerchantId = $this->providerMerchantId;
69: }
70: return $object;
71: }
72:
73: /**
74: * @param object $object
75: *
76: * @return $this
77: * @throws UnexpectedValueException
78: */
79: public function fromObject(object $object): OrderReferences
80: {
81: parent::fromObject($object);
82: if (property_exists($object, 'descriptor')) {
83: $this->descriptor = $object->descriptor;
84: }
85: if (property_exists($object, 'invoiceData')) {
86: if (!is_object($object->invoiceData)) {
87: throw new UnexpectedValueException('value \'' . print_r($object->invoiceData, true) . '\' is not an object');
88: }
89: $value = new OrderInvoiceData();
90: $this->invoiceData = $value->fromObject($object->invoiceData);
91: }
92: if (property_exists($object, 'merchantOrderId')) {
93: $this->merchantOrderId = $object->merchantOrderId;
94: }
95: if (property_exists($object, 'merchantReference')) {
96: $this->merchantReference = $object->merchantReference;
97: }
98: if (property_exists($object, 'providerId')) {
99: $this->providerId = $object->providerId;
100: }
101: if (property_exists($object, 'providerMerchantId')) {
102: $this->providerMerchantId = $object->providerMerchantId;
103: }
104: return $this;
105: }
106: }
107: