dmjio / stripe

:moneybag: Stripe API
http://hackage.haskell.org/package/stripe-haskell
177 stars 74 forks source link

Implement http-client backend for stripe requests #98

Closed creichert closed 6 years ago

creichert commented 6 years ago

fixes #90

This is some initial work I've done to implement an http-client backend for stripe requests. I wanted to get some feedback before I commit too much time to "finalizing" it for merge.

Notes:

Follow-Up:

Initial test results

Failures:

  tests/Web/Stripe/Test/Event.hs:15: 
  1) Event tests Succesfully retrieves events
       predicate failed on: Left (StripeError {errorType = ParseFailure, errorMsg = "key \"evidence_due_by\" not present", errorCode = Nothing, errorParam = Nothing, errorHTTP = Nothing})

Randomized with seed 1531494023

Finished in 193.2520 seconds
89 examples, 1 failure
creichert commented 6 years ago

It looks like the stripe-http-streams lib fails for the same reasons:

Failures:

  tests/Web/Stripe/Test/Event.hs:15: 
  1) Event tests Succesfully retrieves events
       predicate failed on: Left (StripeError {errorType = ParseFailure, errorMsg = "key \"evidence_due_by\" not present", errorCode = Nothing, errorParam = Nothing, errorHTTP = Nothing})

Randomized with seed 567401952

Finished in 211.6145 seconds
89 examples, 1 failure

stripe-http-streams-2.3.0: Test suite tests failed
Completed 9 action(s).
Test suite failure for package stripe-http-streams-2.3.0
    tests:  exited with: ExitFailure 1
Logs printed to console
creichert commented 6 years ago

@dmjio @nmattia Can y'all review the code here? I can remove the Manager or Connection functions if you want. Other than that, it's ready to merge. From there, I'll create a new PR to stripe-haskell that creates a flag for HTTP client.

  - location:
      git: https://github.com/creichert/stripe
      commit: 56f4067fbebe8298b94519327367213a05cddd5a
    extra-dep: true

...

import Web.Stripe.Client.HttpClient
dmjio commented 6 years ago

Bravo @creichert. Huge thanks 🍺

nmattia commented 6 years ago

thanks @creichert !