1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | |
10: | |
11: | |
12: | |
13: | class Payment extends AbstractOrderStatus |
14: | { |
15: | |
16: | |
17: | |
18: | public $hostedCheckoutSpecificOutput = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $paymentOutput = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $status = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $statusOutput = null; |
34: | |
35: | |
36: | |
37: | |
38: | public function toObject() |
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: | |
58: | |
59: | |
60: | |
61: | public function fromObject($object) |
62: | { |
63: | parent::fromObject($object); |
64: | if (property_exists($object, 'hostedCheckoutSpecificOutput')) { |
65: | if (!is_object($object->hostedCheckoutSpecificOutput)) { |
66: | throw new UnexpectedValueException('value \'' . print_r($object->hostedCheckoutSpecificOutput, true) . '\' is not an object'); |
67: | } |
68: | $value = new HostedCheckoutSpecificOutput(); |
69: | $this->hostedCheckoutSpecificOutput = $value->fromObject($object->hostedCheckoutSpecificOutput); |
70: | } |
71: | if (property_exists($object, 'paymentOutput')) { |
72: | if (!is_object($object->paymentOutput)) { |
73: | throw new UnexpectedValueException('value \'' . print_r($object->paymentOutput, true) . '\' is not an object'); |
74: | } |
75: | $value = new PaymentOutput(); |
76: | $this->paymentOutput = $value->fromObject($object->paymentOutput); |
77: | } |
78: | if (property_exists($object, 'status')) { |
79: | $this->status = $object->status; |
80: | } |
81: | if (property_exists($object, 'statusOutput')) { |
82: | if (!is_object($object->statusOutput)) { |
83: | throw new UnexpectedValueException('value \'' . print_r($object->statusOutput, true) . '\' is not an object'); |
84: | } |
85: | $value = new PaymentStatusOutput(); |
86: | $this->statusOutput = $value->fromObject($object->statusOutput); |
87: | } |
88: | return $this; |
89: | } |
90: | } |
91: | |