packages feed

stripe-core 2.4.1 → 2.5.0

raw patch · 5 files changed

+43/−21 lines, 5 files

Files

src/Web/Stripe/Client.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE OverloadedStrings  #-} -- | -- Module      : Web.Stripe.Client -- Copyright   : (c) David Johnson, 2014@@ -13,6 +14,9 @@     , parseFail     , attemptDecode     , unknownCode+    , defaultEndpoint+    , Endpoint      (..)+    , Protocol      (..)     , StripeConfig  (..)     , StripeKey     (..)     , APIVersion    (..)@@ -37,10 +41,28 @@     } deriving (Read, Show, Eq, Ord, Data, Typeable)  ------------------------------------------------------------------------------+-- | Endpoint Protocol+data Protocol = HTTP | HTTPS+  deriving (Read, Show, Eq, Ord, Data, Typeable)++------------------------------------------------------------------------------ -- | Stripe config data StripeConfig = StripeConfig     { secretKey :: StripeKey+    , stripeEndpoint :: Maybe Endpoint     } deriving (Read, Show, Eq, Ord, Data, Typeable)++------------------------------------------------------------------------------+-- | Stripe endpoint, useful for mocking+data Endpoint+  = Endpoint+  { endpointUrl :: ByteString+  , endpointProtocol :: Protocol+  , endpointPort :: Int+  } deriving (Show, Eq, Read, Ord, Data)++defaultEndpoint :: Endpoint+defaultEndpoint = Endpoint "api.stripe.com" HTTPS 443  ------------------------------------------------------------------------------ -- | API Version
src/Web/Stripe/Invoice.hs view
@@ -149,6 +149,7 @@ instance StripeHasParam GetInvoices ExpandParams instance StripeHasParam GetInvoices (EndingBefore InvoiceId) instance StripeHasParam GetInvoices Limit+instance StripeHasParam GetInvoices CustomerId instance StripeHasParam GetInvoices (StartingAfter InvoiceId)  ------------------------------------------------------------------------------
src/Web/Stripe/InvoiceItem.hs view
@@ -164,3 +164,4 @@ instance StripeHasParam GetInvoiceItems (EndingBefore InvoiceItemId) instance StripeHasParam GetInvoiceItems Limit instance StripeHasParam GetInvoiceItems (StartingAfter InvoiceItemId)+instance StripeHasParam GetInvoiceItems InvoiceId
src/Web/Stripe/Types.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE TypeFamilies         #-} {-# LANGUAGE UndecidableInstances #-} --------------------------------------------------------------------------------- | +-- | -- Module      : Web.Stripe.Types -- Copyright   : (c) David Johnson, 2014 -- Maintainer  : djohnson.m@gmail.com@@ -21,6 +21,7 @@ import           Data.Aeson          (FromJSON (parseJSON), ToJSON(..),                                       Value (String, Object, Bool), (.:),                                       (.:?))+import           Data.Aeson.Types    (typeMismatch) import           Data.Data           (Data, Typeable) import qualified Data.HashMap.Strict as H import           Data.Ratio          ((%))@@ -196,7 +197,7 @@     , refundCreated            :: UTCTime     , refundObject             :: Text     , refundCharge             :: ChargeId-    , refundBalanceTransaction :: Expandable TransactionId+    , refundBalanceTransaction :: Maybe (Expandable TransactionId)     , refundMetaData           :: MetaData     } deriving (Read, Show, Eq, Ord, Data, Typeable) @@ -210,7 +211,7 @@                <*> (fromSeconds <$> o .: "created")                <*> o .: "object"                <*> o .: "charge"-               <*> o .: "balance_transaction"+               <*> o .:? "balance_transaction"                <*> o .: "metadata"    parseJSON _ = mzero @@ -250,7 +251,7 @@     , customerDescription    :: Maybe Description     , customerEmail          :: Maybe Email     , customerDelinquent     :: Bool-    , customerSubscriptions  :: StripeList Subscription+    , customerSubscriptions  :: Maybe (StripeList Subscription)     , customerDiscount       :: Maybe Discount     , customerAccountBalance :: Int     , customerCards          :: StripeList Card@@ -258,15 +259,18 @@     , customerDefaultCard    :: Maybe (Expandable CardId)     , customerMetaData       :: MetaData     } | DeletedCustomer {-      deletedCustomer   :: Maybe Bool+      deletedCustomer   :: Bool     , deletedCustomerId :: CustomerId   } deriving (Read, Show, Eq, Ord, Data, Typeable)  ------------------------------------------------------------------------------ -- | JSON Instance for `Customer` instance FromJSON Customer where-    parseJSON (Object o)-        = (Customer+  parseJSON (Object o)+        = (DeletedCustomer+           <$> o .: "deleted"+           <*> (CustomerId <$> o .: "id"))+           <|> (Customer            <$> o .: "object"            <*> (fromSeconds <$> o .: "created")            <*> (CustomerId <$> o .: "id")@@ -274,20 +278,14 @@            <*> o .:? "description"            <*> (fmap Email <$> o .:? "email")            <*> o .: "delinquent"-           <*> o .: "subscriptions"+           <*> o .:? "subscriptions"            <*> o .:? "discount"            <*> o .: "account_balance"            <*> o .: "cards"            <*> o .:? "currency"            <*> o .:? "default_card"-           <*> o .: "metadata"-           <|> DeletedCustomer-           <$> o .: "deleted"-           <*> (CustomerId <$> o .: "id"))-           <|> DeletedCustomer-           <$> o .:? "deleted"-           <*> (CustomerId <$> o .: "id")-    parseJSON _ = mzero+           <*> o .: "metadata")+  parseJSON o = typeMismatch "Customer" o  ------------------------------------------------------------------------------ -- | AccountBalance for a `Customer`@@ -393,7 +391,7 @@     , cardFunding           :: Text     , cardExpMonth          :: ExpMonth     , cardExpYear           :: ExpYear-    , cardFingerprint       :: Text+    , cardFingerprint       :: Maybe Text     , cardCountry           :: Maybe Text     , cardName              :: Maybe Name     , cardAddressLine1      :: Maybe AddressLine1@@ -444,7 +442,7 @@              <*> o .: "funding"              <*> (ExpMonth <$> o .: "exp_month")              <*> (ExpYear <$> o .: "exp_year")-             <*> o .: "fingerprint"+             <*> o .:? "fingerprint"              <*> o .:? "country"              <*> o .:? "name"              <*> (fmap AddressLine1 <$> o .:? "address_line1")@@ -1733,7 +1731,7 @@    parseJSON (String "application_fee.refunded") = pure ApplicationFeeRefundedEvent    parseJSON (String "balance.available") = pure BalanceAvailableEvent    parseJSON (String "charge.succeeded") = pure ChargeSucceededEvent-   parseJSON (String "chage.failed") = pure ChargeFailedEvent+   parseJSON (String "charge.failed") = pure ChargeFailedEvent    parseJSON (String "charge.refunded") = pure ChargeRefundedEvent    parseJSON (String "charge.captured") = pure ChargeCapturedEvent    parseJSON (String "charge.updated") = pure ChargeUpdatedEvent
stripe-core.cabal view
@@ -1,5 +1,5 @@ name:                stripe-core-version:             2.4.1+version:             2.5.0 synopsis:            Stripe API for Haskell - Pure Core license:             MIT license-file:        LICENSE@@ -16,7 +16,7 @@     <<https://stripe.com/img/navigation/logo@2x.png>>     .     [Pure API Wrapper]-    `stripe-core` provides a complete binding to the Stripe API. `stripe-core` provides pure wrappers around all the Stripe API objects and methods. `stripe-core` is pure and is not tied to any particular HTTP client library. End users will typically install the `stripe-haskell` package which pulls in the `stripe-http-streams` library to obtain a complete set of functionality.+    `stripe-core` provides a complete binding to the Stripe API. `stripe-core` provides pure wrappers around all the Stripe API objects and methods. `stripe-core` is pure and is not tied to any particular HTTP client library. End users will typically install the `stripe-haskell` package which pulls in the `stripe-http-client` library to obtain a complete set of functionality.  library   hs-source-dirs:      src