diff --git a/lib/ClientBase.js b/lib/ClientBase.js index ff6fdcd..088e023 100644 --- a/lib/ClientBase.js +++ b/lib/ClientBase.js @@ -9,6 +9,7 @@ var request = require('request'), Checkout = require('./model/Checkout'), Deposit = require('./model/Deposit'), Merchant = require('./model/Merchant'), + Notification = require('./model/Notification'), Order = require('./model/Order'), PaymentMethod = require('./model/PaymentMethod'), Sell = require('./model/Sell'), @@ -31,6 +32,7 @@ var MODELS = { 'checkout' : Checkout, 'deposit' : Deposit, 'merchant' : Merchant, + 'notification' : Notification, 'order' : Order, 'payment_method' : PaymentMethod, 'sell' : Sell, @@ -245,10 +247,13 @@ ClientBase.prototype._getAllHttp = function(opts, callback, headers) { this._getHttp(path, args, function onGet(err, result) { if (!handleError(err, result, callback)) { - var ObjFunc = self._stringToClass(result.data[0].resource); - var objs = _.map(result.data, function onMap(obj) { - return new ObjFunc(self, obj); - }); + var objs = []; + if (result.data.length !== 0) { + var ObjFunc = self._stringToClass(result.data[0].resource); + objs = _.map(result.data, function onMap(obj) { + return new ObjFunc(self, obj); + }); + } callback(null, objs, result.pagination); } }, headers);