Skip to content

Commit

Permalink
Merge pull request #54 from payjp/nonz250/add-balance-statement-urls
Browse files Browse the repository at this point in the history
update: add statement url to balance object.
  • Loading branch information
nonz250 committed May 14, 2024
2 parents f623570 + 80890fd commit 7602c10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "payjp",
"version": "2.2.0",
"version": "2.2.1",
"description": "PAY.JP node.js bindings",
"main": "built/index.js",
"types": "built/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions src/balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ export default class Balances extends Resource {
retrieve(id: string): Promise<I.Balance> {
return this.request('GET', `${this.resource}/${id}`);
}

statementUrls(id: string, query: I.StatementUrlOptions = {}): Promise<I.StatementUrl> {
return this.request('POST', `${this.resource}/${id}/statement_urls`, query);
}
}
11 changes: 11 additions & 0 deletions test/balance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,15 @@ describe('Balance Resource', () => {
});
});
});

describe('statementUrls', () => {
it('Sends the correct request', () => {
const query = {platformer: false};
return payjp.balances.statementUrls('id123', query).then(([_method, _endpoint, _query]) => {
assert(_method === 'POST');
assert(_endpoint === 'balances/id123/statement_urls');
assert.deepStrictEqual(_query, query);
});
});
});
});

0 comments on commit 7602c10

Please sign in to comment.