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 #551

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
8 changes: 8 additions & 0 deletions lib/resources/Checkout/Sessions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

var StripeResource = require('../../StripeResource');

module.exports = StripeResource.extend({
path: 'checkout/sessions',
includeBasic: ['create'],
})
7 changes: 0 additions & 7 deletions lib/resources/CheckoutSessions.js

This file was deleted.

4 changes: 3 additions & 1 deletion lib/stripe.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var resources = {
Balance: require('./resources/Balance'),
BitcoinReceivers: require('./resources/BitcoinReceivers'),
Charges: require('./resources/Charges'),
CheckoutSessions: require('./resources/CheckoutSessions'),
CountrySpecs: require('./resources/CountrySpecs'),
Coupons: require('./resources/Coupons'),
Customers: require('./resources/Customers'),
Expand Down Expand Up @@ -83,6 +82,9 @@ var resources = {
TransferReversals: require('./resources/TransferReversals'),

// Namespaced resources
Checkout: resourceNamespace('checkout', {
Sessions: require('./resources/Checkout/Sessions'),
}),
Issuing: resourceNamespace('issuing', {
Authorizations: require('./resources/Issuing/Authorizations'),
Cardholders: require('./resources/Issuing/Cardholders'),
Expand Down
62 changes: 62 additions & 0 deletions test/resources/Checkout/Sessions.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
'use strict';

var stripe = require('../../../testUtils').getSpyableStripe();

var expect = require('chai').expect;

describe('Checkout', function () {
describe('Sessions Resource', function () {
describe('create', function() {
it('Sends the correct request', function() {
stripe.checkout.sessions.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: 'test@stripe.com',
},
success_url: 'https://stripe.com/success',
});

expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/checkout/sessions',
headers: {},
data: {
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: 'test@stripe.com',
},
success_url: 'https://stripe.com/success',
},
});
});
});
});
});
59 changes: 0 additions & 59 deletions test/resources/CheckoutSessions.spec.js

This file was deleted.