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