made extra charge for paying cash configurable

This commit is contained in:
nek0 2015-07-28 22:56:03 +02:00
parent 1132ab1330
commit a5d08b1b9f
4 changed files with 7 additions and 2 deletions

View file

@ -94,7 +94,7 @@ postBuyCashR bId = do
case quant > beverageAmount bev of
False -> do
master <- getYesod
price <- return $ quant * (beveragePrice bev + 50)
price <- return $ quant * (beveragePrice bev + (appCashCharge $ appSettings master))
runDB $ update bId [BeverageAmount -=. quant]
updateCashier price "Barzahlung"
checkAlert bId

View file

@ -55,6 +55,9 @@ data AppSettings = AppSettings
, appEmail :: Text
-- ^ notification address
, appCurrency :: Text
-- ^ Currency character
, appCashCharge :: Int
-- ^ Extra charge for paying in cash in cents
}
instance FromJSON AppSettings where
@ -82,6 +85,7 @@ instance FromJSON AppSettings where
appAnalytics <- o .:? "analytics"
appEmail <- o .: "email"
appCurrency <- o .: "currency"
appCashCharge <- o .: "cash_charge"
return AppSettings {..}

View file

@ -28,3 +28,4 @@ database:
#analytics: UA-YOURCODE
email: "nek0@momen"
currency: "€"
cash_charge: 50

View file

@ -5,7 +5,7 @@ $doctype 5
<p>
<ul>
<li>
_{MsgPricePerUnit (beveragePrice bev + 50) (appCurrency $ appSettings master)}
_{MsgPricePerUnit (beveragePrice bev + (appCashCharge $ appSettings master)) (appCurrency $ appSettings master)}
<li>
_{MsgVolume}: #{formatIntVolume (beverageMl bev)}