|
| 1 | +<?php declare(strict_types=1); |
| 2 | + |
| 3 | +namespace Ypmn; |
| 4 | + |
| 5 | +use JsonSerializable; |
| 6 | + |
| 7 | +class PodeliMerchant implements JsonSerializable |
| 8 | +{ |
| 9 | + /** |
| 10 | + * @notBlank |
| 11 | + * |
| 12 | + */ |
| 13 | + private string $login; |
| 14 | + |
| 15 | + /** @notBlank */ |
| 16 | + private string $name; |
| 17 | + |
| 18 | + /** @notBlank */ |
| 19 | + private string $legalEntity; |
| 20 | + |
| 21 | + /** @notBlank */ |
| 22 | + private string $inn; |
| 23 | + |
| 24 | + /** @notBlank */ |
| 25 | + private string $mcc; |
| 26 | + |
| 27 | + /** @notBlank */ |
| 28 | + private string $email; |
| 29 | + |
| 30 | + /** @notBlank */ |
| 31 | + private string $siteUrl; |
| 32 | + |
| 33 | + /** @notBlank */ |
| 34 | + private string $agreementSignDate; |
| 35 | + |
| 36 | + /** |
| 37 | + * @isLinkType |
| 38 | + */ |
| 39 | + private PodeliMerchantBankDetails $requisite; |
| 40 | + |
| 41 | + /** |
| 42 | + * @isLinkType |
| 43 | + */ |
| 44 | + private PodeliMerchantAddress $address; |
| 45 | + |
| 46 | + public function getLogin(): string |
| 47 | + { |
| 48 | + return $this->login; |
| 49 | + } |
| 50 | + |
| 51 | + public function setLogin(string $login): PodeliMerchant |
| 52 | + { |
| 53 | + $this->login = $login; |
| 54 | + |
| 55 | + return $this; |
| 56 | + } |
| 57 | + |
| 58 | + public function getName(): string |
| 59 | + { |
| 60 | + return $this->name; |
| 61 | + } |
| 62 | + |
| 63 | + public function setName(string $name): PodeliMerchant |
| 64 | + { |
| 65 | + $this->name = $name; |
| 66 | + |
| 67 | + return $this; |
| 68 | + } |
| 69 | + |
| 70 | + public function getLegalEntity(): string |
| 71 | + { |
| 72 | + return $this->legalEntity; |
| 73 | + } |
| 74 | + |
| 75 | + public function setLegalEntity(string $legalEntity): PodeliMerchant |
| 76 | + { |
| 77 | + $this->legalEntity = $legalEntity; |
| 78 | + |
| 79 | + return $this; |
| 80 | + } |
| 81 | + |
| 82 | + public function getInn(): string |
| 83 | + { |
| 84 | + return $this->inn; |
| 85 | + } |
| 86 | + |
| 87 | + public function setInn(string $inn): PodeliMerchant |
| 88 | + { |
| 89 | + $this->inn = $inn; |
| 90 | + |
| 91 | + return $this; |
| 92 | + } |
| 93 | + |
| 94 | + public function getMcc(): string |
| 95 | + { |
| 96 | + return $this->mcc; |
| 97 | + } |
| 98 | + |
| 99 | + public function setMcc(string $mcc): PodeliMerchant |
| 100 | + { |
| 101 | + $this->mcc = $mcc; |
| 102 | + |
| 103 | + return $this; |
| 104 | + } |
| 105 | + |
| 106 | + public function getEmail(): string |
| 107 | + { |
| 108 | + return $this->email; |
| 109 | + } |
| 110 | + |
| 111 | + public function setEmail(string $email): PodeliMerchant |
| 112 | + { |
| 113 | + $this->email = $email; |
| 114 | + |
| 115 | + return $this; |
| 116 | + } |
| 117 | + |
| 118 | + public function getSiteUrl(): string |
| 119 | + { |
| 120 | + return $this->siteUrl; |
| 121 | + } |
| 122 | + |
| 123 | + public function setSiteUrl(string $siteUrl): PodeliMerchant |
| 124 | + { |
| 125 | + $this->siteUrl = $siteUrl; |
| 126 | + |
| 127 | + return $this; |
| 128 | + } |
| 129 | + |
| 130 | + public function getAgreementSignDate(): string |
| 131 | + { |
| 132 | + return $this->agreementSignDate; |
| 133 | + } |
| 134 | + |
| 135 | + public function setAgreementSignDate(string $agreementSignDate): PodeliMerchant |
| 136 | + { |
| 137 | + $this->agreementSignDate = $agreementSignDate; |
| 138 | + |
| 139 | + return $this; |
| 140 | + } |
| 141 | + |
| 142 | + public function getBankDetails(): PodeliMerchantBankDetails |
| 143 | + { |
| 144 | + return $this->requisite; |
| 145 | + } |
| 146 | + |
| 147 | + public function setBankDetails(PodeliMerchantBankDetails $requisite): PodeliMerchant |
| 148 | + { |
| 149 | + $this->requisite = $requisite; |
| 150 | + |
| 151 | + return $this; |
| 152 | + } |
| 153 | + |
| 154 | + public function getAddress(): PodeliMerchantAddress |
| 155 | + { |
| 156 | + return $this->address; |
| 157 | + } |
| 158 | + |
| 159 | + public function setAddress(PodeliMerchantAddress $address): PodeliMerchant |
| 160 | + { |
| 161 | + $this->address = $address; |
| 162 | + |
| 163 | + return $this; |
| 164 | + } |
| 165 | + |
| 166 | + public function getAsArray(): array |
| 167 | + { |
| 168 | + return array_filter([ |
| 169 | + 'login' => $this->login, |
| 170 | + 'name' => $this->name, |
| 171 | + 'legalEntity' => $this->legalEntity, |
| 172 | + 'inn' => $this->inn, |
| 173 | + 'mcc' => $this->mcc, |
| 174 | + 'email' => $this->email, |
| 175 | + 'siteUrl' => $this->siteUrl, |
| 176 | + 'agreementSignDate' => $this->agreementSignDate, |
| 177 | + 'requisite' => $this->requisite->getAsArray(), |
| 178 | + 'address' => $this->address->getAsArray(), |
| 179 | + ], fn($value) => !is_null($value)); |
| 180 | + } |
| 181 | + |
| 182 | + #[\ReturnTypeWillChange] |
| 183 | + public function jsonSerialize() |
| 184 | + { |
| 185 | + return json_encode($this->getAsArray(), JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT|JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_LINE_TERMINATORS); |
| 186 | + } |
| 187 | +} |
0 commit comments