From 359f837511597354bc6462cfc4200f54d647d728 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Thu, 13 Aug 2015 22:55:41 +0200 Subject: Giving the payment id to the client --- src/server/Controller/Payment.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/server/Controller/Payment.hs') 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 ) -- cgit v1.2.3