stripe 1.42.0 → 1.43.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.txt +5 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +2 -0
- data/lib/stripe/alipay_account.rb +16 -0
- data/lib/stripe/order.rb +9 -1
- data/lib/stripe/order_return.rb +9 -0
- data/lib/stripe/util.rb +2 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/alipay_account_test.rb +11 -0
- data/test/stripe/order_return_test.rb +25 -0
- data/test/stripe/order_test.rb +12 -0
- data/test/test_data.rb +51 -0
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66408a45e6fe0aade6bed89e6b1fc94887ebfcf2
|
4
|
+
data.tar.gz: e6e4bab0429b17fd67c8c55e4733549b4e982e7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfcd581ed60fbf0e314e6ef79ce5e0db9db982a07ca5eda716092473b5d9ca29492a27920302b23fa74307e542ca4cd3323aa7bc728a1245d2324d79043e914e
|
7
|
+
data.tar.gz: 8e8b2446f7410544c423bca16ed8bc1c18c936129cc5870ab2f8fb3d1f63978ad586a2db9cadcb9c79b970fbaf0e385c4dbc057bd5a454db268f2fe5261117cc
|
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.43.0
|
data/lib/stripe.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Stripe
|
2
|
+
class AlipayAccount < APIResource
|
3
|
+
include Stripe::APIOperations::Update
|
4
|
+
include Stripe::APIOperations::Delete
|
5
|
+
|
6
|
+
def resource_url
|
7
|
+
if respond_to?(:customer) && !self.customer.nil?
|
8
|
+
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.retrieve(id, opts=nil)
|
13
|
+
raise NotImplementedError.new("Alipay accounts cannot be retrieved without a customer ID. Retrieve an Alipay account using customer.sources.retrieve('alipay_account_id')")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/stripe/order.rb
CHANGED
@@ -9,11 +9,19 @@ module Stripe
|
|
9
9
|
initialize_from(response, opts)
|
10
10
|
end
|
11
11
|
|
12
|
+
def return_order(params, opts={})
|
13
|
+
response, opts = request(:post, returns_url, params, opts)
|
14
|
+
initialize_from(response, opts)
|
15
|
+
end
|
16
|
+
|
12
17
|
private
|
13
18
|
|
14
19
|
def pay_url
|
15
|
-
resource_url +
|
20
|
+
resource_url + '/pay'
|
16
21
|
end
|
17
22
|
|
23
|
+
def returns_url
|
24
|
+
resource_url + '/returns'
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
data/lib/stripe/util.rb
CHANGED
@@ -24,6 +24,7 @@ module Stripe
|
|
24
24
|
|
25
25
|
# business objects
|
26
26
|
'account' => Account,
|
27
|
+
'alipay_account' => AlipayAccount,
|
27
28
|
'application_fee' => ApplicationFee,
|
28
29
|
'balance' => Balance,
|
29
30
|
'balance_transaction' => BalanceTransaction,
|
@@ -51,6 +52,7 @@ module Stripe
|
|
51
52
|
'product' => Product,
|
52
53
|
'sku' => SKU,
|
53
54
|
'order' => Order,
|
55
|
+
'order_return' => OrderReturn,
|
54
56
|
}
|
55
57
|
end
|
56
58
|
|
data/lib/stripe/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class AlipayAccountTest < Test::Unit::TestCase
|
5
|
+
should "raise if accessing Stripe::Alipay.account directly" do
|
6
|
+
assert_raises NotImplementedError do
|
7
|
+
Stripe::AlipayAccount.retrieve "card_12345"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require File.expand_path('../../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
class OrderReturnTest < Test::Unit::TestCase
|
5
|
+
should "returns should be listable" do
|
6
|
+
@mock.expects(:get).once.returns(make_response(make_order_return_array))
|
7
|
+
returns = Stripe::OrderReturn.list
|
8
|
+
assert returns.data.kind_of?(Array)
|
9
|
+
returns.each do |ret|
|
10
|
+
assert ret.kind_of?(Stripe::OrderReturn)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
should "returns should not be deletable" do
|
15
|
+
p = Stripe::OrderReturn.new("test_order")
|
16
|
+
assert_raises(NoMethodError) { p.delete }
|
17
|
+
end
|
18
|
+
|
19
|
+
should "returns should be immutable" do
|
20
|
+
p = Stripe::OrderReturn.new("test_order")
|
21
|
+
p.items = []
|
22
|
+
assert_raises(NoMethodError) { p.save }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/test/stripe/order_test.rb
CHANGED
@@ -48,5 +48,17 @@ module Stripe
|
|
48
48
|
order.pay(:token => 'test_token')
|
49
49
|
assert_equal "paid", order.status
|
50
50
|
end
|
51
|
+
|
52
|
+
should "return an order" do
|
53
|
+
@mock.expects(:get).once.
|
54
|
+
returns(make_response(make_order(:id => 'or_test_order')))
|
55
|
+
order = Stripe::Order.retrieve('or_test_order')
|
56
|
+
|
57
|
+
@mock.expects(:post).once.
|
58
|
+
with('https://api.stripe.com/v1/orders/or_test_order/returns', nil, 'items[][parent]=sku_foo').
|
59
|
+
returns(make_response(make_paid_order))
|
60
|
+
order.return_order(:items => [{:parent => 'sku_foo'}])
|
61
|
+
assert_equal "paid", order.status
|
62
|
+
end
|
51
63
|
end
|
52
64
|
end
|
data/test/test_data.rb
CHANGED
@@ -686,6 +686,57 @@ module Stripe
|
|
686
686
|
}).merge(params)
|
687
687
|
end
|
688
688
|
|
689
|
+
def make_partially_returned_order(params={})
|
690
|
+
make_paid_order.merge({
|
691
|
+
:returns => make_order_return_array,
|
692
|
+
}).merge(params)
|
693
|
+
end
|
694
|
+
|
695
|
+
def make_order_return
|
696
|
+
{
|
697
|
+
:id => "orret_18CI1jDAu10Yox5R5kGPgbLN",
|
698
|
+
:object => "order_return",
|
699
|
+
:amount => 1220,
|
700
|
+
:created => 1463529303,
|
701
|
+
:currency => "usd",
|
702
|
+
:items => [
|
703
|
+
{
|
704
|
+
:object => "order_item",
|
705
|
+
:amount => 200,
|
706
|
+
:currency => "usd",
|
707
|
+
:description => "Just a SKU",
|
708
|
+
:parent => "sku_80NAUPJ9dpYtck",
|
709
|
+
:quantity => 2,
|
710
|
+
:type => "sku"
|
711
|
+
},
|
712
|
+
{
|
713
|
+
:object => "order_item",
|
714
|
+
:amount => 20,
|
715
|
+
:currency => "usd",
|
716
|
+
:description => "Fair enough",
|
717
|
+
:parent => nil,
|
718
|
+
:quantity => nil,
|
719
|
+
:type => "tax"
|
720
|
+
},
|
721
|
+
],
|
722
|
+
:livemode => false,
|
723
|
+
:order => "or_189jaGDAu10Yox5R0F6LoH6K",
|
724
|
+
:refund => nil,
|
725
|
+
}
|
726
|
+
end
|
727
|
+
|
728
|
+
def make_order_return_array
|
729
|
+
{
|
730
|
+
:object => "list",
|
731
|
+
:resource_url => "/v1/order_returns",
|
732
|
+
:data => [
|
733
|
+
make_order_return,
|
734
|
+
make_order_return,
|
735
|
+
make_order_return,
|
736
|
+
]
|
737
|
+
}
|
738
|
+
end
|
739
|
+
|
689
740
|
def country_spec_array
|
690
741
|
{
|
691
742
|
:object => "list",
|
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.
|
4
|
+
version: 1.43.0
|
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-05-
|
12
|
+
date: 2016-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/data/ca-certificates.crt
|
49
49
|
- lib/stripe.rb
|
50
50
|
- lib/stripe/account.rb
|
51
|
+
- lib/stripe/alipay_account.rb
|
51
52
|
- lib/stripe/api_operations/create.rb
|
52
53
|
- lib/stripe/api_operations/delete.rb
|
53
54
|
- lib/stripe/api_operations/list.rb
|
@@ -80,6 +81,7 @@ files:
|
|
80
81
|
- lib/stripe/invoice_item.rb
|
81
82
|
- lib/stripe/list_object.rb
|
82
83
|
- lib/stripe/order.rb
|
84
|
+
- lib/stripe/order_return.rb
|
83
85
|
- lib/stripe/plan.rb
|
84
86
|
- lib/stripe/product.rb
|
85
87
|
- lib/stripe/recipient.rb
|
@@ -95,6 +97,7 @@ files:
|
|
95
97
|
- lib/stripe/version.rb
|
96
98
|
- stripe.gemspec
|
97
99
|
- test/stripe/account_test.rb
|
100
|
+
- test/stripe/alipay_account_test.rb
|
98
101
|
- test/stripe/api_resource_test.rb
|
99
102
|
- test/stripe/application_fee_refund_test.rb
|
100
103
|
- test/stripe/application_fee_test.rb
|
@@ -113,6 +116,7 @@ files:
|
|
113
116
|
- test/stripe/invoice_test.rb
|
114
117
|
- test/stripe/list_object_test.rb
|
115
118
|
- test/stripe/metadata_test.rb
|
119
|
+
- test/stripe/order_return_test.rb
|
116
120
|
- test/stripe/order_test.rb
|
117
121
|
- test/stripe/product_test.rb
|
118
122
|
- test/stripe/recipient_card_test.rb
|
@@ -152,6 +156,7 @@ specification_version: 4
|
|
152
156
|
summary: Ruby bindings for the Stripe API
|
153
157
|
test_files:
|
154
158
|
- test/stripe/account_test.rb
|
159
|
+
- test/stripe/alipay_account_test.rb
|
155
160
|
- test/stripe/api_resource_test.rb
|
156
161
|
- test/stripe/application_fee_refund_test.rb
|
157
162
|
- test/stripe/application_fee_test.rb
|
@@ -170,6 +175,7 @@ test_files:
|
|
170
175
|
- test/stripe/invoice_test.rb
|
171
176
|
- test/stripe/list_object_test.rb
|
172
177
|
- test/stripe/metadata_test.rb
|
178
|
+
- test/stripe/order_return_test.rb
|
173
179
|
- test/stripe/order_test.rb
|
174
180
|
- test/stripe/product_test.rb
|
175
181
|
- test/stripe/recipient_card_test.rb
|