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