mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-22 16:34:26 +01:00
(Feat): Allowed Fallback Exchange Rate to Be Enabled via API (#6839)
Signed-off-by: Abhijay jain <Abhijay007j@gmail.com>
This commit is contained in:
@@ -95,8 +95,17 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
var storeData = HttpContext.GetStoreData();
|
var storeData = HttpContext.GetStoreData();
|
||||||
var storeBlob = storeData.GetStoreBlob();
|
var storeBlob = storeData.GetStoreBlob();
|
||||||
var blob = storeBlob.GetRateSettings(fallback);
|
var blob = storeBlob.GetRateSettings(fallback);
|
||||||
if (blob is null)
|
|
||||||
|
// If fallback rates are not enabled but someone is trying to configure them, enable them automatically
|
||||||
|
if (blob is null && fallback)
|
||||||
|
{
|
||||||
|
blob = storeBlob.GetOrCreateRateSettings(fallback);
|
||||||
|
}
|
||||||
|
else if (blob is null)
|
||||||
|
{
|
||||||
return this.CreateAPIError(404, "fallback-disabled", "The fallback rates are disabled");
|
return this.CreateAPIError(404, "fallback-disabled", "The fallback rates are disabled");
|
||||||
|
}
|
||||||
|
|
||||||
ValidateAndSanitizeConfiguration(configuration, storeBlob, blob);
|
ValidateAndSanitizeConfiguration(configuration, storeBlob, blob);
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return this.CreateValidationError(ModelState);
|
return this.CreateValidationError(ModelState);
|
||||||
|
|||||||
Reference in New Issue
Block a user