Rename legacy fields

This commit is contained in:
nicolas.dorier
2024-10-07 19:29:05 +09:00
parent c35e7406cd
commit 2f287874e3
13 changed files with 67 additions and 65 deletions

View File

@@ -323,7 +323,7 @@ namespace BTCPayServer.Tests
(Models.InvoicingModels.PaymentModel)((JsonResult)controller.GetStatus(invoice.Id) (Models.InvoicingModels.PaymentModel)((JsonResult)controller.GetStatus(invoice.Id)
.GetAwaiter().GetResult()).Value; .GetAwaiter().GetResult()).Value;
Assert.Single(checkout.AvailableCryptos); Assert.Single(checkout.AvailableCryptos);
Assert.Equal("LTC", checkout.CryptoCode); Assert.Equal("LTC", checkout.PaymentMethodCurrency);
////////////////////// //////////////////////
@@ -478,7 +478,7 @@ namespace BTCPayServer.Tests
(Models.InvoicingModels.PaymentModel)((JsonResult)controller.GetStatus(invoice.Id, null) (Models.InvoicingModels.PaymentModel)((JsonResult)controller.GetStatus(invoice.Id, null)
.GetAwaiter().GetResult()).Value; .GetAwaiter().GetResult()).Value;
Assert.Single(checkout.AvailableCryptos); Assert.Single(checkout.AvailableCryptos);
Assert.Equal("BTC", checkout.CryptoCode); Assert.Equal("BTC", checkout.PaymentMethodCurrency);
Assert.Single(invoice.PaymentCodes); Assert.Single(invoice.PaymentCodes);
Assert.Single(invoice.SupportedTransactionCurrencies); Assert.Single(invoice.SupportedTransactionCurrencies);
@@ -539,7 +539,7 @@ namespace BTCPayServer.Tests
checkout = (Models.InvoicingModels.PaymentModel)((JsonResult)controller.GetStatus(invoice.Id, "LTC") checkout = (Models.InvoicingModels.PaymentModel)((JsonResult)controller.GetStatus(invoice.Id, "LTC")
.GetAwaiter().GetResult()).Value; .GetAwaiter().GetResult()).Value;
Assert.Equal(2, checkout.AvailableCryptos.Count); Assert.Equal(2, checkout.AvailableCryptos.Count);
Assert.Equal("LTC", checkout.CryptoCode); Assert.Equal("LTC", checkout.PaymentMethodCurrency);
Assert.Equal(2, invoice.PaymentCodes.Count()); Assert.Equal(2, invoice.PaymentCodes.Count());
Assert.Equal(2, invoice.SupportedTransactionCurrencies.Count()); Assert.Equal(2, invoice.SupportedTransactionCurrencies.Count());

View File

@@ -1655,8 +1655,8 @@ namespace BTCPayServer.Tests
// Standard for all uppercase characters in QR codes is still not implemented in all wallets // Standard for all uppercase characters in QR codes is still not implemented in all wallets
// But we're proceeding with BECH32 being uppercase // But we're proceeding with BECH32 being uppercase
Assert.Equal($"bitcoin:{paymentMethodUnified.BtcAddress}", paymentMethodUnified.InvoiceBitcoinUrl.Split('?')[0]); Assert.Equal($"bitcoin:{paymentMethodUnified.Address}", paymentMethodUnified.InvoiceBitcoinUrl.Split('?')[0]);
Assert.Equal($"bitcoin:{paymentMethodUnified.BtcAddress.ToUpperInvariant()}", paymentMethodUnified.InvoiceBitcoinUrlQR.Split('?')[0]); Assert.Equal($"bitcoin:{paymentMethodUnified.Address.ToUpperInvariant()}", paymentMethodUnified.InvoiceBitcoinUrlQR.Split('?')[0]);
// Fallback lightning invoice should be uppercase inside the QR code, lowercase in payment URI // Fallback lightning invoice should be uppercase inside the QR code, lowercase in payment URI
var lightningFallback = paymentMethodUnified.InvoiceBitcoinUrl.Split(new[] { "&lightning=" }, StringSplitOptions.None)[1]; var lightningFallback = paymentMethodUnified.InvoiceBitcoinUrl.Split(new[] { "&lightning=" }, StringSplitOptions.None)[1];

View File

@@ -867,7 +867,7 @@ namespace BTCPayServer.Controllers
{ {
Activated = prompt.Activated, Activated = prompt.Activated,
PaymentMethodName = _prettyName.PrettyName(paymentMethodId), PaymentMethodName = _prettyName.PrettyName(paymentMethodId),
CryptoCode = prompt.Currency, PaymentMethodCurrency = prompt.Currency,
RootPath = Request.PathBase.Value.WithTrailingSlash(), RootPath = Request.PathBase.Value.WithTrailingSlash(),
OrderId = orderId, OrderId = orderId,
InvoiceId = invoiceId, InvoiceId = invoiceId,
@@ -879,9 +879,9 @@ namespace BTCPayServer.Controllers
CelebratePayment = storeBlob.CelebratePayment, CelebratePayment = storeBlob.CelebratePayment,
OnChainWithLnInvoiceFallback = storeBlob.OnChainWithLnInvoiceFallback, OnChainWithLnInvoiceFallback = storeBlob.OnChainWithLnInvoiceFallback,
CryptoImage = Request.GetRelativePathOrAbsolute(GetPaymentMethodImage(paymentMethodId)), CryptoImage = Request.GetRelativePathOrAbsolute(GetPaymentMethodImage(paymentMethodId)),
BtcAddress = prompt.Destination, Address = prompt.Destination,
BtcDue = ShowMoney(accounting.Due), Due = ShowMoney(accounting.Due),
BtcPaid = ShowMoney(accounting.Paid), Paid = ShowMoney(accounting.Paid),
InvoiceCurrency = invoice.Currency, InvoiceCurrency = invoice.Currency,
// The Tweak is part of the PaymentMethodFee, but let's not show it in the UI as it's negligible. // The Tweak is part of the PaymentMethodFee, but let's not show it in the UI as it's negligible.
OrderAmount = ShowMoney(accounting.TotalDue - (prompt.PaymentMethodFee - prompt.TweakFee)), OrderAmount = ShowMoney(accounting.TotalDue - (prompt.PaymentMethodFee - prompt.TweakFee)),
@@ -918,6 +918,7 @@ namespace BTCPayServer.Controllers
{ {
Displayed = displayedPaymentMethods.Contains(kv.PaymentMethodId), Displayed = displayedPaymentMethods.Contains(kv.PaymentMethodId),
PaymentMethodId = kv.PaymentMethodId, PaymentMethodId = kv.PaymentMethodId,
PaymentMethodName = _prettyName.PrettyName(kv.PaymentMethodId),
Order = kv.PaymentMethodId switch Order = kv.PaymentMethodId switch
{ {
_ when PaymentTypes.CHAIN.GetPaymentMethodId(_NetworkProvider.DefaultNetwork.CryptoCode) == kv.PaymentMethodId => 0, _ when PaymentTypes.CHAIN.GetPaymentMethodId(_NetworkProvider.DefaultNetwork.CryptoCode) == kv.PaymentMethodId => 0,
@@ -932,7 +933,7 @@ namespace BTCPayServer.Controllers
}; };
model.PaymentMethodId = paymentMethodId.ToString(); model.PaymentMethodId = paymentMethodId.ToString();
model.OrderAmountFiat = OrderAmountFromInvoice(model.CryptoCode, invoice, DisplayFormatter.CurrencyFormat.Symbol); model.OrderAmountFiat = OrderAmountFromInvoice(model.PaymentMethodCurrency, invoice, DisplayFormatter.CurrencyFormat.Symbol);
if (storeBlob.PlaySoundOnPayment) if (storeBlob.PlaySoundOnPayment)
{ {

View File

@@ -15,7 +15,8 @@ namespace BTCPayServer.Models.InvoicingModels
[JsonConverter(typeof(PaymentMethodIdJsonConverter))] [JsonConverter(typeof(PaymentMethodIdJsonConverter))]
public PaymentMethodId PaymentMethodId { get; set; } public PaymentMethodId PaymentMethodId { get; set; }
public bool Displayed { get; set; } public bool Displayed { get; set; }
public string Order { get; set; } public string PaymentMethodName { get; set; }
public int Order { get; set; }
[JsonExtensionData] [JsonExtensionData]
public Dictionary<string, JToken> AdditionalData { get; set; } = new(); public Dictionary<string, JToken> AdditionalData { get; set; } = new();
} }
@@ -33,10 +34,10 @@ namespace BTCPayServer.Models.InvoicingModels
public bool IsUnsetTopUp { get; set; } public bool IsUnsetTopUp { get; set; }
public bool OnChainWithLnInvoiceFallback { get; set; } public bool OnChainWithLnInvoiceFallback { get; set; }
public bool CelebratePayment { get; set; } public bool CelebratePayment { get; set; }
public string CryptoCode { get; set; } public string PaymentMethodCurrency { get; set; }
public string InvoiceId { get; set; } public string InvoiceId { get; set; }
public string BtcAddress { get; set; } public string Address { get; set; }
public string BtcDue { get; set; } public string Due { get; set; }
public string CustomerEmail { get; set; } public string CustomerEmail { get; set; }
public bool ShowRecommendedFee { get; set; } public bool ShowRecommendedFee { get; set; }
public decimal FeeRate { get; set; } public decimal FeeRate { get; set; }
@@ -55,7 +56,7 @@ namespace BTCPayServer.Models.InvoicingModels
public string InvoiceBitcoinUrlQR { get; set; } public string InvoiceBitcoinUrlQR { get; set; }
public int TxCount { get; set; } public int TxCount { get; set; }
public int TxCountForFee { get; set; } public int TxCountForFee { get; set; }
public string BtcPaid { get; set; } public string Paid { get; set; }
public string StoreSupportUrl { get; set; } public string StoreSupportUrl { get; set; }
public string OrderId { get; set; } public string OrderId { get; set; }

View File

@@ -57,7 +57,7 @@ namespace BTCPayServer.Payments.Bitcoin
var bip21Case = _Network.SupportLightning && context.StoreBlob.OnChainWithLnInvoiceFallback; var bip21Case = _Network.SupportLightning && context.StoreBlob.OnChainWithLnInvoiceFallback;
var amountInSats = bip21Case && context.StoreBlob.LightningAmountInSatoshi && context.Model.CryptoCode == "BTC"; var amountInSats = bip21Case && context.StoreBlob.LightningAmountInSatoshi && context.Model.PaymentMethodCurrency == "BTC";
string? lightningFallback = null; string? lightningFallback = null;
if (context.Model.Activated && bip21Case) if (context.Model.Activated && bip21Case)
{ {
@@ -119,10 +119,10 @@ namespace BTCPayServer.Payments.Bitcoin
// model.InvoiceBitcoinUrlQR: bitcoin:bcrt1qxp2qa5dhn7?amount=0.00044007&lightning=LNBCRT4400... // model.InvoiceBitcoinUrlQR: bitcoin:bcrt1qxp2qa5dhn7?amount=0.00044007&lightning=LNBCRT4400...
} }
if (_Network.CryptoCode.Equals("BTC", StringComparison.InvariantCultureIgnoreCase) && _bech32Prefix is not null && context.Model.BtcAddress.StartsWith(_bech32Prefix, StringComparison.OrdinalIgnoreCase)) if (_Network.CryptoCode.Equals("BTC", StringComparison.InvariantCultureIgnoreCase) && _bech32Prefix is not null && context.Model.Address.StartsWith(_bech32Prefix, StringComparison.OrdinalIgnoreCase))
{ {
context.Model.InvoiceBitcoinUrlQR = context.Model.InvoiceBitcoinUrlQR.Replace( context.Model.InvoiceBitcoinUrlQR = context.Model.InvoiceBitcoinUrlQR.Replace(
$"{_Network.NBitcoinNetwork.UriScheme}:{context.Model.BtcAddress}", $"{_Network.NBitcoinNetwork.UriScheme}:{context.Model.BtcAddress.ToUpperInvariant()}", $"{_Network.NBitcoinNetwork.UriScheme}:{context.Model.Address}", $"{_Network.NBitcoinNetwork.UriScheme}:{context.Model.Address.ToUpperInvariant()}",
StringComparison.OrdinalIgnoreCase); StringComparison.OrdinalIgnoreCase);
// model.InvoiceBitcoinUrlQR: bitcoin:BCRT1QXP2QA5DHN...?amount=0.00044007&lightning=LNBCRT4400... // model.InvoiceBitcoinUrlQR: bitcoin:BCRT1QXP2QA5DHN...?amount=0.00044007&lightning=LNBCRT4400...
} }
@@ -144,9 +144,9 @@ namespace BTCPayServer.Payments.Bitcoin
{ {
NumberFormat = { NumberGroupSeparator = " " } NumberFormat = { NumberGroupSeparator = " " }
}; };
model.CryptoCode = "sats"; model.PaymentMethodCurrency = "sats";
model.BtcDue = Money.Parse(model.BtcDue).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); model.Due = Money.Parse(model.Due).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
model.BtcPaid = Money.Parse(model.BtcPaid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); model.Paid = Money.Parse(model.Paid).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture); model.OrderAmount = Money.Parse(model.OrderAmount).ToUnit(MoneyUnit.Satoshi).ToString("N0", satoshiCulture);
model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi); model.NetworkFee = new Money(model.NetworkFee, MoneyUnit.BTC).ToUnit(MoneyUnit.Satoshi);
model.Rate = model.InvoiceCurrency is "BTC" or "SATS" model.Rate = model.InvoiceCurrency is "BTC" or "SATS"

View File

@@ -44,13 +44,13 @@ namespace BTCPayServer.Payments.LNURLPay
var lnurl = paymentLinkExtension.GetPaymentLink(context.Prompt, context.UrlHelper); var lnurl = paymentLinkExtension.GetPaymentLink(context.Prompt, context.UrlHelper);
if (lnurl is not null) if (lnurl is not null)
{ {
context.Model.BtcAddress = lnurl.Replace(UriScheme, ""); context.Model.Address = lnurl.Replace(UriScheme, "");
context.Model.InvoiceBitcoinUrl = lnurl; context.Model.InvoiceBitcoinUrl = lnurl;
context.Model.InvoiceBitcoinUrlQR = lnurl.ToUpperInvariant().Replace(UriScheme.ToUpperInvariant(), UriScheme); context.Model.InvoiceBitcoinUrlQR = lnurl.ToUpperInvariant().Replace(UriScheme.ToUpperInvariant(), UriScheme);
} }
context.Model.CheckoutBodyComponentName = LightningPaymentModelExtension.CheckoutBodyComponentName; context.Model.CheckoutBodyComponentName = LightningPaymentModelExtension.CheckoutBodyComponentName;
context.Model.PeerInfo = handler.ParsePaymentPromptDetails(context.Prompt.Details).NodeInfo; context.Model.PeerInfo = handler.ParsePaymentPromptDetails(context.Prompt.Details).NodeInfo;
if (context.StoreBlob.LightningAmountInSatoshi && context.Model.CryptoCode == "BTC") if (context.StoreBlob.LightningAmountInSatoshi && context.Model.PaymentMethodCurrency == "BTC")
{ {
BitcoinPaymentModelExtension.PreparePaymentModelForAmountInSats(context.Model, context.Prompt.Rate, _displayFormatter); BitcoinPaymentModelExtension.PreparePaymentModelForAmountInSats(context.Model, context.Prompt.Rate, _displayFormatter);
} }

View File

@@ -50,7 +50,7 @@ namespace BTCPayServer.Payments.Lightning
if (context.Model.InvoiceBitcoinUrl is not null) if (context.Model.InvoiceBitcoinUrl is not null)
context.Model.InvoiceBitcoinUrlQR = $"lightning:{context.Model.InvoiceBitcoinUrl.ToUpperInvariant()?.Substring("LIGHTNING:".Length)}"; context.Model.InvoiceBitcoinUrlQR = $"lightning:{context.Model.InvoiceBitcoinUrl.ToUpperInvariant()?.Substring("LIGHTNING:".Length)}";
context.Model.PeerInfo = handler.ParsePaymentPromptDetails(paymentPrompt.Details).NodeInfo; context.Model.PeerInfo = handler.ParsePaymentPromptDetails(paymentPrompt.Details).NodeInfo;
if (context.StoreBlob.LightningAmountInSatoshi && context.Model.CryptoCode == "BTC") if (context.StoreBlob.LightningAmountInSatoshi && context.Model.PaymentMethodCurrency == "BTC")
{ {
BitcoinPaymentModelExtension.PreparePaymentModelForAmountInSats(context.Model, paymentPrompt.Rate, _displayFormatter); BitcoinPaymentModelExtension.PreparePaymentModelForAmountInSats(context.Model, paymentPrompt.Rate, _displayFormatter);
} }

View File

@@ -13,9 +13,9 @@
</div> </div>
<img class="qr-icon" :src="model.cryptoImage" :alt="model.paymentMethodName"/> <img class="qr-icon" :src="model.cryptoImage" :alt="model.paymentMethodName"/>
</div> </div>
<div v-if="model.btcAddress" class="input-group mt-3"> <div v-if="model.address" class="input-group mt-3">
<div class="form-floating" id="Address_@Model.PaymentMethodId"> <div class="form-floating" id="Address_@Model.PaymentMethodId">
<vc:truncate-center text="model.btcAddress" is-vue="true" padding="15" elastic="true" classes="form-control-plaintext" /> <vc:truncate-center text="model.address" is-vue="true" padding="15" elastic="true" classes="form-control-plaintext" />
<label v-t="{ path: 'address', args: { paymentMethod: model.paymentMethodName }}"></label> <label v-t="{ path: 'address', args: { paymentMethod: model.paymentMethodName }}"></label>
</div> </div>
</div> </div>

View File

@@ -10,15 +10,15 @@
</div> </div>
<img class="qr-icon" :src="model.cryptoImage" :alt="model.paymentMethodName"/> <img class="qr-icon" :src="model.cryptoImage" :alt="model.paymentMethodName"/>
</div> </div>
<div v-if="model.btcAddress" class="input-group mt-3"> <div v-if="model.address" class="input-group mt-3">
<div class="form-floating" id="Lightning_@Model.PaymentMethodId"> <div class="form-floating" id="Lightning_@Model.PaymentMethodId">
<vc:truncate-center text="model.btcAddress" is-vue="true" padding="15" elastic="true" classes="form-control-plaintext" /> <vc:truncate-center text="model.address" is-vue="true" padding="15" elastic="true" classes="form-control-plaintext" />
<label v-t="'lightning'"></label> <label v-t="'lightning'"></label>
</div> </div>
</div> </div>
<a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" id="PayInWallet" target="_blank" <a v-if="model.invoiceBitcoinUrl && model.showPayInWalletButton" class="btn btn-primary rounded-pill w-100 mt-4" id="PayInWallet" target="_blank"
:href="model.invoiceBitcoinUrl" v-t="'pay_in_wallet'"></a> :href="model.invoiceBitcoinUrl" v-t="'pay_in_wallet'"></a>
<div v-if="!model.invoiceBitcoinUrl && !model.btcAddress" class="alert alert-danger">This payment method is not available when using an insecure connection. Please use HTTPS or Tor.</div> <div v-if="!model.invoiceBitcoinUrl && !model.address" class="alert alert-danger">This payment method is not available when using an insecure connection. Please use HTTPS or Tor.</div>
@await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-lightning-post-content", model = Model}) @await Component.InvokeAsync("UiExtensionPoint", new {location = "checkout-lightning-post-content", model = Model})
</div> </div>
</template> </template>

View File

@@ -52,14 +52,14 @@
paying: false, paying: false,
mining: false, mining: false,
expiring: false, expiring: false,
amountRemaining: this.btcDue amountRemaining: this.due
} }
}, },
props: { props: {
invoiceId: String, invoiceId: String,
paymentMethodId: String, paymentMethodId: String,
cryptoCode: String, cryptoCode: String,
btcDue: Number, due: Number,
isProcessing: Boolean, isProcessing: Boolean,
isSettled: Boolean isSettled: Boolean
}, },

View File

@@ -5,12 +5,12 @@
<p class="alert alert-danger" style="display: none; word-break: break-all;"></p> <p class="alert alert-danger" style="display: none; word-break: break-all;"></p>
<p class="alert alert-success" style="display: none; word-break: break-all;"></p> <p class="alert alert-success" style="display: none; word-break: break-all;"></p>
<form id="test-payment" action="/i/@Model.InvoiceId/test-payment" method="post" class="cheat-mode form-inline my-2"> <form id="test-payment" action="/i/@Model.InvoiceId/test-payment" method="post" class="cheat-mode form-inline my-2">
<input name="CryptoCode" type="hidden" value="@Model.CryptoCode"> <input name="CryptoCode" type="hidden" value="@Model.PaymentMethodCurrency">
<div class="form-group mb-1"> <div class="form-group mb-1">
<label for="test-payment-amount" class="control-label">{{$t("Fake a @Model.CryptoCode payment for testing")}}</label> <label for="test-payment-amount" class="control-label">{{$t("Fake a @Model.PaymentMethodCurrency payment for testing")}}</label>
<div class="input-group"> <div class="input-group">
<input id="test-payment-amount" name="Amount" type="number" step="0.00000001" min="0" class="form-control" placeholder="Amount" value="@Model.BtcDue" /> <input id="test-payment-amount" name="Amount" type="number" step="0.00000001" min="0" class="form-control" placeholder="Amount" value="@Model.Due" />
<div id="test-payment-crypto-code" class="input-group-addon">@Model.CryptoCode</div> <div id="test-payment-crypto-code" class="input-group-addon">@Model.PaymentMethodCurrency</div>
</div> </div>
</div> </div>
<button id="FakePayment" class="btn btn-primary" type="submit">{{$t("Fake Payment")}}</button> <button id="FakePayment" class="btn btn-primary" type="submit">{{$t("Fake Payment")}}</button>

View File

@@ -60,7 +60,7 @@
} }
else else
{ {
<h2 id="AmountDue" v-text="`${srvModel.btcDue} ${srvModel.cryptoCode}`" :data-clipboard="asNumber(srvModel.btcDue)" data-clipboard-hover :data-amount-due="srvModel.btcDue">@Model.BtcDue @Model.CryptoCode</h2> <h2 id="AmountDue" v-text="`${srvModel.due} ${srvModel.paymentMethodCurrency}`" :data-clipboard="asNumber(srvModel.due)" data-clipboard-hover :data-amount-due="srvModel.due">@Model.Due @Model.PaymentMethodCurrency</h2>
} }
</div> </div>
<div id="PaymentInfo" class="info mt-3 mb-2" v-collapsible="showInfo"> <div id="PaymentInfo" class="info mt-3 mb-2" v-collapsible="showInfo">
@@ -73,7 +73,7 @@
<vc:icon symbol="info" /> <vc:icon symbol="info" />
<span v-t="'partial_payment_info'"></span> <span v-t="'partial_payment_info'"></span>
</div> </div>
<div v-if="showPaymentDueInfo" v-html="replaceNewlines($t('still_due', { amount: `${srvModel.btcDue} ${srvModel.cryptoCode}` }))"></div> <div v-if="showPaymentDueInfo" v-html="replaceNewlines($t('still_due', { amount: `${srvModel.due} ${srvModel.paymentMethodCurrency}` }))"></div>
</div> </div>
</div> </div>
<button id="DetailsToggle" class="d-flex align-items-center gap-1 btn btn-link payment-details-button mb-2" type="button" :aria-expanded="displayPaymentDetails ? 'true' : 'false'" v-on:click="displayPaymentDetails = !displayPaymentDetails"> <button id="DetailsToggle" class="d-flex align-items-center gap-1 btn btn-link payment-details-button mb-2" type="button" :aria-expanded="displayPaymentDetails ? 'true' : 'false'" v-on:click="displayPaymentDetails = !displayPaymentDetails">
@@ -85,8 +85,8 @@
:srv-model="srvModel" :srv-model="srvModel"
:is-active="isActive" :is-active="isActive"
:order-amount="orderAmount" :order-amount="orderAmount"
:btc-paid="btcPaid" :paid="paid"
:btc-due="btcDue" :due="due"
:show-recommended-fee="showRecommendedFee" :show-recommended-fee="showRecommendedFee"
class="pb-4" /> class="pb-4" />
</div> </div>
@@ -127,7 +127,7 @@
</span> </span>
<h4 v-t="'payment_received'" class="mb-4"></h4> <h4 v-t="'payment_received'" class="mb-4"></h4>
<p class="text-center" v-t="'payment_received_body'"></p> <p class="text-center" v-t="'payment_received_body'"></p>
<p class="text-center" v-if="srvModel.receivedConfirmations !== null && srvModel.requiredConfirmations" v-t="{ path: 'payment_received_confirmations', args: { cryptoCode: realCryptoCode, receivedConfirmations: srvModel.receivedConfirmations, requiredConfirmations: srvModel.requiredConfirmations } }"></p> <p class="text-center" v-if="srvModel.receivedConfirmations !== null && srvModel.requiredConfirmations" v-t="{ path: 'payment_received_confirmations', args: { cryptoCode: realPaymentMethodCurrency, receivedConfirmations: srvModel.receivedConfirmations, requiredConfirmations: srvModel.requiredConfirmations } }"></p>
<div id="PaymentDetails" class="payment-details"> <div id="PaymentDetails" class="payment-details">
<dl class="mb-0"> <dl class="mb-0">
<div> <div>
@@ -143,8 +143,8 @@
:srv-model="srvModel" :srv-model="srvModel"
:is-active="isActive" :is-active="isActive"
:order-amount="orderAmount" :order-amount="orderAmount"
:btc-paid="btcPaid" :paid="paid"
:btc-due="btcDue" :due="due"
:show-recommended-fee="showRecommendedFee" :show-recommended-fee="showRecommendedFee"
v-collapsible="displayPaymentDetails" /> v-collapsible="displayPaymentDetails" />
</div> </div>
@@ -180,8 +180,8 @@
:srv-model="srvModel" :srv-model="srvModel"
:is-active="isActive" :is-active="isActive"
:order-amount="orderAmount" :order-amount="orderAmount"
:btc-paid="btcPaid" :paid="paid"
:btc-due="btcDue" :due="due"
:show-recommended-fee="showRecommendedFee" :show-recommended-fee="showRecommendedFee"
class="mb-5" /> class="mb-5" />
</div> </div>
@@ -213,8 +213,8 @@
:srv-model="srvModel" :srv-model="srvModel"
:is-active="isActive" :is-active="isActive"
:order-amount="orderAmount" :order-amount="orderAmount"
:btc-paid="btcPaid" :paid="paid"
:btc-due="btcDue" :due="due"
:show-recommended-fee="showRecommendedFee" :show-recommended-fee="showRecommendedFee"
v-collapsible="displayPaymentDetails" /> v-collapsible="displayPaymentDetails" />
</div> </div>
@@ -234,7 +234,7 @@
</main> </main>
@if (Env.CheatMode) @if (Env.CheatMode)
{ {
<checkout-cheating invoice-id="@Model.InvoiceId" :btc-due="btcDue" :is-settled="isSettled" :is-processing="isProcessing" :payment-method-id="pmId" :crypto-code="srvModel.cryptoCode"></checkout-cheating> <checkout-cheating invoice-id="@Model.InvoiceId" :due="due" :is-settled="isSettled" :is-processing="isProcessing" :payment-method-id="pmId" :crypto-code="srvModel.paymentMethodCurrency"></checkout-cheating>
} }
<footer class="store-footer"> <footer class="store-footer">
<a class="store-powered-by" href="https://btcpayserver.org" target="_blank" rel="noreferrer noopener"> <a class="store-powered-by" href="https://btcpayserver.org" target="_blank" rel="noreferrer noopener">
@@ -257,33 +257,33 @@
<dl> <dl>
<div v-if="orderAmount > 0" id="PaymentDetails-TotalPrice" key="TotalPrice"> <div v-if="orderAmount > 0" id="PaymentDetails-TotalPrice" key="TotalPrice">
<dt v-t="'total_price'"></dt> <dt v-t="'total_price'"></dt>
<dd :data-clipboard="asNumber(srvModel.orderAmount)" data-clipboard-hover="start">{{srvModel.orderAmount}} {{ srvModel.cryptoCode }}</dd> <dd :data-clipboard="asNumber(srvModel.orderAmount)" data-clipboard-hover="start">{{srvModel.orderAmount}} {{ srvModel.paymentMethodCurrency }}</dd>
</div> </div>
<div v-if="orderAmount > 0 && srvModel.orderAmountFiat" id="PaymentDetails-TotalFiat" key="TotalFiat"> <div v-if="orderAmount > 0 && srvModel.orderAmountFiat" id="PaymentDetails-TotalFiat" key="TotalFiat">
<dt v-t="'total_fiat'"></dt> <dt v-t="'total_fiat'"></dt>
<dd :data-clipboard="asNumber(srvModel.orderAmountFiat)" data-clipboard-hover="start">{{srvModel.orderAmountFiat}}</dd> <dd :data-clipboard="asNumber(srvModel.orderAmountFiat)" data-clipboard-hover="start">{{srvModel.orderAmountFiat}}</dd>
</div> </div>
<div v-if="srvModel.rate && srvModel.cryptoCode" id="PaymentDetails-ExchangeRate" key="ExchangeRate"> <div v-if="srvModel.rate && srvModel.paymentMethodCurrency" id="PaymentDetails-ExchangeRate" key="ExchangeRate">
<dt v-t="'exchange_rate'"></dt> <dt v-t="'exchange_rate'"></dt>
<dd :data-clipboard="asNumber(srvModel.rate)" data-clipboard-hover="start"> <dd :data-clipboard="asNumber(srvModel.rate)" data-clipboard-hover="start">
<template v-if="srvModel.cryptoCode === 'sats'">1 sat = {{ srvModel.rate }}</template> <template v-if="srvModel.paymentMethodCurrency === 'sats'">1 sat = {{ srvModel.rate }}</template>
<template v-else>1 {{ srvModel.cryptoCode }} = {{ srvModel.rate }}</template> <template v-else>1 {{ srvModel.paymentMethodCurrency }} = {{ srvModel.rate }}</template>
</dd> </dd>
</div> </div>
<div v-if="srvModel.networkFee" id="PaymentDetails-NetworkCost" key="NetworkCost"> <div v-if="srvModel.networkFee" id="PaymentDetails-NetworkCost" key="NetworkCost">
<dt v-t="'network_cost'"></dt> <dt v-t="'network_cost'"></dt>
<dd :data-clipboard="asNumber(srvModel.networkFee)" data-clipboard-hover="start"> <dd :data-clipboard="asNumber(srvModel.networkFee)" data-clipboard-hover="start">
<div v-if="srvModel.txCountForFee > 0" v-t="{ path: 'tx_count', args: { count: srvModel.txCount } }"></div> <div v-if="srvModel.txCountForFee > 0" v-t="{ path: 'tx_count', args: { count: srvModel.txCount } }"></div>
<div v-text="`${srvModel.networkFee} ${srvModel.cryptoCode}`"></div> <div v-text="`${srvModel.networkFee} ${srvModel.paymentMethodCurrency}`"></div>
</dd> </dd>
</div> </div>
<div v-if="btcPaid > 0" id="PaymentDetails-AmountPaid" key="AmountPaid"> <div v-if="paid > 0" id="PaymentDetails-AmountPaid" key="AmountPaid">
<dt v-t="'amount_paid'"></dt> <dt v-t="'amount_paid'"></dt>
<dd :data-clipboard="asNumber(srvModel.btcPaid)" data-clipboard-hover="start" v-text="`${srvModel.btcPaid} ${srvModel.cryptoCode}`"></dd> <dd :data-clipboard="asNumber(srvModel.paid)" data-clipboard-hover="start" v-text="`${srvModel.paid} ${srvModel.paymentMethodCurrency}`"></dd>
</div> </div>
<div v-if="btcDue > 0" id="PaymentDetails-AmountDue" key="AmountDue"> <div v-if="due > 0" id="PaymentDetails-AmountDue" key="AmountDue">
<dt v-t="'amount_due'"></dt> <dt v-t="'amount_due'"></dt>
<dd :data-clipboard="asNumber(srvModel.btcDue)" data-clipboard-hover="start" v-text="`${srvModel.btcDue} ${srvModel.cryptoCode}`"></dd> <dd :data-clipboard="asNumber(srvModel.due)" data-clipboard-hover="start" v-text="`${srvModel.due} ${srvModel.paymentMethodCurrency}`"></dd>
</div> </div>
<div v-if="showRecommendedFee" id="PaymentDetails-RecommendedFee" key="RecommendedFee"> <div v-if="showRecommendedFee" id="PaymentDetails-RecommendedFee" key="RecommendedFee">
<dt v-t="'recommended_fee'"></dt> <dt v-t="'recommended_fee'"></dt>

View File

@@ -73,8 +73,8 @@ const PaymentDetails = {
isActive: Boolean, isActive: Boolean,
showRecommendedFee: Boolean, showRecommendedFee: Boolean,
orderAmount: Number, orderAmount: Number,
btcPaid: Number, paid: Number,
btcDue: Number due: Number
}, },
methods: { methods: {
asNumber asNumber
@@ -129,7 +129,7 @@ function initApp() {
return STATUS_PAYABLE.includes(this.srvModel.status); return STATUS_PAYABLE.includes(this.srvModel.status);
}, },
isPaidPartial () { isPaidPartial () {
return this.btcPaid > 0 && this.btcDue > 0; return this.paid > 0 && this.due > 0;
}, },
showInfo () { showInfo () {
return this.showTimer || this.showPaymentDueInfo; return this.showTimer || this.showPaymentDueInfo;
@@ -146,11 +146,11 @@ function initApp() {
orderAmount () { orderAmount () {
return this.asNumber(this.srvModel.orderAmount); return this.asNumber(this.srvModel.orderAmount);
}, },
btcDue () { due () {
return this.asNumber(this.srvModel.btcDue); return this.asNumber(this.srvModel.due);
}, },
btcPaid () { paid () {
return this.asNumber(this.srvModel.btcPaid); return this.asNumber(this.srvModel.paid);
}, },
pmId() { pmId() {
return this.paymentMethodId || this.srvModel.paymentMethodId; return this.paymentMethodId || this.srvModel.paymentMethodId;
@@ -182,8 +182,8 @@ function initApp() {
isPluginPaymentMethod () { isPluginPaymentMethod () {
return !this.paymentMethodIds.includes(this.pmId); return !this.paymentMethodIds.includes(this.pmId);
}, },
realCryptoCode () { realPaymentMethodCurrency () {
return this.srvModel.cryptoCode.toLowerCase() === 'sats' ? 'BTC' : this.srvModel.cryptoCode; return this.srvModel.paymentMethodCurrency.toLowerCase() === 'sats' ? 'BTC' : this.srvModel.paymentMethodCurrency;
} }
}, },
watch: { watch: {