| @@ -1,11 +1,12 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace SyncBasalam\Services\Api; |
| 4 | 4 | |
| 5 | -use SyncBasalam\Logger\Logger; | |
| 6 | -use SyncBasalam\Admin\Settings\SettingsConfig; | |
| 7 | -use SyncBasalam\Jobs\Exceptions\RetryableException; | |
| 5 | +use SyncBasalam\Logger\Logger; | |
| 6 | +use SyncBasalam\Admin\Settings\SettingsConfig; | |
| 7 | +use SyncBasalam\Config\Endpoints; | |
| 8 | +use SyncBasalam\Jobs\Exceptions\RetryableException; | |
| 8 | 9 | |
| 9 | 10 | defined('ABSPATH') || exit; |
| 10 | 11 | |
| 11 | 12 | abstract class AbstractApiService |
| @@ -33,11 +34,12 @@ | ||
| 33 | 34 | $this->responseHandler = new ApiResponseHandler(); |
| 34 | 35 | $this->circuitBreaker = new CircuitBreaker(); |
| 35 | 36 | } |
| 36 | 37 | |
| 37 | - public function run(string $url, $data, array $headers = []): array | |
| 38 | - { | |
| 39 | - $validationResult = $this->validator->validate($url, $data, $headers); | |
| 38 | + public function run(string $url, $data, array $headers = []): array | |
| 39 | + { | |
| 40 | + $url = Endpoints::resolve($url); | |
| 41 | + $validationResult = $this->validator->validate($url, $data, $headers); | |
| 40 | 42 | |
| 41 | 43 | if (!$validationResult['valid']) { |
| 42 | 44 | Logger::error("خطا در اعتبارسنجی ریکوئست: " . $validationResult['message']); |
| 43 | 45 | return [ |