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 CardPayoutMethodSpecificInput extends AbstractPayoutMethodSpecificInput
14: {
15: /**
16: * @var Card|null
17: */
18: public ?Card $card = null;
19:
20: /**
21: * @var int|null
22: */
23: public ?int $paymentProductId = null;
24:
25: /**
26: * @var PayoutRecipient|null
27: */
28: public ?PayoutRecipient $recipient = null;
29:
30: /**
31: * @var string|null
32: */
33: public ?string $token = null;
34:
35: /**
36: * @return object
37: */
38: public function toObject(): object
39: {
40: $object = parent::toObject();
41: if (!is_null($this->card)) {
42: $object->card = $this->card->toObject();
43: }
44: if (!is_null($this->paymentProductId)) {
45: $object->paymentProductId = $this->paymentProductId;
46: }
47: if (!is_null($this->recipient)) {
48: $object->recipient = $this->recipient->toObject();
49: }
50: if (!is_null($this->token)) {
51: $object->token = $this->token;
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): CardPayoutMethodSpecificInput
63: {
64: parent::fromObject($object);
65: if (property_exists($object, 'card')) {
66: if (!is_object($object->card)) {
67: throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object');
68: }
69: $value = new Card();
70: $this->card = $value->fromObject($object->card);
71: }
72: if (property_exists($object, 'paymentProductId')) {
73: $this->paymentProductId = $object->paymentProductId;
74: }
75: if (property_exists($object, 'recipient')) {
76: if (!is_object($object->recipient)) {
77: throw new UnexpectedValueException('value \'' . print_r($object->recipient, true) . '\' is not an object');
78: }
79: $value = new PayoutRecipient();
80: $this->recipient = $value->fromObject($object->recipient);
81: }
82: if (property_exists($object, 'token')) {
83: $this->token = $object->token;
84: }
85: return $this;
86: }
87: }
88: