diff --git a/src/token.ts b/src/token.ts index fc9ab94..6cd1f52 100644 --- a/src/token.ts +++ b/src/token.ts @@ -18,4 +18,8 @@ export default class Tokens extends Resource { return this.request('GET', `${this.resource}/${id}`); } + tds_finish(id: string): Promise { + return this.request('POST', `${this.resource}/${id}/tds_finish`); + } + } diff --git a/test/token.spec.js b/test/token.spec.js index 869ae2e..72a8d39 100644 --- a/test/token.spec.js +++ b/test/token.spec.js @@ -28,4 +28,13 @@ describe('Tokens Resource', () => { }); }); + describe('tds_finish', () => { + it('Sends the correct request', () => { + return payjp.tokens.tds_finish('id123').then(([_method, _endpoint]) => { + assert(_method === 'POST'); + assert(_endpoint === 'tokens/id123/tds_finish'); + }); + }); + }); + });