| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | namespace Worldline\Connect\Sdk\V1\Domain; |
| 7: | |
| 8: | use UnexpectedValueException; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | class PaymentOutput extends OrderOutput |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public $amountCaptureRequested = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public $amountCaptured = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | public $amountPaid = null; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public $amountRefundRequested = null; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public $amountRefunded = null; |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public $amountReversed = null; |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | public $bankTransferPaymentMethodSpecificOutput = null; |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | public $cardPaymentMethodSpecificOutput = null; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public $cashPaymentMethodSpecificOutput = null; |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | public $directDebitPaymentMethodSpecificOutput = null; |
| 64: | |
| 65: | |
| 66: | |
| 67: | |
| 68: | public $eInvoicePaymentMethodSpecificOutput = null; |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | public $invoicePaymentMethodSpecificOutput = null; |
| 74: | |
| 75: | |
| 76: | |
| 77: | |
| 78: | public $mobilePaymentMethodSpecificOutput = null; |
| 79: | |
| 80: | |
| 81: | |
| 82: | |
| 83: | public $operations = null; |
| 84: | |
| 85: | |
| 86: | |
| 87: | |
| 88: | public $paymentMethod = null; |
| 89: | |
| 90: | |
| 91: | |
| 92: | |
| 93: | public $redirectPaymentMethodSpecificOutput = null; |
| 94: | |
| 95: | |
| 96: | |
| 97: | |
| 98: | public $reversalReason = null; |
| 99: | |
| 100: | |
| 101: | |
| 102: | |
| 103: | public $sepaDirectDebitPaymentMethodSpecificOutput = null; |
| 104: | |
| 105: | |
| 106: | |
| 107: | |
| 108: | public function toObject() |
| 109: | { |
| 110: | $object = parent::toObject(); |
| 111: | if (!is_null($this->amountCaptureRequested)) { |
| 112: | $object->amountCaptureRequested = $this->amountCaptureRequested; |
| 113: | } |
| 114: | if (!is_null($this->amountCaptured)) { |
| 115: | $object->amountCaptured = $this->amountCaptured; |
| 116: | } |
| 117: | if (!is_null($this->amountPaid)) { |
| 118: | $object->amountPaid = $this->amountPaid; |
| 119: | } |
| 120: | if (!is_null($this->amountRefundRequested)) { |
| 121: | $object->amountRefundRequested = $this->amountRefundRequested; |
| 122: | } |
| 123: | if (!is_null($this->amountRefunded)) { |
| 124: | $object->amountRefunded = $this->amountRefunded; |
| 125: | } |
| 126: | if (!is_null($this->amountReversed)) { |
| 127: | $object->amountReversed = $this->amountReversed; |
| 128: | } |
| 129: | if (!is_null($this->bankTransferPaymentMethodSpecificOutput)) { |
| 130: | $object->bankTransferPaymentMethodSpecificOutput = $this->bankTransferPaymentMethodSpecificOutput->toObject(); |
| 131: | } |
| 132: | if (!is_null($this->cardPaymentMethodSpecificOutput)) { |
| 133: | $object->cardPaymentMethodSpecificOutput = $this->cardPaymentMethodSpecificOutput->toObject(); |
| 134: | } |
| 135: | if (!is_null($this->cashPaymentMethodSpecificOutput)) { |
| 136: | $object->cashPaymentMethodSpecificOutput = $this->cashPaymentMethodSpecificOutput->toObject(); |
| 137: | } |
| 138: | if (!is_null($this->directDebitPaymentMethodSpecificOutput)) { |
| 139: | $object->directDebitPaymentMethodSpecificOutput = $this->directDebitPaymentMethodSpecificOutput->toObject(); |
| 140: | } |
| 141: | if (!is_null($this->eInvoicePaymentMethodSpecificOutput)) { |
| 142: | $object->eInvoicePaymentMethodSpecificOutput = $this->eInvoicePaymentMethodSpecificOutput->toObject(); |
| 143: | } |
| 144: | if (!is_null($this->invoicePaymentMethodSpecificOutput)) { |
| 145: | $object->invoicePaymentMethodSpecificOutput = $this->invoicePaymentMethodSpecificOutput->toObject(); |
| 146: | } |
| 147: | if (!is_null($this->mobilePaymentMethodSpecificOutput)) { |
| 148: | $object->mobilePaymentMethodSpecificOutput = $this->mobilePaymentMethodSpecificOutput->toObject(); |
| 149: | } |
| 150: | if (!is_null($this->operations)) { |
| 151: | $object->operations = []; |
| 152: | foreach ($this->operations as $element) { |
| 153: | if (!is_null($element)) { |
| 154: | $object->operations[] = $element->toObject(); |
| 155: | } |
| 156: | } |
| 157: | } |
| 158: | if (!is_null($this->paymentMethod)) { |
| 159: | $object->paymentMethod = $this->paymentMethod; |
| 160: | } |
| 161: | if (!is_null($this->redirectPaymentMethodSpecificOutput)) { |
| 162: | $object->redirectPaymentMethodSpecificOutput = $this->redirectPaymentMethodSpecificOutput->toObject(); |
| 163: | } |
| 164: | if (!is_null($this->reversalReason)) { |
| 165: | $object->reversalReason = $this->reversalReason; |
| 166: | } |
| 167: | if (!is_null($this->sepaDirectDebitPaymentMethodSpecificOutput)) { |
| 168: | $object->sepaDirectDebitPaymentMethodSpecificOutput = $this->sepaDirectDebitPaymentMethodSpecificOutput->toObject(); |
| 169: | } |
| 170: | return $object; |
| 171: | } |
| 172: | |
| 173: | |
| 174: | |
| 175: | |
| 176: | |
| 177: | |
| 178: | public function fromObject($object) |
| 179: | { |
| 180: | parent::fromObject($object); |
| 181: | if (property_exists($object, 'amountCaptureRequested')) { |
| 182: | $this->amountCaptureRequested = $object->amountCaptureRequested; |
| 183: | } |
| 184: | if (property_exists($object, 'amountCaptured')) { |
| 185: | $this->amountCaptured = $object->amountCaptured; |
| 186: | } |
| 187: | if (property_exists($object, 'amountPaid')) { |
| 188: | $this->amountPaid = $object->amountPaid; |
| 189: | } |
| 190: | if (property_exists($object, 'amountRefundRequested')) { |
| 191: | $this->amountRefundRequested = $object->amountRefundRequested; |
| 192: | } |
| 193: | if (property_exists($object, 'amountRefunded')) { |
| 194: | $this->amountRefunded = $object->amountRefunded; |
| 195: | } |
| 196: | if (property_exists($object, 'amountReversed')) { |
| 197: | $this->amountReversed = $object->amountReversed; |
| 198: | } |
| 199: | if (property_exists($object, 'bankTransferPaymentMethodSpecificOutput')) { |
| 200: | if (!is_object($object->bankTransferPaymentMethodSpecificOutput)) { |
| 201: | throw new UnexpectedValueException('value \'' . print_r($object->bankTransferPaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 202: | } |
| 203: | $value = new BankTransferPaymentMethodSpecificOutput(); |
| 204: | $this->bankTransferPaymentMethodSpecificOutput = $value->fromObject($object->bankTransferPaymentMethodSpecificOutput); |
| 205: | } |
| 206: | if (property_exists($object, 'cardPaymentMethodSpecificOutput')) { |
| 207: | if (!is_object($object->cardPaymentMethodSpecificOutput)) { |
| 208: | throw new UnexpectedValueException('value \'' . print_r($object->cardPaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 209: | } |
| 210: | $value = new CardPaymentMethodSpecificOutput(); |
| 211: | $this->cardPaymentMethodSpecificOutput = $value->fromObject($object->cardPaymentMethodSpecificOutput); |
| 212: | } |
| 213: | if (property_exists($object, 'cashPaymentMethodSpecificOutput')) { |
| 214: | if (!is_object($object->cashPaymentMethodSpecificOutput)) { |
| 215: | throw new UnexpectedValueException('value \'' . print_r($object->cashPaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 216: | } |
| 217: | $value = new CashPaymentMethodSpecificOutput(); |
| 218: | $this->cashPaymentMethodSpecificOutput = $value->fromObject($object->cashPaymentMethodSpecificOutput); |
| 219: | } |
| 220: | if (property_exists($object, 'directDebitPaymentMethodSpecificOutput')) { |
| 221: | if (!is_object($object->directDebitPaymentMethodSpecificOutput)) { |
| 222: | throw new UnexpectedValueException('value \'' . print_r($object->directDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 223: | } |
| 224: | $value = new NonSepaDirectDebitPaymentMethodSpecificOutput(); |
| 225: | $this->directDebitPaymentMethodSpecificOutput = $value->fromObject($object->directDebitPaymentMethodSpecificOutput); |
| 226: | } |
| 227: | if (property_exists($object, 'eInvoicePaymentMethodSpecificOutput')) { |
| 228: | if (!is_object($object->eInvoicePaymentMethodSpecificOutput)) { |
| 229: | throw new UnexpectedValueException('value \'' . print_r($object->eInvoicePaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 230: | } |
| 231: | $value = new EInvoicePaymentMethodSpecificOutput(); |
| 232: | $this->eInvoicePaymentMethodSpecificOutput = $value->fromObject($object->eInvoicePaymentMethodSpecificOutput); |
| 233: | } |
| 234: | if (property_exists($object, 'invoicePaymentMethodSpecificOutput')) { |
| 235: | if (!is_object($object->invoicePaymentMethodSpecificOutput)) { |
| 236: | throw new UnexpectedValueException('value \'' . print_r($object->invoicePaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 237: | } |
| 238: | $value = new InvoicePaymentMethodSpecificOutput(); |
| 239: | $this->invoicePaymentMethodSpecificOutput = $value->fromObject($object->invoicePaymentMethodSpecificOutput); |
| 240: | } |
| 241: | if (property_exists($object, 'mobilePaymentMethodSpecificOutput')) { |
| 242: | if (!is_object($object->mobilePaymentMethodSpecificOutput)) { |
| 243: | throw new UnexpectedValueException('value \'' . print_r($object->mobilePaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 244: | } |
| 245: | $value = new MobilePaymentMethodSpecificOutput(); |
| 246: | $this->mobilePaymentMethodSpecificOutput = $value->fromObject($object->mobilePaymentMethodSpecificOutput); |
| 247: | } |
| 248: | if (property_exists($object, 'operations')) { |
| 249: | if (!is_array($object->operations) && !is_object($object->operations)) { |
| 250: | throw new UnexpectedValueException('value \'' . print_r($object->operations, true) . '\' is not an array or object'); |
| 251: | } |
| 252: | $this->operations = []; |
| 253: | foreach ($object->operations as $element) { |
| 254: | $value = new PaymentOperation(); |
| 255: | $this->operations[] = $value->fromObject($element); |
| 256: | } |
| 257: | } |
| 258: | if (property_exists($object, 'paymentMethod')) { |
| 259: | $this->paymentMethod = $object->paymentMethod; |
| 260: | } |
| 261: | if (property_exists($object, 'redirectPaymentMethodSpecificOutput')) { |
| 262: | if (!is_object($object->redirectPaymentMethodSpecificOutput)) { |
| 263: | throw new UnexpectedValueException('value \'' . print_r($object->redirectPaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 264: | } |
| 265: | $value = new RedirectPaymentMethodSpecificOutput(); |
| 266: | $this->redirectPaymentMethodSpecificOutput = $value->fromObject($object->redirectPaymentMethodSpecificOutput); |
| 267: | } |
| 268: | if (property_exists($object, 'reversalReason')) { |
| 269: | $this->reversalReason = $object->reversalReason; |
| 270: | } |
| 271: | if (property_exists($object, 'sepaDirectDebitPaymentMethodSpecificOutput')) { |
| 272: | if (!is_object($object->sepaDirectDebitPaymentMethodSpecificOutput)) { |
| 273: | throw new UnexpectedValueException('value \'' . print_r($object->sepaDirectDebitPaymentMethodSpecificOutput, true) . '\' is not an object'); |
| 274: | } |
| 275: | $value = new SepaDirectDebitPaymentMethodSpecificOutput(); |
| 276: | $this->sepaDirectDebitPaymentMethodSpecificOutput = $value->fromObject($object->sepaDirectDebitPaymentMethodSpecificOutput); |
| 277: | } |
| 278: | return $this; |
| 279: | } |
| 280: | } |
| 281: | |