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