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[]
17: */
18: public $emvData = null;
19:
20: /**
21: * @var string
22: */
23: public $encryptedPinBlock = null;
24:
25: /**
26: * @var bool
27: */
28: public $isResponseToPinRequest = null;
29:
30: /**
31: * @var bool
32: */
33: public $isRetryWithTheSameOperationId = null;
34:
35: /**
36: * @var string
37: */
38: public $pinMasterKeyReference = null;
39:
40: /**
41: * @var string
42: */
43: public $track2Data = null;
44:
45: /**
46: * @return object
47: */
48: public function toObject()
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: * @return $this
80: * @throws UnexpectedValueException
81: */
82: public function fromObject($object)
83: {
84: parent::fromObject($object);
85: if (property_exists($object, 'emvData')) {
86: if (!is_array($object->emvData) && !is_object($object->emvData)) {
87: throw new UnexpectedValueException('value \'' . print_r($object->emvData, true) . '\' is not an array or object');
88: }
89: $this->emvData = [];
90: foreach ($object->emvData as $element) {
91: $value = new EmvDataItem();
92: $this->emvData[] = $value->fromObject($element);
93: }
94: }
95: if (property_exists($object, 'encryptedPinBlock')) {
96: $this->encryptedPinBlock = $object->encryptedPinBlock;
97: }
98: if (property_exists($object, 'isResponseToPinRequest')) {
99: $this->isResponseToPinRequest = $object->isResponseToPinRequest;
100: }
101: if (property_exists($object, 'isRetryWithTheSameOperationId')) {
102: $this->isRetryWithTheSameOperationId = $object->isRetryWithTheSameOperationId;
103: }
104: if (property_exists($object, 'pinMasterKeyReference')) {
105: $this->pinMasterKeyReference = $object->pinMasterKeyReference;
106: }
107: if (property_exists($object, 'track2Data')) {
108: $this->track2Data = $object->track2Data;
109: }
110: return $this;
111: }
112: }
113: