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