made extra charge for paying cash configurable
This commit is contained in:
parent
1132ab1330
commit
a5d08b1b9f
4 changed files with 7 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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 {..}
|
||||
|
||||
|
|
|
@ -28,3 +28,4 @@ database:
|
|||
#analytics: UA-YOURCODE
|
||||
email: "nek0@momen"
|
||||
currency: "€"
|
||||
cash_charge: 50
|
||||
|
|
|
@ -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)}
|
||||
|
||||
|
|
Loading…
Reference in a new issue