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:
10: /**
11: * @package Worldline\Connect\Sdk\V1\Domain
12: */
13: class Payment extends AbstractOrderStatus
14: {
15: /**
16: * @var HostedCheckoutSpecificOutput|null
17: */
18: public ?HostedCheckoutSpecificOutput $hostedCheckoutSpecificOutput = null;
19:
20: /**
21: * @var PaymentOutput|null
22: */
23: public ?PaymentOutput $paymentOutput = null;
24:
25: /**
26: * @var string|null
27: */
28: public ?string $status = null;
29:
30: /**
31: * @var PaymentStatusOutput|null
32: */
33: public ?PaymentStatusOutput $statusOutput = null;
34:
35: /**
36: * @return object
37: */
38: public function toObject(): object
39: {
40: $object = parent::toObject();
41: if (!is_null($this->hostedCheckoutSpecificOutput)) {
42: $object->hostedCheckoutSpecificOutput = $this->hostedCheckoutSpecificOutput->toObject();
43: }
44: if (!is_null($this->paymentOutput)) {
45: $object->paymentOutput = $this->paymentOutput->toObject();
46: }
47: if (!is_null($this->status)) {
48: $object->status = $this->status;
49: }
50: if (!is_null($this->statusOutput)) {
51: $object->statusOutput = $this->statusOutput->toObject();
52: }
53: return $object;
54: }
55:
56: /**
57: * @param object $object
58: *
59: * @return $this
60: * @throws UnexpectedValueException
61: */
62: public function fromObject(object $object): Payment
63: {
64: parent::fromObject($object);
65: if (property_exists($object, 'hostedCheckoutSpecificOutput')) {
66: if (!is_object($object->hostedCheckoutSpecificOutput)) {
67: throw new UnexpectedValueException('value \'' . print_r($object->hostedCheckoutSpecificOutput, true) . '\' is not an object');
68: }
69: $value = new HostedCheckoutSpecificOutput();
70: $this->hostedCheckoutSpecificOutput = $value->fromObject($object->hostedCheckoutSpecificOutput);
71: }
72: if (property_exists($object, 'paymentOutput')) {
73: if (!is_object($object->paymentOutput)) {
74: throw new UnexpectedValueException('value \'' . print_r($object->paymentOutput, true) . '\' is not an object');
75: }
76: $value = new PaymentOutput();
77: $this->paymentOutput = $value->fromObject($object->paymentOutput);
78: }
79: if (property_exists($object, 'status')) {
80: $this->status = $object->status;
81: }
82: if (property_exists($object, 'statusOutput')) {
83: if (!is_object($object->statusOutput)) {
84: throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object');
85: }
86: $value = new PaymentStatusOutput();
87: $this->statusOutput = $value->fromObject($object->statusOutput);
88: }
89: return $this;
90: }
91: }
92: