diff --git a/src/ZGoBackend.hs b/src/ZGoBackend.hs index 675a665..e4182d3 100644 --- a/src/ZGoBackend.hs +++ b/src/ZGoBackend.hs @@ -1195,12 +1195,17 @@ routes pipe config = do Just pOrder -> do if qtoken pOrder == token then do - status ok200 - Web.Scotty.json - (object - [ "message" .= ("Order found!" :: String) - , "order" .= toJSON (pOrder :: ZGoOrder) - ]) + shop <- liftAndCatchIO $ run (findOwner $ qaddress pOrder) + case cast' . Doc =<< shop of + Nothing -> status badRequest400 + Just s -> do + status ok200 + Web.Scotty.json + (object + [ "message" .= ("Order found!" :: String) + , "order" .= toJSON (pOrder :: ZGoOrder) + , "shop" .= (oname s :: T.Text) + ]) else status forbidden403 else status badRequest400 --Get order by session @@ -1301,6 +1306,14 @@ routes pipe config = do Just textPack -> do status ok200 Web.Scotty.json $ toJSON (textPack :: LangComponent) + get "/getinvoicelang" $ do + lang <- param "lang" + txtPack' <- liftAndCatchIO $ run (findLangComponent lang "invoice") + case cast' . Doc =<< txtPack' of + Nothing -> status noContent204 + Just textPack -> do + status ok200 + Web.Scotty.json $ toJSON (textPack :: LangComponent) get "/api/getlang" $ do component <- param "component" lang <- param "lang"