summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFélix Sipma <felix.sipma@no-log.org>2018-02-20 13:28:08 +0100
committerFélix Sipma <felix.sipma@no-log.org>2018-02-20 13:28:08 +0100
commit1cb79a5544a2ca465afbed3c5cab5706da39c7b4 (patch)
tree12d99e6dab6a49702c4e2f769fae6f8dc123b8ad
parentd5d6f465d38a4275ff03e28593cfb3a2322608fe (diff)
use UUID instead of Text if possible
-rw-r--r--src/Shop/Handler.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Shop/Handler.hs b/src/Shop/Handler.hs
index ab235de..b3ef23e 100644
--- a/src/Shop/Handler.hs
+++ b/src/Shop/Handler.hs
@@ -55,12 +55,12 @@ handlerToApp = lift
charge :: ChargeForm -> App ChargeResponse
charge chargeform = do
cfg <- ask
- cid <- liftIO $ UUID.toText <$> UUID.nextRandom
+ cid <- liftIO UUID.nextRandom
sendCustomMail' cfg (chmail cfg cid)
sendCustomMail' cfg (comail cfg cid)
$(logInfo) $ "Charge successfully created: \"" <> email chargeform <> "\" (" <> showPrice total <> ")"
return ChargeResponse
- { chargeid = cid
+ { chargeid = UUID.toText cid
, chargeamount = show total
, chargeemail = email chargeform
, chargedate = date chargeform
@@ -82,7 +82,7 @@ charge chargeform = do
showPrice :: Int -> Text
showPrice p = toS $ format (fixed 2) (fromIntegral p / 100) <> "€"
-chargeMail :: Address -> Address -> ChargeForm -> Text -> Text -> Mail
+chargeMail :: Address -> Address -> ChargeForm -> Text -> UUID.UUID -> Mail
chargeMail from to chargeform stotal cid = simpleMail
from
[to]
@@ -95,7 +95,7 @@ chargeMail from to chargeform stotal cid = simpleMail
, "Téléphone : " <> phone chargeform
, "Date : " <> date chargeform
, "Total : " <> stotal
- , "Référence de la commande : " <> cid
+ , "Référence de la commande : " <> UUID.toText cid
, "Détails :"
]
<> details (articles chargeform)
@@ -105,7 +105,7 @@ chargeMail from to chargeform stotal cid = simpleMail
rows = [ "Désignation", "Quantité" ] : map rowarticle (articles chargeform)
rowarticle a = [ nom $ product a, if quantity a == 0 then "" else show $ quantity a ]
-confirmationMail :: Address -> Address -> ChargeForm -> Text -> Text -> Mail
+confirmationMail :: Address -> Address -> ChargeForm -> Text -> UUID.UUID -> Mail
confirmationMail from to chargeform stotal cid = simpleMail
from
[ to ]
@@ -118,7 +118,7 @@ confirmationMail from to chargeform stotal cid = simpleMail
, ""
, "À bientôt!"
, ""
- , "Référence de la commande : " <> cid
+ , "Référence de la commande : " <> UUID.toText cid
, ""
, "Détails de la commande :"
]