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 +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +1 -1
- data/lib/stripe/checkout/session.rb +11 -0
- data/lib/stripe/util.rb +1 -1
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/checkout/session_test.rb +35 -0
- data/test/stripe_mock.rb +13 -14
- data/test/test_helper.rb +1 -1
- metadata +6 -6
- data/lib/stripe/checkout_session.rb +0 -9
- data/test/stripe/checkout_session_test.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b17c2d9db8be7ccd4a37eb6ad3b17ab7ee1ec20610b390953f0735547c5dc81
|
4
|
+
data.tar.gz: c38f3a4b02c97cbe2f2f9121e1c50fd2bcbe0abd760f7509fbdd48a19d544b37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03b19f6e689b28d628b043fa2afadbcb77a22c762062a41537563cb3abc9b5cb037c7b4ee58ac64bd34bef9fcef1f466abe00a47002b8d10b95643c9c9880ad7
|
7
|
+
data.tar.gz: d363f4dd535118bf0759e24efd5c7124fd0c633bfcd83deb5b704e5cbeba3ba8c0d910a14ed35c5206b83cec4751daa5decb6c518ed781703539b07562ce840b
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -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.
|
1
|
+
4.7.0
|
data/lib/stripe.rb
CHANGED
@@ -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/
|
52
|
+
require "stripe/checkout/session"
|
53
53
|
require "stripe/country_spec"
|
54
54
|
require "stripe/coupon"
|
55
55
|
require "stripe/customer"
|
data/lib/stripe/util.rb
CHANGED
@@ -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
|
-
|
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,
|
data/lib/stripe/version.rb
CHANGED
@@ -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
|
data/test/stripe_mock.rb
CHANGED
@@ -23,9 +23,7 @@ module Stripe
|
|
23
23
|
return @port
|
24
24
|
end
|
25
25
|
|
26
|
-
|
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
|
-
|
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
|
-
|
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
|
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
|
data/test/test_helper.rb
CHANGED
@@ -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.
|
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.
|
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-
|
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/
|
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/
|
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.
|
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/
|
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,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
|