Skip to content

Commit

Permalink
Merge pull request #43478 from frappe/mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-43476

fix: Fix API endpoint for Frankfurter (backport #43476)
  • Loading branch information
sagarvora authored Oct 2, 2024
2 parents 96c4d1a + 8e7d893 commit 562327f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_api_endpoint(service_provider: str | None = None, use_http: bool = False
if service_provider == "exchangerate.host":
api = "api.exchangerate.host/convert"
elif service_provider == "frankfurter.app":
api = "frankfurter.app/{transaction_date}"
api = "api.frankfurter.app/{transaction_date}"

protocol = "https://"
if use_http:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def json(self):
if kwargs["params"].get("date") and kwargs["params"].get("from") and kwargs["params"].get("to"):
if test_exchange_values.get(kwargs["params"]["date"]):
return PatchResponse({"result": test_exchange_values[kwargs["params"]["date"]]}, 200)
elif args[0].startswith("https://frankfurter.app") and kwargs.get("params"):
elif args[0].startswith("https://api.frankfurter.app") and kwargs.get("params"):
if kwargs["params"].get("base") and kwargs["params"].get("symbols"):
date = args[0].replace("https://frankfurter.app/", "")
date = args[0].replace("https://api.frankfurter.app/", "")
if test_exchange_values.get(date):
return PatchResponse(
{"rates": {kwargs["params"].get("symbols"): test_exchange_values.get(date)}}, 200
Expand Down
2 changes: 1 addition & 1 deletion erpnext/setup/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def setup_currency_exchange():
ces.set("result_key", [])
ces.set("req_params", [])

ces.api_endpoint = "https://frankfurter.app/{transaction_date}"
ces.api_endpoint = "https://api.frankfurter.app/{transaction_date}"
ces.append("result_key", {"key": "rates"})
ces.append("result_key", {"key": "{to_currency}"})
ces.append("req_params", {"key": "base", "value": "{from_currency}"})
Expand Down

0 comments on commit 562327f

Please sign in to comment.