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 PaymentApprovalResponse extends DataObject
15: {
16: /**
17: * @var ApprovePaymentCardPaymentMethodSpecificOutput
18: */
19: public $cardPaymentMethodSpecificOutput = null;
20:
21: /**
22: * @var ApprovePaymentMobilePaymentMethodSpecificOutput
23: */
24: public $mobilePaymentMethodSpecificOutput = null;
25:
26: /**
27: * @var Payment
28: */
29: public $payment = null;
30:
31: /**
32: * @var ApprovePaymentCardPaymentMethodSpecificOutput
33: * @deprecated Use cardPaymentMethodSpecificOutput instead
34: */
35: public $paymentMethodSpecificOutput = null;
36:
37: /**
38: * @return object
39: */
40: public function toObject()
41: {
42: $object = parent::toObject();
43: if (!is_null($this->cardPaymentMethodSpecificOutput)) {
44: $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject();
45: }
46: if (!is_null($this->mobilePaymentMethodSpecificOutput)) {
47: $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject();
48: }
49: if (!is_null($this->payment)) {
50: $object->payment = $this->payment->toObject();
51: }
52: if (!is_null($this->paymentMethodSpecificOutput)) {
53: $object->paymentMethodSpecificOutput = $this->paymentMethodSpecificOutput->toObject();
54: }
55: return $object;
56: }
57:
58: /**
59: * @param object $object
60: * @return $this
61: * @throws UnexpectedValueException
62: */
63: public function fromObject($object)
64: {
65: parent::fromObject($object);
66: if (property_exists($object, 'cardPaymentMethodSpecificOutput')) {
67: if (!is_object($object->cardPaymentMethodSpecificOutput)) {
68: throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object');
69: }
70: $value = new ApprovePaymentCardPaymentMethodSpecificOutput();
71: $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput);
72: }
73: if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) {
74: if (!is_object($object->mobilePaymentMethodSpecificOutput)) {
75: throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object');
76: }
77: $value = new ApprovePaymentMobilePaymentMethodSpecificOutput();
78: $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput);
79: }
80: if (property_exists($object, 'payment')) {
81: if (!is_object($object->payment)) {
82: throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object');
83: }
84: $value = new Payment();
85: $this->payment = $value->fromObject($object->payment);
86: }
87: if (property_exists($object, 'paymentMethodSpecificOutput')) {
88: if (!is_object($object->paymentMethodSpecificOutput)) {
89: throw new UnexpectedValueException('value \'' . print_r($object->paymentMethodSpecificOutput, true) . '\' is not an object');
90: }
91: $value = new ApprovePaymentCardPaymentMethodSpecificOutput();
92: $this->paymentMethodSpecificOutput = $value->fromObject($object->paymentMethodSpecificOutput);
93: }
94: return $this;
95: }
96: }
97: