| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
| 6: | |
| 7: | use DateTime; |
| 8: | use UnexpectedValueException; |
| 9: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | class ApiCaptureRequestForRefund extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $operationId = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $references = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $terminalData = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public $transactionTimestamp = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public function toObject() |
| 40: | { |
| 41: | $object = parent::toObject(); |
| 42: | if (!is_null($this->operationId)) { |
| 43: | $object->operationId = $this->operationId; |
| 44: | } |
| 45: | if (!is_null($this->references)) { |
| 46: | $object->references = $this->references->toObject(); |
| 47: | } |
| 48: | if (!is_null($this->terminalData)) { |
| 49: | $object->terminalData = $this->terminalData->toObject(); |
| 50: | } |
| 51: | if (!is_null($this->transactionTimestamp)) { |
| 52: | $object->transactionTimestamp = $this->transactionTimestamp->format('Y-m-d\\TH:i:s.vP'); |
| 53: | } |
| 54: | return $object; |
| 55: | } |
| 56: | |
| 57: | |
| 58: | |
| 59: | |
| 60: | |
| 61: | |
| 62: | public function fromObject($object) |
| 63: | { |
| 64: | parent::fromObject($object); |
| 65: | if (property_exists($object, 'operationId')) { |
| 66: | $this->operationId = $object->operationId; |
| 67: | } |
| 68: | if (property_exists($object, 'references')) { |
| 69: | if (!is_object($object->references)) { |
| 70: | throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); |
| 71: | } |
| 72: | $value = new PaymentReferences(); |
| 73: | $this->references = $value->fromObject($object->references); |
| 74: | } |
| 75: | if (property_exists($object, 'terminalData')) { |
| 76: | if (!is_object($object->terminalData)) { |
| 77: | throw new UnexpectedValueException('value \'' . print_r($object->terminalData, true) . '\' is not an object'); |
| 78: | } |
| 79: | $value = new TerminalData(); |
| 80: | $this->terminalData = $value->fromObject($object->terminalData); |
| 81: | } |
| 82: | if (property_exists($object, 'transactionTimestamp')) { |
| 83: | $this->transactionTimestamp = new DateTime($object->transactionTimestamp); |
| 84: | } |
| 85: | return $this; |
| 86: | } |
| 87: | } |
| 88: | |