stripe-core 2.0.3 → 2.1.0
raw patch · 5 files changed
+33/−12 lines, 5 filesdep ~timedep ~transformers
Dependency ranges changed: time, transformers
Files
- src/Web/Stripe/Error.hs +11/−6
- src/Web/Stripe/StripeRequest.hs +7/−2
- src/Web/Stripe/Subscription.hs +5/−1
- src/Web/Stripe/Types.hs +7/−0
- stripe-core.cabal +3/−3
src/Web/Stripe/Error.hs view
@@ -1,4 +1,5 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE OverloadedStrings #-} -- | -- Module : Web.Stripe.Error -- Copyright : (c) David Johnson, 2014@@ -14,9 +15,11 @@ ) where import Control.Applicative ((<$>))+import Control.Exception+import Control.Monad (mzero) import Data.Aeson import Data.Text (Text)-import Control.Monad (mzero)+import Data.Typeable ------------------------------------------------------------------------------ -- | Error Codes for HTTP Responses@@ -27,7 +30,7 @@ | NotFound -- ^ 404 | StripeServerError -- ^ (>=500) | UnknownHTTPCode -- ^ All other codes- deriving Show+ deriving (Show, Typeable) ------------------------------------------------------------------------------ -- | Stripe Error Types@@ -38,7 +41,7 @@ | ConnectionFailure | ParseFailure | UnknownErrorType- deriving Show+ deriving (Show, Typeable) ------------------------------------------------------------------------------ -- | Stripe Error Codes@@ -56,7 +59,7 @@ | ProcessingError | RateLimit | UnknownError- deriving Show+ deriving (Show, Typeable) ------------------------------------------------------------------------------ -- | Stripe Error@@ -66,7 +69,9 @@ , errorCode :: Maybe StripeErrorCode , errorParam :: Maybe Text , errorHTTP :: Maybe StripeErrorHTTPCode- } deriving Show+ } deriving (Show, Typeable)++instance Exception StripeError ------------------------------------------------------------------------------ -- | Parses an error message into a `StripeErrorType`
src/Web/Stripe/StripeRequest.hs view
@@ -68,7 +68,8 @@ RefundApplicationFee(..), RefundReason(..), RoutingNumber(..), StartingAfter(..), StatementDescription(..), Source(..),- SubscriptionId(..), TaxID(..), TimeRange(..),+ SubscriptionId(..), TaxID(..), + TaxPercent(..), TimeRange(..), TokenId(..), TransactionId(..), TransactionType(..), TransferId(..), TransferStatus(..), TrialEnd(..),@@ -163,7 +164,7 @@ instance ToStripeParam AtPeriodEnd where toStripeParam (AtPeriodEnd p) =- (("prorate", if p then "true" else "false") :)+ (("at_period_end", if p then "true" else "false") :) instance ToStripeParam BankAccountId where toStripeParam (BankAccountId bid) =@@ -374,6 +375,10 @@ instance ToStripeParam TaxID where toStripeParam (TaxID tid) = (("tax_id", Text.encodeUtf8 tid) :)++instance ToStripeParam TaxPercent where+ toStripeParam (TaxPercent tax) =+ (("tax_percent", fromString $ showFFloat (Just 2) tax "") :) instance ToStripeParam a => ToStripeParam (TimeRange a) where toStripeParam (TimeRange{..}) =
src/Web/Stripe/Subscription.hs view
@@ -69,6 +69,7 @@ , Subscription (..) , SubscriptionId (..) , SubscriptionStatus (..)+ , TaxPercent (..) , TrialEnd (..) ) where @@ -86,7 +87,8 @@ StartingAfter(..), Subscription (..), StripeList(..), SubscriptionId (..),- SubscriptionStatus (..), TrialEnd(..))+ SubscriptionStatus (..), TaxPercent(..), + TrialEnd(..)) import Web.Stripe.Types.Util (getCustomerId) ------------------------------------------------------------------------------@@ -110,6 +112,7 @@ instance StripeHasParam CreateSubscription Quantity instance StripeHasParam CreateSubscription ApplicationFeePercent instance StripeHasParam CreateSubscription MetaData+instance StripeHasParam CreateSubscription TaxPercent ------------------------------------------------------------------------------ -- | Retrieve a `Subscription` by `CustomerId` and `SubscriptionId`@@ -154,6 +157,7 @@ instance StripeHasParam UpdateSubscription Quantity instance StripeHasParam UpdateSubscription ApplicationFeePercent instance StripeHasParam UpdateSubscription MetaData+instance StripeHasParam UpdateSubscription TaxPercent ------------------------------------------------------------------------------ -- | Delete a `Subscription` by `CustomerId` and `SubscriptionId`
src/Web/Stripe/Types.hs view
@@ -557,6 +557,7 @@ , subscriptionApplicationFeePercent :: Maybe Double , subscriptionDiscount :: Maybe Discount , subscriptionMetaData :: MetaData+ , subscriptionTaxPercent :: Maybe Double } deriving (Read, Show, Eq, Ord, Data, Typeable) ------------------------------------------------------------------------------@@ -580,6 +581,7 @@ <*> o .:? "application_fee_percent" <*> o .:? "discount" <*> o .: "metadata"+ <*> o .:? "tax_percent" parseJSON _ = mzero ------------------------------------------------------------------------------@@ -601,6 +603,11 @@ parseJSON (String "canceled") = pure Canceled parseJSON (String "unpaid") = pure UnPaid parseJSON _ = mzero++------------------------------------------------------------------------------+-- | `TaxPercent` for a `Subscription`+newtype TaxPercent = TaxPercent Double deriving (Read, Show, Eq, Ord, Data, Typeable)+ ------------------------------------------------------------------------------ -- | `PlanId` for a `Plan`
stripe-core.cabal view
@@ -1,5 +1,5 @@ name: stripe-core-version: 2.0.3+version: 2.1.0 synopsis: Stripe API for Haskell - Pure Core license: MIT license-file: LICENSE@@ -25,8 +25,8 @@ , bytestring >= 0.10 && < 0.11 , mtl >= 2.1.2 && < 2.3 , text >= 1.0 && < 1.3- , time >= 1.4 && < 1.6- , transformers >= 0.3 && < 0.5+ , time >= 1.4 && < 1.7+ , transformers >= 0.3 && < 0.6 , unordered-containers >= 0.2.5 && < 0.3 default-language: Haskell2010