1: | <?php |
2: | |
3: | |
4: | |
5: | |
6: | namespace Worldline\Connect\Sdk\V1\Domain; |
7: | |
8: | use UnexpectedValueException; |
9: | |
10: | |
11: | |
12: | |
13: | class CardPaymentMethodSpecificOutput extends AbstractPaymentMethodSpecificOutput |
14: | { |
15: | |
16: | |
17: | |
18: | public $authorisationCode = null; |
19: | |
20: | |
21: | |
22: | |
23: | public $card = null; |
24: | |
25: | |
26: | |
27: | |
28: | public $fraudResults = null; |
29: | |
30: | |
31: | |
32: | |
33: | public $initialSchemeTransactionId = null; |
34: | |
35: | |
36: | |
37: | |
38: | public $networkTokenUsed = null; |
39: | |
40: | |
41: | |
42: | |
43: | public $schemeTransactionId = null; |
44: | |
45: | |
46: | |
47: | |
48: | public $threeDSecureResults = null; |
49: | |
50: | |
51: | |
52: | |
53: | public $token = null; |
54: | |
55: | |
56: | |
57: | |
58: | public function toObject() |
59: | { |
60: | $object = parent::toObject(); |
61: | if (!is_null($this->authorisationCode)) { |
62: | $object->authorisationCode = $this->authorisationCode; |
63: | } |
64: | if (!is_null($this->card)) { |
65: | $object->card = $this->card->toObject(); |
66: | } |
67: | if (!is_null($this->fraudResults)) { |
68: | $object->fraudResults = $this->fraudResults->toObject(); |
69: | } |
70: | if (!is_null($this->initialSchemeTransactionId)) { |
71: | $object->initialSchemeTransactionId = $this->initialSchemeTransactionId; |
72: | } |
73: | if (!is_null($this->networkTokenUsed)) { |
74: | $object->networkTokenUsed = $this->networkTokenUsed; |
75: | } |
76: | if (!is_null($this->schemeTransactionId)) { |
77: | $object->schemeTransactionId = $this->schemeTransactionId; |
78: | } |
79: | if (!is_null($this->threeDSecureResults)) { |
80: | $object->threeDSecureResults = $this->threeDSecureResults->toObject(); |
81: | } |
82: | if (!is_null($this->token)) { |
83: | $object->token = $this->token; |
84: | } |
85: | return $object; |
86: | } |
87: | |
88: | |
89: | |
90: | |
91: | |
92: | |
93: | public function fromObject($object) |
94: | { |
95: | parent::fromObject($object); |
96: | if (property_exists($object, 'authorisationCode')) { |
97: | $this->authorisationCode = $object->authorisationCode; |
98: | } |
99: | if (property_exists($object, 'card')) { |
100: | if (!is_object($object->card)) { |
101: | throw new UnexpectedValueException('value \'' . print_r($object->card, true) . '\' is not an object'); |
102: | } |
103: | $value = new CardEssentials(); |
104: | $this->card = $value->fromObject($object->card); |
105: | } |
106: | if (property_exists($object, 'fraudResults')) { |
107: | if (!is_object($object->fraudResults)) { |
108: | throw new UnexpectedValueException('value \'' . print_r($object->fraudResults, true) . '\' is not an object'); |
109: | } |
110: | $value = new CardFraudResults(); |
111: | $this->fraudResults = $value->fromObject($object->fraudResults); |
112: | } |
113: | if (property_exists($object, 'initialSchemeTransactionId')) { |
114: | $this->initialSchemeTransactionId = $object->initialSchemeTransactionId; |
115: | } |
116: | if (property_exists($object, 'networkTokenUsed')) { |
117: | $this->networkTokenUsed = $object->networkTokenUsed; |
118: | } |
119: | if (property_exists($object, 'schemeTransactionId')) { |
120: | $this->schemeTransactionId = $object->schemeTransactionId; |
121: | } |
122: | if (property_exists($object, 'threeDSecureResults')) { |
123: | if (!is_object($object->threeDSecureResults)) { |
124: | throw new UnexpectedValueException('value \'' . print_r($object->threeDSecureResults, true) . '\' is not an object'); |
125: | } |
126: | $value = new ThreeDSecureResults(); |
127: | $this->threeDSecureResults = $value->fromObject($object->threeDSecureResults); |
128: | } |
129: | if (property_exists($object, 'token')) { |
130: | $this->token = $object->token; |
131: | } |
132: | return $this; |
133: | } |
134: | } |
135: | |