Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move CheckoutSession to the Checkout namespace and rename to Session #735

Merged
merged 1 commit into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sudo: false
env:
global:
# If changing this number, please also change it in `test/test_helper.rb`.
- STRIPE_MOCK_VERSION=0.40.1
- STRIPE_MOCK_VERSION=0.42.0

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion lib/stripe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
require "stripe/bitcoin_transaction"
require "stripe/card"
require "stripe/charge"
require "stripe/checkout_session"
require "stripe/checkout/session"
require "stripe/country_spec"
require "stripe/coupon"
require "stripe/customer"
Expand Down
11 changes: 11 additions & 0 deletions lib/stripe/checkout/session.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Stripe
module Checkout
class Session < Stripe::APIResource
extend Stripe::APIOperations::Create

OBJECT_NAME = "checkout.session".freeze
end
end
end
9 changes: 0 additions & 9 deletions lib/stripe/checkout_session.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/stripe/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def self.object_classes # rubocop:disable Metrics/MethodLength
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
Card::OBJECT_NAME => Card,
Charge::OBJECT_NAME => Charge,
CheckoutSession::OBJECT_NAME => CheckoutSession,
Checkout::Session::OBJECT_NAME => Checkout::Session,
CountrySpec::OBJECT_NAME => CountrySpec,
Coupon::OBJECT_NAME => Coupon,
Customer::OBJECT_NAME => Customer,
Expand Down
35 changes: 35 additions & 0 deletions test/stripe/checkout/session_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# frozen_string_literal: true

require ::File.expand_path("../../../test_helper", __FILE__)

module Stripe
module Checkout
class SessionTest < Test::Unit::TestCase
should "be creatable" do
session = Stripe::Checkout::Session.create(
allowed_source_types: ["card"],
cancel_url: "https://stripe.com/cancel",
client_reference_id: "1234",
line_items: [
{
amount: 123,
currency: "usd",
description: "item 1",
images: [
"https://stripe.com/img1",
],
name: "name",
quantity: 2,
},
],
payment_intent_data: [
receipt_email: "[email protected]",
],
success_url: "https://stripe.com/success"
)
assert_requested :post, "#{Stripe.api_base}/v1/checkout/sessions"
assert session.is_a?(Stripe::Checkout::Session)
end
end
end
end
33 changes: 0 additions & 33 deletions test/stripe/checkout_session_test.rb

This file was deleted.

2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
require ::File.expand_path("../stripe_mock", __FILE__)

# If changing this number, please also change it in `.travis.yml`.
MOCK_MINIMUM_VERSION = "0.40.1".freeze
MOCK_MINIMUM_VERSION = "0.42.0".freeze
MOCK_PORT = Stripe::StripeMock.start

# Disable all real network connections except those that are outgoing to
Expand Down