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