updated notify mail to contain quantity and te occasinal user balance rant.
This commit is contained in:
parent
01561b03b6
commit
800d8e6d24
1 changed files with 17 additions and 6 deletions
|
@ -58,7 +58,7 @@ postBuyR uId bId = do
|
||||||
update bId [BeverageAmount -=. quant]
|
update bId [BeverageAmount -=. quant]
|
||||||
checkAlert bId
|
checkAlert bId
|
||||||
master <- getYesod
|
master <- getYesod
|
||||||
liftIO $ notifyUser user bev price master
|
liftIO $ notifyUser user bev quant price master
|
||||||
case sw of
|
case sw of
|
||||||
False -> do
|
False -> do
|
||||||
setMessageI MsgPurchaseSuccess
|
setMessageI MsgPurchaseSuccess
|
||||||
|
@ -73,15 +73,26 @@ postBuyR uId bId = do
|
||||||
setMessageI MsgUserUnknown
|
setMessageI MsgUserUnknown
|
||||||
redirect HomeR
|
redirect HomeR
|
||||||
|
|
||||||
notifyUser :: User -> Beverage -> Int -> App -> IO ()
|
notifyUser :: User -> Beverage -> Int -> Int -> App -> IO ()
|
||||||
notifyUser user bev price master = do
|
notifyUser user bev quant price master = do
|
||||||
case userEmail user of
|
case userEmail user of
|
||||||
Just email ->
|
Just email -> do
|
||||||
|
addendum <- if userBalance user < 0
|
||||||
|
then
|
||||||
|
return $
|
||||||
|
"\n\nDein Guthaben Beträgt im Moment " ++
|
||||||
|
formatIntCurrency (userBalance user) ++
|
||||||
|
appCurrency (appSettings master) ++
|
||||||
|
".\n" ++
|
||||||
|
"LADE DEIN GUTHABEN AUF!\n" ++
|
||||||
|
"VERDAMMT NOCHMAL!!!"
|
||||||
|
else
|
||||||
|
return ""
|
||||||
liftIO $ sendMail email "Einkauf beim Matematen"
|
liftIO $ sendMail email "Einkauf beim Matematen"
|
||||||
[stext|
|
[lt|
|
||||||
Hallo #{userIdent user},
|
Hallo #{userIdent user},
|
||||||
|
|
||||||
Du hast gerade beim Matematen für #{formatIntCurrency price}#{appCurrency $ appSettings master} #{beverageIdent bev} eingekauft.
|
Du hast gerade beim Matematen für #{formatIntCurrency price}#{appCurrency $ appSettings master} #{quant} Stück #{beverageIdent bev} eingekauft.#{addendum}
|
||||||
|
|
||||||
Viele Grüsse,
|
Viele Grüsse,
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue