mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-23 06:59:20 +00:00
chore: switched frankfurter domain from frankfurter.app to frankfurter.dev (backport #50734) (#50739)
Co-authored-by: diptanilsaha <diptanil@frappe.io>
This commit is contained in:
@@ -19,7 +19,7 @@ frappe.ui.form.on("Currency Exchange Settings", {
|
|||||||
to: "{to_currency}",
|
to: "{to_currency}",
|
||||||
};
|
};
|
||||||
add_param(frm, r.message, params, result);
|
add_param(frm, r.message, params, result);
|
||||||
} else if (frm.doc.service_provider == "frankfurter.app") {
|
} else if (frm.doc.service_provider == "frankfurter.dev") {
|
||||||
let result = ["rates", "{to_currency}"];
|
let result = ["rates", "{to_currency}"];
|
||||||
let params = {
|
let params = {
|
||||||
base: "{from_currency}",
|
base: "{from_currency}",
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
"fieldname": "service_provider",
|
"fieldname": "service_provider",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"label": "Service Provider",
|
"label": "Service Provider",
|
||||||
"options": "frankfurter.app\nexchangerate.host\nCustom",
|
"options": "frankfurter.dev\nexchangerate.host\nCustom",
|
||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -104,7 +104,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2024-03-18 08:32:26.895076",
|
"modified": "2025-11-25 13:03:41.896424",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Currency Exchange Settings",
|
"name": "Currency Exchange Settings",
|
||||||
@@ -141,7 +141,8 @@
|
|||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"row_format": "Dynamic",
|
||||||
|
"sort_field": "creation",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"states": [],
|
"states": [],
|
||||||
"track_changes": 1
|
"track_changes": 1
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class CurrencyExchangeSettings(Document):
|
|||||||
self.append("req_params", {"key": "date", "value": "{transaction_date}"})
|
self.append("req_params", {"key": "date", "value": "{transaction_date}"})
|
||||||
self.append("req_params", {"key": "from", "value": "{from_currency}"})
|
self.append("req_params", {"key": "from", "value": "{from_currency}"})
|
||||||
self.append("req_params", {"key": "to", "value": "{to_currency}"})
|
self.append("req_params", {"key": "to", "value": "{to_currency}"})
|
||||||
elif self.service_provider == "frankfurter.app":
|
elif self.service_provider == "frankfurter.dev":
|
||||||
self.set("result_key", [])
|
self.set("result_key", [])
|
||||||
self.set("req_params", [])
|
self.set("req_params", [])
|
||||||
|
|
||||||
@@ -80,11 +80,11 @@ class CurrencyExchangeSettings(Document):
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_api_endpoint(service_provider: str | None = None, use_http: bool = False):
|
def get_api_endpoint(service_provider: str | None = None, use_http: bool = False):
|
||||||
if service_provider and service_provider in ["exchangerate.host", "frankfurter.app"]:
|
if service_provider and service_provider in ["exchangerate.host", "frankfurter.dev"]:
|
||||||
if service_provider == "exchangerate.host":
|
if service_provider == "exchangerate.host":
|
||||||
api = "api.exchangerate.host/convert"
|
api = "api.exchangerate.host/convert"
|
||||||
elif service_provider == "frankfurter.app":
|
elif service_provider == "frankfurter.dev":
|
||||||
api = "api.frankfurter.app/{transaction_date}"
|
api = "api.frankfurter.dev/v1/{transaction_date}"
|
||||||
|
|
||||||
protocol = "https://"
|
protocol = "https://"
|
||||||
if use_http:
|
if use_http:
|
||||||
|
|||||||
@@ -377,3 +377,4 @@ execute:frappe.db.set_single_value("Accounts Settings", "receivable_payable_fetc
|
|||||||
erpnext.patches.v14_0.set_update_price_list_based_on
|
erpnext.patches.v14_0.set_update_price_list_based_on
|
||||||
erpnext.patches.v14_0.rename_group_by_to_categorize_by_in_custom_reports
|
erpnext.patches.v14_0.rename_group_by_to_categorize_by_in_custom_reports
|
||||||
erpnext.patches.v14_0.update_full_name_in_contract
|
erpnext.patches.v14_0.update_full_name_in_contract
|
||||||
|
erpnext.patches.v16_0.update_currency_exchange_settings_for_frankfurter
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
settings = frappe.get_doc("Currency Exchange Settings")
|
||||||
|
if settings.service_provider != "frankfurter.app":
|
||||||
|
return
|
||||||
|
|
||||||
|
settings.service_provider = "frankfurter.dev"
|
||||||
|
settings.set_parameters_and_result()
|
||||||
|
settings.flags.ignore_validate = True
|
||||||
|
settings.save()
|
||||||
@@ -68,9 +68,9 @@ def patched_requests_get(*args, **kwargs):
|
|||||||
if kwargs["params"].get("date") and kwargs["params"].get("from") and kwargs["params"].get("to"):
|
if kwargs["params"].get("date") and kwargs["params"].get("from") and kwargs["params"].get("to"):
|
||||||
if test_exchange_values.get(kwargs["params"]["date"]):
|
if test_exchange_values.get(kwargs["params"]["date"]):
|
||||||
return PatchResponse({"result": test_exchange_values[kwargs["params"]["date"]]}, 200)
|
return PatchResponse({"result": test_exchange_values[kwargs["params"]["date"]]}, 200)
|
||||||
elif args[0].startswith("https://api.frankfurter.app") and kwargs.get("params"):
|
elif args[0].startswith("https://api.frankfurter.dev") and kwargs.get("params"):
|
||||||
if kwargs["params"].get("base") and kwargs["params"].get("symbols"):
|
if kwargs["params"].get("base") and kwargs["params"].get("symbols"):
|
||||||
date = args[0].replace("https://api.frankfurter.app/", "")
|
date = args[0].replace("https://api.frankfurter.dev/v1/", "")
|
||||||
if test_exchange_values.get(date):
|
if test_exchange_values.get(date):
|
||||||
return PatchResponse(
|
return PatchResponse(
|
||||||
{"rates": {kwargs["params"].get("symbols"): test_exchange_values.get(date)}}, 200
|
{"rates": {kwargs["params"].get("symbols"): test_exchange_values.get(date)}}, 200
|
||||||
@@ -149,7 +149,7 @@ class TestCurrencyExchange(unittest.TestCase):
|
|||||||
self.assertEqual(flt(exchange_rate, 3), 65.1)
|
self.assertEqual(flt(exchange_rate, 3), 65.1)
|
||||||
|
|
||||||
settings = frappe.get_single("Currency Exchange Settings")
|
settings = frappe.get_single("Currency Exchange Settings")
|
||||||
settings.service_provider = "frankfurter.app"
|
settings.service_provider = "frankfurter.dev"
|
||||||
settings.save()
|
settings.save()
|
||||||
|
|
||||||
def test_exchange_rate_strict(self, mock_get):
|
def test_exchange_rate_strict(self, mock_get):
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ def setup_currency_exchange():
|
|||||||
ces.set("result_key", [])
|
ces.set("result_key", [])
|
||||||
ces.set("req_params", [])
|
ces.set("req_params", [])
|
||||||
|
|
||||||
ces.api_endpoint = "https://api.frankfurter.app/{transaction_date}"
|
ces.api_endpoint = "https://api.frankfurter.dev/v1/{transaction_date}"
|
||||||
ces.append("result_key", {"key": "rates"})
|
ces.append("result_key", {"key": "rates"})
|
||||||
ces.append("result_key", {"key": "{to_currency}"})
|
ces.append("result_key", {"key": "{to_currency}"})
|
||||||
ces.append("req_params", {"key": "base", "value": "{from_currency}"})
|
ces.append("req_params", {"key": "base", "value": "{from_currency}"})
|
||||||
|
|||||||
Reference in New Issue
Block a user