stripe 4.6.0 → 4.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30001fb9ea2136d96728f5eac636ad6b86f787193fa18339ea0e594d8948d50c
4
- data.tar.gz: 3eaf42ef3e0d39478fd7f386031cfd689df6b15c4d6005aafe93d733cf94ae45
3
+ metadata.gz: 8b17c2d9db8be7ccd4a37eb6ad3b17ab7ee1ec20610b390953f0735547c5dc81
4
+ data.tar.gz: c38f3a4b02c97cbe2f2f9121e1c50fd2bcbe0abd760f7509fbdd48a19d544b37
5
5
  SHA512:
6
- metadata.gz: 1eb34606d76dbb884ce72323554009f4305c353ede914389b2e7a43bb297bccf39a30f4e7d32bcbf881c1adc1ae51df62f729c27ac253d83c585f38d951a4bdf
7
- data.tar.gz: 17b31fdc7ab1d49e23b07e2882a121ee28e3116512a766a8323241ea8681cf02396c8b00a0a850cadafde3fb6b69431829cf3ca6c439cee5b46aa98218320379
6
+ metadata.gz: 03b19f6e689b28d628b043fa2afadbcb77a22c762062a41537563cb3abc9b5cb037c7b4ee58ac64bd34bef9fcef1f466abe00a47002b8d10b95643c9c9880ad7
7
+ data.tar.gz: d363f4dd535118bf0759e24efd5c7124fd0c633bfcd83deb5b704e5cbeba3ba8c0d910a14ed35c5206b83cec4751daa5decb6c518ed781703539b07562ce840b
@@ -17,7 +17,7 @@ sudo: false
17
17
  env:
18
18
  global:
19
19
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.40.1
20
+ - STRIPE_MOCK_VERSION=0.42.0
21
21
 
22
22
  cache:
23
23
  directories:
@@ -1,5 +1,8 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.7.0 - 2019-01-23
4
+ * [#735](https://github.com/stripe/stripe-ruby/pull/735) Rename `CheckoutSession` to `Session` and move it under the `Checkout` namespace. This is a breaking change, but we've reached out to affected merchants and all new merchants would use the new approach.
5
+
3
6
  ## 4.6.0 - 2019-01-21
4
7
  * [#736](https://github.com/stripe/stripe-ruby/pull/736) Properly serialize `individual` on `Account` objects
5
8
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.6.0
1
+ 4.7.0
@@ -49,7 +49,7 @@ require "stripe/bitcoin_receiver"
49
49
  require "stripe/bitcoin_transaction"
50
50
  require "stripe/card"
51
51
  require "stripe/charge"
52
- require "stripe/checkout_session"
52
+ require "stripe/checkout/session"
53
53
  require "stripe/country_spec"
54
54
  require "stripe/coupon"
55
55
  require "stripe/customer"
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ module Checkout
5
+ class Session < Stripe::APIResource
6
+ extend Stripe::APIOperations::Create
7
+
8
+ OBJECT_NAME = "checkout.session".freeze
9
+ end
10
+ end
11
+ end
@@ -58,7 +58,7 @@ module Stripe
58
58
  BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
59
59
  Card::OBJECT_NAME => Card,
60
60
  Charge::OBJECT_NAME => Charge,
61
- CheckoutSession::OBJECT_NAME => CheckoutSession,
61
+ Checkout::Session::OBJECT_NAME => Checkout::Session,
62
62
  CountrySpec::OBJECT_NAME => CountrySpec,
63
63
  Coupon::OBJECT_NAME => Coupon,
64
64
  Customer::OBJECT_NAME => Customer,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "4.6.0".freeze
4
+ VERSION = "4.7.0".freeze
5
5
  end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require ::File.expand_path("../../../test_helper", __FILE__)
4
+
5
+ module Stripe
6
+ module Checkout
7
+ class SessionTest < Test::Unit::TestCase
8
+ should "be creatable" do
9
+ session = Stripe::Checkout::Session.create(
10
+ allowed_source_types: ["card"],
11
+ cancel_url: "https://stripe.com/cancel",
12
+ client_reference_id: "1234",
13
+ line_items: [
14
+ {
15
+ amount: 123,
16
+ currency: "usd",
17
+ description: "item 1",
18
+ images: [
19
+ "https://stripe.com/img1",
20
+ ],
21
+ name: "name",
22
+ quantity: 2,
23
+ },
24
+ ],
25
+ payment_intent_data: [
26
+ receipt_email: "test@stripe.com",
27
+ ],
28
+ success_url: "https://stripe.com/success"
29
+ )
30
+ assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions"
31
+ assert session.is_a?(Stripe::Checkout::Session)
32
+ end
33
+ end
34
+ end
35
+ end
@@ -23,9 +23,7 @@ module Stripe
23
23
  return @port
24
24
  end
25
25
 
26
- @port = find_available_port
27
-
28
- puts("Starting stripe-mock on port #{@port}...")
26
+ puts("Starting stripe-mock...")
29
27
 
30
28
  @stdout, @child_stdout = ::IO.pipe
31
29
  @stderr, @child_stderr = ::IO.pipe
@@ -33,7 +31,7 @@ module Stripe
33
31
  @pid = ::Process.spawn(
34
32
  ["stripe-mock", "stripe-mock"],
35
33
  "-http-port",
36
- @port.to_s,
34
+ "0", # have stripe-mock select a port
37
35
  "-spec",
38
36
  PATH_SPEC,
39
37
  "-fixtures",
@@ -44,11 +42,20 @@ module Stripe
44
42
 
45
43
  [@child_stdout, @child_stderr].each(&:close)
46
44
 
47
- sleep 1
45
+ # Look for port in "Listening for HTTP on port: 50602"
46
+ buffer = ""
47
+ loop do
48
+ buffer += @stdout.readpartial(4096)
49
+ if (matches = buffer.match(/ port: (\d+)/))
50
+ @port = matches[1]
51
+ break
52
+ end
53
+ sleep(0.1)
54
+ end
48
55
 
49
56
  status = (::Process.wait2(@pid, ::Process::WNOHANG) || []).last
50
57
  if status.nil?
51
- puts("Started stripe-mock, PID = #{@pid}")
58
+ puts("Started stripe-mock; PID = #{@pid}, port = #{@port}")
52
59
  else
53
60
  abort("stripe-mock terminated early: #{status}")
54
61
  end
@@ -66,13 +73,5 @@ module Stripe
66
73
  @port = -1
67
74
  puts("Stopped stripe-mock")
68
75
  end
69
-
70
- # Finds and returns an available TCP port
71
- private_class_method def self.find_available_port
72
- server = TCPServer.new("localhost", 0)
73
- port = server.addr[1]
74
- server.close
75
- port
76
- end
77
76
  end
78
77
  end
@@ -17,7 +17,7 @@ require ::File.expand_path("../test_data", __FILE__)
17
17
  require ::File.expand_path("../stripe_mock", __FILE__)
18
18
 
19
19
  # If changing this number, please also change it in `.travis.yml`.
20
- MOCK_MINIMUM_VERSION = "0.40.1".freeze
20
+ MOCK_MINIMUM_VERSION = "0.42.0".freeze
21
21
  MOCK_PORT = Stripe::StripeMock.start
22
22
 
23
23
  # Disable all real network connections except those that are outgoing to
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.6.0
4
+ version: 4.7.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-01-21 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -83,7 +83,7 @@ files:
83
83
  - lib/stripe/bitcoin_transaction.rb
84
84
  - lib/stripe/card.rb
85
85
  - lib/stripe/charge.rb
86
- - lib/stripe/checkout_session.rb
86
+ - lib/stripe/checkout/session.rb
87
87
  - lib/stripe/country_spec.rb
88
88
  - lib/stripe/coupon.rb
89
89
  - lib/stripe/customer.rb
@@ -164,7 +164,7 @@ files:
164
164
  - test/stripe/balance_test.rb
165
165
  - test/stripe/bank_account_test.rb
166
166
  - test/stripe/charge_test.rb
167
- - test/stripe/checkout_session_test.rb
167
+ - test/stripe/checkout/session_test.rb
168
168
  - test/stripe/country_spec_test.rb
169
169
  - test/stripe/coupon_test.rb
170
170
  - test/stripe/customer_card_test.rb
@@ -249,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
249
  version: '0'
250
250
  requirements: []
251
251
  rubyforge_project:
252
- rubygems_version: 2.7.8
252
+ rubygems_version: 2.7.7
253
253
  signing_key:
254
254
  specification_version: 4
255
255
  summary: Ruby bindings for the Stripe API
@@ -271,7 +271,7 @@ test_files:
271
271
  - test/stripe/balance_test.rb
272
272
  - test/stripe/bank_account_test.rb
273
273
  - test/stripe/charge_test.rb
274
- - test/stripe/checkout_session_test.rb
274
+ - test/stripe/checkout/session_test.rb
275
275
  - test/stripe/country_spec_test.rb
276
276
  - test/stripe/coupon_test.rb
277
277
  - test/stripe/customer_card_test.rb
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Stripe
4
- class CheckoutSession < APIResource
5
- extend Stripe::APIOperations::Create
6
-
7
- OBJECT_NAME = "checkout_session".freeze
8
- end
9
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require ::File.expand_path("../../test_helper", __FILE__)
4
-
5
- module Stripe
6
- class CheckoutSessionTest < Test::Unit::TestCase
7
- should "be creatable" do
8
- session = Stripe::CheckoutSession.create(
9
- allowed_source_types: ["card"],
10
- cancel_url: "https://stripe.com/cancel",
11
- client_reference_id: "1234",
12
- line_items: [
13
- {
14
- amount: 123,
15
- currency: "usd",
16
- description: "item 1",
17
- images: [
18
- "https://stripe.com/img1",
19
- ],
20
- name: "name",
21
- quantity: 2,
22
- },
23
- ],
24
- payment_intent_data: [
25
- receipt_email: "test@stripe.com",
26
- ],
27
- success_url: "https://stripe.com/success"
28
- )
29
- assert_requested :post, "#{Stripe.api_base}/v1/checkout_sessions"
30
- assert session.is_a?(Stripe::CheckoutSession)
31
- end
32
- end
33
- end