packages feed

stripe-haskell 0.1.1.0 → 0.1.1.1

raw patch · 5 files changed

+36/−7 lines, 5 filesdep ~hspecPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: hspec

API changes (from Hackage documentation)

+ Web.Stripe: StripeRequest :: Method -> Text -> Params -> StripeRequest
+ Web.Stripe: data StripeRequest
+ Web.Stripe: endpoint :: StripeRequest -> Text
+ Web.Stripe: method :: StripeRequest -> Method
+ Web.Stripe: queryParams :: StripeRequest -> Params
+ Web.Stripe: stripeRaw :: FromJSON a => StripeConfig -> StripeRequest -> IO (Either StripeError a)

Files

src/Web/Stripe/ApplicationFeeRefund.hs view
@@ -11,7 +11,7 @@ -- -- @ -- import Web.Stripe         --- import Web.Stripe.ApplicationFee+-- import Web.Stripe.ApplicationFeeRefund -- -- main :: IO () -- main = do
src/Web/Stripe/Client.hs view
@@ -7,10 +7,15 @@ module Web.Stripe.Client     ( -- * Execute a `Stripe` action       stripe+      -- * Execute a custom `Stripe` action (build your own, useful if+      -- using old API's)+    , stripeRaw       -- * `Stripe` Monad     , Stripe       -- * `Stripe` Secret Key      , StripeConfig       (..)+      -- * `Stripe` Request creator+    , StripeRequest      (..)     , module Web.Stripe.Client.Error     ) where 
src/Web/Stripe/Client/Internal.hs view
@@ -11,6 +11,7 @@ ------------------------------------------------------------------------------ module Web.Stripe.Client.Internal     ( callAPI+    , stripeRaw     , stripe     , Stripe     , StripeRequest      (..)@@ -21,6 +22,7 @@     , module Web.Stripe.Client.Error     ) where + import           Control.Exception          (SomeException, try) import           Control.Monad              (when) import           Control.Monad.IO.Class     (MonadIO (liftIO))@@ -48,10 +50,28 @@                                              paramsToByteString, toBytestring,                                              toExpandable, toMetaData, toText,                                              toTextLower, (</>))- import qualified Data.ByteString            as S import qualified Data.Text.Encoding         as T import qualified System.IO.Streams          as Streams++------------------------------------------------------------------------------+-- | Create a custom request to `Stripe`'s API, Build your own!+-- Useful if you're using an old api) !+stripeRaw+    :: FromJSON a+    => StripeConfig       +    -> StripeRequest+    -> IO (Either StripeError a)+stripeRaw config req = do+  withOpenSSL $ do+    ctx <- baselineContextSSL+    result <- try (openConnectionSSL ctx "api.stripe.com" 443) :: IO (Either SomeException Connection)+    case result of+      Left msg -> return $ Left $ StripeError ConnectionFailure (toText msg) Nothing Nothing Nothing+      Right conn -> do+        json <- flip runReaderT (config, conn) $ runEitherT (callAPI req)+        closeConnection conn+        return json  ------------------------------------------------------------------------------ -- | Create a request to `Stripe`'s API
stripe-haskell.cabal view
@@ -1,13 +1,13 @@ name:                stripe-haskell-version:             0.1.1.0+version:             0.1.1.1 synopsis:            Stripe API for Haskell license:             MIT license-file:        LICENSE author:              David Johnson maintainer:          djohnson.m@gmail.com-copyright:           Copyright (c) 2014 David M. Johnson-homepage:            https://github.com/dmjio/stripe-haskell-bug-reports:         https://github.com/dmjio/stripe-haskell/issues+copyright:           Copyright (c) 2015 David M. Johnson+homepage:            https://github.com/dmjio/stripe+bug-reports:         https://github.com/dmjio/stripe/issues category:            Web build-type:          Simple cabal-version:       >=1.10@@ -112,7 +112,8 @@                     , base >=4.6 && <4.8                     , bytestring                     , either-                    , hspec >= 1.11.4+                    , http-streams+                    , hspec >= 2.1.4                     , random                     , stripe-haskell                     , text
tests/Main.hs view
@@ -23,6 +23,7 @@ import           Test.Subscription          (subscriptionTests) import           Test.Token                 (tokenTests) import           Test.Transfer              (transferTests)+import           Test.Raw                   (rawTest) import           Test.Event                 (eventTests)  ------------------------------------------------------------------------------@@ -31,6 +32,7 @@ main = do   config <- getConfig   hspec $ do+    rawTest config     chargeTests config     refundTests config     customerTests config@@ -50,5 +52,6 @@     balanceTests config     tokenTests config     eventTests config+