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 CardPaymentDataForResponse extends DataObject
14: {
15: /**
16: * @var string|null
17: */
18: public ?string $brand = null;
19:
20: /**
21: * @var ECommerceDataForResponse|null
22: */
23: public ?ECommerceDataForResponse $ecommerceData = null;
24:
25: /**
26: * @var PointOfSaleDataForResponse|null
27: */
28: public ?PointOfSaleDataForResponse $pointOfSaleData = null;
29:
30: /**
31: * @return object
32: */
33: public function toObject(): object
34: {
35: $object = parent::toObject();
36: if (!is_null($this->brand)) {
37: $object->brand = $this->brand;
38: }
39: if (!is_null($this->ecommerceData)) {
40: $object->ecommerceData = $this->ecommerceData->toObject();
41: }
42: if (!is_null($this->pointOfSaleData)) {
43: $object->pointOfSaleData = $this->pointOfSaleData->toObject();
44: }
45: return $object;
46: }
47:
48: /**
49: * @param object $object
50: *
51: * @return $this
52: * @throws UnexpectedValueException
53: */
54: public function fromObject(object $object): CardPaymentDataForResponse
55: {
56: parent::fromObject($object);
57: if (property_exists($object, 'brand')) {
58: $this->brand = $object->brand;
59: }
60: if (property_exists($object, 'ecommerceData')) {
61: if (!is_object($object->ecommerceData)) {
62: throw new UnexpectedValueException('value \'' . print_r($object->ecommerceData, true) . '\' is not an object');
63: }
64: $value = new ECommerceDataForResponse();
65: $this->ecommerceData = $value->fromObject($object->ecommerceData);
66: }
67: if (property_exists($object, 'pointOfSaleData')) {
68: if (!is_object($object->pointOfSaleData)) {
69: throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object');
70: }
71: $value = new PointOfSaleDataForResponse();
72: $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData);
73: }
74: return $this;
75: }
76: }
77: