mangopay 1.8.1 → 1.8.2
raw patch · 3 files changed
+23/−2 lines, 3 files
Files
- mangopay.cabal +1/−1
- src/Web/MangoPay/Cards.hs +18/−1
- src/Web/MangoPay/Types.hs +4/−0
mangopay.cabal view
@@ -1,5 +1,5 @@ name: mangopay-version: 1.8.1+version: 1.8.2 cabal-version: >= 1.8 build-type: Simple author: JP Moresmau <jpmoresmau@gmail.com>
src/Web/MangoPay/Cards.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables,OverloadedStrings, FlexibleContexts, FlexibleInstances,ConstraintKinds #-}+{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, OverloadedStrings, FlexibleContexts, FlexibleInstances, ConstraintKinds, RecordWildCards #-} -- | handle cards module Web.MangoPay.Cards where @@ -146,3 +146,20 @@ v .: "UserId" parseJSON _=fail "Card" +-- | to json as per MangoPay format+instance ToJSON Card where+ toJSON Card {..} = object+ [ "Id" .= cId+ , "CreationDate" .= cCreationDate+ , "Tag" .= cTag+ , "ExpirationDate" .= cExpirationDate+ , "Alias" .= cAlias+ , "CardProvider" .= cCardProvider+ , "CardType" .= cCardType+ , "Product" .= cProduct+ , "BankCode" .= cBankCode+ , "Active" .= cActive+ , "Currency" .= cCurrency+ , "Validity" .= cValidity+ , "Country" .= cCountry+ , "UserId" .= cUserId ]
src/Web/MangoPay/Types.hs view
@@ -307,6 +307,10 @@ Right (ce,"")<- readCardExpiration s=pure ce parseJSON _=fail "CardExpiration" +-- | show Card Expiration to JSON string (MMYY)+instance ToJSON CardExpiration where+ toJSON = toJSON . writeCardExpiration+ instance IsString CardExpiration where fromString s | Right (ce,"")<-readCardExpiration $ fromString s=ce