@@ -13,9 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | class NotAllowedProperty extends \RuntimeException |
| 15 | 15 | { |
| 16 | - public function __construct($object, $property, Throwable $previous = null) |
|
| 17 | - { |
|
| 18 | - $message = sprintf('Not allowed property %s into %s class!', $property,get_class($object)); |
|
| 19 | - parent::__construct($message, 100, $previous); |
|
| 20 | - } |
|
| 16 | + public function __construct($object, $property, Throwable $previous = null) |
|
| 17 | + { |
|
| 18 | + $message = sprintf('Not allowed property %s into %s class!', $property,get_class($object)); |
|
| 19 | + parent::__construct($message, 100, $previous); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -8,390 +8,390 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class Address implements AddressInterface |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * First address line |
|
| 13 | - * |
|
| 14 | - * @var string $line1 |
|
| 15 | - */ |
|
| 16 | - protected $line1; |
|
| 17 | - /** |
|
| 18 | - * Second address line |
|
| 19 | - * |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 22 | - protected $line2; |
|
| 23 | - /** |
|
| 24 | - * Address Country |
|
| 25 | - * |
|
| 26 | - * @var string |
|
| 27 | - */ |
|
| 28 | - protected $country; |
|
| 29 | - /** |
|
| 30 | - * Address postal code |
|
| 31 | - * |
|
| 32 | - * @var string |
|
| 33 | - */ |
|
| 34 | - protected $postalCode; |
|
| 35 | - /** |
|
| 36 | - * Address City |
|
| 37 | - * |
|
| 38 | - * @var string |
|
| 39 | - */ |
|
| 40 | - protected $city; |
|
| 41 | - /** |
|
| 42 | - * @var string |
|
| 43 | - */ |
|
| 44 | - protected $countryEnName; |
|
| 45 | - /** |
|
| 46 | - * @var string |
|
| 47 | - */ |
|
| 48 | - protected $countryNativeName; |
|
| 49 | - /** |
|
| 50 | - * @var integer |
|
| 51 | - */ |
|
| 52 | - protected $regionId; |
|
| 53 | - /** |
|
| 54 | - * @var string |
|
| 55 | - */ |
|
| 56 | - protected $regionName; |
|
| 57 | - /** |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 60 | - protected $postCode; |
|
| 61 | - /** |
|
| 62 | - * @var string |
|
| 63 | - */ |
|
| 64 | - protected $landline; |
|
| 65 | - /** |
|
| 66 | - * @var string |
|
| 67 | - */ |
|
| 68 | - protected $addressLine1; |
|
| 69 | - /** |
|
| 70 | - * @var string |
|
| 71 | - */ |
|
| 72 | - protected $addressLine2; |
|
| 73 | - /** |
|
| 74 | - * Address State |
|
| 75 | - * |
|
| 76 | - * @var string |
|
| 77 | - */ |
|
| 78 | - protected $state; |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * Address constructor. |
|
| 82 | - * @param array|null $data |
|
| 83 | - */ |
|
| 84 | - function __construct(?array $data = []) |
|
| 85 | - { |
|
| 86 | - $this->setAddressLine1($data['address_line1']??null); |
|
| 87 | - $this->setAddressLine2($data['address_line2']??null); |
|
| 88 | - $this->setCity($data['city']??null); |
|
| 89 | - $this->setCountry($data['country']??null); |
|
| 90 | - $this->setCountryEnName($data['country_en_name']??null); |
|
| 91 | - $this->setCountryNativeName($data['country_native_name']??null); |
|
| 92 | - $this->setRegionId($data['region_id']??null); |
|
| 93 | - $this->setRegionName($data['region_name']??null); |
|
| 94 | - $this->setPostCode($data['post_code']??null); |
|
| 95 | - $this->setLandline($data['landline']??null); |
|
| 96 | - $this->setLine1($data['line1']??null); |
|
| 97 | - $this->setLine2($data['line2']??null); |
|
| 98 | - $this->setPostalCode($data['postal_code']??null); |
|
| 99 | - $this->setState($data['state']??null); |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - /** |
|
| 103 | - * Get $line1 |
|
| 104 | - * |
|
| 105 | - * @return string |
|
| 106 | - */ |
|
| 107 | - public function getLine1(): ?string |
|
| 108 | - { |
|
| 109 | - return $this->line1; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * Set $line1 |
|
| 114 | - * |
|
| 115 | - * @param string $line1 $line1 |
|
| 116 | - * |
|
| 117 | - * @return AddressInterface |
|
| 118 | - */ |
|
| 119 | - public function setLine1(?string $line1): AddressInterface |
|
| 120 | - { |
|
| 121 | - $this->line1 = $line1; |
|
| 122 | - |
|
| 123 | - return $this; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 127 | - * Get second address line |
|
| 128 | - * |
|
| 129 | - * @return string |
|
| 130 | - */ |
|
| 131 | - public function getLine2(): ?string |
|
| 132 | - { |
|
| 133 | - return $this->line2; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - /** |
|
| 137 | - * Set second address line |
|
| 138 | - * |
|
| 139 | - * @param string $line2 Second address line |
|
| 140 | - * |
|
| 141 | - * @return AddressInterface |
|
| 142 | - */ |
|
| 143 | - public function setLine2(?string $line2): AddressInterface |
|
| 144 | - { |
|
| 145 | - $this->line2 = $line2; |
|
| 146 | - |
|
| 147 | - return $this; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Get address Country |
|
| 152 | - * |
|
| 153 | - * @return string |
|
| 154 | - */ |
|
| 155 | - public function getCountry(): ?string |
|
| 156 | - { |
|
| 157 | - return $this->country; |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - /** |
|
| 161 | - * Set address Country |
|
| 162 | - * |
|
| 163 | - * @param string $country Address Country |
|
| 164 | - * |
|
| 165 | - * @return AddressInterface |
|
| 166 | - */ |
|
| 167 | - public function setCountry(?string $country): AddressInterface |
|
| 168 | - { |
|
| 169 | - $this->country = $country; |
|
| 170 | - |
|
| 171 | - return $this; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * Get address postal code |
|
| 176 | - * |
|
| 177 | - * @return string |
|
| 178 | - */ |
|
| 179 | - public function getPostalCode(): ?string |
|
| 180 | - { |
|
| 181 | - return $this->postalCode; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - /** |
|
| 185 | - * Set address postal code |
|
| 186 | - * |
|
| 187 | - * @param string $postalCode Address postal code |
|
| 188 | - * |
|
| 189 | - * @return AddressInterface |
|
| 190 | - */ |
|
| 191 | - public function setPostalCode(?string $postalCode): AddressInterface |
|
| 192 | - { |
|
| 193 | - $this->postalCode = $postalCode; |
|
| 194 | - |
|
| 195 | - return $this; |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - /** |
|
| 199 | - * Get address City |
|
| 200 | - * |
|
| 201 | - * @return string |
|
| 202 | - */ |
|
| 203 | - public function getCity(): ?string |
|
| 204 | - { |
|
| 205 | - return $this->city; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - /** |
|
| 209 | - * Set address City |
|
| 210 | - * |
|
| 211 | - * @param string $city Address City |
|
| 212 | - * |
|
| 213 | - * @return AddressInterface |
|
| 214 | - */ |
|
| 215 | - public function setCity(?string $city): AddressInterface |
|
| 216 | - { |
|
| 217 | - $this->city = $city; |
|
| 218 | - |
|
| 219 | - return $this; |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - /** |
|
| 223 | - * @return mixed |
|
| 224 | - */ |
|
| 225 | - public function getCountryEnName():? string |
|
| 226 | - { |
|
| 227 | - return $this->countryEnName; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - /** |
|
| 231 | - * @param mixed $countryEnName |
|
| 232 | - * @return AddressInterface |
|
| 233 | - */ |
|
| 234 | - public function setCountryEnName($countryEnName): AddressInterface |
|
| 235 | - { |
|
| 236 | - $this->countryEnName = $countryEnName; |
|
| 237 | - |
|
| 238 | - return $this; |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - /** |
|
| 242 | - * @return mixed |
|
| 243 | - */ |
|
| 244 | - public function getCountryNativeName():? string |
|
| 245 | - { |
|
| 246 | - return $this->countryNativeName; |
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * @param mixed $countryNativeName |
|
| 251 | - * @return Address |
|
| 252 | - */ |
|
| 253 | - public function setCountryNativeName(?string $countryNativeName): AddressInterface |
|
| 254 | - { |
|
| 255 | - $this->countryNativeName = $countryNativeName; |
|
| 256 | - |
|
| 257 | - return $this; |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * @return number|null |
|
| 262 | - */ |
|
| 263 | - public function getRegionId():? number |
|
| 264 | - { |
|
| 265 | - return $this->regionId; |
|
| 266 | - } |
|
| 267 | - |
|
| 268 | - /** |
|
| 269 | - * @param number|null $regionId |
|
| 270 | - * @return Address |
|
| 271 | - */ |
|
| 272 | - public function setRegionId(?number $regionId): AddressInterface |
|
| 273 | - { |
|
| 274 | - $this->regionId = $regionId; |
|
| 275 | - |
|
| 276 | - return $this; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - /** |
|
| 280 | - * @return string|null |
|
| 281 | - */ |
|
| 282 | - public function getRegionName():? string |
|
| 283 | - { |
|
| 284 | - return $this->regionName; |
|
| 285 | - } |
|
| 286 | - |
|
| 287 | - /** |
|
| 288 | - * @param string|null $regionName |
|
| 289 | - * @return AddressInterface |
|
| 290 | - */ |
|
| 291 | - public function setRegionName(?string $regionName): AddressInterface |
|
| 292 | - { |
|
| 293 | - $this->regionName = $regionName; |
|
| 294 | - |
|
| 295 | - return $this; |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * @return string|null |
|
| 300 | - */ |
|
| 301 | - public function getPostCode():? string |
|
| 302 | - { |
|
| 303 | - return $this->postCode; |
|
| 304 | - } |
|
| 305 | - |
|
| 306 | - /** |
|
| 307 | - * @param string|null $postCode |
|
| 308 | - * @return AddressInterface |
|
| 309 | - */ |
|
| 310 | - public function setPostCode(?string $postCode): AddressInterface |
|
| 311 | - { |
|
| 312 | - $this->postCode = $postCode; |
|
| 313 | - |
|
| 314 | - return $this; |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - /** |
|
| 318 | - * @return string|null |
|
| 319 | - */ |
|
| 320 | - public function getLandline():? string |
|
| 321 | - { |
|
| 322 | - return $this->landline; |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - /** |
|
| 326 | - * @param string|null $landline |
|
| 327 | - * @return AddressInterface |
|
| 328 | - */ |
|
| 329 | - public function setLandline(?string $landline): AddressInterface |
|
| 330 | - { |
|
| 331 | - $this->landline = $landline; |
|
| 332 | - |
|
| 333 | - return $this; |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - /** |
|
| 337 | - * @return string|null |
|
| 338 | - */ |
|
| 339 | - public function getAddressLine1():? string |
|
| 340 | - { |
|
| 341 | - return $this->addressLine1; |
|
| 342 | - } |
|
| 343 | - |
|
| 344 | - /** |
|
| 345 | - * @param string|null $addressLine1 |
|
| 346 | - * @return AddressInterface |
|
| 347 | - */ |
|
| 348 | - public function setAddressLine1(?string $addressLine1): AddressInterface |
|
| 349 | - { |
|
| 350 | - $this->addressLine1 = $addressLine1; |
|
| 351 | - |
|
| 352 | - return $this; |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - /** |
|
| 356 | - * @return string|null |
|
| 357 | - */ |
|
| 358 | - public function getAddressLine2():? string |
|
| 359 | - { |
|
| 360 | - return $this->addressLine2; |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - /** |
|
| 364 | - * @param string|null $addressLine2 |
|
| 365 | - * @return AddressInterface |
|
| 366 | - */ |
|
| 367 | - public function setAddressLine2(?string $addressLine2): AddressInterface |
|
| 368 | - { |
|
| 369 | - $this->addressLine2 = $addressLine2; |
|
| 370 | - |
|
| 371 | - return $this; |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - /** |
|
| 375 | - * Get address State |
|
| 376 | - * |
|
| 377 | - * @return string|null |
|
| 378 | - */ |
|
| 379 | - public function getState(): ?string |
|
| 380 | - { |
|
| 381 | - return $this->state; |
|
| 382 | - } |
|
| 383 | - |
|
| 384 | - /** |
|
| 385 | - * Set address State |
|
| 386 | - * |
|
| 387 | - * @param string|null $state Address State |
|
| 388 | - * |
|
| 389 | - * @return AddressInterface |
|
| 390 | - */ |
|
| 391 | - public function setState(?string $state): AddressInterface |
|
| 392 | - { |
|
| 393 | - $this->state = $state; |
|
| 394 | - |
|
| 395 | - return $this; |
|
| 396 | - } |
|
| 11 | + /** |
|
| 12 | + * First address line |
|
| 13 | + * |
|
| 14 | + * @var string $line1 |
|
| 15 | + */ |
|
| 16 | + protected $line1; |
|
| 17 | + /** |
|
| 18 | + * Second address line |
|
| 19 | + * |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | + protected $line2; |
|
| 23 | + /** |
|
| 24 | + * Address Country |
|
| 25 | + * |
|
| 26 | + * @var string |
|
| 27 | + */ |
|
| 28 | + protected $country; |
|
| 29 | + /** |
|
| 30 | + * Address postal code |
|
| 31 | + * |
|
| 32 | + * @var string |
|
| 33 | + */ |
|
| 34 | + protected $postalCode; |
|
| 35 | + /** |
|
| 36 | + * Address City |
|
| 37 | + * |
|
| 38 | + * @var string |
|
| 39 | + */ |
|
| 40 | + protected $city; |
|
| 41 | + /** |
|
| 42 | + * @var string |
|
| 43 | + */ |
|
| 44 | + protected $countryEnName; |
|
| 45 | + /** |
|
| 46 | + * @var string |
|
| 47 | + */ |
|
| 48 | + protected $countryNativeName; |
|
| 49 | + /** |
|
| 50 | + * @var integer |
|
| 51 | + */ |
|
| 52 | + protected $regionId; |
|
| 53 | + /** |
|
| 54 | + * @var string |
|
| 55 | + */ |
|
| 56 | + protected $regionName; |
|
| 57 | + /** |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | + protected $postCode; |
|
| 61 | + /** |
|
| 62 | + * @var string |
|
| 63 | + */ |
|
| 64 | + protected $landline; |
|
| 65 | + /** |
|
| 66 | + * @var string |
|
| 67 | + */ |
|
| 68 | + protected $addressLine1; |
|
| 69 | + /** |
|
| 70 | + * @var string |
|
| 71 | + */ |
|
| 72 | + protected $addressLine2; |
|
| 73 | + /** |
|
| 74 | + * Address State |
|
| 75 | + * |
|
| 76 | + * @var string |
|
| 77 | + */ |
|
| 78 | + protected $state; |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * Address constructor. |
|
| 82 | + * @param array|null $data |
|
| 83 | + */ |
|
| 84 | + function __construct(?array $data = []) |
|
| 85 | + { |
|
| 86 | + $this->setAddressLine1($data['address_line1']??null); |
|
| 87 | + $this->setAddressLine2($data['address_line2']??null); |
|
| 88 | + $this->setCity($data['city']??null); |
|
| 89 | + $this->setCountry($data['country']??null); |
|
| 90 | + $this->setCountryEnName($data['country_en_name']??null); |
|
| 91 | + $this->setCountryNativeName($data['country_native_name']??null); |
|
| 92 | + $this->setRegionId($data['region_id']??null); |
|
| 93 | + $this->setRegionName($data['region_name']??null); |
|
| 94 | + $this->setPostCode($data['post_code']??null); |
|
| 95 | + $this->setLandline($data['landline']??null); |
|
| 96 | + $this->setLine1($data['line1']??null); |
|
| 97 | + $this->setLine2($data['line2']??null); |
|
| 98 | + $this->setPostalCode($data['postal_code']??null); |
|
| 99 | + $this->setState($data['state']??null); |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + /** |
|
| 103 | + * Get $line1 |
|
| 104 | + * |
|
| 105 | + * @return string |
|
| 106 | + */ |
|
| 107 | + public function getLine1(): ?string |
|
| 108 | + { |
|
| 109 | + return $this->line1; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * Set $line1 |
|
| 114 | + * |
|
| 115 | + * @param string $line1 $line1 |
|
| 116 | + * |
|
| 117 | + * @return AddressInterface |
|
| 118 | + */ |
|
| 119 | + public function setLine1(?string $line1): AddressInterface |
|
| 120 | + { |
|
| 121 | + $this->line1 = $line1; |
|
| 122 | + |
|
| 123 | + return $this; |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + /** |
|
| 127 | + * Get second address line |
|
| 128 | + * |
|
| 129 | + * @return string |
|
| 130 | + */ |
|
| 131 | + public function getLine2(): ?string |
|
| 132 | + { |
|
| 133 | + return $this->line2; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + /** |
|
| 137 | + * Set second address line |
|
| 138 | + * |
|
| 139 | + * @param string $line2 Second address line |
|
| 140 | + * |
|
| 141 | + * @return AddressInterface |
|
| 142 | + */ |
|
| 143 | + public function setLine2(?string $line2): AddressInterface |
|
| 144 | + { |
|
| 145 | + $this->line2 = $line2; |
|
| 146 | + |
|
| 147 | + return $this; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Get address Country |
|
| 152 | + * |
|
| 153 | + * @return string |
|
| 154 | + */ |
|
| 155 | + public function getCountry(): ?string |
|
| 156 | + { |
|
| 157 | + return $this->country; |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * Set address Country |
|
| 162 | + * |
|
| 163 | + * @param string $country Address Country |
|
| 164 | + * |
|
| 165 | + * @return AddressInterface |
|
| 166 | + */ |
|
| 167 | + public function setCountry(?string $country): AddressInterface |
|
| 168 | + { |
|
| 169 | + $this->country = $country; |
|
| 170 | + |
|
| 171 | + return $this; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * Get address postal code |
|
| 176 | + * |
|
| 177 | + * @return string |
|
| 178 | + */ |
|
| 179 | + public function getPostalCode(): ?string |
|
| 180 | + { |
|
| 181 | + return $this->postalCode; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + /** |
|
| 185 | + * Set address postal code |
|
| 186 | + * |
|
| 187 | + * @param string $postalCode Address postal code |
|
| 188 | + * |
|
| 189 | + * @return AddressInterface |
|
| 190 | + */ |
|
| 191 | + public function setPostalCode(?string $postalCode): AddressInterface |
|
| 192 | + { |
|
| 193 | + $this->postalCode = $postalCode; |
|
| 194 | + |
|
| 195 | + return $this; |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + /** |
|
| 199 | + * Get address City |
|
| 200 | + * |
|
| 201 | + * @return string |
|
| 202 | + */ |
|
| 203 | + public function getCity(): ?string |
|
| 204 | + { |
|
| 205 | + return $this->city; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + /** |
|
| 209 | + * Set address City |
|
| 210 | + * |
|
| 211 | + * @param string $city Address City |
|
| 212 | + * |
|
| 213 | + * @return AddressInterface |
|
| 214 | + */ |
|
| 215 | + public function setCity(?string $city): AddressInterface |
|
| 216 | + { |
|
| 217 | + $this->city = $city; |
|
| 218 | + |
|
| 219 | + return $this; |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + /** |
|
| 223 | + * @return mixed |
|
| 224 | + */ |
|
| 225 | + public function getCountryEnName():? string |
|
| 226 | + { |
|
| 227 | + return $this->countryEnName; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + /** |
|
| 231 | + * @param mixed $countryEnName |
|
| 232 | + * @return AddressInterface |
|
| 233 | + */ |
|
| 234 | + public function setCountryEnName($countryEnName): AddressInterface |
|
| 235 | + { |
|
| 236 | + $this->countryEnName = $countryEnName; |
|
| 237 | + |
|
| 238 | + return $this; |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + /** |
|
| 242 | + * @return mixed |
|
| 243 | + */ |
|
| 244 | + public function getCountryNativeName():? string |
|
| 245 | + { |
|
| 246 | + return $this->countryNativeName; |
|
| 247 | + } |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * @param mixed $countryNativeName |
|
| 251 | + * @return Address |
|
| 252 | + */ |
|
| 253 | + public function setCountryNativeName(?string $countryNativeName): AddressInterface |
|
| 254 | + { |
|
| 255 | + $this->countryNativeName = $countryNativeName; |
|
| 256 | + |
|
| 257 | + return $this; |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * @return number|null |
|
| 262 | + */ |
|
| 263 | + public function getRegionId():? number |
|
| 264 | + { |
|
| 265 | + return $this->regionId; |
|
| 266 | + } |
|
| 267 | + |
|
| 268 | + /** |
|
| 269 | + * @param number|null $regionId |
|
| 270 | + * @return Address |
|
| 271 | + */ |
|
| 272 | + public function setRegionId(?number $regionId): AddressInterface |
|
| 273 | + { |
|
| 274 | + $this->regionId = $regionId; |
|
| 275 | + |
|
| 276 | + return $this; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + /** |
|
| 280 | + * @return string|null |
|
| 281 | + */ |
|
| 282 | + public function getRegionName():? string |
|
| 283 | + { |
|
| 284 | + return $this->regionName; |
|
| 285 | + } |
|
| 286 | + |
|
| 287 | + /** |
|
| 288 | + * @param string|null $regionName |
|
| 289 | + * @return AddressInterface |
|
| 290 | + */ |
|
| 291 | + public function setRegionName(?string $regionName): AddressInterface |
|
| 292 | + { |
|
| 293 | + $this->regionName = $regionName; |
|
| 294 | + |
|
| 295 | + return $this; |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * @return string|null |
|
| 300 | + */ |
|
| 301 | + public function getPostCode():? string |
|
| 302 | + { |
|
| 303 | + return $this->postCode; |
|
| 304 | + } |
|
| 305 | + |
|
| 306 | + /** |
|
| 307 | + * @param string|null $postCode |
|
| 308 | + * @return AddressInterface |
|
| 309 | + */ |
|
| 310 | + public function setPostCode(?string $postCode): AddressInterface |
|
| 311 | + { |
|
| 312 | + $this->postCode = $postCode; |
|
| 313 | + |
|
| 314 | + return $this; |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + /** |
|
| 318 | + * @return string|null |
|
| 319 | + */ |
|
| 320 | + public function getLandline():? string |
|
| 321 | + { |
|
| 322 | + return $this->landline; |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + /** |
|
| 326 | + * @param string|null $landline |
|
| 327 | + * @return AddressInterface |
|
| 328 | + */ |
|
| 329 | + public function setLandline(?string $landline): AddressInterface |
|
| 330 | + { |
|
| 331 | + $this->landline = $landline; |
|
| 332 | + |
|
| 333 | + return $this; |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + /** |
|
| 337 | + * @return string|null |
|
| 338 | + */ |
|
| 339 | + public function getAddressLine1():? string |
|
| 340 | + { |
|
| 341 | + return $this->addressLine1; |
|
| 342 | + } |
|
| 343 | + |
|
| 344 | + /** |
|
| 345 | + * @param string|null $addressLine1 |
|
| 346 | + * @return AddressInterface |
|
| 347 | + */ |
|
| 348 | + public function setAddressLine1(?string $addressLine1): AddressInterface |
|
| 349 | + { |
|
| 350 | + $this->addressLine1 = $addressLine1; |
|
| 351 | + |
|
| 352 | + return $this; |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + /** |
|
| 356 | + * @return string|null |
|
| 357 | + */ |
|
| 358 | + public function getAddressLine2():? string |
|
| 359 | + { |
|
| 360 | + return $this->addressLine2; |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + /** |
|
| 364 | + * @param string|null $addressLine2 |
|
| 365 | + * @return AddressInterface |
|
| 366 | + */ |
|
| 367 | + public function setAddressLine2(?string $addressLine2): AddressInterface |
|
| 368 | + { |
|
| 369 | + $this->addressLine2 = $addressLine2; |
|
| 370 | + |
|
| 371 | + return $this; |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + /** |
|
| 375 | + * Get address State |
|
| 376 | + * |
|
| 377 | + * @return string|null |
|
| 378 | + */ |
|
| 379 | + public function getState(): ?string |
|
| 380 | + { |
|
| 381 | + return $this->state; |
|
| 382 | + } |
|
| 383 | + |
|
| 384 | + /** |
|
| 385 | + * Set address State |
|
| 386 | + * |
|
| 387 | + * @param string|null $state Address State |
|
| 388 | + * |
|
| 389 | + * @return AddressInterface |
|
| 390 | + */ |
|
| 391 | + public function setState(?string $state): AddressInterface |
|
| 392 | + { |
|
| 393 | + $this->state = $state; |
|
| 394 | + |
|
| 395 | + return $this; |
|
| 396 | + } |
|
| 397 | 397 | } |
@@ -11,115 +11,115 @@ |
||
| 11 | 11 | const OAUTH_AUTHORIZATION = '/authorize'; |
| 12 | 12 | const OAUTH_TOKEN = '/token'; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Generate an url to merchant authorization. |
|
| 16 | - * |
|
| 17 | - * @param ContextInterface $context |
|
| 18 | - * @param boolean $minimal |
|
| 19 | - * @return string |
|
| 20 | - */ |
|
| 21 | - public static function getAuthorizationURL(ContextInterface $context, $minimal = true) |
|
| 22 | - { |
|
| 23 | - $queryString = [ |
|
| 24 | - 'client_id' => $context->getClientId(), |
|
| 25 | - 'client_secret' => $context->getClientSecret(), |
|
| 26 | - 'redirect_uri' => $context->getRedirectUri(), |
|
| 27 | - 'response_type' => 'code', |
|
| 28 | - ]; |
|
| 29 | - |
|
| 30 | - if (!$minimal) { |
|
| 31 | - $queryString = array_merge($queryString, [ |
|
| 32 | - 'scope' => $context->getScope(), |
|
| 33 | - 'state' => $context->getState(), |
|
| 34 | - ]); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - return SumUp::ENTRYPOINT . self::OAUTH_AUTHORIZATION . '?' . http_build_query($queryString); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - /** |
|
| 41 | - * Request an acess token from sumup services. |
|
| 42 | - * |
|
| 14 | + /** |
|
| 15 | + * Generate an url to merchant authorization. |
|
| 16 | + * |
|
| 17 | + * @param ContextInterface $context |
|
| 18 | + * @param boolean $minimal |
|
| 19 | + * @return string |
|
| 20 | + */ |
|
| 21 | + public static function getAuthorizationURL(ContextInterface $context, $minimal = true) |
|
| 22 | + { |
|
| 23 | + $queryString = [ |
|
| 24 | + 'client_id' => $context->getClientId(), |
|
| 25 | + 'client_secret' => $context->getClientSecret(), |
|
| 26 | + 'redirect_uri' => $context->getRedirectUri(), |
|
| 27 | + 'response_type' => 'code', |
|
| 28 | + ]; |
|
| 29 | + |
|
| 30 | + if (!$minimal) { |
|
| 31 | + $queryString = array_merge($queryString, [ |
|
| 32 | + 'scope' => $context->getScope(), |
|
| 33 | + 'state' => $context->getState(), |
|
| 34 | + ]); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + return SumUp::ENTRYPOINT . self::OAUTH_AUTHORIZATION . '?' . http_build_query($queryString); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + /** |
|
| 41 | + * Request an acess token from sumup services. |
|
| 42 | + * |
|
| 43 | 43 | * @param ContextInterface $context |
| 44 | 44 | * @param array|null $scopes |
| 45 | 45 | * @param array $options |
| 46 | 46 | * @return \BPCI\SumUp\OAuth\AccessToken |
| 47 | - */ |
|
| 47 | + */ |
|
| 48 | 48 | public static function getAccessToken( |
| 49 | 49 | ContextInterface $context, |
| 50 | 50 | array $scopes = null, |
| 51 | 51 | array $options = [] |
| 52 | 52 | ): AccessToken |
| 53 | - { |
|
| 54 | - $formParams = [ |
|
| 55 | - 'grant_type' => 'client_credentials', |
|
| 56 | - 'client_id' => $context->getClientId(), |
|
| 57 | - 'client_secret' => $context->getClientSecret(), |
|
| 58 | - ]; |
|
| 53 | + { |
|
| 54 | + $formParams = [ |
|
| 55 | + 'grant_type' => 'client_credentials', |
|
| 56 | + 'client_id' => $context->getClientId(), |
|
| 57 | + 'client_secret' => $context->getClientSecret(), |
|
| 58 | + ]; |
|
| 59 | 59 | |
| 60 | - if ($scopes !== null) { |
|
| 61 | - $formParams['scope'] = implode(',', $scopes); |
|
| 62 | - } |
|
| 60 | + if ($scopes !== null) { |
|
| 61 | + $formParams['scope'] = implode(',', $scopes); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | $client = SumUp::getClient($options); |
| 65 | 65 | |
| 66 | - $response = $client->request( |
|
| 67 | - 'POST', |
|
| 68 | - self::OAUTH_TOKEN, |
|
| 69 | - [ |
|
| 70 | - 'form_params' => $formParams, |
|
| 71 | - ]); |
|
| 72 | - |
|
| 73 | - $code = $response->getStatusCode(); |
|
| 74 | - if ($code !== 200) { |
|
| 75 | - $message = " Request code: $code \n Message: " . $response->getReasonPhrase(); |
|
| 76 | - throw new BadRequestException($message); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - $body = json_decode($response->getBody()->getContents(), true); |
|
| 80 | - $token_params = [ |
|
| 81 | - $body['access_token'], |
|
| 82 | - $body['token_type'], |
|
| 83 | - $body['expires_in'], |
|
| 84 | - ]; |
|
| 85 | - |
|
| 86 | - if (isset($body['scope'])) { |
|
| 87 | - $token_params[] = $body['scope']; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - return new AccessToken(...$token_params); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * If available check token or generate a new token |
|
| 95 | - * |
|
| 96 | - * @param ContextInterface $context |
|
| 97 | - * @param AccessToken $token |
|
| 98 | - * @param array $scopes |
|
| 66 | + $response = $client->request( |
|
| 67 | + 'POST', |
|
| 68 | + self::OAUTH_TOKEN, |
|
| 69 | + [ |
|
| 70 | + 'form_params' => $formParams, |
|
| 71 | + ]); |
|
| 72 | + |
|
| 73 | + $code = $response->getStatusCode(); |
|
| 74 | + if ($code !== 200) { |
|
| 75 | + $message = " Request code: $code \n Message: " . $response->getReasonPhrase(); |
|
| 76 | + throw new BadRequestException($message); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + $body = json_decode($response->getBody()->getContents(), true); |
|
| 80 | + $token_params = [ |
|
| 81 | + $body['access_token'], |
|
| 82 | + $body['token_type'], |
|
| 83 | + $body['expires_in'], |
|
| 84 | + ]; |
|
| 85 | + |
|
| 86 | + if (isset($body['scope'])) { |
|
| 87 | + $token_params[] = $body['scope']; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + return new AccessToken(...$token_params); |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * If available check token or generate a new token |
|
| 95 | + * |
|
| 96 | + * @param ContextInterface $context |
|
| 97 | + * @param AccessToken $token |
|
| 98 | + * @param array $scopes |
|
| 99 | 99 | * @param array $options |
| 100 | 100 | * |
| 101 | 101 | * @return \BPCI\SumUp\OAuth\AccessToken |
| 102 | - */ |
|
| 102 | + */ |
|
| 103 | 103 | public static function getValidToken( |
| 104 | 104 | ContextInterface $context, |
| 105 | 105 | AccessToken $token = null, |
| 106 | 106 | array $scopes = null, |
| 107 | 107 | array $options = [] |
| 108 | 108 | ): AccessToken |
| 109 | - { |
|
| 110 | - if ($token === null || !$token->isValid()) { |
|
| 109 | + { |
|
| 110 | + if ($token === null || !$token->isValid()) { |
|
| 111 | 111 | $token = AuthenticationHelper::getAccessToken($context, $scopes, $options); |
| 112 | - } |
|
| 113 | - |
|
| 114 | - return $token; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - public static function getOAuthHeader(AccessToken $token): array |
|
| 118 | - { |
|
| 119 | - return [ |
|
| 120 | - 'headers' => [ |
|
| 121 | - 'Authorization' => $token->getType() . ' ' . $token->getToken(), |
|
| 122 | - ], |
|
| 123 | - ]; |
|
| 124 | - } |
|
| 112 | + } |
|
| 113 | + |
|
| 114 | + return $token; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + public static function getOAuthHeader(AccessToken $token): array |
|
| 118 | + { |
|
| 119 | + return [ |
|
| 120 | + 'headers' => [ |
|
| 121 | + 'Authorization' => $token->getType() . ' ' . $token->getToken(), |
|
| 122 | + ], |
|
| 123 | + ]; |
|
| 124 | + } |
|
| 125 | 125 | } |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | class InvalidCheckoutException extends \RuntimeException |
| 8 | 8 | { |
| 9 | 9 | public function __construct(CheckoutInterface $checkout, $code = 10, Throwable $previous = null) |
| 10 | - { |
|
| 11 | - $message = sprintf(<<<MSG |
|
| 10 | + { |
|
| 11 | + $message = sprintf(<<<MSG |
|
| 12 | 12 | Something is wrong with this checkout: |
| 13 | 13 | checkout_reference: %s |
| 14 | 14 | amount: %s |
@@ -19,6 +19,6 @@ discard block |
||
| 19 | 19 | $checkout->getAmount(), |
| 20 | 20 | $checkout->getPayToEmail() |
| 21 | 21 | ); |
| 22 | - parent::__construct($message, $code, $previous); |
|
| 23 | - } |
|
| 22 | + parent::__construct($message, $code, $previous); |
|
| 23 | + } |
|
| 24 | 24 | } |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | ]; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - /** |
|
| 38 | + /** |
|
| 39 | 39 | * Retrieve a paymentInstrument from server and fill the $paymentInstrument Object with response. |
| 40 | - * |
|
| 41 | - */ |
|
| 40 | + * |
|
| 41 | + */ |
|
| 42 | 42 | public function get(): array |
| 43 | 43 | { |
| 44 | 44 | $response = []; |
@@ -50,49 +50,49 @@ discard block |
||
| 50 | 50 | }; |
| 51 | 51 | |
| 52 | 52 | return $response; |
| 53 | - } |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | + /** |
|
| 56 | 56 | * Delete an paymentInstrument from server. |
| 57 | - * |
|
| 57 | + * |
|
| 58 | 58 | * @param PaymentInstrumentInterface $paymentInstrument |
| 59 | 59 | * @return bool |
| 60 | - */ |
|
| 60 | + */ |
|
| 61 | 61 | public function disable(PaymentInstrumentInterface $paymentInstrument):?bool |
| 62 | 62 | { |
| 63 | 63 | $uri = self::getEndPoint().'/'.$paymentInstrument->getToken(); |
| 64 | 64 | |
| 65 | 65 | return $this->request('delete', $paymentInstrument, $uri); |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * CheckoutClientInterface constructor. |
|
| 70 | - * @param ContextInterface $context |
|
| 68 | + /** |
|
| 69 | + * CheckoutClientInterface constructor. |
|
| 70 | + * @param ContextInterface $context |
|
| 71 | 71 | * @param array $options |
| 72 | 72 | */ |
| 73 | 73 | public function __construct(ContextInterface $context, ?array $options = []) |
| 74 | - { |
|
| 74 | + { |
|
| 75 | 75 | $this->context = $context; |
| 76 | 76 | $this->options = $options; |
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * Return last response of client |
|
| 81 | - * @return ResponseInterface |
|
| 82 | - */ |
|
| 83 | - function getLastResponse(): ResponseInterface |
|
| 84 | - { |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * Return last response of client |
|
| 81 | + * @return ResponseInterface |
|
| 82 | + */ |
|
| 83 | + function getLastResponse(): ResponseInterface |
|
| 84 | + { |
|
| 85 | 85 | return $this->lastResponse; |
| 86 | - } |
|
| 87 | - |
|
| 88 | - /** |
|
| 89 | - * return the context used to created the client. |
|
| 90 | - * @return ContextInterface |
|
| 91 | - */ |
|
| 92 | - function getContext(): ContextInterface |
|
| 93 | - { |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + /** |
|
| 89 | + * return the context used to created the client. |
|
| 90 | + * @return ContextInterface |
|
| 91 | + */ |
|
| 92 | + function getContext(): ContextInterface |
|
| 93 | + { |
|
| 94 | 94 | return $this->context; |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * @param PaymentInstrumentInterface $object |
@@ -167,5 +167,5 @@ discard block |
||
| 167 | 167 | public function getCustomer(): CustomerInterface |
| 168 | 168 | { |
| 169 | 169 | return $this->customer; |
| 170 | - } |
|
| 170 | + } |
|
| 171 | 171 | } |
@@ -4,132 +4,132 @@ |
||
| 4 | 4 | |
| 5 | 5 | class Customer implements CustomerInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Customer SumUp ID |
|
| 9 | - * |
|
| 10 | - * @var string |
|
| 11 | - */ |
|
| 12 | - protected $customerId; |
|
| 13 | - |
|
| 14 | - /** |
|
| 15 | - * Customer Name |
|
| 16 | - * |
|
| 17 | - * @var string |
|
| 18 | - */ |
|
| 19 | - protected $name; |
|
| 20 | - |
|
| 21 | - /** |
|
| 22 | - * Customer phone |
|
| 23 | - * |
|
| 24 | - * @var string |
|
| 25 | - */ |
|
| 26 | - protected $phone; |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Cusomter address |
|
| 30 | - * |
|
| 31 | - * @var AddressInterface |
|
| 32 | - */ |
|
| 33 | - protected $address; |
|
| 34 | - |
|
| 35 | - function __construct(?array $data = []) |
|
| 36 | - { |
|
| 37 | - $this->setCustomerId($data['customer_id']??null); |
|
| 38 | - $personal_details = $data['personal_details']??$data; |
|
| 39 | - $this->setName($personal_details['name']??null); |
|
| 40 | - $this->setPhone($personal_details['phone']??null); |
|
| 41 | - $this->setAddress(new Address($personal_details['address']??null)); |
|
| 42 | - } |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Get customer SumUp ID |
|
| 46 | - * |
|
| 47 | - * @return string |
|
| 48 | - */ |
|
| 49 | - public function getCustomerId(): ?string |
|
| 50 | - { |
|
| 51 | - return $this->customerId; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Set customer SumUp ID |
|
| 56 | - * |
|
| 57 | - * @param string $customerId Customer SumUp ID |
|
| 58 | - * @return CustomerInterface |
|
| 59 | - */ |
|
| 60 | - public function setCustomerId(?string $customerId): CustomerInterface |
|
| 61 | - { |
|
| 62 | - $this->customerId = $customerId; |
|
| 63 | - |
|
| 64 | - return $this; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Get customer Name |
|
| 69 | - * |
|
| 70 | - * @return string |
|
| 71 | - */ |
|
| 72 | - public function getName(): ?string |
|
| 73 | - { |
|
| 74 | - return $this->name; |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * Set customer Name |
|
| 79 | - * |
|
| 7 | + /** |
|
| 8 | + * Customer SumUp ID |
|
| 9 | + * |
|
| 10 | + * @var string |
|
| 11 | + */ |
|
| 12 | + protected $customerId; |
|
| 13 | + |
|
| 14 | + /** |
|
| 15 | + * Customer Name |
|
| 16 | + * |
|
| 17 | + * @var string |
|
| 18 | + */ |
|
| 19 | + protected $name; |
|
| 20 | + |
|
| 21 | + /** |
|
| 22 | + * Customer phone |
|
| 23 | + * |
|
| 24 | + * @var string |
|
| 25 | + */ |
|
| 26 | + protected $phone; |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Cusomter address |
|
| 30 | + * |
|
| 31 | + * @var AddressInterface |
|
| 32 | + */ |
|
| 33 | + protected $address; |
|
| 34 | + |
|
| 35 | + function __construct(?array $data = []) |
|
| 36 | + { |
|
| 37 | + $this->setCustomerId($data['customer_id']??null); |
|
| 38 | + $personal_details = $data['personal_details']??$data; |
|
| 39 | + $this->setName($personal_details['name']??null); |
|
| 40 | + $this->setPhone($personal_details['phone']??null); |
|
| 41 | + $this->setAddress(new Address($personal_details['address']??null)); |
|
| 42 | + } |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Get customer SumUp ID |
|
| 46 | + * |
|
| 47 | + * @return string |
|
| 48 | + */ |
|
| 49 | + public function getCustomerId(): ?string |
|
| 50 | + { |
|
| 51 | + return $this->customerId; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Set customer SumUp ID |
|
| 56 | + * |
|
| 57 | + * @param string $customerId Customer SumUp ID |
|
| 58 | + * @return CustomerInterface |
|
| 59 | + */ |
|
| 60 | + public function setCustomerId(?string $customerId): CustomerInterface |
|
| 61 | + { |
|
| 62 | + $this->customerId = $customerId; |
|
| 63 | + |
|
| 64 | + return $this; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Get customer Name |
|
| 69 | + * |
|
| 70 | + * @return string |
|
| 71 | + */ |
|
| 72 | + public function getName(): ?string |
|
| 73 | + { |
|
| 74 | + return $this->name; |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * Set customer Name |
|
| 79 | + * |
|
| 80 | 80 | * @param string $name Customer Name |
| 81 | 81 | * @return Customer|CustomerInterface |
| 82 | - */ |
|
| 83 | - public function setName(?string $name): CustomerInterface |
|
| 84 | - { |
|
| 85 | - $this->name = $name; |
|
| 86 | - |
|
| 87 | - return $this; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * Get customer phone |
|
| 92 | - * |
|
| 93 | - * @return string |
|
| 94 | - */ |
|
| 95 | - public function getPhone(): ?string |
|
| 96 | - { |
|
| 97 | - return $this->phone; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - /** |
|
| 101 | - * Set customer phone |
|
| 102 | - * |
|
| 82 | + */ |
|
| 83 | + public function setName(?string $name): CustomerInterface |
|
| 84 | + { |
|
| 85 | + $this->name = $name; |
|
| 86 | + |
|
| 87 | + return $this; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * Get customer phone |
|
| 92 | + * |
|
| 93 | + * @return string |
|
| 94 | + */ |
|
| 95 | + public function getPhone(): ?string |
|
| 96 | + { |
|
| 97 | + return $this->phone; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + /** |
|
| 101 | + * Set customer phone |
|
| 102 | + * |
|
| 103 | 103 | * @param string $phone Customer phone |
| 104 | 104 | * @return Customer|CustomerInterface |
| 105 | - */ |
|
| 106 | - public function setPhone(?string $phone): CustomerInterface |
|
| 107 | - { |
|
| 108 | - $this->phone = $phone; |
|
| 109 | - |
|
| 110 | - return $this; |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 114 | - * Get cusomter address |
|
| 115 | - * |
|
| 116 | - * @return AddressInterface |
|
| 117 | - */ |
|
| 118 | - public function getAddress(): AddressInterface |
|
| 119 | - { |
|
| 120 | - return $this->address; |
|
| 121 | - } |
|
| 122 | - |
|
| 123 | - /** |
|
| 124 | - * Set cusomter address |
|
| 125 | - * |
|
| 126 | - * @param AddressInterface $address |
|
| 127 | - * @return Customer|CustomerInterface |
|
| 128 | - */ |
|
| 129 | - public function setAddress(AddressInterface $address): CustomerInterface |
|
| 130 | - { |
|
| 131 | - $this->address = $address; |
|
| 132 | - return $this; |
|
| 133 | - } |
|
| 105 | + */ |
|
| 106 | + public function setPhone(?string $phone): CustomerInterface |
|
| 107 | + { |
|
| 108 | + $this->phone = $phone; |
|
| 109 | + |
|
| 110 | + return $this; |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** |
|
| 114 | + * Get cusomter address |
|
| 115 | + * |
|
| 116 | + * @return AddressInterface |
|
| 117 | + */ |
|
| 118 | + public function getAddress(): AddressInterface |
|
| 119 | + { |
|
| 120 | + return $this->address; |
|
| 121 | + } |
|
| 122 | + |
|
| 123 | + /** |
|
| 124 | + * Set cusomter address |
|
| 125 | + * |
|
| 126 | + * @param AddressInterface $address |
|
| 127 | + * @return Customer|CustomerInterface |
|
| 128 | + */ |
|
| 129 | + public function setAddress(AddressInterface $address): CustomerInterface |
|
| 130 | + { |
|
| 131 | + $this->address = $address; |
|
| 132 | + return $this; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | 135 | } |
@@ -24,15 +24,15 @@ discard block |
||
| 24 | 24 | protected $options; |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | - * CheckoutClientInterface constructor. |
|
| 28 | - * @param ContextInterface $context |
|
| 27 | + * CheckoutClientInterface constructor. |
|
| 28 | + * @param ContextInterface $context |
|
| 29 | 29 | * @param array $options |
| 30 | 30 | */ |
| 31 | 31 | public function __construct(ContextInterface $context, ?array $options = []) |
| 32 | - { |
|
| 33 | - $this->context = $context; |
|
| 32 | + { |
|
| 33 | + $this->context = $context; |
|
| 34 | 34 | $this->options = $options; |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * @inheritDoc |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | public function setContext(ContextInterface $context): CustomerClientInterface |
| 77 | - { |
|
| 78 | - $this->context = $context; |
|
| 79 | - } |
|
| 77 | + { |
|
| 78 | + $this->context = $context; |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * @inheritDoc |
@@ -88,18 +88,18 @@ discard block |
||
| 88 | 88 | ]; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - function getLastResponse(): ResponseInterface |
|
| 92 | - { |
|
| 93 | - return $this->lastResponse; |
|
| 94 | - } |
|
| 91 | + function getLastResponse(): ResponseInterface |
|
| 92 | + { |
|
| 93 | + return $this->lastResponse; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * return the context used to created the client. |
|
| 99 | - * @return ContextInterface |
|
| 100 | - */ |
|
| 101 | - function getContext(): ContextInterface |
|
| 102 | - { |
|
| 97 | + /** |
|
| 98 | + * return the context used to created the client. |
|
| 99 | + * @return ContextInterface |
|
| 100 | + */ |
|
| 101 | + function getContext(): ContextInterface |
|
| 102 | + { |
|
| 103 | 103 | return $this->context; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -182,5 +182,5 @@ discard block |
||
| 182 | 182 | function getToken():? AccessToken |
| 183 | 183 | { |
| 184 | 184 | return $this->token; |
| 185 | - } |
|
| 185 | + } |
|
| 186 | 186 | } |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | interface CheckoutClientInterface extends SumUpClientInterface |
| 8 | 8 | { |
| 9 | - /** |
|
| 9 | + /** |
|
| 10 | 10 | * Create a checkout |
| 11 | 11 | * |
| 12 | 12 | * @param CheckoutInterface $checkout |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | /** |
| 28 | 28 | * @param CheckoutInterface $checkout |
| 29 | 29 | * @return string |
| 30 | - */ |
|
| 30 | + */ |
|
| 31 | 31 | static function getCompleteUrl(CheckoutInterface $checkout): string; |
| 32 | 32 | |
| 33 | 33 | } |
@@ -11,378 +11,378 @@ |
||
| 11 | 11 | |
| 12 | 12 | class Checkout implements CheckoutInterface, PropertyHandlerInterface |
| 13 | 13 | { |
| 14 | - use PropertyHandler; |
|
| 15 | - |
|
| 16 | - const PENDING = 'PENDING'; |
|
| 17 | - const COMPLETED = 'COMPLETED'; |
|
| 18 | - const FAILED = 'FAILED'; |
|
| 19 | - |
|
| 20 | - protected $id; |
|
| 21 | - protected $status; |
|
| 22 | - protected $amount; |
|
| 23 | - protected $feeAmount; |
|
| 24 | - protected $currency; |
|
| 25 | - protected $payToEmail; |
|
| 26 | - protected $payFromEmail; |
|
| 27 | - protected $description; |
|
| 28 | - protected $redirectUrl; |
|
| 29 | - protected $validUntil; |
|
| 30 | - protected $token; |
|
| 31 | - protected $transactionId; |
|
| 32 | - protected $transactionCode; |
|
| 33 | - protected $type; |
|
| 34 | - protected $installments; |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Checkout reference |
|
| 38 | - * |
|
| 39 | - * @var string |
|
| 40 | - */ |
|
| 41 | - protected $reference; |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Customer |
|
| 45 | - * |
|
| 46 | - * @var null|Customer |
|
| 47 | - */ |
|
| 48 | - protected $customer; |
|
| 49 | - |
|
| 50 | - /** |
|
| 14 | + use PropertyHandler; |
|
| 15 | + |
|
| 16 | + const PENDING = 'PENDING'; |
|
| 17 | + const COMPLETED = 'COMPLETED'; |
|
| 18 | + const FAILED = 'FAILED'; |
|
| 19 | + |
|
| 20 | + protected $id; |
|
| 21 | + protected $status; |
|
| 22 | + protected $amount; |
|
| 23 | + protected $feeAmount; |
|
| 24 | + protected $currency; |
|
| 25 | + protected $payToEmail; |
|
| 26 | + protected $payFromEmail; |
|
| 27 | + protected $description; |
|
| 28 | + protected $redirectUrl; |
|
| 29 | + protected $validUntil; |
|
| 30 | + protected $token; |
|
| 31 | + protected $transactionId; |
|
| 32 | + protected $transactionCode; |
|
| 33 | + protected $type; |
|
| 34 | + protected $installments; |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Checkout reference |
|
| 38 | + * |
|
| 39 | + * @var string |
|
| 40 | + */ |
|
| 41 | + protected $reference; |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Customer |
|
| 45 | + * |
|
| 46 | + * @var null|Customer |
|
| 47 | + */ |
|
| 48 | + protected $customer; |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | 51 | * PaymentInstrument |
| 52 | - * |
|
| 53 | - * |
|
| 52 | + * |
|
| 53 | + * |
|
| 54 | 54 | * @var null|PaymentInstrument |
| 55 | - */ |
|
| 56 | - protected $card; |
|
| 55 | + */ |
|
| 56 | + protected $card; |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - /** |
|
| 60 | - * checkout constructor |
|
| 61 | - * |
|
| 62 | - * @param array $data |
|
| 63 | - */ |
|
| 64 | - public function __construct(array $data = null) { |
|
| 65 | - if ($data !== null) { |
|
| 59 | + /** |
|
| 60 | + * checkout constructor |
|
| 61 | + * |
|
| 62 | + * @param array $data |
|
| 63 | + */ |
|
| 64 | + public function __construct(array $data = null) { |
|
| 65 | + if ($data !== null) { |
|
| 66 | 66 | $this->setAmount($data['amount']??0); |
| 67 | 67 | $this->setPayToEmail($data['pay_to_email']??''); |
| 68 | 68 | $this->setCheckoutReference($data['checkout_reference']??''); |
| 69 | 69 | $this->setCurrency($data['currency']??''); |
| 70 | - $this->setDescription($data['description']??null); |
|
| 71 | - $this->setFeeAmount($data['fee_amount']??null); |
|
| 72 | - $this->setPayFromEmail($data['pay_from_mail']??null); |
|
| 73 | - $this->setId($data['id']??null); |
|
| 74 | - $this->setRedirectUrl($data['redirect_url']??null); |
|
| 75 | - $this->setStatus($data['status']??null); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - /** |
|
| 80 | - * @inheritDoc |
|
| 81 | - */ |
|
| 82 | - public function isValid(): bool { |
|
| 83 | - return $this->getReference() !== null |
|
| 84 | - && $this->getAmount() !== null |
|
| 85 | - && $this->getPayToEmail() !== null |
|
| 70 | + $this->setDescription($data['description']??null); |
|
| 71 | + $this->setFeeAmount($data['fee_amount']??null); |
|
| 72 | + $this->setPayFromEmail($data['pay_from_mail']??null); |
|
| 73 | + $this->setId($data['id']??null); |
|
| 74 | + $this->setRedirectUrl($data['redirect_url']??null); |
|
| 75 | + $this->setStatus($data['status']??null); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + /** |
|
| 80 | + * @inheritDoc |
|
| 81 | + */ |
|
| 82 | + public function isValid(): bool { |
|
| 83 | + return $this->getReference() !== null |
|
| 84 | + && $this->getAmount() !== null |
|
| 85 | + && $this->getPayToEmail() !== null |
|
| 86 | 86 | && $this->getAmount() > 0 |
| 87 | - && Currency::isValid($this->getCurrency()); |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - /** |
|
| 91 | - * @inheritDoc |
|
| 92 | - */ |
|
| 93 | - public function getId():? string { |
|
| 94 | - return $this->id; |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * @inheritDoc |
|
| 99 | - */ |
|
| 100 | - public function setId(?string $id): CheckoutInterface { |
|
| 101 | - $this->id = $id; |
|
| 102 | - return $this; |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - /** |
|
| 106 | - * @inheritDoc |
|
| 107 | - */ |
|
| 108 | - public function getStatus():? string { |
|
| 109 | - return $this->status; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * @inheritDoc |
|
| 114 | - */ |
|
| 115 | - public function setStatus(?string $status): CheckoutInterface { |
|
| 116 | - $this->status = $status; |
|
| 117 | - return $this; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * @inheritDoc |
|
| 122 | - */ |
|
| 123 | - public function getAmount():? float { |
|
| 124 | - return $this->amount; |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - /** |
|
| 128 | - * @inheritDoc |
|
| 129 | - */ |
|
| 130 | - public function setAmount(float $amount): CheckoutInterface { |
|
| 131 | - $this->amount = $amount > 0 ? $amount : null; |
|
| 132 | - return $this; |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - /** |
|
| 136 | - * @inheritDoc |
|
| 137 | - */ |
|
| 138 | - public function getCurrency():? string { |
|
| 139 | - return $this->currency; |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - /** |
|
| 143 | - * @inheritDoc |
|
| 144 | - */ |
|
| 145 | - public function setCurrency(?string $currency): CheckoutInterface { |
|
| 146 | - $this->currency = $currency; |
|
| 147 | - return $this; |
|
| 148 | - } |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * @inheritDoc |
|
| 152 | - */ |
|
| 153 | - public function getPayToEmail():? string { |
|
| 154 | - return $this->payToEmail; |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - /** |
|
| 158 | - * @inheritDoc |
|
| 159 | - */ |
|
| 160 | - public function setPayToEmail(string $email): CheckoutInterface { |
|
| 161 | - $this->payToEmail = trim($email) === '' ? null : $email; |
|
| 162 | - return $this; |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * @inheritDoc |
|
| 167 | - */ |
|
| 168 | - public function getCheckoutReference():? string { |
|
| 169 | - return $this->reference; |
|
| 170 | - } |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * @inheritDoc |
|
| 174 | - */ |
|
| 175 | - public function setCheckoutReference(string $reference): CheckoutInterface { |
|
| 176 | - $this->reference = trim($reference) === '' ? null : $reference; |
|
| 177 | - return $this; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - /** |
|
| 181 | - * @inheritDoc |
|
| 182 | - */ |
|
| 183 | - public function getDescription():? string { |
|
| 184 | - return $this->description; |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - /** |
|
| 188 | - * @inheritDoc |
|
| 189 | - */ |
|
| 190 | - public function setDescription(?string $description): CheckoutInterface { |
|
| 191 | - $this->description = $description; |
|
| 192 | - return $this; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * @inheritDoc |
|
| 197 | - */ |
|
| 198 | - public function getFeeAmount():? float { |
|
| 199 | - return $this->feeAmount; |
|
| 200 | - } |
|
| 201 | - |
|
| 202 | - /** |
|
| 203 | - * @inheritDoc |
|
| 204 | - */ |
|
| 205 | - public function setFeeAmount(?float $fee): CheckoutInterface { |
|
| 206 | - $this->feeAmount = $fee; |
|
| 207 | - return $this; |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - /** |
|
| 211 | - * @inheritDoc |
|
| 212 | - */ |
|
| 213 | - public function getPayFromEmail():? string { |
|
| 214 | - return $this->payFromEmail; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - /** |
|
| 218 | - * @inheritDoc |
|
| 219 | - */ |
|
| 220 | - public function setPayFromEmail(?string $email): CheckoutInterface { |
|
| 221 | - $this->payFromEmail = $email; |
|
| 222 | - return $this; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - /** |
|
| 226 | - * @inheritDoc |
|
| 227 | - */ |
|
| 228 | - public function getRedirectUrl():? string { |
|
| 229 | - return $this->redirectUrl; |
|
| 230 | - } |
|
| 231 | - |
|
| 232 | - /** |
|
| 233 | - * @inheritDoc |
|
| 234 | - */ |
|
| 235 | - public function setRedirectUrl(?string $url): CheckoutInterface { |
|
| 236 | - $this->redirectUrl = $url; |
|
| 237 | - return $this; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - function getValidUntil():? string { |
|
| 241 | - return $this->validUntil; |
|
| 242 | - } |
|
| 243 | - |
|
| 244 | - function setValidUntil(?string $timestamp): CheckoutInterface { |
|
| 245 | - $this->validUntil = $timestamp; |
|
| 246 | - return $this; |
|
| 247 | - } |
|
| 248 | - |
|
| 249 | - function getTransactionCode():? string { |
|
| 250 | - return $this->transactionCode; |
|
| 251 | - } |
|
| 252 | - |
|
| 253 | - function setTransactionCode(?string $code): CheckoutInterface { |
|
| 254 | - $this->transactionCode = $code; |
|
| 255 | - return $this; |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - function getTransactionId():? string { |
|
| 259 | - return $this->transactionId; |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - function setTransactionId(?string $id): CheckoutInterface { |
|
| 263 | - $this->transactionId = $id; |
|
| 264 | - return $this; |
|
| 265 | - } |
|
| 266 | - |
|
| 267 | - function getTransactions():? array { |
|
| 87 | + && Currency::isValid($this->getCurrency()); |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + /** |
|
| 91 | + * @inheritDoc |
|
| 92 | + */ |
|
| 93 | + public function getId():? string { |
|
| 94 | + return $this->id; |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * @inheritDoc |
|
| 99 | + */ |
|
| 100 | + public function setId(?string $id): CheckoutInterface { |
|
| 101 | + $this->id = $id; |
|
| 102 | + return $this; |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + /** |
|
| 106 | + * @inheritDoc |
|
| 107 | + */ |
|
| 108 | + public function getStatus():? string { |
|
| 109 | + return $this->status; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * @inheritDoc |
|
| 114 | + */ |
|
| 115 | + public function setStatus(?string $status): CheckoutInterface { |
|
| 116 | + $this->status = $status; |
|
| 117 | + return $this; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * @inheritDoc |
|
| 122 | + */ |
|
| 123 | + public function getAmount():? float { |
|
| 124 | + return $this->amount; |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + /** |
|
| 128 | + * @inheritDoc |
|
| 129 | + */ |
|
| 130 | + public function setAmount(float $amount): CheckoutInterface { |
|
| 131 | + $this->amount = $amount > 0 ? $amount : null; |
|
| 132 | + return $this; |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + /** |
|
| 136 | + * @inheritDoc |
|
| 137 | + */ |
|
| 138 | + public function getCurrency():? string { |
|
| 139 | + return $this->currency; |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + /** |
|
| 143 | + * @inheritDoc |
|
| 144 | + */ |
|
| 145 | + public function setCurrency(?string $currency): CheckoutInterface { |
|
| 146 | + $this->currency = $currency; |
|
| 147 | + return $this; |
|
| 148 | + } |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * @inheritDoc |
|
| 152 | + */ |
|
| 153 | + public function getPayToEmail():? string { |
|
| 154 | + return $this->payToEmail; |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + /** |
|
| 158 | + * @inheritDoc |
|
| 159 | + */ |
|
| 160 | + public function setPayToEmail(string $email): CheckoutInterface { |
|
| 161 | + $this->payToEmail = trim($email) === '' ? null : $email; |
|
| 162 | + return $this; |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * @inheritDoc |
|
| 167 | + */ |
|
| 168 | + public function getCheckoutReference():? string { |
|
| 169 | + return $this->reference; |
|
| 170 | + } |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * @inheritDoc |
|
| 174 | + */ |
|
| 175 | + public function setCheckoutReference(string $reference): CheckoutInterface { |
|
| 176 | + $this->reference = trim($reference) === '' ? null : $reference; |
|
| 177 | + return $this; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + /** |
|
| 181 | + * @inheritDoc |
|
| 182 | + */ |
|
| 183 | + public function getDescription():? string { |
|
| 184 | + return $this->description; |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + /** |
|
| 188 | + * @inheritDoc |
|
| 189 | + */ |
|
| 190 | + public function setDescription(?string $description): CheckoutInterface { |
|
| 191 | + $this->description = $description; |
|
| 192 | + return $this; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * @inheritDoc |
|
| 197 | + */ |
|
| 198 | + public function getFeeAmount():? float { |
|
| 199 | + return $this->feeAmount; |
|
| 200 | + } |
|
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @inheritDoc |
|
| 204 | + */ |
|
| 205 | + public function setFeeAmount(?float $fee): CheckoutInterface { |
|
| 206 | + $this->feeAmount = $fee; |
|
| 207 | + return $this; |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + /** |
|
| 211 | + * @inheritDoc |
|
| 212 | + */ |
|
| 213 | + public function getPayFromEmail():? string { |
|
| 214 | + return $this->payFromEmail; |
|
| 215 | + } |
|
| 216 | + |
|
| 217 | + /** |
|
| 218 | + * @inheritDoc |
|
| 219 | + */ |
|
| 220 | + public function setPayFromEmail(?string $email): CheckoutInterface { |
|
| 221 | + $this->payFromEmail = $email; |
|
| 222 | + return $this; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + /** |
|
| 226 | + * @inheritDoc |
|
| 227 | + */ |
|
| 228 | + public function getRedirectUrl():? string { |
|
| 229 | + return $this->redirectUrl; |
|
| 230 | + } |
|
| 231 | + |
|
| 232 | + /** |
|
| 233 | + * @inheritDoc |
|
| 234 | + */ |
|
| 235 | + public function setRedirectUrl(?string $url): CheckoutInterface { |
|
| 236 | + $this->redirectUrl = $url; |
|
| 237 | + return $this; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + function getValidUntil():? string { |
|
| 241 | + return $this->validUntil; |
|
| 242 | + } |
|
| 243 | + |
|
| 244 | + function setValidUntil(?string $timestamp): CheckoutInterface { |
|
| 245 | + $this->validUntil = $timestamp; |
|
| 246 | + return $this; |
|
| 247 | + } |
|
| 248 | + |
|
| 249 | + function getTransactionCode():? string { |
|
| 250 | + return $this->transactionCode; |
|
| 251 | + } |
|
| 252 | + |
|
| 253 | + function setTransactionCode(?string $code): CheckoutInterface { |
|
| 254 | + $this->transactionCode = $code; |
|
| 255 | + return $this; |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + function getTransactionId():? string { |
|
| 259 | + return $this->transactionId; |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + function setTransactionId(?string $id): CheckoutInterface { |
|
| 263 | + $this->transactionId = $id; |
|
| 264 | + return $this; |
|
| 265 | + } |
|
| 266 | + |
|
| 267 | + function getTransactions():? array { |
|
| 268 | 268 | // return $this->transactions; |
| 269 | - //TODO remember myself whats is it. |
|
| 270 | - return []; |
|
| 271 | - } |
|
| 269 | + //TODO remember myself whats is it. |
|
| 270 | + return []; |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | - function setTransactions(?Array $transactions): CheckoutInterface { |
|
| 273 | + function setTransactions(?Array $transactions): CheckoutInterface { |
|
| 274 | 274 | // $this->transactions = $transactions; |
| 275 | - //TODO remember myself whats is it. |
|
| 276 | - return $this; |
|
| 277 | - } |
|
| 278 | - |
|
| 279 | - function getToken():? string { |
|
| 280 | - return $this->token; |
|
| 281 | - } |
|
| 282 | - |
|
| 283 | - function setToken(?string $token): CheckoutInterface { |
|
| 284 | - $this->token = $token; |
|
| 285 | - return $this; |
|
| 286 | - } |
|
| 287 | - |
|
| 288 | - /** |
|
| 289 | - * Get customer |
|
| 290 | - * @return CustomerInterface|null |
|
| 291 | - */ |
|
| 292 | - public function getCustomer(): ?CustomerInterface |
|
| 293 | - { |
|
| 294 | - return $this->customer; |
|
| 295 | - } |
|
| 296 | - |
|
| 297 | - /** |
|
| 298 | - * Set customer |
|
| 299 | - * |
|
| 300 | - * @param null|CustomerInterface $customer Customer |
|
| 301 | - * |
|
| 302 | - * @return CheckoutInterface |
|
| 303 | - */ |
|
| 304 | - public function setCustomer(?CustomerInterface $customer): CheckoutInterface |
|
| 305 | - { |
|
| 306 | - $this->customer = $customer; |
|
| 307 | - |
|
| 308 | - return $this; |
|
| 309 | - } |
|
| 310 | - |
|
| 311 | - /** |
|
| 312 | - * Get card |
|
| 313 | - * |
|
| 275 | + //TODO remember myself whats is it. |
|
| 276 | + return $this; |
|
| 277 | + } |
|
| 278 | + |
|
| 279 | + function getToken():? string { |
|
| 280 | + return $this->token; |
|
| 281 | + } |
|
| 282 | + |
|
| 283 | + function setToken(?string $token): CheckoutInterface { |
|
| 284 | + $this->token = $token; |
|
| 285 | + return $this; |
|
| 286 | + } |
|
| 287 | + |
|
| 288 | + /** |
|
| 289 | + * Get customer |
|
| 290 | + * @return CustomerInterface|null |
|
| 291 | + */ |
|
| 292 | + public function getCustomer(): ?CustomerInterface |
|
| 293 | + { |
|
| 294 | + return $this->customer; |
|
| 295 | + } |
|
| 296 | + |
|
| 297 | + /** |
|
| 298 | + * Set customer |
|
| 299 | + * |
|
| 300 | + * @param null|CustomerInterface $customer Customer |
|
| 301 | + * |
|
| 302 | + * @return CheckoutInterface |
|
| 303 | + */ |
|
| 304 | + public function setCustomer(?CustomerInterface $customer): CheckoutInterface |
|
| 305 | + { |
|
| 306 | + $this->customer = $customer; |
|
| 307 | + |
|
| 308 | + return $this; |
|
| 309 | + } |
|
| 310 | + |
|
| 311 | + /** |
|
| 312 | + * Get card |
|
| 313 | + * |
|
| 314 | 314 | * @return null|PaymentInstrumentInterface |
| 315 | - */ |
|
| 315 | + */ |
|
| 316 | 316 | public function getCard(): ?PaymentInstrumentInterface |
| 317 | - { |
|
| 318 | - return $this->card; |
|
| 319 | - } |
|
| 317 | + { |
|
| 318 | + return $this->card; |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - /** |
|
| 322 | - * Set card |
|
| 323 | - * |
|
| 321 | + /** |
|
| 322 | + * Set card |
|
| 323 | + * |
|
| 324 | 324 | * @param null|PaymentInstrumentInterface $card |
| 325 | - * |
|
| 326 | - * @return CheckoutInterface |
|
| 327 | - */ |
|
| 325 | + * |
|
| 326 | + * @return CheckoutInterface |
|
| 327 | + */ |
|
| 328 | 328 | public function setCard(?PaymentInstrumentInterface $card): CheckoutInterface |
| 329 | - { |
|
| 330 | - $this->card = $card; |
|
| 331 | - |
|
| 332 | - return $this; |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - /** |
|
| 336 | - * Get checkout reference |
|
| 337 | - * |
|
| 338 | - * @return string |
|
| 339 | - */ |
|
| 340 | - public function getReference(): ?string |
|
| 341 | - { |
|
| 342 | - return $this->reference; |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - /** |
|
| 346 | - * Set checkout reference |
|
| 347 | - * |
|
| 348 | - * @param string $reference Checkout reference |
|
| 349 | - * |
|
| 350 | - * @return CheckoutInterface |
|
| 351 | - */ |
|
| 352 | - public function setReference(?string $reference): CheckoutInterface |
|
| 353 | - { |
|
| 354 | - $this->reference = $reference; |
|
| 355 | - |
|
| 356 | - return $this; |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * @return mixed |
|
| 361 | - */ |
|
| 362 | - public function getType():? string |
|
| 363 | - { |
|
| 364 | - return $this->type; |
|
| 365 | - } |
|
| 366 | - |
|
| 367 | - /** |
|
| 368 | - * @param mixed $type |
|
| 369 | - * @return CheckoutInterface |
|
| 370 | - */ |
|
| 371 | - public function setType(?string $type = null): CheckoutInterface |
|
| 372 | - { |
|
| 373 | - $this->type = $type; |
|
| 374 | - |
|
| 375 | - return $this; |
|
| 376 | - } |
|
| 377 | - |
|
| 378 | - public function setInstallments(?string $installments): CheckoutInterface{ |
|
| 379 | - $this->installments = $installments; |
|
| 380 | - return $this; |
|
| 381 | - } |
|
| 382 | - |
|
| 383 | - public function getInstallments(): string |
|
| 384 | - { |
|
| 385 | - return $this->installments; |
|
| 386 | - } |
|
| 329 | + { |
|
| 330 | + $this->card = $card; |
|
| 331 | + |
|
| 332 | + return $this; |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + /** |
|
| 336 | + * Get checkout reference |
|
| 337 | + * |
|
| 338 | + * @return string |
|
| 339 | + */ |
|
| 340 | + public function getReference(): ?string |
|
| 341 | + { |
|
| 342 | + return $this->reference; |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + /** |
|
| 346 | + * Set checkout reference |
|
| 347 | + * |
|
| 348 | + * @param string $reference Checkout reference |
|
| 349 | + * |
|
| 350 | + * @return CheckoutInterface |
|
| 351 | + */ |
|
| 352 | + public function setReference(?string $reference): CheckoutInterface |
|
| 353 | + { |
|
| 354 | + $this->reference = $reference; |
|
| 355 | + |
|
| 356 | + return $this; |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * @return mixed |
|
| 361 | + */ |
|
| 362 | + public function getType():? string |
|
| 363 | + { |
|
| 364 | + return $this->type; |
|
| 365 | + } |
|
| 366 | + |
|
| 367 | + /** |
|
| 368 | + * @param mixed $type |
|
| 369 | + * @return CheckoutInterface |
|
| 370 | + */ |
|
| 371 | + public function setType(?string $type = null): CheckoutInterface |
|
| 372 | + { |
|
| 373 | + $this->type = $type; |
|
| 374 | + |
|
| 375 | + return $this; |
|
| 376 | + } |
|
| 377 | + |
|
| 378 | + public function setInstallments(?string $installments): CheckoutInterface{ |
|
| 379 | + $this->installments = $installments; |
|
| 380 | + return $this; |
|
| 381 | + } |
|
| 382 | + |
|
| 383 | + public function getInstallments(): string |
|
| 384 | + { |
|
| 385 | + return $this->installments; |
|
| 386 | + } |
|
| 387 | 387 | |
| 388 | 388 | } |