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