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