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>
|
||||
<Product>LN Prism</Product>
|
||||
<Description>Automated value splits for lightning.</Description>
|
||||
<Version>1.0.4</Version>
|
||||
<Version>1.0.5</Version>
|
||||
</PropertyGroup>
|
||||
<!-- Plugin development properties -->
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -262,6 +262,10 @@ namespace BTCPayServer.Plugins.Prism
|
||||
}
|
||||
|
||||
await UpdatePrismSettingsForStore(creditDestination.StoreId, prismSettings, true);
|
||||
if (await CreatePayouts(creditDestination.StoreId, prismSettings))
|
||||
{
|
||||
await UpdatePrismSettingsForStore(creditDestination.StoreId, prismSettings, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,8 +318,10 @@ namespace BTCPayServer.Plugins.Prism
|
||||
}
|
||||
|
||||
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
||||
await CreatePayouts(address.StoreDataId, prismSettings);
|
||||
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
||||
if (await CreatePayouts(address.StoreDataId, prismSettings))
|
||||
{
|
||||
await UpdatePrismSettingsForStore(address.StoreDataId, prismSettings, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -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)
|
||||
{
|
||||
var amt = amtMsats / 1000;
|
||||
@@ -357,9 +364,12 @@ namespace BTCPayServer.Plugins.Prism
|
||||
new PendingPayout(payoutAmount, reserveFee));
|
||||
prismSettings.DestinationBalance.AddOrReplace(destination,
|
||||
amtMsats - (payoutAmount + reserveFee) * 1000);
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user