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