Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to the upstream v2.4.0 #15

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
fb671bc
Add delete to Invoiceitems (#434)
Dec 7, 2018
79a46fb
Upgrade stripe-mock 0.38 (#436)
snewcomer Dec 7, 2018
3108b68
Update ex_doc to 0.19
begedin Nov 7, 2018
ced855c
Release 2.2.2
begedin Dec 18, 2018
824ef3a
Configurable json serializer (#446)
snewcomer Jan 13, 2019
2e10109
add support for voiding invoices (#444)
Jan 13, 2019
7bd8bd9
Use singular time units in System.system_time/1 (#450)
maartenvanvliet Jan 17, 2019
42e0c99
More configuration options (#447)
Jan 17, 2019
f7010c0
add shared options to documentation (#452)
dnsbty Jan 17, 2019
57daef8
Add invoice settings to customer/invoice objects (#451)
maartenvanvliet Jan 18, 2019
ac683ea
Upgrade to 2018-11-08 Stripe API (#439)
snewcomer Jan 18, 2019
db20f65
Move aroud README (#455)
snewcomer Jan 18, 2019
b298d4f
Update Configuration instructions in README.md (#457)
annaminton Feb 5, 2019
97efb1b
Typo for retrieving invoice items + Adds handler for Usage endpoint (…
Feb 6, 2019
bfb0131
Add formatter (#453)
snewcomer Feb 6, 2019
5be0f02
Add elixir 1.8 to test matrix (#449)
maartenvanvliet Feb 6, 2019
96082ac
Resolves #462. Add authorization header api key to deauthorization oa…
zgohr Mar 4, 2019
d30ef74
add support for idempotent post requests (#461)
swelham Mar 4, 2019
85b2c17
Support new Checkout flow (#466)
dnsbty Mar 5, 2019
eecc46c
Add receipt_url to the return charge data. (#467)
zgohr Mar 6, 2019
87a45e8
convert review.opened too
Deepwalker Mar 7, 2019
26b6f9c
add ip_address, ip_address_location and session fields to review
Deepwalker Mar 18, 2019
028ec89
just float
Deepwalker Mar 18, 2019
89a74a4
float
Deepwalker Mar 18, 2019
2b5c5b6
add payment intents (#470)
christian-froh Mar 19, 2019
ffae57d
made client_secret optional (#473)
christian-froh Mar 20, 2019
5683757
Improve README with commit sha
snewcomer Mar 29, 2019
3cb2239
Upgrade stripe mock to 0.55 (#485)
maartenvanvliet May 4, 2019
732b742
Implement `assert_stripe_requested/3` (#487)
maartenvanvliet May 6, 2019
28a193a
Release 2.2.3
begedin May 10, 2019
f96d499
add closed property back to invoice
jalexander Nov 19, 2024
9a480cf
Configurable json serializer (#446)
snewcomer Jan 13, 2019
0b2dcb1
Reorganize docs (#496)
maartenvanvliet May 12, 2019
515020d
Enforce formatter (#490)
maartenvanvliet May 12, 2019
4854c40
Format mix.exs to pass CI (#498)
snewcomer May 21, 2019
c78819c
Add PaymentMethods module, with struct, list/2, attach/2, detach/2
begedin May 10, 2019
3bd2654
Fix typo dettach -> detach
begedin May 15, 2019
aeffdf6
Add create/2, retrieve/2. update/3
begedin May 20, 2019
ae65de8
Add CreditNote api calls (#492)
maartenvanvliet May 24, 2019
fcc5973
Add support for Subscription Schedules (#480)
maartenvanvliet May 24, 2019
876aed9
Add Stripe Issuing (#493)
jcartwright May 28, 2019
f6977f4
Add tax rate api
maartenvanvliet May 7, 2019
873f7b5
Add `tax_rate` to converter
maartenvanvliet May 8, 2019
75d7ae2
Mark percentage as integer
maartenvanvliet May 25, 2019
51b2814
Make update params optional
maartenvanvliet May 25, 2019
7e189de
Add to Billing section in docs
maartenvanvliet May 25, 2019
3812c13
Fix docs warning
maartenvanvliet May 25, 2019
1772b15
Update doc organization with issuing
maartenvanvliet Jun 1, 2019
bcbd485
Release 2.3.0
snewcomer May 28, 2019
dd2a637
Set minimum elixir version to 1.7
maartenvanvliet May 26, 2019
06ec021
Upgrade inch_ex to 2.0
maartenvanvliet May 26, 2019
5706d7d
Upgrade excoveralls dependency (#503)
maartenvanvliet Jun 2, 2019
bac6f10
Use Jason over Poison (#509)
maartenvanvliet Jun 3, 2019
959ed8b
Update Stripe version (#483)
snewcomer Jun 7, 2019
ffdd4f4
Add support for sending invoices. (#510)
Jun 9, 2019
88447f3
Warn when unknown objects are processed (#514)
maartenvanvliet Jun 11, 2019
d2967e7
Support upcoming invoices with subscription only (#515)
sheharyarn Jun 11, 2019
5a0e667
Add missing invoice endpoints (#513)
maartenvanvliet Jun 11, 2019
b4d9397
Issues/add missing fields (#511)
maartenvanvliet Jun 14, 2019
be92e2b
Release 2.4 (#512)
snewcomer Jun 14, 2019
20c7c37
Bump to 2.4 in mix
snewcomer Jun 14, 2019
47d86a0
add location back to types
jalexander Nov 19, 2024
db5aacc
updates to match upstream v2.4.0
jalexander Nov 21, 2024
f711715
revert change to webhook
jalexander Nov 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export_locals_without_parens = [
plug: 1,
plug: 2,
forward: 2,
forward: 3,
forward: 4,
match: 2,
match: 3,
get: 2,
get: 3,
post: 2,
post: 3,
put: 2,
put: 3,
patch: 2,
patch: 3,
delete: 2,
delete: 3,
options: 2,
options: 3
]

[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"],
locals_without_parens: export_locals_without_parens,
export: [locals_without_parens: export_locals_without_parens]
]
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ erl_crash.dump
config/config.secret.exs
/doc
.DS_Store
tags

# elixir LS files

Expand All @@ -13,4 +14,4 @@ config/config.secret.exs

/.idea
*.iml
priv/plts/*.plt
priv/plts/*
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
language: elixir
dist: trusty
elixir:
- 1.5
- 1.6
- 1.7
- 1.8
otp_release:
- 19.3
- 20.1
matrix:
exclude:
- otp_release: 19.3
elixir: 1.8
sudo: false
env:
global:
- STRIPE_MOCK_VERSION=0.30.0
- STRIPE_MOCK_VERSION=0.55.0
- MIX_ENV=test STRIPE_SECRET_KEY=non_empty_secret_key_string
cache:
directories:
Expand All @@ -25,6 +28,10 @@ before_install:
fi
- export PATH=$PATH:$PWD/stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
script:
- |
if [ "$TRAVIS_ELIXIR_VERSION" == "1.8" ]; then
mix format --dry-run --check-formatted;
fi
- mix coveralls.travis
- MIX_ENV=dev mix dialyzer --halt-exit-status
after_script:
Expand Down
54 changes: 54 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
# Latest

## 2.4.0

- [Issues/add missing fields](https://github.com/code-corps/stripity_stripe/pull/511)
- [Support upcoming invoices with subscription only](https://github.com/code-corps/stripity_stripe/pull/515)
- [Warn when unknown objects are processed](https://github.com/code-corps/stripity_stripe/pull/514)
- [Add missing invoice endpoints](https://github.com/code-corps/stripity_stripe/pull/513)
- [Add support for sending invoices](https://github.com/code-corps/stripity_stripe/pull/510)
- [Update Stripe version](https://github.com/code-corps/stripity_stripe/pull/483)
- [Use Jason over Poison](https://github.com/code-corps/stripity_stripe/pull/509)
- [Set minimum elixir version to 1.7](https://github.com/code-corps/stripity_stripe/pull/504)

## 2.3.0

- [Add support for Subscription Schedules](https://github.com/code-corps/stripity_stripe/pull/480)
- [Add Stripe Issuing](https://github.com/code-corps/stripity_stripe/pull/493)
- [Add CreditNote api calls](https://github.com/code-corps/stripity_stripe/pull/492)
- [Add tax_rate struct and api calls](https://github.com/code-corps/stripity_stripe/pull/491)
- [Format mix.exs to pass CI](https://github.com/code-corps/stripity_stripe/pull/498)
- [Reorganize docs](https://github.com/code-corps/stripity_stripe/pull/496)
- [Add PaymentMethods module, with struct, list/2, attach/2, detach/2](https://github.com/code-corps/stripity_stripe/pull/495)

## 2.2.3

- [Configurable json serializer - You can now use Jason instead of Poison](https://github.com/code-corps/stripity_stripe/pull/446)
- [Support for voiding invoices](https://github.com/code-corps/stripity_stripe/pull/444)
- [Use singular time units in System.system_time/1](https://github.com/code-corps/stripity_stripe/pull/450)
- [Expanded configuration options](https://github.com/code-corps/stripity_stripe/pull/447)
- [Add invoice settings to customer/invoice objects](https://github.com/code-corps/stripity_stripe/pull/451)
- [Upgrade to 2018-11-08 Stripe API](https://github.com/code-corps/stripity_stripe/pull/439)
- [Fixed bug in `Usage.retrieve`](https://github.com/code-corps/stripity_stripe/pull/433)
- [Add elixir 1.8 to test matrix](https://github.com/code-corps/stripity_stripe/pull/449)
- [Add authorization header api key to deauthorization endpoint]((https://github.com/code-corps/stripity_stripe/pull/465)
- [Add support for idempotent post requests](https://github.com/code-corps/stripity_stripe/pull/461)
- [Support new Checkout flow](https://github.com/code-corps/stripity_stripe/pull/466)
- [Add `receipt_url` to the return Charge data](https://github.com/code-corps/stripity_stripe/pull/467)
- [Fixed some bugs in `Review` struct fields](https://github.com/code-corps/stripity_stripe/pull/468)
- [Add basic support for payment intents](https://github.com/code-corps/stripity_stripe/pull/470)
- [Make `client_secret` optional](https://github.com/code-corps/stripity_stripe/pull/473)
- [Update hackney requirement to 1.15](https://github.com/code-corps/stripity_stripe/pull/475)
- [Upgrade to ex doc 0.20](https://github.com/code-corps/stripity_stripe/pull/486)
- [Upgrade stripe mock to 0.55](https://github.com/code-corps/stripity_stripe/pull/485)
- [Remove unused Bypass dependency](https://github.com/code-corps/stripity_stripe/pull/88)
- [Implement `assert_stripe_requested/3` test helper](https://github.com/code-corps/stripity_stripe/pull/487)
- Misc documentation improvements

## 2.2.2

- [Upgrade stripe-mock 0.38](https://github.com/code-corps/stripity_stripe/pull/436)
- *New Feature:* [Add delete endpoint to Invoiceitems](https://github.com/code-corps/stripity_stripe/pull/434)
- [Ensure tests wait until stripe_mock started](https://github.com/code-corps/stripity_stripe/pull/427)
- [Upgraded erlexec for OTP 21 support](https://github.com/code-corps/stripity_stripe/pull/426)
- [Added missing invoice attributes](https://github.com/code-corps/stripity_stripe/pull/425)
- [Enabled Dialyxir in CI](https://github.com/code-corps/stripity_stripe/pull/424)

## 2.2.1

- [Fix: date_query type had fields incorrectly marked as mandatory](https://github.com/code-corps/stripity_stripe/pull/421)
Expand Down
37 changes: 30 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ The actively developed line of releases is `2.x.x` and is contained within the `
------------ | -------------
`2.0.x` | `2018-02-28`
`2.1.x - 2.2.x` | `2018-05-21`
`master` | `2018-08-23`
`master` | `2019-03-14`

# Documentation

Expand All @@ -32,12 +32,18 @@ The actively developed line of releases is `2.x.x` and is contained within the `

## Installation

Install the dependency:
Install the dependency by version:

```ex
{:stripity_stripe, "~> 2.0.0"}
```

Or by commit reference (still awaiting hex publish rights so this is your best best for now):

```ex
{:stripity_stripe, git: "https://github.com/code-corps/stripity_stripe", ref: "8c091d4278d29a917bacef7bb2f0606317fcc025"}
```

Next, add to your applications:

_Not necessary if using elixir >= 1.4_
Expand All @@ -55,9 +61,25 @@ To make API calls, it is necessary to configure your Stripe secret key.
```ex
use Mix.Config

config :stripity_stripe, api_key: System.get_env("STRIPE_SECRET")
# OR
config :stripity_stripe, api_key: "YOUR SECRET KEY"
```

It's possible to use a function or a tuple to resolve the secret:

```ex
config :stripity_stripe, api_key: {MyApp.Secrets, :stripe_secret, []}
# OR
config :stripity_stripe, api_key: fn -> System.get_env("STRIPE_SECRET") end
```

Moreover, if you are using Poison instead of Jason, you can configure the library to use Poison like so:

```ex
config :stripity_stripe, json_library: Poison
```

## Note: Object Expansion

Some Stripe API endpoints support returning related objects via the object expansion query parameter. To take advantage of this feature, stripity_stripe accepts
Expand Down Expand Up @@ -95,6 +117,12 @@ We will get the full object back as well.

For details on which objects can be expanded check out the [stripe object expansion](https://stripe.com/docs/api#expanding_objects) docs.

# Testing

To run the tests you'll need to install [`stripe-mock`](https://github.com/stripe/stripe-mock) It is a mock HTTP server that responds like the real Stripe API. It's powered by the [Stripe OpenAPI specification](https://github.com/stripe/openapi), which is generated from within Stripe's API.

Start `stripe-mock` before running the tests with `mix test`.

# Documentation for 1.x.x

<details><summary>Click to expand</summary>
Expand Down Expand Up @@ -131,11 +159,6 @@ config :stripity_stripe, secret_key: "YOUR SECRET KEY"
config :stripity_stripe, platform_client_id: "YOUR CONNECT PLATFORM CLIENT ID"
```

To customize the underlying HTTPoison library, you may optionally add an `:httpoison_options` key to the stripity_stripe configuration. For a full list of configuration options, please refer to the [HTTPoison documentation](https://github.com/edgurgel/httpoison).

```ex
config :stripity_stripe, httpoison_options: [timeout: 10000, recv_timeout: 10000, proxy: {"proxy.mydomain.com", 8080}]
```

## Testing

Expand Down
25 changes: 20 additions & 5 deletions lib/stripe.ex
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,21 @@ defmodule Stripe do

config :stripity_stripe, api_key: System.get_env("STRIPE_API_KEY")

### Shared Options

Almost all of the requests that can be sent accept the following options:

* `:api_key` - The Stripe API key to use for the request. See
[https://stripe.com/docs/api/authentication](https://stripe.com/docs/api/authentication)
* `:connect_account` - The ID of a Stripe Connect account for which the
request should be made, passed through as the "Stripe-Account" header. The
preferred authentication method for Stripe Connect. See
[https://stripe.com/docs/connect/authentication#stripe-account-header](https://stripe.com/docs/connect/authentication#stripe-account-header)
* `:expand` - Takes a list of fields that should be expanded in the response
from Stripe. See [https://stripe.com/docs/api/expanding_objects](https://stripe.com/docs/api/expanding_objects)
* `:idempotency_key` - A string that is passed through as the "Idempotency-Key" header on all POST requests. This is used by Stripe's idempotency layer to manage
duplicate requests to the stripe API. See [https://stripe.com/docs/api/idempotent_requests](https://stripe.com/docs/api/idempotent_requests)

### HTTP Connection Pool

Stripity Stripe is set up to use an HTTP connection pool by default. This
Expand Down Expand Up @@ -49,11 +64,11 @@ defmodule Stripe do

@type id :: String.t()
@type date_query :: %{
optional(:gt) => timestamp,
optional(:gte) => timestamp,
optional(:lt) => timestamp,
optional(:lte) => timestamp
}
optional(:gt) => timestamp,
optional(:gte) => timestamp,
optional(:lt) => timestamp,
optional(:lte) => timestamp
}
@type options :: Keyword.t()
@type timestamp :: pos_integer

Expand Down
Loading