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 GetDccRateRequest extends DataObject
14: {
15: /**
16: * @var CardDataForDcc|null
17: */
18: public ?CardDataForDcc $cardPaymentData = null;
19:
20: /**
21: * @var string|null
22: */
23: public ?string $operationId = null;
24:
25: /**
26: * @var PointOfSaleDataForDcc|null
27: */
28: public ?PointOfSaleDataForDcc $pointOfSaleData = null;
29:
30: /**
31: * @var string|null
32: */
33: public ?string $rateReferenceId = null;
34:
35: /**
36: * @var string|null
37: */
38: public ?string $targetCurrency = null;
39:
40: /**
41: * @var TransactionDataForDcc|null
42: */
43: public ?TransactionDataForDcc $transaction = null;
44:
45: /**
46: * @return object
47: */
48: public function toObject(): object
49: {
50: $object = parent::toObject();
51: if (!is_null($this->cardPaymentData)) {
52: $object->cardPaymentData = $this->cardPaymentData->toObject();
53: }
54: if (!is_null($this->operationId)) {
55: $object->operationId = $this->operationId;
56: }
57: if (!is_null($this->pointOfSaleData)) {
58: $object->pointOfSaleData = $this->pointOfSaleData->toObject();
59: }
60: if (!is_null($this->rateReferenceId)) {
61: $object->rateReferenceId = $this->rateReferenceId;
62: }
63: if (!is_null($this->targetCurrency)) {
64: $object->targetCurrency = $this->targetCurrency;
65: }
66: if (!is_null($this->transaction)) {
67: $object->transaction = $this->transaction->toObject();
68: }
69: return $object;
70: }
71:
72: /**
73: * @param object $object
74: *
75: * @return $this
76: * @throws UnexpectedValueException
77: */
78: public function fromObject(object $object): GetDccRateRequest
79: {
80: parent::fromObject($object);
81: if (property_exists($object, 'cardPaymentData')) {
82: if (!is_object($object->cardPaymentData)) {
83: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
84: }
85: $value = new CardDataForDcc();
86: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
87: }
88: if (property_exists($object, 'operationId')) {
89: $this->operationId = $object->operationId;
90: }
91: if (property_exists($object, 'pointOfSaleData')) {
92: if (!is_object($object->pointOfSaleData)) {
93: throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object');
94: }
95: $value = new PointOfSaleDataForDcc();
96: $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData);
97: }
98: if (property_exists($object, 'rateReferenceId')) {
99: $this->rateReferenceId = $object->rateReferenceId;
100: }
101: if (property_exists($object, 'targetCurrency')) {
102: $this->targetCurrency = $object->targetCurrency;
103: }
104: if (property_exists($object, 'transaction')) {
105: if (!is_object($object->transaction)) {
106: throw new UnexpectedValueException('value \'' . print_r($object->transaction, true) . '\' is not an object');
107: }
108: $value = new TransactionDataForDcc();
109: $this->transaction = $value->fromObject($object->transaction);
110: }
111: return $this;
112: }
113: }
114: