Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | declare(strict_types=1); |
| 3 | /** |
| 4 | * Pop PHP Framework (https://www.popphp.org/) |
| 5 | * |
| 6 | * @link https://github.com/popphp/popphp-framework |
| 7 | * @author Nick Sagona, III <dev@noladev.com> |
| 8 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 9 | * @license https://www.popphp.org/license New BSD License |
| 10 | */ |
| 11 | |
| 12 | /** |
| 13 | * @namespace |
| 14 | */ |
| 15 | namespace Pop\Shipping\Adapter; |
| 16 | |
| 17 | use Pop\Shipping\Address; |
| 18 | use Pop\Shipping\Package; |
| 19 | |
| 20 | /** |
| 21 | * Pop shipping adapter interface |
| 22 | * |
| 23 | * @category Pop |
| 24 | * @package Pop\Shipping |
| 25 | * @author Nick Sagona, III <dev@noladev.com> |
| 26 | * @copyright Copyright (c) 2009-2027 NOLA Interactive, LLC. |
| 27 | * @license https://www.popphp.org/license New BSD License |
| 28 | * @version 4.0.0 |
| 29 | */ |
| 30 | interface AdapterInterface |
| 31 | { |
| 32 | |
| 33 | /** |
| 34 | * Set rates API URL |
| 35 | * |
| 36 | * @param string $ratesApiUrl |
| 37 | * @return AdapterInterface |
| 38 | */ |
| 39 | public function setRatesApiUrl(string $ratesApiUrl): AdapterInterface; |
| 40 | |
| 41 | /** |
| 42 | * Set tracking API URL |
| 43 | * |
| 44 | * @param string $trackingApiUrl |
| 45 | * @return AdapterInterface |
| 46 | */ |
| 47 | public function setTrackingApiUrl(string $trackingApiUrl): AdapterInterface; |
| 48 | |
| 49 | /** |
| 50 | * Set user-agent |
| 51 | * |
| 52 | * @param string $userAgent |
| 53 | * @return AdapterInterface |
| 54 | */ |
| 55 | public function setUserAgent(string $userAgent): AdapterInterface; |
| 56 | |
| 57 | /** |
| 58 | * Get rates API URL |
| 59 | * |
| 60 | * @return ?string |
| 61 | */ |
| 62 | public function getRatesApiUrl(): ?string; |
| 63 | |
| 64 | /** |
| 65 | * Get tracking API URL |
| 66 | * |
| 67 | * @return ?string |
| 68 | */ |
| 69 | public function getTrackingApiUrl(): ?string; |
| 70 | |
| 71 | /** |
| 72 | * Get user-agent |
| 73 | * |
| 74 | * @return string |
| 75 | */ |
| 76 | public function getUserAgent(): string; |
| 77 | |
| 78 | /** |
| 79 | * Has rates API URL |
| 80 | * |
| 81 | * @return bool |
| 82 | */ |
| 83 | public function hasRatesApiUrl(): bool; |
| 84 | |
| 85 | /** |
| 86 | * Has tracking API URL |
| 87 | * |
| 88 | * @return bool |
| 89 | */ |
| 90 | public function hasTrackingApiUrl(): bool; |
| 91 | |
| 92 | /** |
| 93 | * Add shipping packages |
| 94 | * |
| 95 | * @param array $packages |
| 96 | * @return AdapterInterface |
| 97 | */ |
| 98 | public function addPackages(array $packages): AdapterInterface; |
| 99 | |
| 100 | /** |
| 101 | * Add shipping package |
| 102 | * |
| 103 | * @param Package $package |
| 104 | * @return AdapterInterface |
| 105 | */ |
| 106 | public function addPackage(Package $package): AdapterInterface; |
| 107 | |
| 108 | /** |
| 109 | * Get shipping packages |
| 110 | * |
| 111 | * @return array |
| 112 | */ |
| 113 | public function getPackages(): array; |
| 114 | |
| 115 | /** |
| 116 | * Get shipping package |
| 117 | * |
| 118 | * @param mixed $id |
| 119 | * @return ?Package |
| 120 | */ |
| 121 | public function getPackage(mixed $id): ?Package; |
| 122 | |
| 123 | /** |
| 124 | * Has shipping packages |
| 125 | * |
| 126 | * @return bool |
| 127 | */ |
| 128 | public function hasPackages(): bool; |
| 129 | |
| 130 | /** |
| 131 | * Has shipping package |
| 132 | * |
| 133 | * @param mixed $id |
| 134 | * @return bool |
| 135 | */ |
| 136 | public function hasPackage(mixed $id): bool; |
| 137 | |
| 138 | /** |
| 139 | * Add shipping tracking numbers |
| 140 | * |
| 141 | * @param array $trackingNumbers |
| 142 | * @return AdapterInterface |
| 143 | */ |
| 144 | public function addTrackingNumbers(array $trackingNumbers): AdapterInterface; |
| 145 | |
| 146 | /** |
| 147 | * Add shipping tracking number |
| 148 | * |
| 149 | * @param string $trackingNumber |
| 150 | * @return AdapterInterface |
| 151 | */ |
| 152 | public function addTrackingNumber(string $trackingNumber): AdapterInterface; |
| 153 | |
| 154 | /** |
| 155 | * Get shipping packages |
| 156 | * |
| 157 | * @return array |
| 158 | */ |
| 159 | public function getTrackingNumbers(): array; |
| 160 | |
| 161 | /** |
| 162 | * Has shipping tracking numbers |
| 163 | * |
| 164 | * @return bool |
| 165 | */ |
| 166 | public function hasTrackingNumbers(): bool; |
| 167 | |
| 168 | /** |
| 169 | * Has shipping tracking number |
| 170 | * |
| 171 | * @param string $trackingNumber |
| 172 | * @return bool |
| 173 | */ |
| 174 | public function hasTrackingNumber(string $trackingNumber): bool; |
| 175 | |
| 176 | /** |
| 177 | * Set ship to |
| 178 | * |
| 179 | * @param array|Address $shipTo |
| 180 | * @return AbstractAdapter |
| 181 | */ |
| 182 | public function setShipTo(array|Address $shipTo): AbstractAdapter; |
| 183 | |
| 184 | /** |
| 185 | * Get ship to |
| 186 | * |
| 187 | * @return ?Address |
| 188 | */ |
| 189 | public function getShipTo(): ?Address; |
| 190 | |
| 191 | /** |
| 192 | * Has ship to |
| 193 | * |
| 194 | * @return bool |
| 195 | */ |
| 196 | public function hasShipTo(): bool; |
| 197 | |
| 198 | /** |
| 199 | * Set ship from |
| 200 | * |
| 201 | * @param array|Address $shipFrom |
| 202 | * @return AbstractAdapter |
| 203 | */ |
| 204 | public function setShipFrom(array|Address $shipFrom): AbstractAdapter; |
| 205 | |
| 206 | /** |
| 207 | * Get ship from |
| 208 | * |
| 209 | * @return ?Address |
| 210 | */ |
| 211 | public function getShipFrom(): ?Address; |
| 212 | |
| 213 | /** |
| 214 | * Has ship from |
| 215 | * |
| 216 | * @return bool |
| 217 | */ |
| 218 | public function hasShipFrom(): bool; |
| 219 | |
| 220 | /** |
| 221 | * Get response |
| 222 | * |
| 223 | * @return mixed |
| 224 | */ |
| 225 | public function getResponse(): mixed; |
| 226 | |
| 227 | /** |
| 228 | * Has response |
| 229 | * |
| 230 | * @return bool |
| 231 | */ |
| 232 | public function hasResponse(): bool; |
| 233 | |
| 234 | /** |
| 235 | * Is success |
| 236 | * |
| 237 | * @return bool |
| 238 | */ |
| 239 | public function isSuccess(): bool; |
| 240 | |
| 241 | /** |
| 242 | * Get error code |
| 243 | * |
| 244 | * @return mixed |
| 245 | */ |
| 246 | public function getErrorCode(): mixed; |
| 247 | |
| 248 | /** |
| 249 | * Has error code |
| 250 | * |
| 251 | * @return bool |
| 252 | */ |
| 253 | public function hasErrorCode(): bool; |
| 254 | |
| 255 | /** |
| 256 | * Get error message |
| 257 | * |
| 258 | * @return mixed |
| 259 | */ |
| 260 | public function getErrorMessage(): mixed; |
| 261 | |
| 262 | /** |
| 263 | * Has error message |
| 264 | * |
| 265 | * @return bool |
| 266 | */ |
| 267 | public function hasErrorMessage(): bool; |
| 268 | |
| 269 | /** |
| 270 | * Get rates |
| 271 | * |
| 272 | * @return array |
| 273 | */ |
| 274 | public function getRates(): array; |
| 275 | |
| 276 | /** |
| 277 | * Has rates |
| 278 | * |
| 279 | * @return bool |
| 280 | */ |
| 281 | public function hasRates(): bool; |
| 282 | |
| 283 | /** |
| 284 | * Fetch rates from the API |
| 285 | * |
| 286 | * @return array |
| 287 | */ |
| 288 | public function fetchRates(): array; |
| 289 | |
| 290 | /** |
| 291 | * Parse rates response |
| 292 | * |
| 293 | * @return array |
| 294 | */ |
| 295 | public function parseRatesResponse(): array; |
| 296 | |
| 297 | /** |
| 298 | * Get tracking |
| 299 | * |
| 300 | * @param string|array|null $trackingNumbers |
| 301 | * @return array |
| 302 | */ |
| 303 | public function getTracking(string|array|null $trackingNumbers = null): array; |
| 304 | |
| 305 | /** |
| 306 | * Parse tracking response |
| 307 | * |
| 308 | * @return array |
| 309 | */ |
| 310 | public function parseTrackingResponse(): array; |
| 311 | |
| 312 | } |