yesod-mangopay 1.9 → 1.9.1
raw patch · 7 files changed
+29/−29 lines, 7 files
Files
- app/Handler/Account.hs +4/−4
- app/Handler/Card.hs +3/−3
- app/Handler/Doc.hs +2/−2
- app/Handler/Transaction.hs +11/−11
- app/Handler/User.hs +1/−1
- app/Handler/Wallet.hs +7/−7
- yesod-mangopay.cabal +1/−1
app/Handler/Account.hs view
@@ -7,7 +7,7 @@ -- | get account list-getAccountsR :: AnyUserID -> Handler Html+getAccountsR :: AnyUserId -> Handler Html getAccountsR uid=do -- no paging, should be reasonable accounts<-runYesodMPTToken $ getAll $ listAccounts uid@@ -16,7 +16,7 @@ $(widgetFile "accounts") -- | get account registration form-getAccountR :: AnyUserID -> Handler Html+getAccountR :: AnyUserId -> Handler Html getAccountR uid=do (widget, enctype) <- generateFormPost accountForm defaultLayout $ do@@ -24,7 +24,7 @@ $(widgetFile "account") -- | register account-postAccountR :: AnyUserID -> Handler Html+postAccountR :: AnyUserId -> Handler Html postAccountR uid=do ((result, widget), enctype) <- runFormPost accountForm case result of@@ -56,7 +56,7 @@ } -- | get the proper BankAccount structure-toBankAccount :: AnyUserID -> BankAccountPartial -> BankAccount+toBankAccount :: AnyUserId -> BankAccountPartial -> BankAccount toBankAccount uid bap=BankAccount Nothing Nothing (Just uid) (bapTag bap) (IBAN (bapIBAN bap) (bapBIC bap)) (bapOwnerName bap) (bapOwnerAddress bap)
app/Handler/Card.hs view
@@ -16,7 +16,7 @@ import Control.Arrow ((&&&)) -- | get card list-getCardsR :: AnyUserID -> Handler Html+getCardsR :: AnyUserId -> Handler Html getCardsR uid=do -- no paging, should be reasonable cards<-runYesodMPTToken $ getAll $ listCards uid@@ -39,7 +39,7 @@ -- and submit it back to us using the same session! -- if we didn't have a iframe and redirect the main page via the validation server, we lose the session, so we would need to encode a token in the url -- we can also use the pure Ajax solution via the mangopay JS toolkit, but the iframe system should work in more browsers-getCardR :: AnyUserID -> Handler Html+getCardR :: AnyUserId -> Handler Html getCardR uid=do ((result, _), _) <- runFormGet currencyForm case result of@@ -75,7 +75,7 @@ respond typePlain qs -- | this gets the token via JavaScript submission-postCardR :: AnyUserID -> Handler Html+postCardR :: AnyUserId -> Handler Html postCardR uid=do ((result, _), _) <- runFormPost cardTokenForm mjcr<-lookupSession "cardReg"
app/Handler/Doc.hs view
@@ -12,7 +12,7 @@ import Data.ByteString.Lazy (toStrict) -- | get the upload form-getDocR :: AnyUserID -> Handler Html+getDocR :: AnyUserId -> Handler Html getDocR uid= do (widget, enctype) <- generateFormPost uploadForm defaultLayout $ do@@ -20,7 +20,7 @@ $(widgetFile "docupload") -- | upload doc and file and show result-postDocR :: AnyUserID -> Handler Html+postDocR :: AnyUserId -> Handler Html postDocR uid=do ((result, _), _) <- runFormPost uploadForm case result of
app/Handler/Transaction.hs view
@@ -10,7 +10,7 @@ import Data.Text (pack) -- | transaction list-getTransactionsR :: AnyUserID -> Handler Html+getTransactionsR :: AnyUserId -> Handler Html getTransactionsR uid= do pg<-getPagination txsL<-runYesodMPTToken $ listTransactionsForUser uid pg@@ -23,7 +23,7 @@ -- | get payin form-getPayinR :: AnyUserID -> Handler Html+getPayinR :: AnyUserId -> Handler Html getPayinR uid=do cards<-runYesodMPTToken $ getAll $ listCards uid wallets<-runYesodMPTToken $ getAll $ listWallets uid@@ -33,7 +33,7 @@ $(widgetFile "payin") -- | payin-postPayinR :: AnyUserID -> Handler Html+postPayinR :: AnyUserId -> Handler Html postPayinR uid=do cards<-runYesodMPTToken $ getAll $ listCards uid wallets<-runYesodMPTToken $ getAll $ listWallets uid@@ -60,7 +60,7 @@ $(widgetFile "payin") -- | get first transfer page: choose the target user-getTransfer1R :: AnyUserID -> Handler Html+getTransfer1R :: AnyUserId -> Handler Html getTransfer1R uid=do users<-runYesodMPTToken $ getAll listUsers defaultLayout $ do@@ -68,7 +68,7 @@ $(widgetFile "transfer1") -- | get second transfer page: choose between wallets-getTransfer2R :: AnyUserID -> AnyUserID -> Handler Html+getTransfer2R :: AnyUserId -> AnyUserId -> Handler Html getTransfer2R uid touid=do fromWallets<-runYesodMPTToken $ getAll $ listWallets uid toWallets<-runYesodMPTToken $ getAll $ listWallets touid@@ -78,7 +78,7 @@ $(widgetFile "transfer2") -- | perfrm transfer-postTransfer2R :: AnyUserID -> AnyUserID -> Handler Html+postTransfer2R :: AnyUserId -> AnyUserId -> Handler Html postTransfer2R uid touid=do fromWallets<-runYesodMPTToken $ getAll $ listWallets uid toWallets<-runYesodMPTToken $ getAll $ listWallets touid@@ -106,7 +106,7 @@ $(widgetFile "transfer2") -- | get payout form-getPayoutR :: AnyUserID -> Handler Html+getPayoutR :: AnyUserId -> Handler Html getPayoutR uid=do wallets<-runYesodMPTToken $ getAll $ listWallets uid accounts<-runYesodMPTToken $ getAll $ listAccounts uid@@ -117,7 +117,7 @@ $(widgetFile "payout") -- | payout-postPayoutR :: AnyUserID -> Handler Html+postPayoutR :: AnyUserId -> Handler Html postPayoutR uid=do wallets<-runYesodMPTToken $ getAll $ listWallets uid accounts<-runYesodMPTToken $ getAll $ listAccounts uid@@ -146,7 +146,7 @@ -- | data necessary for payin-data PayIn = PayIn CardID WalletID Integer Currency+data PayIn = PayIn CardId WalletId Integer Currency -- | payin form payinInForm :: [Card] -> [Wallet] -> Html -> MForm Handler (FormResult PayIn, Widget)@@ -157,7 +157,7 @@ <*> areq (selectFieldList (map (id &&& id) supportedCurrencies)) (localizedFS MsgPayInCurrency) Nothing -- | data necessary for transfer-data MPTransfer= MPTransfer WalletID WalletID Integer Currency+data MPTransfer= MPTransfer WalletId WalletId Integer Currency -- | transfer form transferForm :: [Wallet] -> [Wallet] -> Html -> MForm Handler (FormResult MPTransfer, Widget)@@ -168,7 +168,7 @@ <*> areq (selectFieldList (map (id &&& id) supportedCurrencies)) (localizedFS MsgTransferCurrency) Nothing -- | data necessary for payout-data PayOut = PayOut WalletID BankAccountID Integer Currency+data PayOut = PayOut WalletId BankAccountId Integer Currency -- | payin form payoutForm :: [Wallet] -> [BankAccount] -> Html -> MForm Handler (FormResult PayOut, Widget)
app/Handler/User.hs view
@@ -10,7 +10,7 @@ import Yesod.MangoPay.Util -- | get the form to edit any type of user-getUserR :: AnyUserID -> Handler Html+getUserR :: AnyUserId -> Handler Html getUserR uid=do eu <- runYesodMPTToken $ getUser uid case eu of
app/Handler/Wallet.hs view
@@ -9,7 +9,7 @@ import Data.Text (pack) -- | get wallet list-getWalletsR :: AnyUserID -> Handler Html+getWalletsR :: AnyUserId -> Handler Html getWalletsR uid=do -- no paging, should be reasonable wallets<-runYesodMPTToken $ getAll $ listWallets uid@@ -18,18 +18,18 @@ $(widgetFile "wallets") -- | get wallet creation form-getWalletR :: AnyUserID -> Handler Html+getWalletR :: AnyUserId -> Handler Html getWalletR uid = readerWallet uid Nothing -- | get wallet edition form-getWalletEditR :: AnyUserID -> WalletID -> Handler Html+getWalletEditR :: AnyUserId -> WalletId -> Handler Html getWalletEditR uid wid = do wallet <- runYesodMPTToken $ fetchWallet wid readerWallet uid $ Just wallet -- | helper to generate the proper form given maybe an existing wallet-readerWallet :: AnyUserID -> Maybe Wallet -> Handler Html+readerWallet :: AnyUserId -> Maybe Wallet -> Handler Html readerWallet uid mwallet = do (widget, enctype) <- generateFormPost $ walletForm mwallet let mwid = join $ wId <$> mwallet@@ -40,7 +40,7 @@ -- | helper to create or modify a wallet helperWallet :: (Wallet -> AccessToken -> MangoPayT Handler Wallet) ->- Maybe Wallet -> AnyUserID -> Handler Html+ Maybe Wallet -> AnyUserId -> Handler Html helperWallet fn mw uid=do ((result, _), _) <- runFormPost $ walletForm mw mwallet<-case result of@@ -63,11 +63,11 @@ readerWallet uid mwallet -postWalletR :: AnyUserID -> Handler Html+postWalletR :: AnyUserId -> Handler Html postWalletR = helperWallet createWallet Nothing -putWalletEditR :: AnyUserID -> WalletID -> Handler Html+putWalletEditR :: AnyUserId -> WalletId -> Handler Html putWalletEditR uid wid = do wallet <- runYesodMPTToken $ fetchWallet wid helperWallet modifyWallet (Just wallet) uid
yesod-mangopay.cabal view
@@ -1,5 +1,5 @@ name: yesod-mangopay-version: 1.9+version: 1.9.1 cabal-version: >= 1.8 build-type: Simple author: JP Moresmau <jpmoresmau@gmail.com>