Rendering of Conversion tab on Invoice if enabled in store settings

This commit is contained in:
lepipele
2018-03-17 23:49:09 -05:00
parent c36a900627
commit 14b70ff35e
3 changed files with 39 additions and 26 deletions

View File

@@ -229,6 +229,7 @@ namespace BTCPayServer.Controllers
Status = invoice.Status, Status = invoice.Status,
CryptoImage = "/" + GetImage(paymentMethodId, network), CryptoImage = "/" + GetImage(paymentMethodId, network),
NetworkFeeDescription = $"{accounting.TxRequired} transaction{(accounting.TxRequired > 1 ? "s" : "")} x {paymentMethodDetails.GetTxFee()} {network.CryptoCode}", NetworkFeeDescription = $"{accounting.TxRequired} transaction{(accounting.TxRequired > 1 ? "s" : "")} x {paymentMethodDetails.GetTxFee()} {network.CryptoCode}",
AllowCoinConversion = store.GetStoreBlob().AllowCoinConversion,
AvailableCryptos = invoice.GetPaymentMethods(_NetworkProvider) AvailableCryptos = invoice.GetPaymentMethods(_NetworkProvider)
.Where(i => i.Network != null) .Where(i => i.Network != null)
.Select(kv=> new PaymentModel.AvailableCrypto() .Select(kv=> new PaymentModel.AvailableCrypto()

View File

@@ -43,5 +43,7 @@ namespace BTCPayServer.Models.InvoicingModels
public int MaxTimeMinutes { get; internal set; } public int MaxTimeMinutes { get; internal set; }
public string PaymentType { get; internal set; } public string PaymentType { get; internal set; }
public string PaymentMethodId { get; internal set; } public string PaymentMethodId { get; internal set; }
public bool AllowCoinConversion { get; set; }
} }
} }

View File

@@ -170,10 +170,17 @@
<div class="payment-tabs__tab" id="copy-tab"> <div class="payment-tabs__tab" id="copy-tab">
<span i18n="">Copy</span> <span i18n="">Copy</span>
</div> </div>
<div class="payment-tabs__tab" id="altcoins-tab"> @if (Model.AllowCoinConversion)
<span i18n="">Conversion</span> {
</div> <div class="payment-tabs__tab" id="altcoins-tab">
<div id="tabsSlider" class="payment-tabs__slider three-tabs"></div> <span i18n="">Conversion</span>
</div>
<div id="tabsSlider" class="payment-tabs__slider three-tabs"></div>
}
else
{
<div id="tabsSlider" class="payment-tabs__slider"></div>
}
</div> </div>
</div> </div>
<div adjust-height="" class="payment-box"> <div adjust-height="" class="payment-box">
@@ -262,29 +269,32 @@
</div> </div>
</div> </div>
</div> </div>
<div id="altcoins" class="bp-view payment manual-flow"> @if (Model.AllowCoinConversion)
<div class="manual__step-two__instructions"> {
<span> <div id="altcoins" class="bp-view payment manual-flow">
You can pay {{ srvModel.btcDue }} {{ srvModel.cryptoCode }} using altcoins other than the ones merchant directly supports. <div class="manual__step-two__instructions">
<br /><br /> <span>
This service is provided by 3rd party. Please keep in mind that You can pay {{ srvModel.btcDue }} {{ srvModel.cryptoCode }} using altcoins other than the ones merchant directly supports.
<span style="font-weight: 900;">we have no control</span> over how providers will forward your funds. <br /><br />
Invoice will only be marked paid once funds are received on {{srvModel.cryptoCode}} Blockchain. This service is provided by 3rd party. Please keep in mind that
</span> <span style="font-weight: 900;">we have no control</span> over how providers will forward your funds.
</div> Invoice will only be marked paid once funds are received on {{srvModel.cryptoCode}} Blockchain.
<center> </span>
<script>function shapeshift_click(a, e) { e.preventDefault(); var link = a.href; var shapeshiftWindow = window.open(link, '1418115287605', 'width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=0,left=0,top=0'); shapeshiftWindow.focus(); return false; }</script> </div>
<a onclick="shapeshift_click(this, event);" v-bind:href="srvModel.shapeshiftUrl"> <center>
<img src="https://shapeshift.io/images/shifty/xs_light_altcoins.png" class="ss-button"> <script>function shapeshift_click(a, e) { e.preventDefault(); var link = a.href; var shapeshiftWindow = window.open(link, '1418115287605', 'width=700,height=500,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=0,left=0,top=0'); shapeshiftWindow.focus(); return false; }</script>
</a> <a onclick="shapeshift_click(this, event);" v-bind:href="srvModel.shapeshiftUrl">
<img src="https://shapeshift.io/images/shifty/xs_light_altcoins.png" class="ss-button">
</a>
@*Changelly doesn't have TO_AMOUNT support so we can't include it @*Changelly doesn't have TO_AMOUNT support so we can't include it
<script type="text/javascript">function open_widget(a, e) { e.preventDefault(); var link = a.href; var changellyWindow = window.open(link, 'Changelly', 'width=600,height=470,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=0,left=0,top=0'); changellyWindow.focus(); return false; }</script> <script type="text/javascript">function open_widget(a, e) { e.preventDefault(); var link = a.href; var changellyWindow = window.open(link, 'Changelly', 'width=600,height=470,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=0,left=0,top=0'); changellyWindow.focus(); return false; }</script>
<a onclick="open_widget(this, event);" href="https://changelly.com/widget/v1?auth=email&from=DASH&to=BTC&address=&amount=1&merchant_id=&ref_id="> <a onclick="open_widget(this, event);" href="https://changelly.com/widget/v1?auth=email&from=DASH&to=BTC&address=&amount=1&merchant_id=&ref_id=">
<img src="https://changelly.com/pay_button_pay_with.png" alt="Changelly" /> <img src="https://changelly.com/pay_button_pay_with.png" alt="Changelly" />
</a>*@ </a>*@
</center> </center>
</div> </div>
}
<div class="bp-view" id="link-expired" style="padding-top: 3.6rem;"> <div class="bp-view" id="link-expired" style="padding-top: 3.6rem;">
<div class="manual__step-one refund-address-form" novalidate=""> <div class="manual__step-one refund-address-form" novalidate="">
<div class="manual__step-one__header" i18n="">Link Expired</div> <div class="manual__step-one__header" i18n="">Link Expired</div>