mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
Improve checkout page
This commit is contained in:
parent
d039b5f6ff
commit
a3ea94c771
7 changed files with 31 additions and 11 deletions
|
@ -48,7 +48,8 @@ namespace BTCPayServer.Controllers
|
|||
StoreName = store.StoreName,
|
||||
TxFees = invoice.TxFee.ToString(),
|
||||
InvoiceBitcoinUrl = dto.PaymentUrls.BIP72,
|
||||
TxCount = invoice.Payments.Count + 1,
|
||||
TxCount = invoice.GetTxCount(),
|
||||
BTCPaid = invoice.GetTotalPaid().ToString(),
|
||||
Status = invoice.Status
|
||||
};
|
||||
|
||||
|
|
|
@ -104,6 +104,12 @@ namespace BTCPayServer.Invoicing
|
|||
{
|
||||
get; set;
|
||||
}
|
||||
|
||||
public int GetTxCount()
|
||||
{
|
||||
return Calculate().TxCount;
|
||||
}
|
||||
|
||||
public string OrderId
|
||||
{
|
||||
get; set;
|
||||
|
@ -114,10 +120,11 @@ namespace BTCPayServer.Invoicing
|
|||
return Calculate().TotalDue;
|
||||
}
|
||||
|
||||
private (Money TotalDue, Money Paid) Calculate()
|
||||
private (Money TotalDue, Money Paid, int TxCount) Calculate()
|
||||
{
|
||||
var totalDue = Money.Coins((decimal)(ProductInformation.Price / Rate)) + TxFee;
|
||||
var paid = Money.Zero;
|
||||
int txCount = 1;
|
||||
var payments =
|
||||
Payments
|
||||
.OrderByDescending(p => p.ReceivedTime)
|
||||
|
@ -130,11 +137,14 @@ namespace BTCPayServer.Invoicing
|
|||
{
|
||||
var paidEnough = totalDue <= paid;
|
||||
if(!paidEnough)
|
||||
{
|
||||
txCount++;
|
||||
totalDue += TxFee;
|
||||
}
|
||||
return !paidEnough;
|
||||
})
|
||||
.ToArray();
|
||||
return (totalDue, paid);
|
||||
return (totalDue, paid, txCount);
|
||||
}
|
||||
|
||||
public Money GetTotalPaid()
|
||||
|
|
|
@ -71,14 +71,14 @@ namespace BTCPayServer.Invoicing
|
|||
|
||||
private async Task<(bool NeedSave, UTXOChanges Changes)> UpdateInvoice(UTXOChanges changes, InvoiceEntity invoice)
|
||||
{
|
||||
if(invoice.Status == "invalid" && (invoice.Status == "new" || invoice.Status == "paidPartial"))
|
||||
if(invoice.Status == "invalid")
|
||||
{
|
||||
return (false, changes);
|
||||
}
|
||||
bool needSave = false;
|
||||
bool shouldWait = true;
|
||||
|
||||
if(invoice.ExpirationTime < DateTimeOffset.UtcNow)
|
||||
if(invoice.ExpirationTime < DateTimeOffset.UtcNow && (invoice.Status == "new" || invoice.Status == "paidPartial"))
|
||||
{
|
||||
needSave = true;
|
||||
invoice.Status = "invalid";
|
||||
|
|
|
@ -90,6 +90,10 @@ namespace BTCPayServer.Models.InvoicingModels
|
|||
{
|
||||
get; set;
|
||||
}
|
||||
public string BTCPaid
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
public string StoreEmail
|
||||
{
|
||||
get; set;
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
<!---->
|
||||
<div class="single-item-order__right">
|
||||
<div class="single-item-order__right__btc-price clickable" id="buyerTotalBtcAmount">
|
||||
<span>@Model.BTCDue</span>
|
||||
<span>@Model.BTCTotalDue</span>
|
||||
<!---->
|
||||
<img class="single-item-order__right__btc-price__chevron" src="~/img/chevron.svg">
|
||||
</div>
|
||||
|
@ -152,9 +152,15 @@
|
|||
</div>
|
||||
<div class="line-items__item__value" i18n="">@Model.TxCount transaction x @Model.TxFees BTC</div>
|
||||
</div>
|
||||
<div class="line-items__item">
|
||||
<div class="line-items__item__label">
|
||||
<span i18n="">Already Paid</span>
|
||||
</div>
|
||||
<div class="line-items__item__value" i18n="">-@Model.BTCPaid BTC</div>
|
||||
</div>
|
||||
<div class="line-items__item line-items__item--total">
|
||||
<div class="line-items__item__label" i18n="">Total</div>
|
||||
<div class="line-items__item__value">@Model.BTCTotalDue BTC</div>
|
||||
<div class="line-items__item__label" i18n="">Due </div>
|
||||
<div class="line-items__item__value">@Model.BTCDue BTC</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
<ul class="nav nav-pills nav-stacked">
|
||||
<li class="@ManageNavPages.IndexNavClass(ViewContext)"><a asp-action="Index">Profile</a></li>
|
||||
<li class="@ManageNavPages.ChangePasswordNavClass(ViewContext)"><a asp-action="ChangePassword">Password</a></li>
|
||||
<li class="@ManageNavPages.TokensNavClass(ViewContext)"><a asp-action="ListTokens">Access Tokens</a></li>
|
||||
@if (hasExternalLogins)
|
||||
{
|
||||
<li class="@ManageNavPages.ExternalLoginsNavClass(ViewContext)"><a asp-action="ExternalLogins">External logins</a></li>
|
||||
|
|
|
@ -10121,7 +10121,7 @@ All mobile class names should be prefixed by m- */
|
|||
.paid-partial .top-header,
|
||||
.refund-complete .top-header,
|
||||
.archived .top-header {
|
||||
max-height: 49px;
|
||||
max-height: 59px;
|
||||
}
|
||||
|
||||
.paid .timer-row,
|
||||
|
@ -11068,7 +11068,7 @@ line-items {
|
|||
}
|
||||
|
||||
line-items.expanded {
|
||||
height: 110px;
|
||||
height: 120px;
|
||||
border-top: 1px solid rgba(238, 238, 238, 0.5);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue