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
17: */
18: public $cardPaymentData = null;
19:
20: /**
21: * @var string
22: */
23: public $operationId = null;
24:
25: /**
26: * @var PointOfSaleDataForDcc
27: */
28: public $pointOfSaleData = null;
29:
30: /**
31: * @var string
32: */
33: public $rateReferenceId = null;
34:
35: /**
36: * @var string
37: */
38: public $targetCurrency = null;
39:
40: /**
41: * @var TransactionDataForDcc
42: */
43: public $transaction = null;
44:
45: /**
46: * @return object
47: */
48: public function toObject()
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: * @return $this
75: * @throws UnexpectedValueException
76: */
77: public function fromObject($object)
78: {
79: parent::fromObject($object);
80: if (property_exists($object, 'cardPaymentData')) {
81: if (!is_object($object->cardPaymentData)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object');
83: }
84: $value = new CardDataForDcc();
85: $this->cardPaymentData = $value->fromObject($object->cardPaymentData);
86: }
87: if (property_exists($object, 'operationId')) {
88: $this->operationId = $object->operationId;
89: }
90: if (property_exists($object, 'pointOfSaleData')) {
91: if (!is_object($object->pointOfSaleData)) {
92: throw new UnexpectedValueException('value \'' . print_r($object->pointOfSaleData, true) . '\' is not an object');
93: }
94: $value = new PointOfSaleDataForDcc();
95: $this->pointOfSaleData = $value->fromObject($object->pointOfSaleData);
96: }
97: if (property_exists($object, 'rateReferenceId')) {
98: $this->rateReferenceId = $object->rateReferenceId;
99: }
100: if (property_exists($object, 'targetCurrency')) {
101: $this->targetCurrency = $object->targetCurrency;
102: }
103: if (property_exists($object, 'transaction')) {
104: if (!is_object($object->transaction)) {
105: throw new UnexpectedValueException('value \'' . print_r($object->transaction, true) . '\' is not an object');
106: }
107: $value = new TransactionDataForDcc();
108: $this->transaction = $value->fromObject($object->transaction);
109: }
110: return $this;
111: }
112: }
113: