| 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 SubOperation extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $amount = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $authorizationCode = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $operationId = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public $operationTimestamp = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public $operationType = null; |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | public $responseCode = null; |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | public $responseCodeCategory = null; |
| 50: | |
| 51: | |
| 52: | |
| 53: | |
| 54: | public $responseCodeDescription = null; |
| 55: | |
| 56: | |
| 57: | |
| 58: | |
| 59: | public function toObject() |
| 60: | { |
| 61: | $object = parent::toObject(); |
| 62: | if (!is_null($this->amount)) { |
| 63: | $object->amount = $this->amount->toObject(); |
| 64: | } |
| 65: | if (!is_null($this->authorizationCode)) { |
| 66: | $object->authorizationCode = $this->authorizationCode; |
| 67: | } |
| 68: | if (!is_null($this->operationId)) { |
| 69: | $object->operationId = $this->operationId; |
| 70: | } |
| 71: | if (!is_null($this->operationTimestamp)) { |
| 72: | $object->operationTimestamp = $this->operationTimestamp->format('Y-m-d\\TH:i:s.vP'); |
| 73: | } |
| 74: | if (!is_null($this->operationType)) { |
| 75: | $object->operationType = $this->operationType; |
| 76: | } |
| 77: | if (!is_null($this->responseCode)) { |
| 78: | $object->responseCode = $this->responseCode; |
| 79: | } |
| 80: | if (!is_null($this->responseCodeCategory)) { |
| 81: | $object->responseCodeCategory = $this->responseCodeCategory; |
| 82: | } |
| 83: | if (!is_null($this->responseCodeDescription)) { |
| 84: | $object->responseCodeDescription = $this->responseCodeDescription; |
| 85: | } |
| 86: | return $object; |
| 87: | } |
| 88: | |
| 89: | |
| 90: | |
| 91: | |
| 92: | |
| 93: | |
| 94: | public function fromObject($object) |
| 95: | { |
| 96: | parent::fromObject($object); |
| 97: | if (property_exists($object, 'amount')) { |
| 98: | if (!is_object($object->amount)) { |
| 99: | throw new UnexpectedValueException('value \'' . print_r($object->amount, true) . '\' is not an object'); |
| 100: | } |
| 101: | $value = new AmountData(); |
| 102: | $this->amount = $value->fromObject($object->amount); |
| 103: | } |
| 104: | if (property_exists($object, 'authorizationCode')) { |
| 105: | $this->authorizationCode = $object->authorizationCode; |
| 106: | } |
| 107: | if (property_exists($object, 'operationId')) { |
| 108: | $this->operationId = $object->operationId; |
| 109: | } |
| 110: | if (property_exists($object, 'operationTimestamp')) { |
| 111: | $this->operationTimestamp = new DateTime($object->operationTimestamp); |
| 112: | } |
| 113: | if (property_exists($object, 'operationType')) { |
| 114: | $this->operationType = $object->operationType; |
| 115: | } |
| 116: | if (property_exists($object, 'responseCode')) { |
| 117: | $this->responseCode = $object->responseCode; |
| 118: | } |
| 119: | if (property_exists($object, 'responseCodeCategory')) { |
| 120: | $this->responseCodeCategory = $object->responseCodeCategory; |
| 121: | } |
| 122: | if (property_exists($object, 'responseCodeDescription')) { |
| 123: | $this->responseCodeDescription = $object->responseCodeDescription; |
| 124: | } |
| 125: | return $this; |
| 126: | } |
| 127: | } |
| 128: | |