@@ -69,9 +69,11 @@ sendRequest' resp endpoint body =
6969 url s = s host /: "api" /: "v1" /: endpoint
7070 obj <- object <$> addGuid body
7171 let jbody = ReqBodyJson obj
72− if tls
72+ r <- if tls
7373 then reqCb POST (url https) jbody resp auth (logRequest obj)
7474 else reqCb POST (url http) jbody resp auth (logRequest obj)
75+ logResponse r
76+ pure r
7577 where
7678 addGuid b =
7779 do guid <- asks (.deviceGuid)
@@ -83,8 +85,8 @@ sendRequest' resp endpoint body =
8385 Object obj
8486 | Just c <- KeyMap.lookup "Card" obj -> Object (KeyMap.insert "Card" (replaceCard c) obj)
8587 other -> other
86− msg = Text.unlines [ ""
87− , Text.pack (show r)
88+ msg = Text.unlines [ "Connexpay request:"
89+ , tshow r
8890 , Text.decodeUtf8 (ByteString.toStrict $ encode v')
8991 ]
9092 _ <- liftIO (log_ msg)
@@ -96,7 +98,6 @@ sendRequest' resp endpoint body =
9698 $ c
9799 replaceCard v = v
98100
99−
100101sendRequestJson :: FromJSON a => Text -> [Pair] -> ConnexpayM (JsonResponse a)
101102sendRequestJson = sendRequest' jsonResponse
102103