Allow checkout with litecoin

This commit is contained in:
nicolas.dorier
2018-01-09 11:41:07 +09:00
parent 0c735f4e29
commit 6ae9d13c43
14 changed files with 600 additions and 34 deletions

View File

@@ -16,9 +16,14 @@ namespace BTCPayServer.Models.StoreViewModels
public string Crypto { get; set; }
public string Value { get; set; }
}
class Format
{
public string Name { get; set; }
public string Value { get; set; }
}
public StoreViewModel()
{
}
public string Id { get; set; }
@@ -66,5 +71,17 @@ namespace BTCPayServer.Models.StoreViewModels
{
get; set;
}
public SelectList CryptoCurrencies { get; set; }
[Display(Name = "Default crypto currency on checkout")]
public string DefaultCryptoCurrency { get; set; }
public void SetCryptoCurrencies(ExplorerClientProvider explorerProvider, string defaultCrypto)
{
var choices = explorerProvider.GetAll().Select(o => new Format() { Name = o.Item1.CryptoCode, Value = o.Item1.CryptoCode }).ToArray();
var chosen = choices.FirstOrDefault(f => f.Name == defaultCrypto) ?? choices.FirstOrDefault();
CryptoCurrencies = new SelectList(choices, nameof(chosen.Value), nameof(chosen.Name), chosen);
DefaultCryptoCurrency = chosen.Name;
}
}
}