| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | namespace Worldline\Connect\Sdk\V1\Domain; |
| 7: | |
| 8: | use UnexpectedValueException; |
| 9: | use Worldline\Connect\Sdk\Domain\DataObject; |
| 10: | |
| 11: | |
| 12: | |
| 13: | |
| 14: | class OrderReferences extends DataObject |
| 15: | { |
| 16: | |
| 17: | |
| 18: | |
| 19: | public $descriptor = null; |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | public $invoiceData = null; |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public $merchantOrderId = null; |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public $merchantReference = null; |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | public $providerId = null; |
| 40: | |
| 41: | |
| 42: | |
| 43: | |
| 44: | public $providerMerchantId = null; |
| 45: | |
| 46: | |
| 47: | |
| 48: | |
| 49: | public function toObject() |
| 50: | { |
| 51: | $object = parent::toObject(); |
| 52: | if (!is_null($this->descriptor)) { |
| 53: | $object->descriptor = $this->descriptor; |
| 54: | } |
| 55: | if (!is_null($this->invoiceData)) { |
| 56: | $object->invoiceData = $this->invoiceData->toObject(); |
| 57: | } |
| 58: | if (!is_null($this->merchantOrderId)) { |
| 59: | $object->merchantOrderId = $this->merchantOrderId; |
| 60: | } |
| 61: | if (!is_null($this->merchantReference)) { |
| 62: | $object->merchantReference = $this->merchantReference; |
| 63: | } |
| 64: | if (!is_null($this->providerId)) { |
| 65: | $object->providerId = $this->providerId; |
| 66: | } |
| 67: | if (!is_null($this->providerMerchantId)) { |
| 68: | $object->providerMerchantId = $this->providerMerchantId; |
| 69: | } |
| 70: | return $object; |
| 71: | } |
| 72: | |
| 73: | |
| 74: | |
| 75: | |
| 76: | |
| 77: | |
| 78: | public function fromObject($object) |
| 79: | { |
| 80: | parent::fromObject($object); |
| 81: | if (property_exists($object, 'descriptor')) { |
| 82: | $this->descriptor = $object->descriptor; |
| 83: | } |
| 84: | if (property_exists($object, 'invoiceData')) { |
| 85: | if (!is_object($object->invoiceData)) { |
| 86: | throw new UnexpectedValueException('value \'' . print_r($object->invoiceData, true) . '\' is not an object'); |
| 87: | } |
| 88: | $value = new OrderInvoiceData(); |
| 89: | $this->invoiceData = $value->fromObject($object->invoiceData); |
| 90: | } |
| 91: | if (property_exists($object, 'merchantOrderId')) { |
| 92: | $this->merchantOrderId = $object->merchantOrderId; |
| 93: | } |
| 94: | if (property_exists($object, 'merchantReference')) { |
| 95: | $this->merchantReference = $object->merchantReference; |
| 96: | } |
| 97: | if (property_exists($object, 'providerId')) { |
| 98: | $this->providerId = $object->providerId; |
| 99: | } |
| 100: | if (property_exists($object, 'providerMerchantId')) { |
| 101: | $this->providerMerchantId = $object->providerMerchantId; |
| 102: | } |
| 103: | return $this; |
| 104: | } |
| 105: | } |
| 106: | |