Fix: Do not allow retry of payouts if they are non interactive (Boltcard) (#6382)

This commit is contained in:
Nicolas Dorier
2024-11-12 09:58:10 +09:00
committed by GitHub
parent d40669c7bd
commit 0f7c0341c5
4 changed files with 9 additions and 2 deletions

View File

@@ -192,6 +192,7 @@ namespace BTCPayServer
PayoutMethodId = pmi, PayoutMethodId = pmi,
PullPaymentId = pullPaymentId, PullPaymentId = pullPaymentId,
StoreId = pp.StoreId, StoreId = pp.StoreId,
NonInteractiveOnly = nonInteractiveOnly,
ClaimedAmount = result.MinimumAmount.ToDecimal(unit), ClaimedAmount = result.MinimumAmount.ToDecimal(unit),
}); });

View File

@@ -27,7 +27,8 @@ namespace BTCPayServer.Data
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public int? ErrorCount { get; set; } public int? ErrorCount { get; set; }
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool NonInteractiveOnly { get; set; }
public int IncrementErrorCount() public int IncrementErrorCount()
{ {
if (ErrorCount is { } c) if (ErrorCount is { } c)

View File

@@ -709,11 +709,12 @@ namespace BTCPayServer.HostedServices
DedupId = req.ClaimRequest.Destination.Id, DedupId = req.ClaimRequest.Destination.Id,
StoreDataId = req.ClaimRequest.StoreId ?? pp?.StoreId, StoreDataId = req.ClaimRequest.StoreId ?? pp?.StoreId,
Currency = payoutHandler.Currency, Currency = payoutHandler.Currency,
OriginalCurrency = pp?.Currency ?? payoutHandler.Currency OriginalCurrency = pp?.Currency ?? payoutHandler.Currency,
}; };
var payoutBlob = new PayoutBlob() var payoutBlob = new PayoutBlob()
{ {
Destination = req.ClaimRequest.Destination.ToString(), Destination = req.ClaimRequest.Destination.ToString(),
NonInteractiveOnly = req.ClaimRequest.NonInteractiveOnly,
Metadata = req.ClaimRequest.Metadata ?? new JObject(), Metadata = req.ClaimRequest.Metadata ?? new JObject(),
}; };
payout.OriginalAmount = claimed; payout.OriginalAmount = claimed;
@@ -1067,6 +1068,7 @@ namespace BTCPayServer.HostedServices
public IClaimDestination Destination { get; set; } public IClaimDestination Destination { get; set; }
public string StoreId { get; set; } public string StoreId { get; set; }
public bool? PreApprove { get; set; } public bool? PreApprove { get; set; }
public bool NonInteractiveOnly { get; set; }
public JObject Metadata { get; set; } public JObject Metadata { get; set; }
} }

View File

@@ -117,6 +117,9 @@ public class LightningAutomatedPayoutProcessor : BaseAutomatedPayoutProcessor<Li
break; break;
} }
if (result.Success is false && blob.NonInteractiveOnly)
payoutData.State = PayoutState.Cancelled;
bool updateBlob = false; bool updateBlob = false;
if (result.Success is false && payoutData.State == PayoutState.AwaitingPayment) if (result.Success is false && payoutData.State == PayoutState.AwaitingPayment)
{ {