| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
| 6: | |
| 7: | use UnexpectedValueException; |
| 8: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | class CardOnFileData extends DataObject |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public $initialCardOnFileData = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public $isInitialTransaction = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | public $subsequentCardOnFileData = null; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public function toObject() |
| 34: | { |
| 35: | $object = parent::toObject(); |
| 36: | if (!is_null($this->initialCardOnFileData)) { |
| 37: | $object->initialCardOnFileData = $this->initialCardOnFileData->toObject(); |
| 38: | } |
| 39: | if (!is_null($this->isInitialTransaction)) { |
| 40: | $object->isInitialTransaction = $this->isInitialTransaction; |
| 41: | } |
| 42: | if (!is_null($this->subsequentCardOnFileData)) { |
| 43: | $object->subsequentCardOnFileData = $this->subsequentCardOnFileData->toObject(); |
| 44: | } |
| 45: | return $object; |
| 46: | } |
| 47: | |
| 48: | |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | public function fromObject($object) |
| 54: | { |
| 55: | parent::fromObject($object); |
| 56: | if (property_exists($object, 'initialCardOnFileData')) { |
| 57: | if (!is_object($object->initialCardOnFileData)) { |
| 58: | throw new UnexpectedValueException('value \'' . print_r($object->initialCardOnFileData, true) . '\' is not an object'); |
| 59: | } |
| 60: | $value = new InitialCardOnFileData(); |
| 61: | $this->initialCardOnFileData = $value->fromObject($object->initialCardOnFileData); |
| 62: | } |
| 63: | if (property_exists($object, 'isInitialTransaction')) { |
| 64: | $this->isInitialTransaction = $object->isInitialTransaction; |
| 65: | } |
| 66: | if (property_exists($object, 'subsequentCardOnFileData')) { |
| 67: | if (!is_object($object->subsequentCardOnFileData)) { |
| 68: | throw new UnexpectedValueException('value \'' . print_r($object->subsequentCardOnFileData, true) . '\' is not an object'); |
| 69: | } |
| 70: | $value = new SubsequentCardOnFileData(); |
| 71: | $this->subsequentCardOnFileData = $value->fromObject($object->subsequentCardOnFileData); |
| 72: | } |
| 73: | return $this; |
| 74: | } |
| 75: | } |
| 76: | |