diff --git a/Handler/Wallet.hs b/Handler/Wallet.hs index b0332d8..d668a75 100644 --- a/Handler/Wallet.hs +++ b/Handler/Wallet.hs @@ -2,13 +2,23 @@ module Handler.Wallet where import Import +import Eve.Api.Char +import Eve.Api.Types as T + getWalletR :: Handler Html -getWalletR = do +getWalletR = loginOrDo $ (\(uid,user) -> do + man <- getHttpManager <$> ask + apiKey <- runDB $ getBy $ UniqueApiUser uid + acc <- case apiKey of + Just (Entity _ (Api _ k v)) -> do + a <- liftIO $ getAccountBalance man (ApiComplete (T.ApiKey (VCode v) (KeyId k)) (T.CharacterId (userCharId user))) + return (Just a) + Nothing -> return Nothing defaultLayout $ [whamlet|

Transactions in the last xx hours

Statistices for the last xx days - - |] - + #{show acc} + |] + ) diff --git a/install.sh b/install.sh index 78a381b..d095763 100755 --- a/install.sh +++ b/install.sh @@ -3,7 +3,9 @@ mkdir deps cd deps git clone https://github.com/Drezil/yesod-auth-oauth2 +git clone https://github.com/Drezil/eve-api cd .. cabal sandbox init cabal sandbox add-source deps/yesod-auth-oauth2 +cabal sandbox add-source deps/eve-api cabal install --only-dependencies diff --git a/neat.cabal b/neat.cabal index 06e9f73..2c5f4ff 100644 --- a/neat.cabal +++ b/neat.cabal @@ -84,10 +84,11 @@ library , unordered-containers , containers , vector - , time + , time >= 1.5 , HTTP , xml-lens , xml-conduit + , eve-api executable neat diff --git a/templates/default-layout-wrapper.hamlet b/templates/default-layout-wrapper.hamlet index 9893adf..8d5d71e 100644 --- a/templates/default-layout-wrapper.hamlet +++ b/templates/default-layout-wrapper.hamlet @@ -34,12 +34,13 @@ $newline never - Brand + NEAT