mangopay 1.9.6 → 1.9.7
raw patch · 4 files changed
+115/−112 lines, 4 filesdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- mangopay.cabal +2/−2
- src/Web/MangoPay/Payins.hs +50/−49
- src/Web/MangoPay/Payouts.hs +19/−19
- src/Web/MangoPay/Wallets.hs +44/−42
mangopay.cabal view
@@ -1,5 +1,5 @@ name: mangopay-version: 1.9.6+version: 1.9.7 cabal-version: >= 1.8 build-type: Simple author: JP Moresmau <jpmoresmau@gmail.com>@@ -41,7 +41,7 @@ , http-types , http-conduit >= 2.0 && < 2.2 , attoparsec >= 0.10 && < 0.13- , aeson >= 0.7 && < 0.8+ , aeson >= 0.7 && < 0.9 , time , data-default , lifted-base
src/Web/MangoPay/Payins.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, OverloadedStrings, FlexibleContexts, FlexibleInstances, ConstraintKinds #-}+{-# LANGUAGE ConstraintKinds, DeriveDataTypeable, FlexibleContexts,+ FlexibleInstances, OverloadedStrings, ScopedTypeVariables #-} -- | handle payins module Web.MangoPay.Payins where @@ -58,28 +59,28 @@ -- there are a lot of common fields between all kinds of payments -- so this could probably become a "Payment" type data BankWire=BankWire {- bwId :: Maybe BankWireId- ,bwCreationDate :: Maybe POSIXTime- ,bwTag :: Maybe Text -- ^ custom data- ,bwAuthorId :: AnyUserId -- ^ The user Id of the author- ,bwCreditedUserId :: AnyUserId -- ^ It represents the amount credited on the targeted e-wallet.- ,bwFees :: Maybe Amount -- ^ It represents your fees taken on the DebitedFundsDebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,bwCreditedWalletId :: WalletId -- ^ The Id of the credited wallet- ,bwDebitedWalletId :: Maybe WalletId -- ^ The Id of the debited wallet- ,bwDebitedFunds :: Maybe Amount -- ^ It represents the amount debited from the bank account.- ,bwCreditedFunds :: Maybe Amount -- ^ It represents the amount credited on the targeted e-wallet.- ,bwDeclaredDebitedFunds :: Amount -- ^ It represents the expected amount by the platform before that the user makes the payment.- ,bwDeclaredFees :: Amount -- ^ It represents the expected fees amount by the platform before that the user makes the payment.- ,bwWireReference :: Maybe Text -- ^ It is a reference generated by MANGOPAY and displayed to the user by the platform. The user have to indicate it into the bank wire.- ,bwBankAccount :: Maybe BankAccount -- ^ The bank account is generated by MANGOPAY and displayed to the user.- ,bwStatus :: Maybe TransferStatus -- ^ The status of the payment- ,bwResultCode :: Maybe Text -- ^ The transaction result code- ,bwResultMessage :: Maybe Text -- ^ The transaction result Message- ,bwExecutionDate :: Maybe POSIXTime -- ^ The date when the payment is processed- ,bwType :: Maybe TransactionType -- ^ The type of the transaction- ,bwNature :: Maybe TransactionNature -- ^ The nature of the transaction:- ,bwPaymentType :: Maybe PaymentType -- ^ The type of the payment (which type of mean of payment is used).- ,bwExecutionType :: Maybe PaymentExecution -- ^ How the payment has been executed:+ bwId :: Maybe BankWireId+ ,bwCreationDate :: Maybe POSIXTime+ ,bwTag :: Maybe Text -- ^ custom data+ ,bwAuthorId :: AnyUserId -- ^ The user Id of the author+ ,bwCreditedUserId :: AnyUserId -- ^ It represents the amount credited on the targeted e-wallet.+ ,bwFees :: Maybe Amount -- ^ It represents your fees taken on the DebitedFundsDebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,bwCreditedWalletId :: WalletId -- ^ The Id of the credited wallet+ ,bwDebitedWalletId :: Maybe WalletId -- ^ The Id of the debited wallet+ ,bwDebitedFunds :: Maybe Amount -- ^ It represents the amount debited from the bank account.+ ,bwCreditedFunds :: Maybe Amount -- ^ It represents the amount credited on the targeted e-wallet.+ ,bwDeclaredDebitedFunds :: Amount -- ^ It represents the expected amount by the platform before that the user makes the payment.+ ,bwDeclaredFees :: Amount -- ^ It represents the expected fees amount by the platform before that the user makes the payment.+ ,bwWireReference :: Maybe Text -- ^ It is a reference generated by MANGOPAY and displayed to the user by the platform. The user have to indicate it into the bank wire.+ ,bwBankAccount :: Maybe BankAccount -- ^ The bank account is generated by MANGOPAY and displayed to the user.+ ,bwStatus :: Maybe TransferStatus -- ^ The status of the payment+ ,bwResultCode :: Maybe Text -- ^ The transaction result code+ ,bwResultMessage :: Maybe Text -- ^ The transaction result Message+ ,bwExecutionDate :: Maybe POSIXTime -- ^ The date when the payment is processed+ ,bwType :: Maybe TransactionType -- ^ The type of the transaction+ ,bwNature :: Maybe TransactionNature -- ^ The nature of the transaction:+ ,bwPaymentType :: Maybe PaymentType -- ^ The type of the payment (which type of mean of payment is used).+ ,bwExecutionType :: Maybe PaymentExecution -- ^ How the payment has been executed: } deriving (Show,Eq,Ord,Typeable) -- | to json as per MangoPay format@@ -91,8 +92,8 @@ -- | from json as per MangoPay format instance FromJSON BankWire where parseJSON (Object v) =BankWire <$>- v .: "Id" <*>- v .: "CreationDate" <*>+ v .:? "Id" <*>+ v .:? "CreationDate" <*> v .:? "Tag" <*> v .: "AuthorId" <*> v .: "CreditedUserId" <*>@@ -127,43 +128,43 @@ -- | direct pay in via registered card data CardPayin=CardPayin {- cpId :: Maybe CardPayinId- ,cpCreationDate :: Maybe POSIXTime- ,cpTag :: Maybe Text -- ^ custom data- ,cpAuthorId :: AnyUserId -- ^ The user Id of the author- ,cpCreditedUserId :: AnyUserId -- ^ The user Id of the owner of the credited wallet- ,cpFees :: Amount -- ^ It represents your fees taken on the DebitedFundsDebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,cpCreditedWalletId :: WalletId -- ^ The Id of the credited wallet- ,cpDebitedWalletId :: Maybe WalletId -- ^ The Id of the debited wallet- ,cpDebitedFunds :: Amount -- ^ It represents the amount debited from the bank account.- ,cpCreditedFunds :: Maybe Amount -- ^ It represents the amount credited on the targeted e-wallet.- ,cpSecureModeReturnURL :: Maybe Text -- ^ This URL will be used in case the SecureMode is activated.- ,cpSecureMode :: Maybe Text -- ^ The SecureMode correspond to « 3D secure » for CB Visa and MasterCard or « Amex Safe Key » for American Express. This field lets you activate it manually.+ cpId :: Maybe CardPayinId+ ,cpCreationDate :: Maybe POSIXTime+ ,cpTag :: Maybe Text -- ^ custom data+ ,cpAuthorId :: AnyUserId -- ^ The user Id of the author+ ,cpCreditedUserId :: AnyUserId -- ^ The user Id of the owner of the credited wallet+ ,cpFees :: Amount -- ^ It represents your fees taken on the DebitedFundsDebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,cpCreditedWalletId :: WalletId -- ^ The Id of the credited wallet+ ,cpDebitedWalletId :: Maybe WalletId -- ^ The Id of the debited wallet+ ,cpDebitedFunds :: Amount -- ^ It represents the amount debited from the bank account.+ ,cpCreditedFunds :: Maybe Amount -- ^ It represents the amount credited on the targeted e-wallet.+ ,cpSecureModeReturnURL :: Maybe Text -- ^ This URL will be used in case the SecureMode is activated.+ ,cpSecureMode :: Maybe Text -- ^ The SecureMode correspond to « 3D secure » for CB Visa and MasterCard or « Amex Safe Key » for American Express. This field lets you activate it manually. ,cpSecureModeRedirectURL :: Maybe Text -- ^ This URL will be used in case the SecureMode is activated.- ,cpCardId :: CardId -- ^ The Id of the registered card (Got through CardRegistration object)- ,cpStatus :: Maybe TransferStatus -- ^ The status of the payment- ,cpResultCode :: Maybe Text -- ^ The transaction result code- ,cpResultMessage :: Maybe Text -- ^ The transaction result Message- ,cpExecutionDate :: Maybe POSIXTime -- The date when the payment is processed- ,cpType :: Maybe TransactionType -- ^ The type of the transaction- ,cpNature :: Maybe TransactionNature -- ^ The nature of the transaction:- ,cpPaymentType :: Maybe Text -- ^ The type of the payment (which type of mean of payment is used).- ,cpExecutionType :: Maybe PaymentExecution -- ^ How the payment has been executed:+ ,cpCardId :: CardId -- ^ The Id of the registered card (Got through CardRegistration object)+ ,cpStatus :: Maybe TransferStatus -- ^ The status of the payment+ ,cpResultCode :: Maybe Text -- ^ The transaction result code+ ,cpResultMessage :: Maybe Text -- ^ The transaction result Message+ ,cpExecutionDate :: Maybe POSIXTime -- The date when the payment is processed+ ,cpType :: Maybe TransactionType -- ^ The type of the transaction+ ,cpNature :: Maybe TransactionNature -- ^ The nature of the transaction:+ ,cpPaymentType :: Maybe Text -- ^ The type of the payment (which type of mean of payment is used).+ ,cpExecutionType :: Maybe PaymentExecution -- ^ How the payment has been executed: } deriving (Show,Eq,Ord,Typeable) -- | to json as per MangoPay format instance ToJSON CardPayin where toJSON cp=object ["Tag" .= cpTag cp,"AuthorId" .= cpAuthorId cp ,"CreditedUserId" .= cpCreditedUserId cp,"CreditedWalletId" .= cpCreditedWalletId cp- ,"DebitedFunds" .= cpDebitedFunds cp,"Fees" .= cpFees cp,"CardID" .= cpCardId cp+ ,"DebitedFunds" .= cpDebitedFunds cp,"Fees" .= cpFees cp,"CardId" .= cpCardId cp ,"SecureModeReturnURL" .= cpSecureModeReturnURL cp ,"SecureMode" .= cpSecureMode cp] -- | from json as per MangoPay format instance FromJSON CardPayin where parseJSON (Object v) =CardPayin <$>- v .: "Id" <*>- v .: "CreationDate" <*>+ v .:? "Id" <*>+ v .:? "CreationDate" <*> v .:? "Tag" <*> v .: "AuthorId" <*> v .: "CreditedUserId" <*>
src/Web/MangoPay/Payouts.hs view
@@ -32,23 +32,23 @@ -- | payout data Payout=Payout {- ptId :: Maybe PayoutId- ,ptCreationDate :: Maybe POSIXTime- ,ptTag :: Maybe Text -- ^ custom data for client- ,ptAuthorId :: AnyUserId -- ^ The user Id of the author- ,ptDebitedWalletId :: WalletId- ,ptDebitedFunds :: Amount- ,ptFees :: Amount- ,ptBankAccountId :: BankAccountId- ,ptCreditedUserId :: Maybe AnyUserId- ,ptCreditedFunds :: Maybe Amount- ,ptStatus :: Maybe TransferStatus- ,ptResultCode :: Maybe Text -- ^ The transaction result code- ,ptResultMessage :: Maybe Text -- ^ The transaction result code- ,ptExecutionDate :: Maybe POSIXTime- ,ptType :: Maybe TransactionType- ,ptNature :: Maybe TransactionNature- ,ptPaymentType :: Maybe PaymentType+ ptId :: Maybe PayoutId+ ,ptCreationDate :: Maybe POSIXTime+ ,ptTag :: Maybe Text -- ^ custom data for client+ ,ptAuthorId :: AnyUserId -- ^ The user Id of the author+ ,ptDebitedWalletId :: WalletId+ ,ptDebitedFunds :: Amount+ ,ptFees :: Amount+ ,ptBankAccountId :: BankAccountId+ ,ptCreditedUserId :: Maybe AnyUserId+ ,ptCreditedFunds :: Maybe Amount+ ,ptStatus :: Maybe TransferStatus+ ,ptResultCode :: Maybe Text -- ^ The transaction result code+ ,ptResultMessage :: Maybe Text -- ^ The transaction result code+ ,ptExecutionDate :: Maybe POSIXTime+ ,ptType :: Maybe TransactionType+ ,ptNature :: Maybe TransactionNature+ ,ptPaymentType :: Maybe PaymentType ,ptMeanOfPaymentType :: Maybe PaymentType -- ^ « BANK_WIRE », } deriving (Show,Eq,Ord,Typeable) @@ -62,8 +62,8 @@ -- | from json as per MangoPay format instance FromJSON Payout where parseJSON (Object v) =Payout <$>- v .: "Id" <*>- v .: "CreationDate" <*>+ v .:? "Id" <*>+ v .:? "CreationDate" <*> v .:? "Tag" <*> v .: "AuthorId" <*> v .: "DebitedWalletId" <*>
src/Web/MangoPay/Wallets.hs view
@@ -1,4 +1,6 @@-{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, OverloadedStrings, FlexibleContexts, FlexibleInstances, PatternGuards, ConstraintKinds #-}+{-# LANGUAGE ConstraintKinds, DeriveDataTypeable, FlexibleContexts,+ FlexibleInstances, OverloadedStrings, PatternGuards,+ ScopedTypeVariables #-} -- | handle wallets module Web.MangoPay.Wallets where @@ -54,13 +56,13 @@ -- | a wallet data Wallet = Wallet {- wId:: Maybe WalletId -- ^ The Id of the wallet+ wId :: Maybe WalletId -- ^ The Id of the wallet ,wCreationDate :: Maybe POSIXTime -- ^ The creation date of the object- ,wTag :: Maybe Text -- ^ Custom data- ,wOwners :: [Text] -- ^ The owner of the wallet- ,wDescription :: Text -- ^ A description of the wallet- ,wCurrency :: Currency -- ^ Currency of the wallet- ,wBalance :: Maybe Amount -- ^ The amount held on the wallet+ ,wTag :: Maybe Text -- ^ Custom data+ ,wOwners :: [Text] -- ^ The owner of the wallet+ ,wDescription :: Text -- ^ A description of the wallet+ ,wCurrency :: Currency -- ^ Currency of the wallet+ ,wBalance :: Maybe Amount -- ^ The amount held on the wallet } deriving (Show,Eq,Ord,Typeable) @@ -71,8 +73,8 @@ -- | from json as per MangoPay format instance FromJSON Wallet where parseJSON (Object v) =Wallet <$>- v .: "Id" <*>- v .: "CreationDate" <*>+ v .:? "Id" <*>+ v .:? "CreationDate" <*> v .:? "Tag" <*> v .: "Owners" <*> v .: "Description" <*>@@ -103,20 +105,20 @@ -- | transfer between wallets data Transfer = Transfer{- tId :: Maybe TransferId -- ^ Id of the transfer- ,tCreationDate :: Maybe POSIXTime -- ^ The creation date of the object- ,tTag :: Maybe Text -- ^ Custom data- ,tAuthorId :: AnyUserId -- ^ The Id of the author- ,tCreditedUserId :: Maybe AnyUserId -- ^ The Id of the user owner of the credited wallet- ,tDebitedFunds :: Amount -- ^ The funds debited from the « debited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,tFees :: Amount -- ^ The fees taken on the transfer.DebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,tDebitedWalletId :: WalletId -- ^ The debited wallet (where the funds are held before the transfer)+ tId :: Maybe TransferId -- ^ Id of the transfer+ ,tCreationDate :: Maybe POSIXTime -- ^ The creation date of the object+ ,tTag :: Maybe Text -- ^ Custom data+ ,tAuthorId :: AnyUserId -- ^ The Id of the author+ ,tCreditedUserId :: Maybe AnyUserId -- ^ The Id of the user owner of the credited wallet+ ,tDebitedFunds :: Amount -- ^ The funds debited from the « debited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,tFees :: Amount -- ^ The fees taken on the transfer.DebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,tDebitedWalletId :: WalletId -- ^ The debited wallet (where the funds are held before the transfer) ,tCreditedWalletId:: WalletId -- ^ The credited wallet (where the funds will be held after the transfer)- ,tCreditedFunds :: Maybe Amount -- ^ The funds credited on the « credited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,tStatus :: Maybe TransferStatus -- ^ The status of the transfer:- ,tResultCode :: Maybe Text -- ^ The transaction result code- ,tResultMessage :: Maybe Text -- ^ The transaction result message- ,tExecutionDate :: Maybe POSIXTime -- ^ The execution date of the transfer+ ,tCreditedFunds :: Maybe Amount -- ^ The funds credited on the « credited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,tStatus :: Maybe TransferStatus -- ^ The status of the transfer:+ ,tResultCode :: Maybe Text -- ^ The transaction result code+ ,tResultMessage :: Maybe Text -- ^ The transaction result message+ ,tExecutionDate :: Maybe POSIXTime -- ^ The execution date of the transfer } deriving (Show,Eq,Ord,Typeable) @@ -129,11 +131,11 @@ -- | from json as per MangoPay format instance FromJSON Transfer where parseJSON (Object v) =Transfer <$>- v .: "Id" <*>- v .: "CreationDate" <*>+ v .:? "Id" <*>+ v .:? "CreationDate" <*> v .:? "Tag" <*> v .: "AuthorId" <*>- v .: "CreditedUserId" <*>+ v .:? "CreditedUserId" <*> v .: "DebitedFunds" <*> v .: "Fees" <*> v .: "DebitedWalletId" <*> -- yes, it's Id one way, Id the other@@ -181,22 +183,22 @@ -- | any transaction data Transaction = Transaction{- txId :: Maybe TransactionId -- ^ Id of the transfer- ,txCreationDate :: Maybe POSIXTime -- ^ The creation date of the object- ,txTag :: Maybe Text -- ^ Custom data- ,txAuthorId :: AnyUserId -- ^ The Id of the author- ,txCreditedUserId :: Maybe AnyUserId -- ^ The Id of the user owner of the credited wallet- ,txDebitedFunds :: Amount -- ^ The funds debited from the « debited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,txFees :: Amount -- ^ The fees taken on the transfer.DebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,txDebitedWalletId :: Maybe WalletId -- ^ The debited wallet (where the funds are held before the transfer)+ txId :: Maybe TransactionId -- ^ Id of the transfer+ ,txCreationDate :: Maybe POSIXTime -- ^ The creation date of the object+ ,txTag :: Maybe Text -- ^ Custom data+ ,txAuthorId :: AnyUserId -- ^ The Id of the author+ ,txCreditedUserId :: Maybe AnyUserId -- ^ The Id of the user owner of the credited wallet+ ,txDebitedFunds :: Amount -- ^ The funds debited from the « debited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,txFees :: Amount -- ^ The fees taken on the transfer.DebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,txDebitedWalletId :: Maybe WalletId -- ^ The debited wallet (where the funds are held before the transfer) ,txCreditedWalletId:: Maybe WalletId -- ^ The credited wallet (where the funds will be held after the transfer)- ,txCreditedFunds :: Maybe Amount -- ^ The funds credited on the « credited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)- ,txStatus :: Maybe TransferStatus -- ^ The status of the transfer:- ,txResultCode :: Maybe Text -- ^ The transaction result code- ,txResultMessage :: Maybe Text -- ^ The transaction result message- ,txExecutionDate :: Maybe POSIXTime -- ^ The execution date of the transfer- ,txType :: TransactionType -- ^ The type of the transaction- ,txNature :: TransactionNature -- ^ The nature of the transaction:+ ,txCreditedFunds :: Maybe Amount -- ^ The funds credited on the « credited wallet »DebitedFunds – Fees = CreditedFunds (amount received on wallet)+ ,txStatus :: Maybe TransferStatus -- ^ The status of the transfer:+ ,txResultCode :: Maybe Text -- ^ The transaction result code+ ,txResultMessage :: Maybe Text -- ^ The transaction result message+ ,txExecutionDate :: Maybe POSIXTime -- ^ The execution date of the transfer+ ,txType :: TransactionType -- ^ The type of the transaction+ ,txNature :: TransactionNature -- ^ The nature of the transaction: } deriving (Show,Eq,Ord,Typeable) @@ -209,8 +211,8 @@ -- | from json as per MangoPay format instance FromJSON Transaction where parseJSON (Object v) =Transaction <$>- v .: "Id" <*>- v .: "CreationDate" <*>+ v .:? "Id" <*>+ v .:? "CreationDate" <*> v .:? "Tag" <*> v .: "AuthorId" <*> v .: "CreditedUserId" <*>