Add shop name to receipt endpoint

This commit is contained in:
Rene Vergara 2023-06-20 08:54:28 -05:00
parent f632b48f32
commit f469ed6763
Signed by: pitmutt
GPG key ID: 65122AD495A7F5B2

View file

@ -1195,12 +1195,17 @@ routes pipe config = do
Just pOrder -> do Just pOrder -> do
if qtoken pOrder == token if qtoken pOrder == token
then do then do
status ok200 shop <- liftAndCatchIO $ run (findOwner $ qaddress pOrder)
Web.Scotty.json case cast' . Doc =<< shop of
(object Nothing -> status badRequest400
[ "message" .= ("Order found!" :: String) Just s -> do
, "order" .= toJSON (pOrder :: ZGoOrder) status ok200
]) Web.Scotty.json
(object
[ "message" .= ("Order found!" :: String)
, "order" .= toJSON (pOrder :: ZGoOrder)
, "shop" .= (oname s :: T.Text)
])
else status forbidden403 else status forbidden403
else status badRequest400 else status badRequest400
--Get order by session --Get order by session
@ -1301,6 +1306,14 @@ routes pipe config = do
Just textPack -> do Just textPack -> do
status ok200 status ok200
Web.Scotty.json $ toJSON (textPack :: LangComponent) 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 get "/api/getlang" $ do
component <- param "component" component <- param "component"
lang <- param "lang" lang <- param "lang"