summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2018-02-16 16:26:59 +0100
committerFélix Sipma <felix.sipma@no-log.org>2018-02-16 16:26:59 +0100
commit6540c36d87d26c024fa453576aceb1f755f76ded (patch)
tree50d454c205fb820ff86cc0340a35f1011b3c1577
parent0f91cabd1e0bc04e632cf1c258a77ada12fef673 (diff)
add TODOs
-rw-r--r--src/Shop/Handler.hs9
-rw-r--r--src/Shop/Types.hs2
2 files changed, 8 insertions, 3 deletions
diff --git a/src/Shop/Handler.hs b/src/Shop/Handler.hs
index c3b0eda..f873535 100644
--- a/src/Shop/Handler.hs
+++ b/src/Shop/Handler.hs
@@ -9,7 +9,6 @@ module Shop.Handler where
import Control.Monad.Logger (LoggingT, runStdoutLoggingT,
logInfo, logWarn)
import Formatting (format, (%), fixed)
---import Formatting.Formatters (fixed)
import Shop.Config
import Shop.Types
import Protolude hiding (product, (%))
@@ -46,9 +45,13 @@ charge chargeform = do
cfg <- ask
-- TODO: send email
let cid = "TODO"
- a = "TODO"
+ -- ^ generate id (uuid)
+ a = show total
$(logInfo) $ "Charge successfully created: \"" <> email chargeform <> "\" (" <> showPrice total <> ")"
- return $ ChargeResponse cid a
+ return ChargeResponse
+ { chargeid = cid
+ , chargeamount = a
+ }
where
total = foldl (\n a -> n + quantity a * prix (product a)) 0 (articles chargeform)
diff --git a/src/Shop/Types.hs b/src/Shop/Types.hs
index c2ddaa5..81980b5 100644
--- a/src/Shop/Types.hs
+++ b/src/Shop/Types.hs
@@ -14,8 +14,10 @@ import Servant.API
data ChargeResponse = ChargeResponse
{ chargeid :: Text
+ -- ^ TODO: generate id (uuid)?
, chargeamount :: Text
}
+ -- ^ TODO: add email, date
deriving (Show, Read, Generic, Eq)
instance ToJSON ChargeResponse