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 MerchantAction extends DataObject
15: {
16: /**
17: * @var string
18: */
19: public $actionType = null;
20:
21: /**
22: * @var PaymentProductField[]
23: */
24: public $formFields = null;
25:
26: /**
27: * @var MobileThreeDSecureChallengeParameters
28: */
29: public $mobileThreeDSecureChallengeParameters = null;
30:
31: /**
32: * @var RedirectData
33: */
34: public $redirectData = null;
35:
36: /**
37: * @var string
38: */
39: public $renderingData = null;
40:
41: /**
42: * @var KeyValuePair[]
43: */
44: public $showData = null;
45:
46: /**
47: * @var ThirdPartyData
48: */
49: public $thirdPartyData = null;
50:
51: /**
52: * @return object
53: */
54: public function toObject()
55: {
56: $object = parent::toObject();
57: if (!is_null($this->actionType)) {
58: $object->actionType = $this->actionType;
59: }
60: if (!is_null($this->formFields)) {
61: $object->formFields = [];
62: foreach ($this->formFields as $element) {
63: if (!is_null($element)) {
64: $object->formFields[] = $element->toObject();
65: }
66: }
67: }
68: if (!is_null($this->mobileThreeDSecureChallengeParameters)) {
69: $object->mobileThreeDSecureChallengeParameters = $this->mobileThreeDSecureChallengeParameters->toObject();
70: }
71: if (!is_null($this->redirectData)) {
72: $object->redirectData = $this->redirectData->toObject();
73: }
74: if (!is_null($this->renderingData)) {
75: $object->renderingData = $this->renderingData;
76: }
77: if (!is_null($this->showData)) {
78: $object->showData = [];
79: foreach ($this->showData as $element) {
80: if (!is_null($element)) {
81: $object->showData[] = $element->toObject();
82: }
83: }
84: }
85: if (!is_null($this->thirdPartyData)) {
86: $object->thirdPartyData = $this->thirdPartyData->toObject();
87: }
88: return $object;
89: }
90:
91: /**
92: * @param object $object
93: * @return $this
94: * @throws UnexpectedValueException
95: */
96: public function fromObject($object)
97: {
98: parent::fromObject($object);
99: if (property_exists($object, 'actionType')) {
100: $this->actionType = $object->actionType;
101: }
102: if (property_exists($object, 'formFields')) {
103: if (!is_array($object->formFields) && !is_object($object->formFields)) {
104: throw new UnexpectedValueException('value \'' . print_r($object->formFields, true) . '\' is not an array or object');
105: }
106: $this->formFields = [];
107: foreach ($object->formFields as $element) {
108: $value = new PaymentProductField();
109: $this->formFields[] = $value->fromObject($element);
110: }
111: }
112: if (property_exists($object, 'mobileThreeDSecureChallengeParameters')) {
113: if (!is_object($object->mobileThreeDSecureChallengeParameters)) {
114: throw new UnexpectedValueException('value \'' . print_r($object->mobileThreeDSecureChallengeParameters, true) . '\' is not an object');
115: }
116: $value = new MobileThreeDSecureChallengeParameters();
117: $this->mobileThreeDSecureChallengeParameters = $value->fromObject($object->mobileThreeDSecureChallengeParameters);
118: }
119: if (property_exists($object, 'redirectData')) {
120: if (!is_object($object->redirectData)) {
121: throw new UnexpectedValueException('value \'' . print_r($object->redirectData, true) . '\' is not an object');
122: }
123: $value = new RedirectData();
124: $this->redirectData = $value->fromObject($object->redirectData);
125: }
126: if (property_exists($object, 'renderingData')) {
127: $this->renderingData = $object->renderingData;
128: }
129: if (property_exists($object, 'showData')) {
130: if (!is_array($object->showData) && !is_object($object->showData)) {
131: throw new UnexpectedValueException('value \'' . print_r($object->showData, true) . '\' is not an array or object');
132: }
133: $this->showData = [];
134: foreach ($object->showData as $element) {
135: $value = new KeyValuePair();
136: $this->showData[] = $value->fromObject($element);
137: }
138: }
139: if (property_exists($object, 'thirdPartyData')) {
140: if (!is_object($object->thirdPartyData)) {
141: throw new UnexpectedValueException('value \'' . print_r($object->thirdPartyData, true) . '\' is not an object');
142: }
143: $value = new ThirdPartyData();
144: $this->thirdPartyData = $value->fromObject($object->thirdPartyData);
145: }
146: return $this;
147: }
148: }
149: