aboutsummaryrefslogtreecommitdiff
path: root/src/server/Controller/Payment.hs
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-08-13 22:55:41 +0200
committerJoris Guyonvarch2015-08-13 22:55:41 +0200
commit359f837511597354bc6462cfc4200f54d647d728 (patch)
tree13d896bd1280a735945609e890faa606abd135fa /src/server/Controller/Payment.hs
parent35557ae09d10aa6388b79e2e19ee7702efb28bc6 (diff)
downloadbudget-359f837511597354bc6462cfc4200f54d647d728.tar.gz
budget-359f837511597354bc6462cfc4200f54d647d728.tar.bz2
budget-359f837511597354bc6462cfc4200f54d647d728.zip
Giving the payment id to the client
Diffstat (limited to 'src/server/Controller/Payment.hs')
-rw-r--r--src/server/Controller/Payment.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/server/Controller/Payment.hs b/src/server/Controller/Payment.hs
index 1287825..219206a 100644
--- a/src/server/Controller/Payment.hs
+++ b/src/server/Controller/Payment.hs
@@ -11,10 +11,13 @@ import Control.Monad.IO.Class (liftIO)
import Data.Text (Text)
+import Database.Persist.Sqlite (unSqlBackendKey)
+
import qualified Secure
import Model.Database
import Model.Payment
+import Model.Json.Message
getPaymentsAction :: ActionM ()
getPaymentsAction =
@@ -26,6 +29,6 @@ getPaymentsAction =
createPaymentAction :: Text -> Int -> ActionM ()
createPaymentAction name cost =
Secure.loggedAction (\user -> do
- _ <- liftIO . runDb $ createPayment (entityKey user) name cost
- return ()
+ paymentKey <- liftIO . runDb $ createPayment (entityKey user) name cost
+ json . Message . paymentKeyToText $ paymentKey
)