mirror of
https://github.com/aljazceru/BTCPayServerPlugins.git
synced 2025-12-17 07:34:24 +01:00
creat payouts on cancel
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>LN Prism</Product>
|
<Product>LN Prism</Product>
|
||||||
<Description>Automated value splits for lightning.</Description>
|
<Description>Automated value splits for lightning.</Description>
|
||||||
<Version>1.0.4</Version>
|
<Version>1.0.5</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<!-- Plugin development properties -->
|
<!-- Plugin development properties -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -262,6 +262,10 @@ namespace BTCPayServer.Plugins.Prism
|
|||||||
}
|
}
|
||||||
|
|
||||||
await UpdatePrismSettingsForStore(creditDestination.StoreId, prismSettings, true);
|
await UpdatePrismSettingsForStore(creditDestination.StoreId, prismSettings, true);
|
||||||
|
if (await CreatePayouts(creditDestination.StoreId, prismSettings))
|
||||||
|
{
|
||||||
|
await UpdatePrismSettingsForStore(creditDestination.StoreId, prismSettings, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -314,10 +318,12 @@ namespace BTCPayServer.Plugins.Prism
|
|||||||
}
|
}
|
||||||
|
|
||||||
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
||||||
await CreatePayouts(address.StoreDataId, prismSettings);
|
if (await CreatePayouts(address.StoreDataId, prismSettings))
|
||||||
|
{
|
||||||
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logs.PayServer.LogWarning(e, "Error while processing prism event");
|
Logs.PayServer.LogWarning(e, "Error while processing prism event");
|
||||||
@@ -328,8 +334,9 @@ namespace BTCPayServer.Plugins.Prism
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CreatePayouts(string storeId, PrismSettings prismSettings)
|
private async Task<bool> CreatePayouts(string storeId, PrismSettings prismSettings)
|
||||||
{
|
{
|
||||||
|
var result = false;
|
||||||
foreach (var (destination, amtMsats) in prismSettings.DestinationBalance)
|
foreach (var (destination, amtMsats) in prismSettings.DestinationBalance)
|
||||||
{
|
{
|
||||||
var amt = amtMsats / 1000;
|
var amt = amtMsats / 1000;
|
||||||
@@ -357,9 +364,12 @@ namespace BTCPayServer.Plugins.Prism
|
|||||||
new PendingPayout(payoutAmount, reserveFee));
|
new PendingPayout(payoutAmount, reserveFee));
|
||||||
prismSettings.DestinationBalance.AddOrReplace(destination,
|
prismSettings.DestinationBalance.AddOrReplace(destination,
|
||||||
amtMsats - (payoutAmount + reserveFee) * 1000);
|
amtMsats - (payoutAmount + reserveFee) * 1000);
|
||||||
|
result = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user