diff options
Diffstat (limited to 'website/sandbox/learnpianochords/src/server/App.hs')
-rw-r--r-- | website/sandbox/learnpianochords/src/server/App.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/website/sandbox/learnpianochords/src/server/App.hs b/website/sandbox/learnpianochords/src/server/App.hs index 92dee6045d46..e23757b01544 100644 --- a/website/sandbox/learnpianochords/src/server/App.hs +++ b/website/sandbox/learnpianochords/src/server/App.hs @@ -12,11 +12,13 @@ import Utils import qualified Network.Wai.Handler.Warp as Warp import qualified GoogleSignIn +import qualified Stripe import qualified Types as T -------------------------------------------------------------------------------- server :: T.Context -> Server API -server T.Context{..} = verifyGoogleSignIn +server ctx@T.Context{..} = verifyGoogleSignIn + :<|> createPaymentIntent where verifyGoogleSignIn :: T.VerifyGoogleSignInRequest -> Handler NoContent verifyGoogleSignIn T.VerifyGoogleSignInRequest{..} = do @@ -31,6 +33,11 @@ server T.Context{..} = verifyGoogleSignIn err -> do throwError err401 { errBody = err |> GoogleSignIn.explainResult |> cs } + createPaymentIntent :: T.PaymentIntent -> Handler T.CreatePaymentIntentResponse + createPaymentIntent pmt = do + clientSecret <- liftIO $ Stripe.createPaymentIntent ctx pmt + pure T.CreatePaymentIntentResponse{..} + run :: T.App run = do ctx@T.Context{..} <- ask |