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 CardPaymentData extends DataObject
14: {
15: /**
16: * @var bool
17: */
18: public $allowPartialApproval = null;
19:
20: /**
21: * @var string
22: */
23: public $brand = null;
24:
25: /**
26: * @var bool
27: */
28: public $captureImmediately = null;
29:
30: /**
31: * @var PlainCardData
32: */
33: public $cardData = null;
34:
35: /**
36: * @var string
37: */
38: public $cardEntryMode = null;
39:
40: /**
41: * @var CardOnFileData
42: */
43: public $cardOnFileData = null;
44:
45: /**
46: * @var string
47: */
48: public $cardholderVerificationMethod = null;
49:
50: /**
51: * @var ECommerceData
52: */
53: public $ecommerceData = null;
54:
55: /**
56: * @var NetworkTokenData
57: */
58: public $networkTokenData = null;
59:
60: /**
61: * @var PointOfSaleData
62: */
63: public $pointOfSaleData = null;
64:
65: /**
66: * @var string
67: */
68: public $walletId = null;
69:
70: /**
71: * @return object
72: */
73: public function toObject()
74: {
75: $object = parent::toObject();
76: if (!is_null($this->allowPartialApproval)) {
77: $object->allowPartialApproval = $this->allowPartialApproval;
78: }
79: if (!is_null($this->brand)) {
80: $object->brand = $this->brand;
81: }
82: if (!is_null($this->captureImmediately)) {
83: $object->captureImmediately = $this->captureImmediately;
84: }
85: if (!is_null($this->cardData)) {
86: $object->cardData = $this->cardData->toObject();
87: }
88: if (!is_null($this->cardEntryMode)) {
89: $object->cardEntryMode = $this->cardEntryMode;
90: }
91: if (!is_null($this->cardOnFileData)) {
92: $object->cardOnFileData = $this->cardOnFileData->toObject();
93: }
94: if (!is_null($this->cardholderVerificationMethod)) {
95: $object->cardholderVerificationMethod = $this->cardholderVerificationMethod;
96: }
97: if (!is_null($this->ecommerceData)) {
98: $object->ecommerceData = $this->ecommerceData->toObject();
99: }
100: if (!is_null($this->networkTokenData)) {
101: $object->networkTokenData = $this->networkTokenData->toObject();
102: }
103: if (!is_null($this->pointOfSaleData)) {
104: $object->pointOfSaleData = $this->pointOfSaleData->toObject();
105: }
106: if (!is_null($this->walletId)) {
107: $object->walletId = $this->walletId;
108: }
109: return $object;
110: }
111:
112: /**
113: * @param object $object
114: * @return $this
115: * @throws UnexpectedValueException
116: */
117: public function fromObject($object)
118: {
119: parent::fromObject($object);
120: if (property_exists($object, 'allowPartialApproval')) {
121: $this->allowPartialApproval = $object->allowPartialApproval;
122: }
123: if (property_exists($object, 'brand')) {
124: $this->brand = $object->brand;
125: }
126: if (property_exists($object, 'captureImmediately')) {
127: $this->captureImmediately = $object->captureImmediately;
128: }
129: if (property_exists($object, 'cardData')) {
130: if (!is_object($object->cardData)) {
131: throw new UnexpectedValueException('value \'' . print_r($object->cardData, true) . '\' is not an object');
132: }
133: $value = new PlainCardData();
134: $this->cardData = $value->fromObject($object->cardData);
135: }
136: if (property_exists($object, 'cardEntryMode')) {
137: $this->cardEntryMode = $object->cardEntryMode;
138: }
139: if (property_exists($object, 'cardOnFileData')) {
140: if (!is_object($object->cardOnFileData)) {
141: throw new UnexpectedValueException('value \'' . print_r($object->cardOnFileData, true) . '\' is not an object');
142: }
143: $value = new CardOnFileData();
144: $this->cardOnFileData = $value->fromObject($object->cardOnFileData);
145: }
146: if (property_exists($object, 'cardholderVerificationMethod')) {
147: $this->cardholderVerificationMethod = $object->cardholderVerificationMethod;
148: }
149: if (property_exists($object, 'ecommerceData')) {
150: if (!is_object($object->ecommerceData)) {
151: throw new UnexpectedValueException('value \'' . print_r($object->ecommerceData, true) . '\' is not an object');
152: }
153: $value = new ECommerceData();
154: $this->ecommerceData = $value->fromObject($object->ecommerceData);
155: }
156: if (property_exists($object, 'networkTokenData')) {
157: if (!is_object($object->networkTokenData)) {
158: throw new UnexpectedValueException('value \'' . print_r($object->networkTokenData, true) . '\' is not an object');
159: }
160: $value = new NetworkTokenData();
161: $this->networkTokenData = $value->fromObject($object->networkTokenData);
162: }
163: if (property_exists($object, 'pointOfSaleData')) {
164: if (!is_object($object->pointOfSaleData)) {
165: throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object');
166: }
167: $value = new PointOfSaleData();
168: $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData);
169: }
170: if (property_exists($object, 'walletId')) {
171: $this->walletId = $object->walletId;
172: }
173: return $this;
174: }
175: }
176: