From 91b18bbbb67cc357f881adfd3f8289f94d40b687 Mon Sep 17 00:00:00 2001 From: shum Date: Thu, 22 Oct 2026 02:26:17 +0000 Subject: [PATCH] store: read invoices on BTCPay payment events --- .../src/StoreService/Providers/BTCPay.hs | 3 ++- tests/Bots/StoreService/BTCPayTests.hs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/simplex-store-service/src/StoreService/Providers/BTCPay.hs b/apps/simplex-store-service/src/StoreService/Providers/BTCPay.hs index 1a910205c6..3b55fe1190 100644 --- a/apps/simplex-store-service/src/StoreService/Providers/BTCPay.hs +++ b/apps/simplex-store-service/src/StoreService/Providers/BTCPay.hs @@ -81,8 +81,9 @@ xmrMethodId = "XMR-CHAIN" knownMethodIds :: [Text] knownMethodIds = [btcMethodId, xmrMethodId] +-- The last two are the only events a payment into a closed invoice sends. actedOnEventTypes :: [Text] -actedOnEventTypes = ["InvoiceProcessing", "InvoiceSettled", "InvoiceExpired", "InvoiceInvalid"] +actedOnEventTypes = ["InvoiceProcessing", "InvoiceSettled", "InvoiceExpired", "InvoiceInvalid", "InvoiceReceivedPayment", "InvoicePaymentSettled"] maxErrorBytes :: Int64 maxErrorBytes = 4000 diff --git a/tests/Bots/StoreService/BTCPayTests.hs b/tests/Bots/StoreService/BTCPayTests.hs index edd164c046..268faca7e8 100644 --- a/tests/Bots/StoreService/BTCPayTests.hs +++ b/tests/Bots/StoreService/BTCPayTests.hs @@ -435,7 +435,7 @@ testWebhookAccepts :: IO () testWebhookAccepts = mapM_ (\t -> let b = webhookEvent t ref in verifyEvent (webhookSigHeader secret b) b `shouldBe` Right (Just ref)) - ["InvoiceProcessing", "InvoiceSettled", "InvoiceExpired", "InvoiceInvalid"] + ["InvoiceProcessing", "InvoiceSettled", "InvoiceExpired", "InvoiceInvalid", "InvoiceReceivedPayment", "InvoicePaymentSettled"] testWebhookHeaderCase :: IO () testWebhookHeaderCase = do @@ -449,7 +449,7 @@ testWebhookUppercaseHex = do testWebhookIgnoresOtherType :: IO () testWebhookIgnoresOtherType = do - let b = webhookEvent "InvoiceReceivedPayment" ref + let b = webhookEvent "InvoiceCreated" ref verifyEvent (webhookSigHeader secret b) b `shouldBe` Right Nothing testWebhookIgnoresUnreadableBody :: IO ()