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
17: */
18: public $card = null;
19:
20: /**
21: * @var int
22: */
23: public $paymentProductId = null;
24:
25: /**
26: * @var PayoutRecipient
27: */
28: public $recipient = null;
29:
30: /**
31: * @var string
32: */
33: public $token = null;
34:
35: /**
36: * @return object
37: */
38: public function toObject()
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: * @return $this
59: * @throws UnexpectedValueException
60: */
61: public function fromObject($object)
62: {
63: parent::fromObject($object);
64: if (property_exists($object, 'card')) {
65: if (!is_object($object->card)) {
66: throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object');
67: }
68: $value = new Card();
69: $this->card = $value->fromObject($object->card);
70: }
71: if (property_exists($object, 'paymentProductId')) {
72: $this->paymentProductId = $object->paymentProductId;
73: }
74: if (property_exists($object, 'recipient')) {
75: if (!is_object($object->recipient)) {
76: throw new UnexpectedValueException('value \'' . print_r($object->recipient, true) . '\' is not an object');
77: }
78: $value = new PayoutRecipient();
79: $this->recipient = $value->fromObject($object->recipient);
80: }
81: if (property_exists($object, 'token')) {
82: $this->token = $object->token;
83: }
84: return $this;
85: }
86: }
87: