1: <?php
2: /*
3: * This file was automatically generated.
4: */
5: namespace Worldline\Acquiring\Sdk\V1\Domain;
6:
7: use UnexpectedValueException;
8: use Worldline\Acquiring\Sdk\Domain\DataObject;
9:
10: /**
11: * @package Worldline\Acquiring\Sdk\V1\Domain
12: */
13: class PointOfSaleData extends DataObject
14: {
15: /**
16: * @var EmvDataItem[]|null
17: */
18: public ?array $emvData = null;
19:
20: /**
21: * @var string|null
22: */
23: public ?string $encryptedPinBlock = null;
24:
25: /**
26: * @var bool|null
27: */
28: public ?bool $isResponseToPinRequest = null;
29:
30: /**
31: * @var bool|null
32: */
33: public ?bool $isRetryWithTheSameOperationId = null;
34:
35: /**
36: * @var string|null
37: */
38: public ?string $pinMasterKeyReference = null;
39:
40: /**
41: * @var string|null
42: */
43: public ?string $track2Data = null;
44:
45: /**
46: * @return object
47: */
48: public function toObject(): object
49: {
50: $object = parent::toObject();
51: if (!is_null($this->emvData)) {
52: $object->emvData = [];
53: foreach ($this->emvData as $element) {
54: if (!is_null($element)) {
55: $object->emvData[] = $element->toObject();
56: }
57: }
58: }
59: if (!is_null($this->encryptedPinBlock)) {
60: $object->encryptedPinBlock = $this->encryptedPinBlock;
61: }
62: if (!is_null($this->isResponseToPinRequest)) {
63: $object->isResponseToPinRequest = $this->isResponseToPinRequest;
64: }
65: if (!is_null($this->isRetryWithTheSameOperationId)) {
66: $object->isRetryWithTheSameOperationId = $this->isRetryWithTheSameOperationId;
67: }
68: if (!is_null($this->pinMasterKeyReference)) {
69: $object->pinMasterKeyReference = $this->pinMasterKeyReference;
70: }
71: if (!is_null($this->track2Data)) {
72: $object->track2Data = $this->track2Data;
73: }
74: return $object;
75: }
76:
77: /**
78: * @param object $object
79: *
80: * @return $this
81: * @throws UnexpectedValueException
82: */
83: public function fromObject(object $object): PointOfSaleData
84: {
85: parent::fromObject($object);
86: if (property_exists($object, 'emvData')) {
87: if (!is_array($object->emvData) && !is_object($object->emvData)) {
88: throw new UnexpectedValueException('value \'' . print_r($object->emvData, true) . '\' is not an array or object');
89: }
90: $this->emvData = [];
91: foreach ($object->emvData as $element) {
92: $value = new EmvDataItem();
93: $this->emvData[] = $value->fromObject($element);
94: }
95: }
96: if (property_exists($object, 'encryptedPinBlock')) {
97: $this->encryptedPinBlock = $object->encryptedPinBlock;
98: }
99: if (property_exists($object, 'isResponseToPinRequest')) {
100: $this->isResponseToPinRequest = $object->isResponseToPinRequest;
101: }
102: if (property_exists($object, 'isRetryWithTheSameOperationId')) {
103: $this->isRetryWithTheSameOperationId = $object->isRetryWithTheSameOperationId;
104: }
105: if (property_exists($object, 'pinMasterKeyReference')) {
106: $this->pinMasterKeyReference = $object->pinMasterKeyReference;
107: }
108: if (property_exists($object, 'track2Data')) {
109: $this->track2Data = $object->track2Data;
110: }
111: return $this;
112: }
113: }
114: