| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | namespace Worldline\Acquiring\Sdk\V1\Domain; |
| 6: | |
| 7: | use UnexpectedValueException; |
| 8: | use Worldline\Acquiring\Sdk\Domain\DataObject; |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | class MerchantData extends DataObject |
| 14: | { |
| 15: | |
| 16: | |
| 17: | |
| 18: | public ?string $address = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | public ?string $city = null; |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | public ?string $countryCode = null; |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | public ?CustomerServiceData $customerServiceData = null; |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | public ?int $merchantCategoryCode = null; |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public ?string $name = null; |
| 44: | |
| 45: | |
| 46: | |
| 47: | |
| 48: | public ?string $paymentFacilitatorId = null; |
| 49: | |
| 50: | |
| 51: | |
| 52: | |
| 53: | public ?string $postalCode = null; |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public ?string $stateCode = null; |
| 59: | |
| 60: | |
| 61: | |
| 62: | |
| 63: | public ?string $subMerchantId = null; |
| 64: | |
| 65: | |
| 66: | |
| 67: | |
| 68: | public ?string $taxId = null; |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | public function toObject(): object |
| 74: | { |
| 75: | $object = parent::toObject(); |
| 76: | if (!is_null($this->address)) { |
| 77: | $object->address = $this->address; |
| 78: | } |
| 79: | if (!is_null($this->city)) { |
| 80: | $object->city = $this->city; |
| 81: | } |
| 82: | if (!is_null($this->countryCode)) { |
| 83: | $object->countryCode = $this->countryCode; |
| 84: | } |
| 85: | if (!is_null($this->customerServiceData)) { |
| 86: | $object->customerServiceData = $this->customerServiceData->toObject(); |
| 87: | } |
| 88: | if (!is_null($this->merchantCategoryCode)) { |
| 89: | $object->merchantCategoryCode = $this->merchantCategoryCode; |
| 90: | } |
| 91: | if (!is_null($this->name)) { |
| 92: | $object->name = $this->name; |
| 93: | } |
| 94: | if (!is_null($this->paymentFacilitatorId)) { |
| 95: | $object->paymentFacilitatorId = $this->paymentFacilitatorId; |
| 96: | } |
| 97: | if (!is_null($this->postalCode)) { |
| 98: | $object->postalCode = $this->postalCode; |
| 99: | } |
| 100: | if (!is_null($this->stateCode)) { |
| 101: | $object->stateCode = $this->stateCode; |
| 102: | } |
| 103: | if (!is_null($this->subMerchantId)) { |
| 104: | $object->subMerchantId = $this->subMerchantId; |
| 105: | } |
| 106: | if (!is_null($this->taxId)) { |
| 107: | $object->taxId = $this->taxId; |
| 108: | } |
| 109: | return $object; |
| 110: | } |
| 111: | |
| 112: | |
| 113: | |
| 114: | |
| 115: | |
| 116: | |
| 117: | |
| 118: | public function fromObject(object $object): MerchantData |
| 119: | { |
| 120: | parent::fromObject($object); |
| 121: | if (property_exists($object, 'address')) { |
| 122: | $this->address = $object->address; |
| 123: | } |
| 124: | if (property_exists($object, 'city')) { |
| 125: | $this->city = $object->city; |
| 126: | } |
| 127: | if (property_exists($object, 'countryCode')) { |
| 128: | $this->countryCode = $object->countryCode; |
| 129: | } |
| 130: | if (property_exists($object, 'customerServiceData')) { |
| 131: | if (!is_object($object->customerServiceData)) { |
| 132: | throw new UnexpectedValueException('value \'' . print_r($object->customerServiceData, true) . '\' is not an object'); |
| 133: | } |
| 134: | $value = new CustomerServiceData(); |
| 135: | $this->customerServiceData = $value->fromObject($object->customerServiceData); |
| 136: | } |
| 137: | if (property_exists($object, 'merchantCategoryCode')) { |
| 138: | $this->merchantCategoryCode = $object->merchantCategoryCode; |
| 139: | } |
| 140: | if (property_exists($object, 'name')) { |
| 141: | $this->name = $object->name; |
| 142: | } |
| 143: | if (property_exists($object, 'paymentFacilitatorId')) { |
| 144: | $this->paymentFacilitatorId = $object->paymentFacilitatorId; |
| 145: | } |
| 146: | if (property_exists($object, 'postalCode')) { |
| 147: | $this->postalCode = $object->postalCode; |
| 148: | } |
| 149: | if (property_exists($object, 'stateCode')) { |
| 150: | $this->stateCode = $object->stateCode; |
| 151: | } |
| 152: | if (property_exists($object, 'subMerchantId')) { |
| 153: | $this->subMerchantId = $object->subMerchantId; |
| 154: | } |
| 155: | if (property_exists($object, 'taxId')) { |
| 156: | $this->taxId = $object->taxId; |
| 157: | } |
| 158: | return $this; |
| 159: | } |
| 160: | } |
| 161: | |