module Controller.Payment ( getPaymentsAction , createPaymentAction ) where import Web.Scotty import Database.Persist import Control.Monad.IO.Class (liftIO) import Data.Text (Text) import qualified Secure import Model.Database import Model.Payment getPaymentsAction :: ActionM () getPaymentsAction = Secure.loggedAction (\_ -> do payments <- liftIO $ runDb getPayments json payments ) createPaymentAction :: Text -> Int -> ActionM () createPaymentAction name cost = Secure.loggedAction (\user -> do _ <- liftIO . runDb $ createPayment (entityKey user) name cost return () )