bookRenewalT :: EmailConfig -> RequestConfig -> BookRenewalMonad :~> Handler
bookRenewalT emailConf RequestConfig{..} = NT $ \ma ->
  withResource reqDbconn $ \conn -> do
    let sconf = ServerConfig
              { serverStripeConfig = reqStripeConfig
              , serverDbconn = conn
              , serverPayment = reqPayment
              , serverServiceTime = reqServiceTime
              }

    let io = flip runReaderT sconf (runExceptT (runRenewal ma))
    let transacted = withTransaction conn (emailBracket emailConf io)
    liftIO transacted >>= \case
        Right a -> pure a
        Left err -> throwError $ toServantErr err
bookRenewalT :: EmailConfig -> RequestConfig -> BookRenewalMonad :~> Handler
bookRenewalT emailConf RequestConfig{..} = NT $ \ma ->
  withResource reqDbconn $ \conn -> do
    let sconf = ServerConfig
              { serverStripeConfig = reqStripeConfig
              , serverDbconn = conn
              , serverPayment = reqPayment
              , serverServiceTime = reqServiceTime
              }

    let io = flip runReaderT sconf (runExceptT (runRenewal ma))
    let transacted = withTransaction conn (emailBracket emailConf io)
    liftIO transacted >>= \case
        Right a -> pure a
        Left err -> throwError $ toServantErr err
bookRenewalT emailConf RequestConfig{..} = NT $ \ma ->
  withResource reqDbconn $ \conn -> do
    let sconf = ServerConfig
              { serverStripeConfig = reqStripeConfig
              , serverDbconn = conn
              , serverPayment = reqPayment
              , serverServiceTime = reqServiceTime
              }

    let io = flip runReaderT sconf (runExceptT (runRenewal ma))
    let transacted = withTransaction conn (emailBracket emailConf io)
    liftIO transacted >>= \case
        Right a -> pure a
        Left err -> throwError $ toServantErr err