(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'models/CreateRefundRequest', 'models/ErrorResponseVo', 'models/RefundResponse', 'models/RefundsResponse'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('../models/CreateRefundRequest'), require('../models/ErrorResponseVo'), require('../models/RefundResponse'), require('../models/RefundsResponse'));
} else {
// Browser globals (root is window)
if (!root.OrbipayPaymentsapiClient) {
root.OrbipayPaymentsapiClient = {};
}
root.OrbipayPaymentsapiClient.RefundApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CreateRefundRequest, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.RefundResponse, root.OrbipayPaymentsapiClient.RefundsResponse);
}
}(this, function(ApiClient, CreateRefundRequest, ErrorResponseVo, RefundResponse, RefundsResponse) {
'use strict';
/**
* Refund service.
* @module api/RefundApi
*/
/**
* <h3 style="color:red"> This class subject to change without prior notice, Please dont use this class directly. </h3>
* Constructs a new RefundApi.
* @alias module:api/RefundApi
* @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 createRefund operation.
* @callback module:api/RefundApi~createRefundCallback
* @param {String} error Error message, if any.
* @param {module:models/RefundResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Create Refund
* This API is used to initiate a refund. Any payment made using EBPP can be refunded. Customer cannot initiate a refund request. In other words, the Create Refund request will fail if the associated requestor_type is customer.
* @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 {String} id_customer The unique identifier assigned by EBPP to the customer.
* @param {module:models/CreateRefundRequest} create_refund_request JSON containing all the fields required to refund a payment.
* @param {Object} opts Optional parameters
* @param {String} opts.requestor The identifier for the requestor of the API.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
* @param {module:api/RefundApi~createRefundCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/RefundResponse}
*/
this.createRefund = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, create_refund_request, opts, callback) {
opts = opts || {};
var postBody = create_refund_request;
var pathParams = {
'ID_PAYMENT': id_payment,
'ID_CUSTOMER': id_customer
};
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'],
'trace_id': opts['trace_id']
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = RefundResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/payments/{ID_PAYMENT}/refunds', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the getRefund operation.
* @callback module:api/RefundApi~getRefundCallback
* @param {String} error Error message, if any.
* @param {module:models/RefundResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Refund
* The API is used to retrieve the details of a refund 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_refund The unique identifier assigned by EBPP to the refund.
* @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.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
* @param {module:api/RefundApi~getRefundCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/RefundResponse}
*/
this.getRefund = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_refund, id_customer, opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {
'ID_REFUND': id_refund,
'ID_CUSTOMER': id_customer
};
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'],
'trace_id': opts['trace_id']
};
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = RefundResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/refunds/{ID_REFUND}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the retrieveRefunds operation.
* @callback module:api/RefundApi~retrieveRefundsCallback
* @param {String} error Error message, if any.
* @param {module:models/RefundsResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Retrieve Refunds
* The API is used to retrieve the refunds made to a customer against payments processed through EBPP. Refunds can be filtered using the customer id, confirmation number of the payment being refunded or of the refund, status of the refund and others mentioned below. Scheduled refunds that are yet to be processed and all the refunds processed in the last six months are returned if date criteria is not specified. The results are sorted in descending order of the refund_date followed by the last_modified_time.
* @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 {Object} opts Optional parameters
* @param {String} opts.requestor The identifier for the requestor of the API.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {String} opts.trace_id The unique reference that can be used for tracing and debugging an API call.
* @param {String} opts.id_customer The unique identifier assigned by EBPP to the customer.
* @param {String} opts.confirmation_number The confirmation number provided to the customer for the refund or for the corresponding successful payment.
* @param {Array.<module:models/String>} opts.status The status of the refund. This can take multiple values in the format key=value1&key=value2....
* @param {String} opts.from_date The date from which refunds, matching the criteria specified, need to be retrieved.
* @param {String} opts.to_date The date upto which refunds, 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 Customers 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/RefundApi~retrieveRefundsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/RefundsResponse}
*/
this.retrieveRefunds = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
var queryParams = {
'id_customer': opts['id_customer'],
'confirmation_number': opts['confirmation_number'],
'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'],
'trace_id': opts['trace_id']
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = RefundsResponse;
return this.apiClient.callApi(
'/refunds', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
};
return exports;
}));