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 ApprovePaymentRequest extends DataObject
15: {
16: /**
17: * @var int
18: */
19: public $amount = null;
20:
21: /**
22: * @var ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput
23: */
24: public $directDebitPaymentMethodSpecificInput = null;
25:
26: /**
27: * @var OrderApprovePayment
28: */
29: public $order = null;
30:
31: /**
32: * @var ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput
33: */
34: public $sepaDirectDebitPaymentMethodSpecificInput = null;
35:
36: /**
37: * @return object
38: */
39: public function toObject()
40: {
41: $object = parent::toObject();
42: if (!is_null($this->amount)) {
43: $object->amount = $this->amount;
44: }
45: if (!is_null($this->directDebitPaymentMethodSpecificInput)) {
46: $object->directDebitPaymentMethodSpecificInput = $this->directDebitPaymentMethodSpecificInput->toObject();
47: }
48: if (!is_null($this->order)) {
49: $object->order = $this->order->toObject();
50: }
51: if (!is_null($this->sepaDirectDebitPaymentMethodSpecificInput)) {
52: $object->sepaDirectDebitPaymentMethodSpecificInput = $this->sepaDirectDebitPaymentMethodSpecificInput->toObject();
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, 'amount')) {
66: $this->amount = $object->amount;
67: }
68: if (property_exists($object, 'directDebitPaymentMethodSpecificInput')) {
69: if (!is_object($object->directDebitPaymentMethodSpecificInput)) {
70: throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificInput, true) . '\' is not an object');
71: }
72: $value = new ApprovePaymentNonSepaDirectDebitPaymentMethodSpecificInput();
73: $this->directDebitPaymentMethodSpecificInput = $value->fromObject($object->directDebitPaymentMethodSpecificInput);
74: }
75: if (property_exists($object, 'order')) {
76: if (!is_object($object->order)) {
77: throw new UnexpectedValueException('value \'' . print_r($object->order, true) . '\' is not an object');
78: }
79: $value = new OrderApprovePayment();
80: $this->order = $value->fromObject($object->order);
81: }
82: if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificInput')) {
83: if (!is_object($object->sepaDirectDebitPaymentMethodSpecificInput)) {
84: throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificInput, true) . '\' is not an object');
85: }
86: $value = new ApprovePaymentSepaDirectDebitPaymentMethodSpecificInput();
87: $this->sepaDirectDebitPaymentMethodSpecificInput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificInput);
88: }
89: return $this;
90: }
91: }
92: