Skip to content

Commit

Permalink
Merge pull request #524 from stripe/remi-fix-checkout-sessions
Browse files Browse the repository at this point in the history
Move CheckoutSession to the Checkout namespace and rename to Session
  • Loading branch information
remi-stripe authored Jan 23, 2019
2 parents 95716e6 + 5e2745a commit e424cbf
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ cache:
env:
global:
# If changing this number, please also change it in `tests/conftest.py`.
- STRIPE_MOCK_VERSION=0.40.0
- STRIPE_MOCK_VERSION=0.42.0

before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
Expand Down
1 change: 1 addition & 0 deletions stripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

# API resources
from stripe.api_resources import * # noqa
from stripe.api_resources import checkout # noqa
from stripe.api_resources import issuing # noqa
from stripe.api_resources import radar # noqa
from stripe.api_resources import reporting # noqa
Expand Down
1 change: 0 additions & 1 deletion stripe/api_resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from stripe.api_resources.bitcoin_transaction import BitcoinTransaction
from stripe.api_resources.card import Card
from stripe.api_resources.charge import Charge
from stripe.api_resources.checkout_session import CheckoutSession
from stripe.api_resources.country_spec import CountrySpec
from stripe.api_resources.coupon import Coupon
from stripe.api_resources.customer import Customer
Expand Down
5 changes: 5 additions & 0 deletions stripe/api_resources/checkout/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from __future__ import absolute_import, division, print_function

# flake8: noqa

from stripe.api_resources.checkout.session import Session
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
from stripe.api_resources.abstract import CreateableAPIResource


class CheckoutSession(CreateableAPIResource):
OBJECT_NAME = "checkout_session"
class Session(CreateableAPIResource):
OBJECT_NAME = "checkout.session"
2 changes: 1 addition & 1 deletion stripe/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def load_object_classes():
api_resources.BitcoinTransaction.OBJECT_NAME: api_resources.BitcoinTransaction,
api_resources.Card.OBJECT_NAME: api_resources.Card,
api_resources.Charge.OBJECT_NAME: api_resources.Charge,
api_resources.CheckoutSession.OBJECT_NAME: api_resources.CheckoutSession,
api_resources.checkout.Session.OBJECT_NAME: api_resources.checkout.Session,
api_resources.CountrySpec.OBJECT_NAME: api_resources.CountrySpec,
api_resources.Coupon.OBJECT_NAME: api_resources.Coupon,
api_resources.Customer.OBJECT_NAME: api_resources.Customer,
Expand Down
2 changes: 1 addition & 1 deletion stripe/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '2.18.1'
VERSION = "2.18.1"
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
import stripe


class TestCheckoutSession(object):
TEST_RESOURCE_ID = "loc_123"


class TestSession(object):
def test_is_creatable(self, request_mock):
resource = stripe.CheckoutSession.create(
resource = stripe.checkout.Session.create(
allowed_source_types=["card"],
cancel_url="https://stripe.com/cancel",
client_reference_id="1234",
Expand All @@ -22,5 +25,5 @@ def test_is_creatable(self, request_mock):
payment_intent_data={"receipt_email": "test@stripe.com"},
success_url="https://stripe.com/success",
)
request_mock.assert_requested("post", "/v1/checkout_sessions")
assert isinstance(resource, stripe.CheckoutSession)
request_mock.assert_requested("post", "/v1/checkout/sessions")
assert isinstance(resource, stripe.checkout.Session)
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


# When changing this number, don't forget to change it in `.travis.yml` too.
MOCK_MINIMUM_VERSION = "0.40.0"
MOCK_MINIMUM_VERSION = "0.42.0"

# Starts stripe-mock if an OpenAPI spec override is found in `openapi/`, and
# otherwise fall back to `STRIPE_MOCK_PORT` or 12111.
Expand Down

0 comments on commit e424cbf

Please sign in to comment.