add coinswitch shitcoin tax

This commit is contained in:
Kukks
2019-03-31 18:55:14 +02:00
parent ad0edb5f4c
commit 6db9061dd1
7 changed files with 18 additions and 3 deletions

View File

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

View File

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

View File

@@ -66,5 +66,6 @@ namespace BTCPayServer.Models.InvoicingModels
public string CoinSwitchMode { get; set; } public string CoinSwitchMode { get; set; }
public string CoinSwitchMerchantId { get; set; } public string CoinSwitchMerchantId { get; set; }
public string RootPath { 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")] [Display(Name = "Integration Mode")]
public string Mode { get; set; } = "inline"; 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> 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 MerchantId { get; set; }
public string Mode { get; set; } public string Mode { get; set; }
public bool Enabled { get; set; } public bool Enabled { get; set; }
public decimal AmountMarkupPercentage { get; set; }
public bool IsConfigured() public bool IsConfigured()
{ {

View File

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

View File

@@ -30,7 +30,11 @@
<select asp-for="Mode" asp-items="Model.Modes" class="form-control"> <select asp-for="Mode" asp-items="Model.Modes" class="form-control">
</select> </select>
</div> </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"> <div class="form-group">
<label asp-for="Enabled"></label> <label asp-for="Enabled"></label>
<input asp-for="Enabled" type="checkbox" class="form-check"/> <input asp-for="Enabled" type="checkbox" class="form-check"/>