| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | namespace Worldline\Connect\Sdk\V1\Domain; |
| 7: | |
| 8: | use UnexpectedValueException; |
| 9: | use Worldline\Connect\Sdk\Domain\DataObject; |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | class CreateHostedCheckoutResponse extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $RETURNMAC = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $hostedCheckoutId = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $invalidTokens = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public $merchantReference = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public $partialRedirectUrl = null; |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | public function toObject() |
| 45: | { |
| 46: | $object = parent::toObject(); |
| 47: | if (!is_null($this->RETURNMAC)) { |
| 48: | $object->RETURNMAC = $this->RETURNMAC; |
| 49: | } |
| 50: | if (!is_null($this->hostedCheckoutId)) { |
| 51: | $object->hostedCheckoutId = $this->hostedCheckoutId; |
| 52: | } |
| 53: | if (!is_null($this->invalidTokens)) { |
| 54: | $object->invalidTokens = []; |
| 55: | foreach ($this->invalidTokens as $element) { |
| 56: | if (!is_null($element)) { |
| 57: | $object->invalidTokens[] = $element; |
| 58: | } |
| 59: | } |
| 60: | } |
| 61: | if (!is_null($this->merchantReference)) { |
| 62: | $object->merchantReference = $this->merchantReference; |
| 63: | } |
| 64: | if (!is_null($this->partialRedirectUrl)) { |
| 65: | $object->partialRedirectUrl = $this->partialRedirectUrl; |
| 66: | } |
| 67: | return $object; |
| 68: | } |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | |
| 74: | |
| 75: | public function fromObject($object) |
| 76: | { |
| 77: | parent::fromObject($object); |
| 78: | if (property_exists($object, 'RETURNMAC')) { |
| 79: | $this->RETURNMAC = $object->RETURNMAC; |
| 80: | } |
| 81: | if (property_exists($object, 'hostedCheckoutId')) { |
| 82: | $this->hostedCheckoutId = $object->hostedCheckoutId; |
| 83: | } |
| 84: | if (property_exists($object, 'invalidTokens')) { |
| 85: | if (!is_array($object->invalidTokens) && !is_object($object->invalidTokens)) { |
| 86: | throw new UnexpectedValueException('value \'' . print_r($object->invalidTokens, true) . '\' is not an array or object'); |
| 87: | } |
| 88: | $this->invalidTokens = []; |
| 89: | foreach ($object->invalidTokens as $element) { |
| 90: | $this->invalidTokens[] = $element; |
| 91: | } |
| 92: | } |
| 93: | if (property_exists($object, 'merchantReference')) { |
| 94: | $this->merchantReference = $object->merchantReference; |
| 95: | } |
| 96: | if (property_exists($object, 'partialRedirectUrl')) { |
| 97: | $this->partialRedirectUrl = $object->partialRedirectUrl; |
| 98: | } |
| 99: | return $this; |
| 100: | } |
| 101: | } |
| 102: | |