Merge pull request #731 from Kukks/coinswitch-shitcoin-tax

add coinswitch shitcoin tax
This commit is contained in:
Nicolas Dorier 2019-04-02 17:33:37 +09:00 committed by GitHub
commit 5b4b073fc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 3 deletions

View file

@ -333,6 +333,7 @@ namespace BTCPayServer.Controllers
ChangellyMerchantId = changelly?.ChangellyMerchantId,
ChangellyAmountDue = changellyAmountDue,
CoinSwitchEnabled = coinswitch != null,
CoinSwitchAmountMarkupPercentage = coinswitch?.AmountMarkupPercentage?? 0,
CoinSwitchMerchantId = coinswitch?.MerchantId,
CoinSwitchMode = coinswitch?.Mode,
StoreId = store.Id,

View file

@ -28,6 +28,7 @@ namespace BTCPayServer.Controllers
vm.MerchantId = existing.MerchantId;
vm.Enabled = existing.Enabled;
vm.Mode = existing.Mode;
vm.AmountMarkupPercentage = existing.AmountMarkupPercentage;
}
[HttpPost]
@ -50,7 +51,8 @@ namespace BTCPayServer.Controllers
{
MerchantId = vm.MerchantId,
Enabled = vm.Enabled,
Mode = vm.Mode
Mode = vm.Mode,
AmountMarkupPercentage = vm.AmountMarkupPercentage
};
switch (command)

View file

@ -66,5 +66,6 @@ namespace BTCPayServer.Models.InvoicingModels
public string CoinSwitchMode { get; set; }
public string CoinSwitchMerchantId { get; set; }
public string RootPath { get; set; }
public decimal CoinSwitchAmountMarkupPercentage { get; set; }
}
}

View file

@ -12,6 +12,12 @@ namespace BTCPayServer.Models.StoreViewModels
[Display(Name = "Integration Mode")]
public string Mode { get; set; } = "inline";
[Required]
[Range(0, 100)]
[Display(Name =
"Percentage to multiply amount requested at Coinswitch to avoid underpaid situations due to Coinswitch not guaranteeing rates. ")]
public decimal AmountMarkupPercentage { get; set; } = new decimal(2);
public List<SelectListItem> Modes { get; } = new List<SelectListItem>
{

View file

@ -5,6 +5,7 @@ namespace BTCPayServer.Payments.CoinSwitch
public string MerchantId { get; set; }
public string Mode { get; set; }
public bool Enabled { get; set; }
public decimal AmountMarkupPercentage { get; set; }
public bool IsConfigured()
{

View file

@ -303,7 +303,7 @@
:mode="srvModel.coinSwitchMode"
:merchant-id="srvModel.coinSwitchMerchantId"
:to-currency="srvModel.paymentMethodId"
:to-currency-due="srvModel.btcDue"
:to-currency-due="srvModel.coinSwitchAmountMarkupPercentage? (1 + (srvModel.coinSwitchAmountMarkupPercentage / 100) :srvModel.btcDue"
:autoload="selectedThirdPartyProcessor === 'coinswitch'"
:to-currency-address="srvModel.btcAddress">
<div>

View file

@ -30,7 +30,11 @@
<select asp-for="Mode" asp-items="Model.Modes" class="form-control">
</select>
</div>
<div class="form-group">
<label asp-for="AmountMarkupPercentage"></label>
<input asp-for="AmountMarkupPercentage" class="form-control"/>
<span asp-validation-for="AmountMarkupPercentage" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Enabled"></label>
<input asp-for="Enabled" type="checkbox" class="form-check"/>