diff --git a/app/Jobs/FetchConversionRate.php b/app/Jobs/FetchConversionRate.php index 35e69024..77432baf 100644 --- a/app/Jobs/FetchConversionRate.php +++ b/app/Jobs/FetchConversionRate.php @@ -50,9 +50,8 @@ public function handle( } $url = sprintf( - 'https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/latest/currencies/%s/%s.json', + 'https://cdn.jsdelivr.net/npm/@fawazahmed0/currency-api@latest/v1/currencies/%s.json', $baseCurrency->iso_lowercased, - $targetCurrency->iso_lowercased, ); try { @@ -60,7 +59,7 @@ public function handle( $decoded_response = json_decode($response->getBody(), true); - $rate = $decoded_response[$targetCurrency->iso_lowercased]; + $rate = $decoded_response[$baseCurrency->iso_lowercased][$targetCurrency->iso_lowercased]; } catch (Exception $e) { continue; }