(Feat): Allowed Fallback Exchange Rate to Be Enabled via API (#6839)

Signed-off-by: Abhijay jain <Abhijay007j@gmail.com>
This commit is contained in:
Abhijay Jain
2025-07-10 07:28:59 +05:30
committed by GitHub
parent 76524c1fac
commit 895d13c34e

View File

@@ -95,8 +95,17 @@ namespace BTCPayServer.Controllers.GreenField
var storeData = HttpContext.GetStoreData();
var storeBlob = storeData.GetStoreBlob();
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");
}
ValidateAndSanitizeConfiguration(configuration, storeBlob, blob);
if (!ModelState.IsValid)
return this.CreateValidationError(ModelState);