Add shop name to receipt endpoint
This commit is contained in:
parent
f632b48f32
commit
f469ed6763
1 changed files with 19 additions and 6 deletions
|
@ -1195,11 +1195,16 @@ routes pipe config = do
|
||||||
Just pOrder -> do
|
Just pOrder -> do
|
||||||
if qtoken pOrder == token
|
if qtoken pOrder == token
|
||||||
then do
|
then do
|
||||||
|
shop <- liftAndCatchIO $ run (findOwner $ qaddress pOrder)
|
||||||
|
case cast' . Doc =<< shop of
|
||||||
|
Nothing -> status badRequest400
|
||||||
|
Just s -> do
|
||||||
status ok200
|
status ok200
|
||||||
Web.Scotty.json
|
Web.Scotty.json
|
||||||
(object
|
(object
|
||||||
[ "message" .= ("Order found!" :: String)
|
[ "message" .= ("Order found!" :: String)
|
||||||
, "order" .= toJSON (pOrder :: ZGoOrder)
|
, "order" .= toJSON (pOrder :: ZGoOrder)
|
||||||
|
, "shop" .= (oname s :: T.Text)
|
||||||
])
|
])
|
||||||
else status forbidden403
|
else status forbidden403
|
||||||
else status badRequest400
|
else status badRequest400
|
||||||
|
@ -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"
|
||||||
|
|
Loading…
Reference in a new issue