mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 23:54:26 +01:00
fix ss
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
<PropertyGroup>
|
||||
<Product>SideShift</Product>
|
||||
<Description>Allows you to embed a SideShift conversion screen to allow customers to pay with altcoins.</Description>
|
||||
<Version>1.1.9</Version>
|
||||
<Version>1.1.10</Version>
|
||||
</PropertyGroup>
|
||||
<!-- Plugin development properties -->
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
@@ -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("_");
|
||||
|
||||
Reference in New Issue
Block a user