diff --git a/Plugins/BTCPayServer.Plugins.SideShift/BTCPayServer.Plugins.SideShift.csproj b/Plugins/BTCPayServer.Plugins.SideShift/BTCPayServer.Plugins.SideShift.csproj
index 79dac87..72d77df 100644
--- a/Plugins/BTCPayServer.Plugins.SideShift/BTCPayServer.Plugins.SideShift.csproj
+++ b/Plugins/BTCPayServer.Plugins.SideShift/BTCPayServer.Plugins.SideShift.csproj
@@ -9,7 +9,7 @@
SideShift
Allows you to embed a SideShift conversion screen to allow customers to pay with altcoins.
- 1.1.9
+ 1.1.10
diff --git a/Plugins/BTCPayServer.Plugins.SideShift/Resources/js/sideShiftComponent.js b/Plugins/BTCPayServer.Plugins.SideShift/Resources/js/sideShiftComponent.js
index 8eecf6e..6a4e24e 100644
--- a/Plugins/BTCPayServer.Plugins.SideShift/Resources/js/sideShiftComponent.js
+++ b/Plugins/BTCPayServer.Plugins.SideShift/Resources/js/sideShiftComponent.js
@@ -5,25 +5,22 @@ Vue.component("side-shift", {
if (e && e.preventDefault) {
e.preventDefault();
}
+ const toCurrency = this.toCurrency.toLowerCase();
let settleMethodId = "";
let amount = !this.$parent.srvModel.isUnsetTopUp
? this.toCurrencyDue
: undefined;
- if (this.toCurrency.toLowerCase() === "lbtc") {
+ if (toCurrency === "lbtc") {
settleMethodId = "liquid";
- } else if (this.toCurrency.toLowerCase() === "usdt") {
+ } else if (toCurrency=== "usdt") {
settleMethodId = "usdtla";
} else if (
- this.toCurrency.endsWith("LightningLike") ||
- this.toCurrency.endsWith("LNURLPay")
+ toCurrency.endsWith("lightninglike") ||
+ toCurrency.endsWith("lnurlpay")
) {
settleMethodId = "ln";
} else {
- settleMethodId = this.toCurrency
- .replace("_BTCLike", "")
- .replace("_MoneroLike", "")
- .replace("_ZcashLike", "")
- .toLowerCase();
+ settleMethodId = toCurrency.replace('_btclike', '').replace('_monerolike', '').replace('_zcashlike', '').toLowerCase();
}
window.__SIDESHIFT__ = {
parentAffiliateId: "qg0OrfHJV",
diff --git a/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentExtension.cshtml b/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentExtension.cshtml
index b360fc1..8fe2bf3 100644
--- a/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentExtension.cshtml
+++ b/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentExtension.cshtml
@@ -1,11 +1,21 @@
@using BTCPayServer.Plugins.SideShift
+@using BTCPayServer.Payments
@inject BTCPayServer.Security.ContentSecurityPolicies csp
@inject SideShiftService SideShiftService
@model BTCPayServer.Models.InvoicingModels.PaymentModel
@{
var settings = await SideShiftService.GetSideShiftForInvoice(Model.InvoiceId, Model.StoreId);
- var preferredTargetPaymentMethodId = string.IsNullOrEmpty(settings?.PreferredTargetPaymentMethodId) ? null : Model.AvailableCryptos.Any(crypto => crypto.PaymentMethodId == settings.PreferredTargetPaymentMethodId) ? settings.PreferredTargetPaymentMethodId : null;
-
+ var preferredTargetPaymentMethodId = "";
+ if(!PaymentMethodId.TryParse(settings?.PreferredTargetPaymentMethodId, out var preferredPMI))
+ {
+ preferredTargetPaymentMethodId = null;
+ }
+ else
+ {
+ preferredTargetPaymentMethodId = Model.AvailableCryptos.FirstOrDefault(crypto =>
+ crypto.PaymentMethodId == settings.PreferredTargetPaymentMethodId ||
+ (crypto.CryptoCode == preferredPMI.CryptoCode && crypto.PaymentMethodId.EndsWith(LNURLPayPaymentType.Instance.GetId()) || crypto.PaymentMethodId.EndsWith(LightningPaymentType.Instance.GetId())))?.PaymentMethodId;
+ }
}
@if (settings?.Enabled is true)
{
@@ -28,7 +38,7 @@
preferredToCurrency: @Json.Serialize(preferredTargetPaymentMethodId),
}
},
- created () {
+ async created () {
const self = this;
setInterval(function() {
if ( self.explicitId === window.ssExplicitId) {
@@ -36,6 +46,12 @@
}
self.explicitId = window.ssExplicitId;
},200)
+ if(this.preferredToCurrency && this.model.paymentMethodId !== this.preferredToCurrency){
+ this.$parent.paymentMethodId = this.preferredToCurrency;
+ await this.$parent.fetchData();
+ this.$parent.paymentMethodId = "SideShift";
+ }
+
},
computed: {
content () {
@@ -45,14 +61,17 @@
return this.model.paymentMethodId;
},
settleMethodId () {
- if (this.currency.toLowerCase() === "lbtc") {
+
+ const toCurrency = this.currency.toLowerCase();
+
+ if (toCurrency === "lbtc") {
return 'liquid';
- } else if (this.currency.toLowerCase() === "usdt") {
+ } else if (toCurrency === "usdt") {
return "usdtla";
- } else if (this.currency.endsWith('LightningLike') || this.currency.endsWith('LNURLPay')) {
+ } else if (toCurrency.endsWith('lightninglike') || toCurrency.endsWith('lnurlpay')) {
return "ln";
} else {
- return this.currency.replace('_BTCLike', '').replace('_MoneroLike', '').replace('_ZcashLike', '').toLowerCase();
+ return toCurrency.replace('_btclike', '').replace('_monerolike', '').replace('_zcashlike', '').toLowerCase();
}
},
type () {
diff --git a/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentMethodExtension.cshtml b/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentMethodExtension.cshtml
index e4569ad..f94d252 100644
--- a/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentMethodExtension.cshtml
+++ b/Plugins/BTCPayServer.Plugins.SideShift/Views/Shared/SideShift/CheckoutPaymentMethodExtension.cshtml
@@ -7,9 +7,9 @@
if (settings?.Enabled is true)
{
- var coins = await SideShiftService.GetDepositOptions();
if (settings.ExplicitMethods?.Any() is true)
{
+ var coins = await SideShiftService.GetDepositOptions();
foreach (var explicitMethod in settings.ExplicitMethods)
{
var s = explicitMethod.Split("_");