From b71fd1653e57361bfad56650c1f49f18e4b1c4de Mon Sep 17 00:00:00 2001 From: Kukks Date: Tue, 25 Feb 2020 16:44:19 +0100 Subject: [PATCH] remove changelly fiat option closes #728 --- .../Controllers/StoresController.Changelly.cs | 5 +-- .../UpdateChangellySettingsViewModel.cs | 3 -- BTCPayServer/Payments/Changelly/Changelly.cs | 32 +++---------------- .../Changelly/ChangellyClientProvider.cs | 5 +-- .../Payments/Changelly/ChangellySettings.cs | 1 - .../Stores/UpdateChangellySettings.cshtml | 5 --- 6 files changed, 9 insertions(+), 42 deletions(-) diff --git a/BTCPayServer/Controllers/StoresController.Changelly.cs b/BTCPayServer/Controllers/StoresController.Changelly.cs index 68b475e33..ad0bb4399 100644 --- a/BTCPayServer/Controllers/StoresController.Changelly.cs +++ b/BTCPayServer/Controllers/StoresController.Changelly.cs @@ -33,8 +33,6 @@ namespace BTCPayServer.Controllers vm.ChangellyMerchantId = existing.ChangellyMerchantId; vm.Enabled = existing.Enabled; vm.AmountMarkupPercentage = existing.AmountMarkupPercentage; - vm.ShowFiat = existing.ShowFiat; - } [HttpPost] @@ -60,8 +58,7 @@ namespace BTCPayServer.Controllers ApiUrl = vm.ApiUrl, ChangellyMerchantId = vm.ChangellyMerchantId, Enabled = vm.Enabled, - AmountMarkupPercentage = vm.AmountMarkupPercentage, - ShowFiat = vm.ShowFiat + AmountMarkupPercentage = vm.AmountMarkupPercentage }; switch (command) diff --git a/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs b/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs index e143e7453..9a3db8815 100644 --- a/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs +++ b/BTCPayServer/Models/StoreViewModels/UpdateChangellySettingsViewModel.cs @@ -17,9 +17,6 @@ namespace BTCPayServer.Models.StoreViewModels [Display(Name = "Optional, Changelly Merchant Id")] public string ChangellyMerchantId { get; set; } - [Display(Name = "Show Fiat Currencies as option in conversion")] - public bool ShowFiat { get; set; } = true; - [Required] [Range(0, 100)] [Display(Name = diff --git a/BTCPayServer/Payments/Changelly/Changelly.cs b/BTCPayServer/Payments/Changelly/Changelly.cs index ca5e921b6..080e03f81 100644 --- a/BTCPayServer/Payments/Changelly/Changelly.cs +++ b/BTCPayServer/Payments/Changelly/Changelly.cs @@ -16,13 +16,11 @@ namespace BTCPayServer.Payments.Changelly public class Changelly { private readonly string _apisecret; - private readonly bool _showFiat; private readonly HttpClient _httpClient; - public Changelly(HttpClient httpClient, string apiKey, string apiSecret, string apiUrl, bool showFiat = true) + public Changelly(HttpClient httpClient, string apiKey, string apiSecret, string apiUrl) { _apisecret = apiSecret; - _showFiat = showFiat; _httpClient = httpClient; _httpClient.BaseAddress = new Uri(apiUrl); _httpClient.DefaultRequestHeaders.Add("api-key", apiKey); @@ -62,36 +60,16 @@ namespace BTCPayServer.Payments.Changelly public virtual async Task> GetCurrenciesFull() { - const string message = @"{ + const string message = @"{ ""jsonrpc"": ""2.0"", ""id"": 1, ""method"": ""getCurrenciesFull"", ""params"": [] }"; - var result = await PostToApi>(message); - var appendedResult = _showFiat - ? result.Result.Concat(new[] - { - new CurrencyFull() - { - Enable = true, - Name = "EUR", - FullName = "Euro", - PayInConfirmations = 0, - ImageLink = "https://changelly.com/api/coins/eur.png" - }, - new CurrencyFull() - { - Enable = true, - Name = "USD", - FullName = "US Dollar", - PayInConfirmations = 0, - ImageLink = "https://changelly.com/api/coins/usd.png" - } - }) - : result.Result; - return appendedResult; + var result = await PostToApi>(message); + + return result.Result; } public virtual async Task GetExchangeAmount(string fromCurrency, diff --git a/BTCPayServer/Payments/Changelly/ChangellyClientProvider.cs b/BTCPayServer/Payments/Changelly/ChangellyClientProvider.cs index cb490eae4..0428f9804 100644 --- a/BTCPayServer/Payments/Changelly/ChangellyClientProvider.cs +++ b/BTCPayServer/Payments/Changelly/ChangellyClientProvider.cs @@ -61,8 +61,9 @@ namespace BTCPayServer.Payments.Changelly throw new ChangellyException("Changelly not enabled for this store"); } - var changelly = new Changelly(_httpClientFactory.CreateClient("Changelly"), changellySettings.ApiKey, changellySettings.ApiSecret, - changellySettings.ApiUrl, changellySettings.ShowFiat); + var changelly = new Changelly(_httpClientFactory.CreateClient("Changelly"), changellySettings.ApiKey, + changellySettings.ApiSecret, + changellySettings.ApiUrl); _clientCache.AddOrReplace(storeId, changelly); return changelly; } diff --git a/BTCPayServer/Payments/Changelly/ChangellySettings.cs b/BTCPayServer/Payments/Changelly/ChangellySettings.cs index 56d6b7567..784852a49 100644 --- a/BTCPayServer/Payments/Changelly/ChangellySettings.cs +++ b/BTCPayServer/Payments/Changelly/ChangellySettings.cs @@ -8,7 +8,6 @@ namespace BTCPayServer.Payments.Changelly public bool Enabled { get; set; } public string ChangellyMerchantId { get; set; } public decimal AmountMarkupPercentage { get; set; } - public bool ShowFiat { get; set; } public bool IsConfigured() { diff --git a/BTCPayServer/Views/Stores/UpdateChangellySettings.cshtml b/BTCPayServer/Views/Stores/UpdateChangellySettings.cshtml index 524ab3846..c8bfff9cc 100644 --- a/BTCPayServer/Views/Stores/UpdateChangellySettings.cshtml +++ b/BTCPayServer/Views/Stores/UpdateChangellySettings.cshtml @@ -38,11 +38,6 @@ -
- - - -