From 413b88faf135e394b5df9a34dc96b74f097a5ef0 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 2 Mar 2024 19:44:03 +0900 Subject: [PATCH] Fixup hack invoice mark complete --- .../HostedServices/PullPaymentHostedService.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/BTCPayServer/HostedServices/PullPaymentHostedService.cs b/BTCPayServer/HostedServices/PullPaymentHostedService.cs index e3fac7c0d..6e6352247 100644 --- a/BTCPayServer/HostedServices/PullPaymentHostedService.cs +++ b/BTCPayServer/HostedServices/PullPaymentHostedService.cs @@ -426,12 +426,19 @@ namespace BTCPayServer.HostedServices StoreDataId = pp.StoreId }; var rate = topUp.InvoiceEntity.Rates["BTC"]; - var cryptoAmount = Math.Round(topUp.InvoiceEntity.PaidAmount.Net / rate, 11); + + var paidAmount = topUp.InvoiceEntity.PaidAmount.Net; + if (paidAmount == 0.0m) + // If marked as complete, the paid amount is not set. + // HOWEVER THIS FIX ONLY WORK IF THE INVOICE IS IN BTC REMOVE THIS HACK AFTER CONFERENCE + paidAmount = topUp.InvoiceEntity.Price; + + var cryptoAmount = Math.Round(paidAmount / rate, 11); var payoutBlob = new PayoutBlob() { CryptoAmount = -cryptoAmount, - Amount = -topUp.InvoiceEntity.PaidAmount.Net, + Amount = -paidAmount, Destination = topUp.InvoiceEntity.Id, Metadata = new JObject(), };