mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Add taxIncluded field in invoice
This commit is contained in:
@@ -1988,6 +1988,7 @@ donation:
|
|||||||
var invoice = user.BitPay.CreateInvoice(new Invoice()
|
var invoice = user.BitPay.CreateInvoice(new Invoice()
|
||||||
{
|
{
|
||||||
Price = 5000.0m,
|
Price = 5000.0m,
|
||||||
|
TaxIncluded = 1000.0m,
|
||||||
Currency = "USD",
|
Currency = "USD",
|
||||||
PosData = "posData",
|
PosData = "posData",
|
||||||
OrderId = "orderId",
|
OrderId = "orderId",
|
||||||
@@ -2017,6 +2018,8 @@ donation:
|
|||||||
});
|
});
|
||||||
|
|
||||||
invoice = user.BitPay.GetInvoice(invoice.Id, Facade.Merchant);
|
invoice = user.BitPay.GetInvoice(invoice.Id, Facade.Merchant);
|
||||||
|
Assert.Equal(1000.0m, invoice.TaxIncluded);
|
||||||
|
Assert.Equal(5000.0m, invoice.Price);
|
||||||
Assert.Equal(Money.Coins(0), invoice.BtcPaid);
|
Assert.Equal(Money.Coins(0), invoice.BtcPaid);
|
||||||
Assert.Equal("new", invoice.Status);
|
Assert.Equal("new", invoice.Status);
|
||||||
Assert.False((bool)((JValue)invoice.ExceptionStatus).Value);
|
Assert.False((bool)((JValue)invoice.ExceptionStatus).Value);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
<EmbeddedResource Include="Currencies.txt" />
|
<EmbeddedResource Include="Currencies.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.1.0.4" />
|
<PackageReference Include="BTCPayServer.Lightning.All" Version="1.1.0.5" />
|
||||||
<PackageReference Include="BuildBundlerMinifier" Version="2.7.385" />
|
<PackageReference Include="BuildBundlerMinifier" Version="2.7.385" />
|
||||||
<PackageReference Include="DigitalRuby.ExchangeSharp" Version="0.5.3" />
|
<PackageReference Include="DigitalRuby.ExchangeSharp" Version="0.5.3" />
|
||||||
<PackageReference Include="HtmlSanitizer" Version="4.0.199" />
|
<PackageReference Include="HtmlSanitizer" Version="4.0.199" />
|
||||||
@@ -45,8 +45,8 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="NBitcoin" Version="4.1.1.77" />
|
<PackageReference Include="NBitcoin" Version="4.1.1.78" />
|
||||||
<PackageReference Include="NBitpayClient" Version="1.0.0.30" />
|
<PackageReference Include="NBitpayClient" Version="1.0.0.31" />
|
||||||
<PackageReference Include="DBreeze" Version="1.92.0" />
|
<PackageReference Include="DBreeze" Version="1.92.0" />
|
||||||
<PackageReference Include="NBXplorer.Client" Version="2.0.0.3" />
|
<PackageReference Include="NBXplorer.Client" Version="2.0.0.3" />
|
||||||
<PackageReference Include="NicolasDorier.CommandLine" Version="1.0.0.2" />
|
<PackageReference Include="NicolasDorier.CommandLine" Version="1.0.0.2" />
|
||||||
|
|||||||
@@ -99,8 +99,12 @@ namespace BTCPayServer.Controllers
|
|||||||
if (currencyInfo != null)
|
if (currencyInfo != null)
|
||||||
{
|
{
|
||||||
invoice.Price = Math.Round(invoice.Price, currencyInfo.CurrencyDecimalDigits);
|
invoice.Price = Math.Round(invoice.Price, currencyInfo.CurrencyDecimalDigits);
|
||||||
|
invoice.TaxIncluded = Math.Round(invoice.TaxIncluded, currencyInfo.CurrencyDecimalDigits);
|
||||||
}
|
}
|
||||||
invoice.Price = Math.Max(0.0m, invoice.Price);
|
invoice.Price = Math.Max(0.0m, invoice.Price);
|
||||||
|
invoice.TaxIncluded = Math.Max(0.0m, invoice.TaxIncluded);
|
||||||
|
invoice.TaxIncluded = Math.Min(invoice.TaxIncluded, invoice.Price);
|
||||||
|
|
||||||
entity.ProductInformation = Map<Invoice, ProductInformation>(invoice);
|
entity.ProductInformation = Map<Invoice, ProductInformation>(invoice);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,12 @@ namespace BTCPayServer.Models
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty("taxIncluded", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public decimal TaxIncluded
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
//"currency":"USD"
|
//"currency":"USD"
|
||||||
[JsonProperty("currency")]
|
[JsonProperty("currency")]
|
||||||
public string Currency
|
public string Currency
|
||||||
|
|||||||
@@ -91,6 +91,12 @@ namespace BTCPayServer.Services.Invoices
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty(PropertyName = "taxIncluded", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
|
public decimal TaxIncluded
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
[JsonProperty(PropertyName = "currency")]
|
[JsonProperty(PropertyName = "currency")]
|
||||||
public string Currency
|
public string Currency
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -157,6 +157,10 @@
|
|||||||
<th>Price</th>
|
<th>Price</th>
|
||||||
<td>@Model.ProductInformation.Price @Model.ProductInformation.Currency</td>
|
<td>@Model.ProductInformation.Price @Model.ProductInformation.Currency</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Tax included</th>
|
||||||
|
<td>@Model.ProductInformation.TaxIncluded @Model.ProductInformation.Currency</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
@@ -180,6 +184,10 @@
|
|||||||
<th>Price</th>
|
<th>Price</th>
|
||||||
<td>@Model.ProductInformation.Price @Model.ProductInformation.Currency</td>
|
<td>@Model.ProductInformation.Price @Model.ProductInformation.Currency</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Tax included</th>
|
||||||
|
<td>@Model.ProductInformation.TaxIncluded @Model.ProductInformation.Currency</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
|
|||||||
Reference in New Issue
Block a user