- 1 :
- 2 :
- 3 :
(function(root, factory) {
- 4 :
- 5 :
if (typeof module === 'object' && module.exports) {
- 6 :
// CommonJS-like environments that support module.exports, like Node.
- 7 :
module.exports = factory(require('../ApiClient'), require('./InvocationContext'), require('../CommonUtil'), require('../ResponseWrapper'), require('./Base')
- 8 :
, require('../handlers/RetrieveFundingAccountsHandler')
- 9 :
, require('../handlers/RetrieveFundingAccountsPageHandler'), require('../OrbipayApiError'));
- 10 :
}
- 11 :
}(this, function(ApiClient, InvocationContext, CommonUtil, ResponseWrapper, Base, RetrieveFundingAccountsHandler, RetrieveFundingAccountsPageHandler, OrbipayApiError) {
- 12 :
'use strict';
- 13 :
- 14 :
/**
- 15 :
* The FundingAccounts wrapper module.
- 16 :
* @module wrappers/FundingAccounts
- 17 :
*/
- 18 :
var exports = function() {
- 19 :
- 20 :
};
- 21 :
exports.constructFromObject = function (data, obj) {
- 22 :
if (data) {
- 23 :
obj = obj || new exports();
- 24 :
if (data.hasOwnProperty('list')) {
- 25 :
var FundingAccount = require('./FundingAccount');
- 26 :
obj['list'] = ApiClient.convertToType(data['list'], [FundingAccount]);
- 27 :
}
- 28 :
if (data.hasOwnProperty('total_results_count')) {
- 29 :
obj['total_results_count'] = data['total_results_count'];
- 30 :
}
- 31 :
if (data.hasOwnProperty('has_more_results')) {
- 32 :
obj['has_more_results'] = data['has_more_results'];
- 33 :
}
- 34 :
if (data.hasOwnProperty('url')) {
- 35 :
obj['url'] = data['url'];
- 36 :
}
- 37 :
if (data.hasOwnProperty('from_index')) {
- 38 :
obj['from_index'] = data['from_index'];
- 39 :
}
- 40 :
if (data.hasOwnProperty('to_index')) {
- 41 :
obj['to_index'] = data['to_index'];
- 42 :
}
- 43 :
if (data.hasOwnProperty('query_id')) {
- 44 :
obj['query_id'] = data['query_id'];
- 45 :
}
- 46 :
if (data.hasOwnProperty('ID_CUSTOMER')) {
- 47 :
obj['ID_CUSTOMER'] = data['ID_CUSTOMER'];
- 48 :
}
- 49 :
if (data.hasOwnProperty('page_size')) {
- 50 :
obj['page_size'] = data['page_size'];
- 51 :
}
- 52 :
if (data.hasOwnProperty('account_number')) {
- 53 :
obj['account_number'] = data['account_number'];
- 54 :
}
- 55 :
if (data.hasOwnProperty('status')) {
- 56 :
obj['status'] = data['status'];
- 57 :
}
- 58 :
if (data.hasOwnProperty('aba_routing_number')) {
- 59 :
obj['aba_routing_number'] = data['aba_routing_number'];
- 60 :
}
- 61 :
if (data.hasOwnProperty('account_type')) {
- 62 :
obj['account_type'] = data['account_type'];
- 63 :
}
- 64 :
if (data.hasOwnProperty('account_subtype')) {
- 65 :
obj['account_subtype'] = data['account_subtype'];
- 66 :
}
- 67 :
}
- 68 :
return obj;
- 69 :
};
- 70 :
- 71 :
- 72 :
exports.prototype = Object.create(Base.prototype);
- 73 :
exports.prototype.constructor = exports;
- 74 :
- 75 :
/**
- 76 :
* @member [FundingAccount] list
- 77 :
*/
- 78 :
exports.prototype['list'] = undefined;
- 79 :
/**
- 80 :
* The total number of funding accounts of the customer matching the search criteria.
- 81 :
* @member {String} total_results_count
- 82 :
*/
- 83 :
exports.prototype['total_results_count'] = undefined;
- 84 :
/**
- 85 :
* true if there are more results or pages
- 86 :
* @member {String} has_more_results
- 87 :
*/
- 88 :
exports.prototype['has_more_results'] = undefined;
- 89 :
/**
- 90 :
* This URL fetches the next or previous set of funding accounts, based on the presence of after_object or before_object parameter.
- 91 :
* @member {String} url
- 92 :
*/
- 93 :
exports.prototype['url'] = undefined;
- 94 :
/**
- 95 :
* The id of the object before which the previous set of objects are to be retrieved.
- 96 :
* @member {String} from_index
- 97 :
*/
- 98 :
exports.prototype['from_index'] = undefined;
- 99 :
/**
- 100 :
* The id of the object after which the next set of objects are to be retrieved.
- 101 :
* @member {String} to_index
- 102 :
*/
- 103 :
exports.prototype['to_index'] = undefined;
- 104 :
/**
- 105 :
* The query id of the object.
- 106 :
* @member {String} query_id
- 107 :
*/
- 108 :
exports.prototype['query_id'] = undefined;
- 109 :
/**
- 110 :
* The unique identifier assigned by EBPP to the customer.
- 111 :
* @member {String} ID_CUSTOMER
- 112 :
*/
- 113 :
exports.prototype['ID_CUSTOMER'] = undefined;
- 114 :
/**
- 115 :
* The maximum number of objects returned in the query.
- 116 :
* @member {String} page_size
- 117 :
*/
- 118 :
exports.prototype['page_size'] = undefined;
- 119 :
/**
- 120 :
* The Account Number to get details of.
- 121 :
* @member {String} account_number
- 122 :
*/
- 123 :
exports.prototype['account_number'] = undefined;
- 124 :
/**
- 125 :
* The status of the funding account in EBPP. This can take multiple values in the format key=value1&key=value2....
- 126 :
* @member [String] status
- 127 :
*/
- 128 :
exports.prototype['status'] = undefined;
- 129 :
/**
- 130 :
* The ABA/Routing number for the bank account.
- 131 :
* @member {String} aba_routing_number
- 132 :
*/
- 133 :
exports.prototype['aba_routing_number'] = undefined;
- 134 :
/**
- 135 :
* The type of the funding account. This can take multiple values in the format key=value1&key=value2....
- 136 :
* @member [String] account_type
- 137 :
*/
- 138 :
exports.prototype['account_type'] = undefined;
- 139 :
/**
- 140 :
* The sub type of the funding account. This is derived by EBPP in the case of card funding accounts. It needs to be passed when adding or editing a DDA/bank account.
- 141 :
* @member {String} account_subtype
- 142 :
*/
- 143 :
exports.prototype['account_subtype'] = undefined;
- 144 :
- 145 :
/**
- 146 :
* @param {String} client_key - The client_key of FundingAccounts.
- 147 :
* @return {module:wrappers/FundingAccounts} The instance of <code>FundingAccounts</code>.
- 148 :
*/
- 149 :
exports.prototype.forClient = function (client_key) {
- 150 :
var _this = this;
- 151 :
Base.prototype.forClient.call(_this,client_key);
- 152 :
return _this;
- 153 :
};
- 154 :
/**
- 155 :
* @param {String} channel - The channel of FundingAccounts.
- 156 :
* @return {module:wrappers/FundingAccounts} The instance of <code>FundingAccounts</code>.
- 157 :
*/
- 158 :
exports.prototype.videChannel = function (channel) {
- 159 :
var _this = this;
- 160 :
Base.prototype.videChannel.call(_this,channel);
- 161 :
return _this;
- 162 :
};
- 163 :
/**
- 164 :
* @param {String} aba_routing_number - The aba_routing_number of FundingAccounts.
- 165 :
* @param [String] account_type - The account_type of FundingAccounts.
- 166 :
* @param {String} account_subtype - The account_subtype of FundingAccounts.
- 167 :
* @param {String} account_number - The account_number of FundingAccounts.
- 168 :
* @param [String] status - The status of FundingAccounts.
- 169 :
* @param {String} page_size - The page_size of FundingAccounts.
- 170 :
* @param {String} query_id - The query_id of FundingAccounts.
- 171 :
* @param {String} from_index - The from_index of FundingAccounts.
- 172 :
* @param {String} to_index - The to_index of FundingAccounts.
- 173 :
* @return {module:wrappers/FundingAccounts} The instance of <code>FundingAccounts</code>.
- 174 :
*/
- 175 :
exports.prototype.findBy = function (filterParameters) {
- 176 :
var _this = this;
- 177 :
if(filterParameters){
- 178 :
- 179 :
_this['aba_routing_number'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'aba_routing_number', false);
- 180 :
_this['account_type'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'account_type', true);
- 181 :
- 182 :
- 183 :
_this['account_subtype'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'account_subtype', false);
- 184 :
- 185 :
_this['account_number'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'account_number', false);
- 186 :
_this['status'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'status', true);
- 187 :
- 188 :
- 189 :
_this['page_size'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'page_size', false);
- 190 :
- 191 :
_this['query_id'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'query_id', false);
- 192 :
- 193 :
_this['from_index'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'from_index', false);
- 194 :
- 195 :
_this['to_index'] = CommonUtil.getValuesFromMultiMap(filterParameters, 'to_index', false);
- 196 :
}
- 197 :
return _this;
- 198 :
};
- 199 :
/**
- 200 :
* @param {String} ID_CUSTOMER - The ID_CUSTOMER of FundingAccounts.
- 201 :
* @return {module:wrappers/FundingAccounts} The instance of <code>FundingAccounts</code>.
- 202 :
*/
- 203 :
exports.prototype.forCustomer = function (id_customer) {
- 204 :
var _this = this;
- 205 :
- 206 :
_this['ID_CUSTOMER'] = id_customer;
- 207 :
- 208 :
- 209 :
return _this;
- 210 :
};
- 211 :
- 212 :
exports.prototype.retrievedBy = function (requestor, requestor_type) {
- 213 :
var _this = this;
- 214 :
_this.requestedBy(requestor, requestor_type);
- 215 :
return _this;
- 216 :
};
- 217 :
- 218 :
exports.prototype.get = function (invocation_context, callback, live_mode, api_end_point) {
- 219 :
var _this = this;
- 220 :
var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
- 221 :
try {
- 222 :
var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
- 223 :
if (callback) {
- 224 :
callback(response['exception'], response['data'])
- 225 :
}
- 226 :
} catch (e) {
- 227 :
exception = OrbipayApiError.getDefaultException(e);
- 228 :
if (callback) {
- 229 :
callback(exception)
- 230 :
}
- 231 :
}
- 232 :
};
- 233 :
try {
- 234 :
_this.withContext(invocation_context, live_mode, api_end_point);
- 235 :
var handler = new RetrieveFundingAccountsHandler();
- 236 :
if (callback && CommonUtil.isFunction(callback)) {
- 237 :
return handler.process(_this, internalCallback);
- 238 :
} else {
- 239 :
return handler.process(_this);
- 240 :
}
- 241 :
}
- 242 :
catch (e){
- 243 :
var error = OrbipayApiError.getDefaultException(e);
- 244 :
if (callback) {
- 245 :
callback(error)
- 246 :
}
- 247 :
}
- 248 :
};
- 249 :
exports.prototype.getPage = function (invocation_context, callback, live_mode, api_end_point) {
- 250 :
var _this = this;
- 251 :
var internalCallback = function (errorMessage, parsedData, httpResponse, exception) {
- 252 :
try {
- 253 :
var response = ResponseWrapper.wrapResponse(exports, exception, errorMessage, parsedData, httpResponse);
- 254 :
if (callback) {
- 255 :
callback(response['exception'], response['data'])
- 256 :
}
- 257 :
} catch (e) {
- 258 :
exception = OrbipayApiError.getDefaultException(e);
- 259 :
if (callback) {
- 260 :
callback(exception)
- 261 :
}
- 262 :
}
- 263 :
};
- 264 :
try {
- 265 :
_this.withContext(invocation_context, live_mode, api_end_point);
- 266 :
var handler = new RetrieveFundingAccountsPageHandler();
- 267 :
if (callback && CommonUtil.isFunction(callback)) {
- 268 :
return handler.process(_this, internalCallback);
- 269 :
} else {
- 270 :
return handler.process(_this);
- 271 :
}
- 272 :
}
- 273 :
catch (e){
- 274 :
var error = OrbipayApiError.getDefaultException(e);
- 275 :
if (callback) {
- 276 :
callback(error)
- 277 :
}
- 278 :
}
- 279 :
};
- 280 :
- 281 :
return exports;
- 282 :
- 283 :
}));