-
Notifications
You must be signed in to change notification settings - Fork 765
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #498 from stripe/daz-terminal-bindings
Bindings for Terminal endpoints
- Loading branch information
Showing
7 changed files
with
198 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 'terminal/connection_tokens', | ||
includeBasic: ['create'], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 'terminal/locations', | ||
includeBasic: ['create', 'list', 'retrieve', 'update'], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 'terminal/readers', | ||
includeBasic: ['create', 'list', 'retrieve', 'update'], | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../../testUtils').getSpyableStripe(); | ||
|
||
var expect = require('chai').expect; | ||
|
||
describe('Terminal', function() { | ||
describe('ConnectionToken Resource', function () { | ||
describe('create', function() { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.connectionTokens.create({}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/terminal/connection_tokens', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../../testUtils').getSpyableStripe(); | ||
|
||
var expect = require('chai').expect; | ||
|
||
describe('Terminal', function () { | ||
describe('Locations Resource', function () { | ||
describe('retrieve', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.locations.retrieve('loc_123'); | ||
|
||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/terminal/locations/loc_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('create', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.locations.create({ | ||
display_name: 'name', | ||
address: { | ||
line1: 'line1', | ||
country: 'US', | ||
postal_code: '12345', | ||
state: 'CA', | ||
city: 'San Francisco', | ||
}, | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/terminal/locations', | ||
headers: {}, | ||
data: { | ||
display_name: 'name', | ||
address: { | ||
line1: 'line1', | ||
country: 'US', | ||
postal_code: '12345', | ||
state: 'CA', | ||
city: 'San Francisco', | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.locations.update('loc_123', { | ||
display_name: 'name' | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/terminal/locations/loc_123', | ||
headers: {}, | ||
data: { | ||
display_name: 'name', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.locations.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/terminal/locations', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
'use strict'; | ||
|
||
var stripe = require('../../testUtils').getSpyableStripe(); | ||
|
||
var expect = require('chai').expect; | ||
|
||
describe('Terminal', function () { | ||
describe('Readers Resource', function () { | ||
describe('retrieve', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.readers.retrieve('rdr_123'); | ||
|
||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/terminal/readers/rdr_123', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('create', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.readers.create({ | ||
registration_code: 'a-b-c', | ||
label: 'name', | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/terminal/readers', | ||
headers: {}, | ||
data: { | ||
registration_code: 'a-b-c', | ||
label: 'name', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('update', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.readers.update('rdr_123', { | ||
label: 'name' | ||
}); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'POST', | ||
url: '/v1/terminal/readers/rdr_123', | ||
headers: {}, | ||
data: { | ||
label: 'name', | ||
}, | ||
}); | ||
}); | ||
}); | ||
|
||
describe('list', function () { | ||
it('Sends the correct request', function () { | ||
stripe.terminal.readers.list(); | ||
expect(stripe.LAST_REQUEST).to.deep.equal({ | ||
method: 'GET', | ||
url: '/v1/terminal/readers', | ||
headers: {}, | ||
data: {}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |