chore: code clean up
diff --git a/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.json b/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.json
index a0dfe73..bd86242 100644
--- a/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.json
+++ b/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.json
@@ -7,6 +7,7 @@
  "field_order": [
   "api_details_section",
   "api_endpoint",
+  "url",
   "column_break_3",
   "result_key",
   "section_break_2",
@@ -59,12 +60,18 @@
    "label": "Result Key",
    "options": "Currency Exchange Settings Result",
    "reqd": 1
+  },
+  {
+   "fieldname": "url",
+   "fieldtype": "Data",
+   "label": "URL",
+   "read_only": 1
   }
  ],
  "index_web_pages_for_search": 1,
  "issingle": 1,
  "links": [],
- "modified": "2021-09-03 13:21:16.397695",
+ "modified": "2021-09-03 19:09:02.741016",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Currency Exchange Settings",
diff --git a/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.py b/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.py
index 92828e6..1ecb0ff 100644
--- a/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.py
+++ b/erpnext/setup/doctype/currency_exchange_settings/currency_exchange_settings.py
@@ -12,7 +12,7 @@
 		transaction_date = '2021-08-01'
 		from_currency = 'USD'
 		to_currency = 'INR'
-		req_params={
+		req_params = {
 			"transaction_date": transaction_date,
 			"from_currency": from_currency,
 			"to_currency": to_currency
@@ -25,7 +25,11 @@
 			except:
 				frappe.throw(_("Make sure no mandatory parameters are repeated."))
 		for eparam in self.extra_params:
-			params[eparam.key] = eparam.value
+			params[eparam.key] = eparam.value.format(
+				transaction_date=transaction_date,
+				to_currency=to_currency,
+				from_currency=from_currency
+			)
 		import requests
 		api_url = self.api_endpoint.format(
 			transaction_date=transaction_date,
@@ -46,7 +50,8 @@
 					from_currency=from_currency
 				)]
 		except KeyError:
-			frappe.throw(_("Invalid result key. Response: ") + response.text)
+			frappe.throw("Invalid result key. Response: " + response.text)
 		if not isinstance(value, (int, float)):
 			frappe.throw(_("Returned exchange rate is neither integer not float."))
-		frappe.msgprint(_("Exchange rate of USD to INR on 01-08-2021 is ") + str(value))
+		self.url = response.url
+		frappe.msgprint("Exchange rate of USD to INR on 01-08-2021 is " + str(value))
diff --git a/erpnext/setup/doctype/currency_exchange_settings_details/currency_exchange_settings_details.json b/erpnext/setup/doctype/currency_exchange_settings_details/currency_exchange_settings_details.json
index 9d49daa..dbb886f 100644
--- a/erpnext/setup/doctype/currency_exchange_settings_details/currency_exchange_settings_details.json
+++ b/erpnext/setup/doctype/currency_exchange_settings_details/currency_exchange_settings_details.json
@@ -14,7 +14,8 @@
    "fieldtype": "Data",
    "in_list_view": 1,
    "label": "Key",
-   "reqd": 1
+   "reqd": 1,
+   "unique": 1
   },
   {
    "fieldname": "value",
@@ -28,7 +29,7 @@
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-09-02 15:24:24.675019",
+ "modified": "2021-09-03 18:50:47.145457",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Currency Exchange Settings Details",
diff --git a/erpnext/setup/doctype/currency_exchange_settings_extra_details/currency_exchange_settings_extra_details.json b/erpnext/setup/doctype/currency_exchange_settings_extra_details/currency_exchange_settings_extra_details.json
index fb85bb1..f21f9ce 100644
--- a/erpnext/setup/doctype/currency_exchange_settings_extra_details/currency_exchange_settings_extra_details.json
+++ b/erpnext/setup/doctype/currency_exchange_settings_extra_details/currency_exchange_settings_extra_details.json
@@ -14,7 +14,8 @@
    "fieldtype": "Data",
    "in_list_view": 1,
    "label": "Key",
-   "reqd": 1
+   "reqd": 1,
+   "unique": 1
   },
   {
    "fieldname": "value",
@@ -27,7 +28,7 @@
  "index_web_pages_for_search": 1,
  "istable": 1,
  "links": [],
- "modified": "2021-09-02 15:18:17.888667",
+ "modified": "2021-09-03 18:50:28.482851",
  "modified_by": "Administrator",
  "module": "Setup",
  "name": "Currency Exchange Settings Extra Details",
diff --git a/erpnext/setup/utils.py b/erpnext/setup/utils.py
index c54f62d..9146566 100644
--- a/erpnext/setup/utils.py
+++ b/erpnext/setup/utils.py
@@ -101,7 +101,7 @@
 		if not value:
 			import requests
 			settings = frappe.get_single('Currency Exchange Settings')
-			req_params={
+			req_params = {
 				"transaction_date": transaction_date,
 				"from_currency": from_currency,
 				"to_currency": to_currency
@@ -110,21 +110,13 @@
 			for row in settings.req_params:
 				params[row.key] = req_params[row.value]
 			for eparam in settings.extra_params:
-				params[eparam.key] = eparam.value
-			response = requests.get(settings.api_endpoint.format(
-				transaction_date=transaction_date,
-				to_currency=to_currency,
-				from_currency=from_currency
-			), params=params)
+				params[eparam.key] = format_ces_api(eparam.value, req_params)
+			response = requests.get(format_ces_api(settings.api_endpoint, req_params), params=params)
 			# expire in 6 hours
 			response.raise_for_status()
 			value = response.json()
 			for res_key in settings.result_key:
-				value = value[str(res_key.key).format(
-					transaction_date=transaction_date,
-					to_currency=to_currency,
-					from_currency=from_currency
-				)]
+				value = value[format_ces_api(str(res_key.key), req_params)]
 			cache.setex(name=key, time=21600, value=flt(value))
 		return flt(value)
 	except Exception:
@@ -132,6 +124,13 @@
 		frappe.msgprint(_("Unable to find exchange rate for {0} to {1} for key date {2}. Please create a Currency Exchange record manually").format(from_currency, to_currency, transaction_date))
 		return 0.0
 
+def format_ces_api(data="", param={}):
+	return data.format(
+		transaction_date=param["transaction_date"],
+		to_currency=param["to_currency"],
+		from_currency=param["from_currency"]
+	)
+
 def enable_all_roles_and_domains():
 	""" enable all roles and domain for testing """
 	# add all roles to users