stripe 1.42.0 → 1.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d527e690f11344fa8621791ef6d1081060615be4
4
- data.tar.gz: 4eb5cc04a3066b3b0fd41676c73e4dfc4d01d4db
3
+ metadata.gz: 66408a45e6fe0aade6bed89e6b1fc94887ebfcf2
4
+ data.tar.gz: e6e4bab0429b17fd67c8c55e4733549b4e982e7a
5
5
  SHA512:
6
- metadata.gz: 6c221fc569da0fa801dd6881aa782c907d20eff284539ca3851d30201d7d3b38704f64a038b65f0376391ed4fb53b651f8bfd707adf5ca92897e0e924de145e6
7
- data.tar.gz: 865fa052fb613f85a6a3544c99579ee6a8b01146314ba794a7af1f486aff2f9e4713806b6d3a069bc102398ee63813b3e01edde6676e2975837a70b02ec5b962
6
+ metadata.gz: cfcd581ed60fbf0e314e6ef79ce5e0db9db982a07ca5eda716092473b5d9ca29492a27920302b23fa74307e542ca4cd3323aa7bc728a1245d2324d79043e914e
7
+ data.tar.gz: 8e8b2446f7410544c423bca16ed8bc1c18c936129cc5870ab2f8fb3d1f63978ad586a2db9cadcb9c79b970fbaf0e385c4dbc057bd5a454db268f2fe5261117cc
@@ -1,3 +1,8 @@
1
+ === 1.43.0 2016-05-20
2
+
3
+ * Allow Relay orders to be returned and add associated types
4
+ * Support Alipay account retrieval and deletion
5
+
1
6
  === 1.42.0 2016-05-04
2
7
 
3
8
  * Add support for the new /v1/subscriptions endpoint
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.42.0
1
+ 1.43.0
@@ -53,6 +53,8 @@ require 'stripe/dispute'
53
53
  require 'stripe/product'
54
54
  require 'stripe/sku'
55
55
  require 'stripe/order'
56
+ require 'stripe/order_return'
57
+ require 'stripe/alipay_account'
56
58
 
57
59
  # Errors
58
60
  require 'stripe/errors/stripe_error'
@@ -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
@@ -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 + "/pay"
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
@@ -0,0 +1,9 @@
1
+ module Stripe
2
+ class OrderReturn < APIResource
3
+ extend Stripe::APIOperations::List
4
+
5
+ def self.resource_url
6
+ "/v1/order_returns"
7
+ end
8
+ end
9
+ end
@@ -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
 
@@ -1,3 +1,3 @@
1
1
  module Stripe
2
- VERSION = '1.42.0'
2
+ VERSION = '1.43.0'
3
3
  end
@@ -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
@@ -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
@@ -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.42.0
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-04 00:00:00.000000000 Z
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