1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | use Worldline\Connect\Sdk\Domain\DataObject; |
10: | |
11: | |
12: | |
13: | |
14: | class GetInstallmentRequest extends DataObject |
15: | { |
16: | |
17: | |
18: | |
19: | public $amountOfMoney = null; |
20: | |
21: | |
22: | |
23: | |
24: | public $bin = null; |
25: | |
26: | |
27: | |
28: | |
29: | public $countryCode = null; |
30: | |
31: | |
32: | |
33: | |
34: | public $paymentProductId = null; |
35: | |
36: | |
37: | |
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->bin)) { |
46: | $object->bin = $this->bin; |
47: | } |
48: | if (!is_null($this->countryCode)) { |
49: | $object->countryCode = $this->countryCode; |
50: | } |
51: | if (!is_null($this->paymentProductId)) { |
52: | $object->paymentProductId = $this->paymentProductId; |
53: | } |
54: | return $object; |
55: | } |
56: | |
57: | |
58: | |
59: | |
60: | |
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, 'bin')) { |
73: | $this->bin = $object->bin; |
74: | } |
75: | if (property_exists($object, 'countryCode')) { |
76: | $this->countryCode = $object->countryCode; |
77: | } |
78: | if (property_exists($object, 'paymentProductId')) { |
79: | $this->paymentProductId = $object->paymentProductId; |
80: | } |
81: | return $this; |
82: | } |
83: | } |
84: | |