forked from dmjio/stripe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstripe-haskell.cabal
176 lines (169 loc) · 7 KB
/
stripe-haskell.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: stripe-haskell
version: 0.1.3.0
synopsis: Stripe API for Haskell
license: MIT
license-file: LICENSE
author: David Johnson
maintainer: [email protected]
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
Description:
.
<<https://stripe.com/img/navigation/[email protected]>>
.
[100% Stripe API Coverage - <https://stripe.com/docs/api>]
All Stripe commands are supported,
including but not limited to Charges, Refunds, Customers, Cards,
Subscriptions, Plans, Coupons, Discounts, Invoices, Invoice Items,
Disputes, Transfers, Recipients, Application Fees, Application Fee Refunds,
Account, Balance, Events and Tokens.
.
[100% Haddock Coverage]
All code written for this library is documented to completion with the haddock documentation tool
.
[100+ Hspec Tests] Thoroughly unit-tested with hspec.
All API commands are unit-tested before inclusion into the API (see the tests directory).
To run the tests, perform the following:
.
> cabal clean && cabal configure --enable-tests && cabal build tests && dist/build/tests/tests -- You will be prompted to enter your *TEST* key
.
[Pagination - <https://stripe.com/docs/api#pagination>]
Pagination is possible on all API calls that return a JSON array.
Any API call that returns a `StripeList` is eligible for pagination.
To use in practice do the following:
.
> import Web.Stripe
> import Web.Stripe.Customer
>
> main :: IO ()
> main = do
> let config = StripeConfig "secret key"
> result <- stripe config $ getCustomers
> (Just 30 :: Maybe Limit) -- Defaults to 10 if Nothing, 100 is Max
> (StartingAfter $ CustomerId "customer_id0")
> (EndingBefore $ CustomerId "customer_id30")
> case result of
> Right stripelist -> print (list stripelist :: [Customer])
> Left stripeError -> print stripeError
>
.
[Versioning - <https://stripe.com/docs/api#versioning>]
All versioning is hard-coded (for safety).
Stripe API versions specified in the HTTP headers of Stripe requests take precedence
over the API version specified in your Stripe Dashboard. In an attempt to ensure
API consistency and correct parsing of returned JSON, all Stripe versions are hard-coded, and are
inaccessible to the end-users of this library. When a new Stripe API version is released
this library will increment the hard-coded API version.
.
[Expansion - <https://stripe.com/docs/api#expansion>] Object expansion is supported on Stripe objects eligible for expansion though the `ExpandParams` type.
Object expansion allows normal Stripe API calls to return expanded objects inside of other objects.
For example, a `Customer` object contains a Card ID hash on the default_card field.
This default_card hash can be expanded into a full `Card` object inside a `Customer` object.
As an example:
.
> import Web.Stripe
> import Web.Stripe.Customer
>
> main :: IO ()
> main = do
> let config = StripeConfig "secret key"
> result <- stripe config $ getCustomerExpandable
> (CustomerId "customerid")
> (["default_card"] :: ExpandParams)
> case result of
> Right customer -> print (defaultCard customer) -- Will be an `ExpandedCard`
> Left stripeError -> print stripeError
>
.
[MetaData - <https://stripe.com/docs/api#metadata>]
Stripe objects allow the embedding of arbitrary metadata.
Any Stripe object that supports the embedding of metadata is available via this API.
As an example:
.
> import Web.Stripe
> import Web.Stripe.Coupon
>
> main :: IO ()
> main = do
> let config = StripeConfig "secret key"
> result <- stripe config $ updateCoupon (CouponId "couponid") [("key1", "value2"), ("key2", "value2")]
> case result of
> Right coupon -> print $ couponMetaData coupon
> Left stripeError -> print stripeError
.
[Issues - <https://github.com/dmjio/stripe-haskell/issues>]
Any API recommendations or bugs can be reported on the GitHub issue tracker.
Pull requests welcome!
.
Test-Suite tests
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: tests
build-depends: HsOpenSSL
, aeson
, base >=4.6 && <4.8
, bytestring
, either
, hspec >= 2.1.4
, http-streams
, random
, random >= 1.1
, stripe-haskell
, text
, time
, transformers
default-language: Haskell2010
ghc-options: -Wall -threaded -rtsopts
library
hs-source-dirs: src
build-depends: HsOpenSSL
, aeson
, base >=4.6 && <4.8
, bytestring
, either
, http-streams
, io-streams
, mtl >= 2.1.3.1
, random >= 1.1
, text
, time
, transformers
, unordered-containers
default-language: Haskell2010
other-modules: Web.Stripe.Client
Web.Stripe.Client.Internal
Web.Stripe.Client.Error
Web.Stripe.Client.Types
Web.Stripe.Client.Util
Web.Stripe.Types
Web.Stripe.Types.Util
exposed-modules:
Web.Stripe
Web.Stripe.Account
Web.Stripe.ApplicationFee
Web.Stripe.ApplicationFeeRefund
Web.Stripe.Balance
Web.Stripe.Bitcoin
Web.Stripe.Card
Web.Stripe.Charge
Web.Stripe.Coupon
Web.Stripe.Customer
Web.Stripe.Discount
Web.Stripe.Dispute
Web.Stripe.Event
Web.Stripe.Invoice
Web.Stripe.InvoiceItem
Web.Stripe.Plan
Web.Stripe.Recipient
Web.Stripe.Refund
Web.Stripe.Subscription
Web.Stripe.Token
Web.Stripe.Transfer
ghc-options: -Wall -rtsopts
source-repository head
type: git
location: git://github.com/dmjio/stripe-haskell.git