| 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 CreatePaymentResult extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $creationOutput = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $merchantAction = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $payment = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function toObject() |
| 35: | { |
| 36: | $object = parent::toObject(); |
| 37: | if (!is_null($this->creationOutput)) { |
| 38: | $object->creationOutput = $this->creationOutput->toObject(); |
| 39: | } |
| 40: | if (!is_null($this->merchantAction)) { |
| 41: | $object->merchantAction = $this->merchantAction->toObject(); |
| 42: | } |
| 43: | if (!is_null($this->payment)) { |
| 44: | $object->payment = $this->payment->toObject(); |
| 45: | } |
| 46: | return $object; |
| 47: | } |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | |
| 54: | public function fromObject($object) |
| 55: | { |
| 56: | parent::fromObject($object); |
| 57: | if (property_exists($object, 'creationOutput')) { |
| 58: | if (!is_object($object->creationOutput)) { |
| 59: | throw new UnexpectedValueException('value \'' . print_r($object->creationOutput, true) . '\' is not an object'); |
| 60: | } |
| 61: | $value = new PaymentCreationOutput(); |
| 62: | $this->creationOutput = $value->fromObject($object->creationOutput); |
| 63: | } |
| 64: | if (property_exists($object, 'merchantAction')) { |
| 65: | if (!is_object($object->merchantAction)) { |
| 66: | throw new UnexpectedValueException('value \'' . print_r($object->merchantAction, true) . '\' is not an object'); |
| 67: | } |
| 68: | $value = new MerchantAction(); |
| 69: | $this->merchantAction = $value->fromObject($object->merchantAction); |
| 70: | } |
| 71: | if (property_exists($object, 'payment')) { |
| 72: | if (!is_object($object->payment)) { |
| 73: | throw new UnexpectedValueException('value \'' . print_r($object->payment, true) . '\' is not an object'); |
| 74: | } |
| 75: | $value = new Payment(); |
| 76: | $this->payment = $value->fromObject($object->payment); |
| 77: | } |
| 78: | return $this; |
| 79: | } |
| 80: | } |
| 81: | |