From 420f206bdea9a732d95d14403acec65e77934070 Mon Sep 17 00:00:00 2001 From: Olivier Bellone Date: Tue, 7 May 2019 12:51:14 -0700 Subject: [PATCH] Add BalanceTransactions resource --- lib/resources/BalanceTransactions.js | 6 +++++ lib/stripe.js | 1 + test/resources/BalanceTransactions.spec.js | 30 ++++++++++++++++++++++ 3 files changed, 37 insertions(+) create mode 100644 lib/resources/BalanceTransactions.js create mode 100644 test/resources/BalanceTransactions.spec.js diff --git a/lib/resources/BalanceTransactions.js b/lib/resources/BalanceTransactions.js new file mode 100644 index 0000000000..c8095d4bdf --- /dev/null +++ b/lib/resources/BalanceTransactions.js @@ -0,0 +1,6 @@ +'use strict'; + +module.exports = require('../StripeResource').extend({ + path: 'balance/history', + includeBasic: ['list', 'retrieve'], +}); diff --git a/lib/stripe.js b/lib/stripe.js index 70a741a431..fa5d96f51b 100644 --- a/lib/stripe.js +++ b/lib/stripe.js @@ -39,6 +39,7 @@ var resources = { ApplePayDomains: require('./resources/ApplePayDomains'), ApplicationFees: require('./resources/ApplicationFees'), Balance: require('./resources/Balance'), + BalanceTransactions: require('./resources/BalanceTransactions'), BitcoinReceivers: require('./resources/BitcoinReceivers'), Charges: require('./resources/Charges'), CountrySpecs: require('./resources/CountrySpecs'), diff --git a/test/resources/BalanceTransactions.spec.js b/test/resources/BalanceTransactions.spec.js new file mode 100644 index 0000000000..72ede8ccdd --- /dev/null +++ b/test/resources/BalanceTransactions.spec.js @@ -0,0 +1,30 @@ +'use strict'; + +var stripe = require('../../testUtils').getSpyableStripe(); +var expect = require('chai').expect; + +describe('BalanceTransactions Resource', function() { + describe('retrieve', function() { + it('Sends the correct request', function() { + stripe.balanceTransactions.retrieve('txn_123'); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/balance/history/txn_123', + headers: {}, + data: {}, + }); + }); + }); + + describe('list', function() { + it('Sends the correct request', function() { + stripe.balanceTransactions.list(); + expect(stripe.LAST_REQUEST).to.deep.equal({ + method: 'GET', + url: '/v1/balance/history', + headers: {}, + data: {}, + }); + }); + }); +});