stripe 4.13.0 → 4.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +1 -0
- data/lib/stripe/credit_note.rb +19 -0
- data/lib/stripe/util.rb +1 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/credit_note_test.rb +61 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 790e0608c4ddd64ef2fe1c9c479bf5aea4860001f710f01bec506d5abb5c6d00
|
4
|
+
data.tar.gz: dcda60f272c74dda8e2681c2ca023e6355a52efcac58f69b773a4881eeedf541
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31001e18ef97dd7c17f882398a14cd983ff33e08e5f30a3d22331863bd3a67ec7946968a1465c46d64e564b619625b9c3fe59e4ec1b9076307ccba2fe5c49d98
|
7
|
+
data.tar.gz: 493304d4c23cb7ea517419a5ebe70aa23da0610ede0c5364a2dccac1c8c425d36f50c6d923db494e71a54edb4c3eeb872819b844fe90921bde47c75b631fea46
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.14.0 - 2019-04-18
|
4
|
+
* [#758](https://github.com/stripe/stripe-ruby/pull/758) Add support for the `CreditNote` resource and APIs
|
5
|
+
|
3
6
|
## 4.13.0 - 2019-04-16
|
4
7
|
* [#766](https://github.com/stripe/stripe-ruby/pull/766) Relax constraints on objects that we'll accept as a file (now they just need to respond to `#read`)
|
5
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.
|
1
|
+
4.14.0
|
data/lib/stripe.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class CreditNote < APIResource
|
5
|
+
extend Stripe::APIOperations::List
|
6
|
+
include Stripe::APIOperations::Save
|
7
|
+
extend Stripe::APIOperations::Create
|
8
|
+
|
9
|
+
OBJECT_NAME = "credit_note".freeze
|
10
|
+
|
11
|
+
custom_method :void_credit_note, http_verb: :post, http_path: "void"
|
12
|
+
|
13
|
+
def void_credit_note(params = {}, opts = {})
|
14
|
+
url = resource_url + "/void"
|
15
|
+
resp, opts = request(:post, url, params, opts)
|
16
|
+
initialize_from(resp.data, opts)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/stripe/util.rb
CHANGED
@@ -61,6 +61,7 @@ module Stripe
|
|
61
61
|
Checkout::Session::OBJECT_NAME => Checkout::Session,
|
62
62
|
CountrySpec::OBJECT_NAME => CountrySpec,
|
63
63
|
Coupon::OBJECT_NAME => Coupon,
|
64
|
+
CreditNote::OBJECT_NAME => CreditNote,
|
64
65
|
Customer::OBJECT_NAME => Customer,
|
65
66
|
Discount::OBJECT_NAME => Discount,
|
66
67
|
Dispute::OBJECT_NAME => Dispute,
|
data/lib/stripe/version.rb
CHANGED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path("../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
class CreditNoteTest < Test::Unit::TestCase
|
7
|
+
should "be listable" do
|
8
|
+
credit_notes = Stripe::CreditNote.list
|
9
|
+
assert_requested :get, "#{Stripe.api_base}/v1/credit_notes"
|
10
|
+
assert credit_notes.data.is_a?(Array)
|
11
|
+
assert credit_notes.first.is_a?(Stripe::CreditNote)
|
12
|
+
end
|
13
|
+
|
14
|
+
should "be retrievable" do
|
15
|
+
credit_note = Stripe::CreditNote.retrieve("cn_123")
|
16
|
+
assert_requested :get, "#{Stripe.api_base}/v1/credit_notes/cn_123"
|
17
|
+
assert credit_note.is_a?(Stripe::CreditNote)
|
18
|
+
end
|
19
|
+
|
20
|
+
should "be creatable" do
|
21
|
+
credit_note = Stripe::CreditNote.create(
|
22
|
+
amount: 100,
|
23
|
+
invoice: "in_123",
|
24
|
+
reason: "duplicate"
|
25
|
+
)
|
26
|
+
assert_requested :post, "#{Stripe.api_base}/v1/credit_notes"
|
27
|
+
assert credit_note.is_a?(Stripe::CreditNote)
|
28
|
+
end
|
29
|
+
|
30
|
+
should "be saveable" do
|
31
|
+
credit_note = Stripe::CreditNote.retrieve("cn_123")
|
32
|
+
credit_note.metadata["key"] = "value"
|
33
|
+
credit_note.save
|
34
|
+
assert_requested :post, "#{Stripe.api_base}/v1/credit_notes/#{credit_note.id}"
|
35
|
+
end
|
36
|
+
|
37
|
+
should "be updateable" do
|
38
|
+
credit_note = Stripe::CreditNote.update("cn_123", metadata: { key: "value" })
|
39
|
+
assert_requested :post, "#{Stripe.api_base}/v1/credit_notes/cn_123"
|
40
|
+
assert credit_note.is_a?(Stripe::CreditNote)
|
41
|
+
end
|
42
|
+
|
43
|
+
context "#void_credit_note" do
|
44
|
+
should "void credit_note" do
|
45
|
+
credit_note = Stripe::CreditNote.retrieve("cn_123")
|
46
|
+
credit_note = credit_note.void_credit_note
|
47
|
+
assert_requested :post,
|
48
|
+
"#{Stripe.api_base}/v1/credit_notes/#{credit_note.id}/void"
|
49
|
+
assert credit_note.is_a?(Stripe::CreditNote)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context ".void_credit_note" do
|
54
|
+
should "void credit_note" do
|
55
|
+
credit_note = Stripe::CreditNote.void_credit_note("cn_123")
|
56
|
+
assert_requested :post, "#{Stripe.api_base}/v1/credit_notes/cn_123/void"
|
57
|
+
assert credit_note.is_a?(Stripe::CreditNote)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/stripe/checkout/session.rb
|
87
87
|
- lib/stripe/country_spec.rb
|
88
88
|
- lib/stripe/coupon.rb
|
89
|
+
- lib/stripe/credit_note.rb
|
89
90
|
- lib/stripe/customer.rb
|
90
91
|
- lib/stripe/discount.rb
|
91
92
|
- lib/stripe/dispute.rb
|
@@ -167,6 +168,7 @@ files:
|
|
167
168
|
- test/stripe/checkout/session_test.rb
|
168
169
|
- test/stripe/country_spec_test.rb
|
169
170
|
- test/stripe/coupon_test.rb
|
171
|
+
- test/stripe/credit_note_test.rb
|
170
172
|
- test/stripe/customer_card_test.rb
|
171
173
|
- test/stripe/customer_test.rb
|
172
174
|
- test/stripe/dispute_test.rb
|
@@ -270,6 +272,7 @@ test_files:
|
|
270
272
|
- test/stripe/checkout/session_test.rb
|
271
273
|
- test/stripe/country_spec_test.rb
|
272
274
|
- test/stripe/coupon_test.rb
|
275
|
+
- test/stripe/credit_note_test.rb
|
273
276
|
- test/stripe/customer_card_test.rb
|
274
277
|
- test/stripe/customer_test.rb
|
275
278
|
- test/stripe/dispute_test.rb
|