Merge pull request #117 from lepipele/master

Improvements to i18n, invoice expiry bugfix
This commit is contained in:
Nicolas Dorier
2018-04-14 13:06:45 +09:00
committed by GitHub
6 changed files with 28 additions and 29 deletions

View File

@@ -238,7 +238,8 @@ namespace BTCPayServer.Controllers
BtcPaid = accounting.Paid.ToString(),
Status = invoice.Status,
CryptoImage = "/" + GetImage(paymentMethodId, network),
NetworkFeeDescription = $"{accounting.TxRequired} transaction{(accounting.TxRequired > 1 ? "s" : "")} x {paymentMethodDetails.GetTxFee()} {network.CryptoCode}",
NetworkFee = paymentMethodDetails.GetTxFee(),
IsMultiCurrency = invoice.GetPayments().Select(p => p.GetPaymentMethodId()).Concat(new[] { paymentMethod.GetId() }).Distinct().Count() > 1,
AllowCoinConversion = storeBlob.AllowCoinConversion,
AvailableCryptos = invoice.GetPaymentMethods(_NetworkProvider)
.Where(i => i.Network != null)
@@ -251,10 +252,6 @@ namespace BTCPayServer.Controllers
.ToList()
};
var isMultiCurrency = invoice.GetPayments().Select(p => p.GetPaymentMethodId()).Concat(new[] { paymentMethod.GetId() }).Distinct().Count() > 1;
if (isMultiCurrency)
model.NetworkFeeDescription = $"{accounting.NetworkFee} {network.CryptoCode}";
var expiration = TimeSpan.FromSeconds(model.ExpirationSeconds);
model.TimeLeft = PrettyPrint(expiration);
return model;

View File

@@ -43,7 +43,8 @@ namespace BTCPayServer.Models.InvoicingModels
public string OrderId { get; set; }
public string CryptoImage { get; set; }
public string NetworkFeeDescription { get; internal set; }
public decimal NetworkFee { get; set; }
public bool IsMultiCurrency { get; set; }
public int MaxTimeMinutes { get; internal set; }
public string PaymentType { get; internal set; }
public string PaymentMethodId { get; internal set; }

View File

@@ -87,7 +87,14 @@
<div class="line-items__item__label">
<span>{{$t("Network Cost")}}</span>
</div>
<div class="line-items__item__value" i18n="">{{srvModel.networkFeeDescription }}</div>
<div class="line-items__item__value">
<span v-if="srvModel.IsMultiCurrency">
{{ srvModel.networkFee }} {{ srvModel.cryptoCode }}
</span>
<span v-else>
{{$t("txCount", {count: srvModel.txCount})}} x {{ srvModel.networkFee }} {{ srvModel.cryptoCode }}
</span>
</div>
</div>
<div class="line-items__item">
<div class="line-items__item__label">
@@ -249,11 +256,9 @@
</div>
</div>
<div class="success-message">{{$t("This invoice has been paid")}}</div>
<button class="action-button">
<bp-done-text>
<span>{{$t("Return to StoreName", srvModel)}}</span>
</bp-done-text>
</button>
<a class="action-button" :href="srvModel.merchantRefLink" v-show="srvModel.merchantRefLink">
<span>{{$t("Return to StoreName", srvModel)}}</span>
</a>
</div>
</div>
<div class="button-wrapper refund-address-form-container" id="refund-overpayment-button">
@@ -295,10 +300,9 @@
{{srvModel.orderId}}
</div>
</div>
<a class="action-button" style="margin-top: 20px;">
<bp-done-text>
<span>{{$t("Return to StoreName", srvModel)}}</span>
</bp-done-text>
<a class="action-button" :href="srvModel.merchantRefLink" v-show="srvModel.merchantRefLink"
style="margin-top: 20px;">
<span>{{$t("Return to StoreName", srvModel)}}</span>
</a>
</div>
</div>

View File

@@ -32,15 +32,6 @@ function onDataCallback(jsonData) {
$(".modal-dialog").removeClass("expired");
}
if (srvModel.merchantRefLink !== "") {
$(".action-button").click(function () {
window.location.href = srvModel.merchantRefLink;
});
}
else {
$(".action-button").hide();
}
$(".modal-dialog").addClass("paid");
resetTabsSlider();

View File

@@ -47,5 +47,8 @@ You can return to {{storeName}} if you would like to submit your payment again."
"Archived_Body": "Please contact the store for order information or assistance",
// Lightning
"BOLT 11 Invoice": "BOLT 11 Invoice",
"Node Info": "Node Info"
"Node Info": "Node Info",
//
"txCount": "{{count}} transaction",
"txCount_plural": "{{count}} transactions"
};

View File

@@ -44,7 +44,10 @@ const locales_es = {
// Invoice archived
"This invoice has been archived": "Esta factura ha sido archivada",
"Archived_Body": "Por favor, comuníquese con la tienda para obtener información de su pedido o asistencia",
// Lightning
// Lightning
"BOLT 11 Invoice": "Factura BOLT 11",
"Node Info": "Información del nodo"
};
"Node Info": "Información del nodo",
//
"txCount": "{{count}} transacción",
"txCount_plural": "{{count}} transacciones"
};