(function(root, factory) {
  if (typeof define === 'function' && define.amd) {
    // AMD. Register as an anonymous module.
    define(['ApiClient', 'models/DeleteRecordedPaymentRequest', 'models/ErrorResponseVo', 'models/GetRecordedPaymentResponse', 'models/RecordPaymentRequest', 'models/RecordedPaymentResponse', 'models/RecordedPaymentsResponse'], factory);
  } else if (typeof module === 'object' && module.exports) {
    // CommonJS-like environments that support module.exports, like Node.
    module.exports = factory(require('../ApiClient'), require('../models/DeleteRecordedPaymentRequest'), require('../models/ErrorResponseVo'), require('../models/GetRecordedPaymentResponse'), require('../models/RecordPaymentRequest'), require('../models/RecordedPaymentResponse'), require('../models/RecordedPaymentsResponse'));
  } else {
    // Browser globals (root is window)
    if (!root.OrbipayPaymentsapiClient) {
      root.OrbipayPaymentsapiClient = {};
    }
    root.OrbipayPaymentsapiClient.RecordedPaymentApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.DeleteRecordedPaymentRequest, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.GetRecordedPaymentResponse, root.OrbipayPaymentsapiClient.RecordPaymentRequest, root.OrbipayPaymentsapiClient.RecordedPaymentResponse, root.OrbipayPaymentsapiClient.RecordedPaymentsResponse);
  }
}(this, function(ApiClient, DeleteRecordedPaymentRequest, ErrorResponseVo, GetRecordedPaymentResponse, RecordPaymentRequest, RecordedPaymentResponse, RecordedPaymentsResponse) {
  'use strict';

  /**
   * RecordedPayment service.
   * @module api/RecordedPaymentApi
   */

  /**
   * <h3 style="color:red"> This class subject to change without prior notice, Please dont use this class directly. </h3>

   * Constructs a new RecordedPaymentApi. 
   * @alias module:api/RecordedPaymentApi
   * @class
   * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
   * default to {@link module:ApiClient#instance} if unspecified.
   */
  var exports = function(apiClient) {
    this.apiClient = apiClient || ApiClient.instance;


    /**
     * Callback function to receive the result of the deleteRecordPayment operation.
     * @callback module:api/RecordedPaymentApi~deleteRecordPaymentCallback
     * @param {String} error Error message, if any.
     * @param data This operation does not return a value.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Delete Recorded Payment
     * The API is used to delete the recorded payment. It returns 204 http status code with empty body in successful case
     * @param {String} channel The channel through which the API is invoked.
     * @param {String} client_key The unique identifier assigned by EBPP to the client.
     * @param {module:models/String} product The product identifier corresponding to the API.
     * @param {String} timestamp The timestamp for the moment when the API request is created.
     * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
     * @param {module:models/String} requestor_type Type of the requestor of the API.
     * @param {String} id_payment The unique identifier assigned by EBPP to the payment.
     * @param {module:models/DeleteRecordedPaymentRequest} delete_recorded_payment_request Details of payment to be deleted/cancelled
     * @param {Object} opts Optional parameters
     * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
     * @param {String} opts.x_opay_headers Intended for the future use.
     * @param {module:api/RecordedPaymentApi~deleteRecordPaymentCallback} callback The callback function, accepting three arguments: error, data, response
     */
    this.deleteRecordPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, delete_recorded_payment_request, opts, callback) {
      opts = opts || {};
      var postBody = delete_recorded_payment_request;

      var pathParams = {
        'ID_PAYMENT': id_payment
      };
      var queryParams = {
      };
      var headerParams = {
        'channel': channel,
        'client_key': client_key,
        'product': product,
        'timestamp': timestamp,
        'idempotent_request_key': idempotent_request_key,
        'requestor_type': requestor_type,
        'requestor': opts['requestor'],
        'X-OPAY-Headers': opts['x_opay_headers']
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = null;

      return this.apiClient.callApi(
        '/recordedpayments/{ID_PAYMENT}', 'DELETE',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    };

    /**
     * Callback function to receive the result of the getRecordPayment operation.
     * @callback module:api/RecordedPaymentApi~getRecordPaymentCallback
     * @param {String} error Error message, if any.
     * @param {module:models/GetRecordedPaymentResponse} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Get Recorded Payment
     * The API is used to retrieve the details of a payment by id.
     * @param {String} channel The channel through which the API is invoked.
     * @param {String} client_key The unique identifier assigned by EBPP to the client.
     * @param {module:models/String} product The product identifier corresponding to the API.
     * @param {String} timestamp The timestamp for the moment when the API request is created.
     * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
     * @param {module:models/String} requestor_type Type of the requestor of the API.
     * @param {String} id_payment The unique identifier assigned by EBPP to the payment.
     * @param {Object} opts Optional parameters
     * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
     * @param {String} opts.x_opay_headers Intended for the future use.
     * @param {module:api/RecordedPaymentApi~getRecordPaymentCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link module:models/GetRecordedPaymentResponse}
     */
    this.getRecordPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, opts, callback) {
      opts = opts || {};
      var postBody = null;

      var pathParams = {
        'ID_PAYMENT': id_payment
      };
      var queryParams = {
      };
      var headerParams = {
        'channel': channel,
        'client_key': client_key,
        'product': product,
        'timestamp': timestamp,
        'idempotent_request_key': idempotent_request_key,
        'requestor_type': requestor_type,
        'requestor': opts['requestor'],
        'X-OPAY-Headers': opts['x_opay_headers']
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = ['application/json'];
      var returnType = GetRecordedPaymentResponse;

      return this.apiClient.callApi(
        '/recordedpayments/{ID_PAYMENT}', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    };

    /**
     * Callback function to receive the result of the recordPayment operation.
     * @callback module:api/RecordedPaymentApi~recordPaymentCallback
     * @param {String} error Error message, if any.
     * @param {module:models/RecordedPaymentResponse} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Record Payment
     * The API is used to record payments in EBPP those are made and fulfilled outside EBPP.
     * @param {String} channel The channel through which the API is invoked.
     * @param {String} client_key The unique identifier assigned by EBPP to the client.
     * @param {module:models/String} product The product identifier corresponding to the API.
     * @param {String} timestamp The timestamp for the moment when the API request is created.
     * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
     * @param {module:models/String} requestor_type Type of the requestor of the API.
     * @param {module:models/RecordPaymentRequest} record_payment_request JSON containing all the fields required to record a payment.
     * @param {Object} opts Optional parameters
     * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
     * @param {String} opts.x_opay_headers Intended for the future use.
     * @param {module:api/RecordedPaymentApi~recordPaymentCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link module:models/RecordedPaymentResponse}
     */
    this.recordPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, record_payment_request, opts, callback) {
      opts = opts || {};
      var postBody = record_payment_request;

      var pathParams = {
      };
      var queryParams = {
      };
      var headerParams = {
        'channel': channel,
        'client_key': client_key,
        'product': product,
        'timestamp': timestamp,
        'idempotent_request_key': idempotent_request_key,
        'requestor_type': requestor_type,
        'requestor': opts['requestor'],
        'X-OPAY-Headers': opts['x_opay_headers']
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = ['application/json'];
      var accepts = ['application/json'];
      var returnType = RecordedPaymentResponse;

      return this.apiClient.callApi(
        '/recordedpayments', 'POST',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    };

    /**
     * Callback function to receive the result of the retrieveRecordPayments operation.
     * @callback module:api/RecordedPaymentApi~retrieveRecordPaymentsCallback
     * @param {String} error Error message, if any.
     * @param {module:models/RecordedPaymentsResponse} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Retrieve Recorded Payments
     * The API is used to retrieve the payments made by a customer. Payments can be filtered using the confirmation number, customer account, status, by date range and others mentioned below. If no dates are provided for retrieval, payments in the last six months and all the payments scheduled for a future date are returned. In case a payment has failed due to ACH returns, then the payment return date and the return code will be available in the response.
     * @param {String} channel The channel through which the API is invoked.
     * @param {String} client_key The unique identifier assigned by EBPP to the client.
     * @param {module:models/String} product The product identifier corresponding to the API.
     * @param {String} timestamp The timestamp for the moment when the API request is created.
     * @param {String} idempotent_request_key The unique token that clients can generate and maintain in order to identify an API request.
     * @param {module:models/String} requestor_type Type of the requestor of the API.
     * @param {String} id_customer The unique identifier assigned by EBPP to the customer.
     * @param {Object} opts Optional parameters
     * @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is &lt;b&gt;system&lt;/b&gt;, requestor is optional.
     * @param {String} opts.x_opay_headers Intended for the future use.
     * @param {String} opts.id_customer_account The unique identifier assigned by EBPP to the customer account
     * @param {String} opts.confirmation_number The confirmation number or reference provided to the customer for the successful payment.
     * @param {Array.<module:models/String>} opts.payment_method The non fulfillment method for the payment. This can take multiple values in the format key&#x3D;value1&amp;key&#x3D;value2....
     * @param {Array.<module:models/String>} opts.status The status of the payment. This can take multiple values in the format key&#x3D;value1&amp;key&#x3D;value2....
     * @param {String} opts.from_date The date from which payments, matching the criteria specified, need to be retrieved.
     * @param {String} opts.to_date The date upto which payments, matching the criteria specified, need to be retrieved.
     * @param {String} opts.page_size The maximum number of objects returned in the query.
     * @param {String} opts.query_id query id of the Retrieve/Search Payments lookup.
     * @param {String} opts.from_index To fetch the next set of objects that start after this object
     * @param {String} opts.to_index To fetch the previous set of objects that end at this object
     * @param {module:api/RecordedPaymentApi~retrieveRecordPaymentsCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link module:models/RecordedPaymentsResponse}
     */
    this.retrieveRecordPayments = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, opts, callback) {
      opts = opts || {};
      var postBody = null;

      var pathParams = {
      };
      var queryParams = {
        'id_customer': id_customer,
        'id_customer_account': opts['id_customer_account'],
        'confirmation_number': opts['confirmation_number'],
        'payment_method': opts['payment_method'],
        'status': opts['status'],
        'from_date': opts['from_date'],
        'to_date': opts['to_date'],
        'page_size': opts['page_size'],
        'query_id': opts['query_id'],
        'from_index': opts['from_index'],
        'to_index': opts['to_index']
      };
      var headerParams = {
        'channel': channel,
        'client_key': client_key,
        'product': product,
        'timestamp': timestamp,
        'idempotent_request_key': idempotent_request_key,
        'requestor_type': requestor_type,
        'requestor': opts['requestor'],
        'X-OPAY-Headers': opts['x_opay_headers']
      };
      var formParams = {
      };

      var authNames = [];
      var contentTypes = [];
      var accepts = ['application/json'];
      var returnType = RecordedPaymentsResponse;

      return this.apiClient.callApi(
        '/recordedpayments', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, callback
      );
    };
  };

  return exports;
}));