diff --git a/apps/simplex-store-service/src/StoreService/Web/Names/Orders.hs b/apps/simplex-store-service/src/StoreService/Web/Names/Orders.hs index aa82cb3834..5f288b4032 100644 --- a/apps/simplex-store-service/src/StoreService/Web/Names/Orders.hs +++ b/apps/simplex-store-service/src/StoreService/Web/Names/Orders.hs @@ -147,7 +147,7 @@ createAtProvider env@OrdersEnv {oeStore, oeConfig, oeNow} cfg providers waiters `E.catch` strandedBy provider piProviderRef >>= \case Left refusal -> do - logWarn (what <> ": the order lost to another, so invoice " <> piProviderRef <> " is cancelled at the provider") + logWarn (what <> ": the order was refused, so invoice " <> piProviderRef <> " is cancelled at the provider") (\a -> a {aAfter = cancelAtProvider provider piProviderRef}) <$> refused what refusal Right closed -> do row_ <- getInvoice oeStore invId diff --git a/tests/Bots/StoreService/NamesSpendTests.hs b/tests/Bots/StoreService/NamesSpendTests.hs index 522939fb01..6ff3e0b45f 100644 --- a/tests/Bots/StoreService/NamesSpendTests.hs +++ b/tests/Bots/StoreService/NamesSpendTests.hs @@ -9,7 +9,7 @@ import Bots.StoreService.FakeEthNode import Bots.StoreService.NamesContractsTests (reservedNamesCall) import Bots.StoreService.NamesOrdersTests (Ctx (..), Order (..), advance, aliceOrder, commitmentOf, field, fieldsOf, invoiceRegistration, keyB, orderTime, placeOrder, post, refusedWith, registrationById, registrationOf, settleNow, withOrdersVia, yearsDuration) import Bots.StoreService.NamesStoreTests (at, order, ownerA, placePaid, reg, t0, write) -import Bots.StoreService.WebTests (StubCall (..), StubState (..), jsonObject, rcv, sampleProviderInvoice, statusOf, stubCalls, webGet, webRequestBody) +import Bots.StoreService.WebTests (StubCall (..), capturingStderr, StubState (..), jsonObject, rcv, sampleProviderInvoice, statusOf, stubCalls, webGet, webRequestBody) import Control.Concurrent.Async (Async, async, cancel, concurrently, wait) import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar) import Control.Concurrent.STM (atomically, check) @@ -521,7 +521,10 @@ testWriteRefusedAtBalance = withSpendHook $ \hook ctx@Ctx {cOpenStore} -> do src <- sourceOf ctx "src" 6000 other <- cOpenStore onCreate hook $ credit other "src" 500 - answer <- spend ctx src (difference 6000) + answered <- newIORef Nothing + logs <- capturingStderr $ spend ctx src (difference 6000) >>= writeIORef answered . Just + logs `shouldSatisfy` T.isInfixOf "the order was refused, so invoice pref-1 is cancelled at the provider" + Just answer <- readIORef answered current <- balanceOf ctx src (fmap blAmount current, blHold =<< current) `shouldBe` (Just 6500, Nothing) answer `shouldBe` balanceChanged current