stripe 1.35.0 → 1.35.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/VERSION +1 -1
- data/lib/stripe/charge.rb +23 -5
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/charge_test.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba258c6ce34968c0caaadec16763905ff632084a
|
4
|
+
data.tar.gz: d80c2169b9ae78b37236a3124419679c7a2a93f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcf9630e2a0cf7e77bd21a933c00f91808418913a87b367ba7d4e19add2e9fda9b9632d6c111e9e9fa8ca1b575d75f1f1c44888dcf814017e14c46672b4cd67e
|
7
|
+
data.tar.gz: 1e28646f0b94e1c56d7acd5440d17707b1b247e2c1a593595520ee650a6de08a402548e8c3c9f9d0866ba0d8ac2b02740f84faf4f111042604caaccd33810ee7
|
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.35.
|
1
|
+
1.35.1
|
data/lib/stripe/charge.rb
CHANGED
@@ -5,12 +5,24 @@ module Stripe
|
|
5
5
|
include Stripe::APIOperations::Update
|
6
6
|
|
7
7
|
def refund(params={}, opts={})
|
8
|
-
|
8
|
+
# Old versions of charge objects included a `refunds` field that was just
|
9
|
+
# a vanilla array instead of a Stripe list object.
|
10
|
+
#
|
11
|
+
# Where possible, we'd still like to use the new refund endpoint (thus
|
12
|
+
# `self.refunds.create`), but detect the old API version by looking for
|
13
|
+
# an `Array` and fall back to the old refund URL if necessary so as to
|
14
|
+
# maintain internal compatibility.
|
15
|
+
unless self.refunds.is_a?(Array)
|
16
|
+
refund = self.refunds.create(params, opts)
|
9
17
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
18
|
+
# now that a refund has been created, we expect the state of this object
|
19
|
+
# to change as well (i.e. `refunded` will now be `true`) so refresh it
|
20
|
+
# from the server
|
21
|
+
self.refresh
|
22
|
+
else
|
23
|
+
response, opts = request(:post, refund_url, params, opts)
|
24
|
+
initialize_from(response, opts)
|
25
|
+
end
|
14
26
|
end
|
15
27
|
|
16
28
|
def capture(params={}, opts={})
|
@@ -58,5 +70,11 @@ module Stripe
|
|
58
70
|
def close_dispute_url
|
59
71
|
url + '/dispute/close'
|
60
72
|
end
|
73
|
+
|
74
|
+
# Note that this is actually the *old* refund URL and its use is no longer
|
75
|
+
# preferred.
|
76
|
+
def refund_url
|
77
|
+
url + '/refund'
|
78
|
+
end
|
61
79
|
end
|
62
80
|
end
|
data/lib/stripe/version.rb
CHANGED
data/test/stripe/charge_test.rb
CHANGED
@@ -19,6 +19,20 @@ module Stripe
|
|
19
19
|
assert r.is_a?(Stripe::Refund)
|
20
20
|
end
|
21
21
|
|
22
|
+
should "charges should be refundable for old API versions" do
|
23
|
+
# "refunds" was a plain array in old API versions but is not a Stripe
|
24
|
+
# list (see the implementation of `make_charge` for a current example)
|
25
|
+
data = make_charge.merge!(:refunds => [])
|
26
|
+
c = Stripe::Charge.construct_from(data)
|
27
|
+
@mock.expects(:get).never
|
28
|
+
@mock.expects(:post).once.
|
29
|
+
with("#{Stripe.api_base}/v1/charges/#{c.id}/refund", nil, '').
|
30
|
+
returns(make_response(data.merge(:refunded => true)))
|
31
|
+
c = c.refund
|
32
|
+
assert c.is_a?(Stripe::Charge)
|
33
|
+
assert c.refunded
|
34
|
+
end
|
35
|
+
|
22
36
|
should "charges should not be deletable" do
|
23
37
|
assert_raises NoMethodError do
|
24
38
|
@mock.expects(:get).once.returns(make_response(make_charge))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.35.
|
4
|
+
version: 1.35.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ross Boucher
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-02-
|
12
|
+
date: 2016-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|