| 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 ApiPaymentResponse extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $additionalResponseData = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $cardPaymentData = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $initialAuthorizationCode = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public $operationId = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public $paymentId = null; |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | public $references = null; |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | public $responder = null; |
| 50: | |
| 51: | |
| 52: | |
| 53: | |
| 54: | public $responseCode = null; |
| 55: | |
| 56: | |
| 57: | |
| 58: | |
| 59: | public $responseCodeCategory = null; |
| 60: | |
| 61: | |
| 62: | |
| 63: | |
| 64: | public $responseCodeDescription = null; |
| 65: | |
| 66: | |
| 67: | |
| 68: | |
| 69: | public $status = null; |
| 70: | |
| 71: | |
| 72: | |
| 73: | |
| 74: | public $statusTimestamp = null; |
| 75: | |
| 76: | |
| 77: | |
| 78: | |
| 79: | public $totalAuthorizedAmount = null; |
| 80: | |
| 81: | |
| 82: | |
| 83: | |
| 84: | public function toObject() |
| 85: | { |
| 86: | $object = parent::toObject(); |
| 87: | if (!is_null($this->additionalResponseData)) { |
| 88: | $object->additionalResponseData = $this->additionalResponseData->toObject(); |
| 89: | } |
| 90: | if (!is_null($this->cardPaymentData)) { |
| 91: | $object->cardPaymentData = $this->cardPaymentData->toObject(); |
| 92: | } |
| 93: | if (!is_null($this->initialAuthorizationCode)) { |
| 94: | $object->initialAuthorizationCode = $this->initialAuthorizationCode; |
| 95: | } |
| 96: | if (!is_null($this->operationId)) { |
| 97: | $object->operationId = $this->operationId; |
| 98: | } |
| 99: | if (!is_null($this->paymentId)) { |
| 100: | $object->paymentId = $this->paymentId; |
| 101: | } |
| 102: | if (!is_null($this->references)) { |
| 103: | $object->references = $this->references->toObject(); |
| 104: | } |
| 105: | if (!is_null($this->responder)) { |
| 106: | $object->responder = $this->responder; |
| 107: | } |
| 108: | if (!is_null($this->responseCode)) { |
| 109: | $object->responseCode = $this->responseCode; |
| 110: | } |
| 111: | if (!is_null($this->responseCodeCategory)) { |
| 112: | $object->responseCodeCategory = $this->responseCodeCategory; |
| 113: | } |
| 114: | if (!is_null($this->responseCodeDescription)) { |
| 115: | $object->responseCodeDescription = $this->responseCodeDescription; |
| 116: | } |
| 117: | if (!is_null($this->status)) { |
| 118: | $object->status = $this->status; |
| 119: | } |
| 120: | if (!is_null($this->statusTimestamp)) { |
| 121: | $object->statusTimestamp = $this->statusTimestamp->format('Y-m-d\\TH:i:s.vP'); |
| 122: | } |
| 123: | if (!is_null($this->totalAuthorizedAmount)) { |
| 124: | $object->totalAuthorizedAmount = $this->totalAuthorizedAmount->toObject(); |
| 125: | } |
| 126: | return $object; |
| 127: | } |
| 128: | |
| 129: | |
| 130: | |
| 131: | |
| 132: | |
| 133: | |
| 134: | public function fromObject($object) |
| 135: | { |
| 136: | parent::fromObject($object); |
| 137: | if (property_exists($object, 'additionalResponseData')) { |
| 138: | if (!is_object($object->additionalResponseData)) { |
| 139: | throw new UnexpectedValueException('value \'' . print_r($object->additionalResponseData, true) . '\' is not an object'); |
| 140: | } |
| 141: | $value = new AdditionalResponseData(); |
| 142: | $this->additionalResponseData = $value->fromObject($object->additionalResponseData); |
| 143: | } |
| 144: | if (property_exists($object, 'cardPaymentData')) { |
| 145: | if (!is_object($object->cardPaymentData)) { |
| 146: | throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentData, true) . '\' is not an object'); |
| 147: | } |
| 148: | $value = new CardPaymentDataForResponse(); |
| 149: | $this->cardPaymentData = $value->fromObject($object->cardPaymentData); |
| 150: | } |
| 151: | if (property_exists($object, 'initialAuthorizationCode')) { |
| 152: | $this->initialAuthorizationCode = $object->initialAuthorizationCode; |
| 153: | } |
| 154: | if (property_exists($object, 'operationId')) { |
| 155: | $this->operationId = $object->operationId; |
| 156: | } |
| 157: | if (property_exists($object, 'paymentId')) { |
| 158: | $this->paymentId = $object->paymentId; |
| 159: | } |
| 160: | if (property_exists($object, 'references')) { |
| 161: | if (!is_object($object->references)) { |
| 162: | throw new UnexpectedValueException('value \'' . print_r($object->references, true) . '\' is not an object'); |
| 163: | } |
| 164: | $value = new ApiReferencesForResponses(); |
| 165: | $this->references = $value->fromObject($object->references); |
| 166: | } |
| 167: | if (property_exists($object, 'responder')) { |
| 168: | $this->responder = $object->responder; |
| 169: | } |
| 170: | if (property_exists($object, 'responseCode')) { |
| 171: | $this->responseCode = $object->responseCode; |
| 172: | } |
| 173: | if (property_exists($object, 'responseCodeCategory')) { |
| 174: | $this->responseCodeCategory = $object->responseCodeCategory; |
| 175: | } |
| 176: | if (property_exists($object, 'responseCodeDescription')) { |
| 177: | $this->responseCodeDescription = $object->responseCodeDescription; |
| 178: | } |
| 179: | if (property_exists($object, 'status')) { |
| 180: | $this->status = $object->status; |
| 181: | } |
| 182: | if (property_exists($object, 'statusTimestamp')) { |
| 183: | $this->statusTimestamp = new DateTime($object->statusTimestamp); |
| 184: | } |
| 185: | if (property_exists($object, 'totalAuthorizedAmount')) { |
| 186: | if (!is_object($object->totalAuthorizedAmount)) { |
| 187: | throw new UnexpectedValueException('value \'' . print_r($object->totalAuthorizedAmount, true) . '\' is not an object'); |
| 188: | } |
| 189: | $value = new AmountData(); |
| 190: | $this->totalAuthorizedAmount = $value->fromObject($object->totalAuthorizedAmount); |
| 191: | } |
| 192: | return $this; |
| 193: | } |
| 194: | } |
| 195: | |