(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'models/CreatePaymentRequest', 'models/DeletePaymentRequest', 'models/DeleteResponse', 'models/ErrorResponseVo', 'models/PaymentResponse', 'models/PaymentsResponse', 'models/SimplePaymentRequest', 'models/SimplePaymentResponse', 'models/UpdatePaymentRequest'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('../models/CreatePaymentRequest'), require('../models/DeletePaymentRequest'), require('../models/DeleteResponse'), require('../models/ErrorResponseVo'), require('../models/PaymentResponse'), require('../models/PaymentsResponse'), require('../models/SimplePaymentRequest'), require('../models/SimplePaymentResponse'), require('../models/UpdatePaymentRequest'));
} else {
// Browser globals (root is window)
if (!root.OrbipayPaymentsapiClient) {
root.OrbipayPaymentsapiClient = {};
}
root.OrbipayPaymentsapiClient.PaymentApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.CreatePaymentRequest, root.OrbipayPaymentsapiClient.DeletePaymentRequest, root.OrbipayPaymentsapiClient.DeleteResponse, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.PaymentResponse, root.OrbipayPaymentsapiClient.PaymentsResponse, root.OrbipayPaymentsapiClient.SimplePaymentRequest, root.OrbipayPaymentsapiClient.SimplePaymentResponse, root.OrbipayPaymentsapiClient.UpdatePaymentRequest);
}
}(this, function(ApiClient, CreatePaymentRequest, DeletePaymentRequest, DeleteResponse, ErrorResponseVo, PaymentResponse, PaymentsResponse, SimplePaymentRequest, SimplePaymentResponse, UpdatePaymentRequest) {
'use strict';
/**
* Payment service.
* @module api/PaymentApi
*/
/**
* <h3 style="color:red"> This class subject to change without prior notice, Please dont use this class directly. </h3>
* Constructs a new PaymentApi.
* @alias module:api/PaymentApi
* @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 createPayment operation.
* @callback module:api/PaymentApi~createPaymentCallback
* @param {String} error Error message, if any.
* @param {module:models/PaymentResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Create Payment
* The API is used to make payments to service a customer account. Client systems can provide the unique identifier for the payment in their system as payment_reference.<p>Fee amount and fee type are conditional and should be provided if the details of the fee to be charged are maintained in the client system. The fee types that are supported in EBPP are add_to_principal and bill_separately. Alternatively, the fee information can be setup in EBPP, in which case, these fields are ignored. If fee information is setup in the system, the details of the fee are returned 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 {module:models/CreatePaymentRequest} create_payment_request JSON containing all the fields required to make a payment.
* @param {Object} opts Optional parameters
* @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {module:api/PaymentApi~createPaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/PaymentResponse}
*/
this.createPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, create_payment_request, opts, callback) {
opts = opts || {};
var postBody = create_payment_request;
var pathParams = {
'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']
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = PaymentResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/payments', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the deletePayment operation.
* @callback module:api/PaymentApi~deletePaymentCallback
* @param {String} error Error message, if any.
* @param {module:models/DeleteResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Delete Payment
* The API is used to delete or cancel a payment. Payments that are under processing or have already been processed cannot be deleted.
* @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/DeletePaymentRequest} delete_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 <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {module:api/PaymentApi~deletePaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/DeleteResponse}
*/
this.deletePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, delete_payment_request, opts, callback) {
opts = opts || {};
var postBody = delete_payment_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']
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = DeleteResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/payments/{ID_PAYMENT}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the getPayment operation.
* @callback module:api/PaymentApi~getPaymentCallback
* @param {String} error Error message, if any.
* @param {module:models/PaymentResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get 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 {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 <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {module:api/PaymentApi~getPaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/PaymentResponse}
*/
this.getPayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, opts, callback) {
opts = opts || {};
var postBody = null;
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']
};
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = PaymentResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/payments/{ID_PAYMENT}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the retrieveFeePayment operation.
* @callback module:api/PaymentApi~retrieveFeePaymentCallback
* @param {String} error Error message, if any.
* @param {module:models/PaymentResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Fee Payment
* The API is used to retrieve the details of a fee payment by id.
* @param {String} channel The channel through which the API is invoked.
* @param {String} client_key The unique identifier assigned by OrbiPay 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_fee The unique identifier assigned by OrbiPay to the FeePayment.
* @param {String} id_customer The unique identifier assigned by OrbiPay 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 <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {module:api/PaymentApi~retrieveFeePaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/PaymentResponse}
*/
this.retrieveFeePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_fee, id_customer, opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {
'ID_FEE': id_fee,
'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']
};
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = PaymentResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fees/{ID_FEE}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the retrievePayments operation.
* @callback module:api/PaymentApi~retrievePaymentsCallback
* @param {String} error Error message, if any.
* @param {module:models/PaymentsResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Retrieve Payments
* The API is used to retrieve the payments made by a customer. Payments can be filtered using the confirmation number, customer account, funding account, status and payment schedule type, 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. If the requestor type is customer then the id_customer request parameter is mandatory.
* @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. If the requestor_type is <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {String} opts.id_customer The unique identifier assigned by EBPP to the customer.
* @param {String} opts.id_funding_account The unique identifier assigned by EBPP to the funding account
* @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.status The status of the payment. This can take multiple values in the format key=value1&key=value2....
* @param {Array.<module:models/String>} opts.payment_schedule_type The schedule type for the payment setup. This can take multiple values in the format key=value1&key=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 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/PaymentApi~retrievePaymentsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/PaymentsResponse}
*/
this.retrievePayments = 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'],
'id_funding_account': opts['id_funding_account'],
'id_customer_account': opts['id_customer_account'],
'confirmation_number': opts['confirmation_number'],
'status': opts['status'],
'payment_schedule_type': opts['payment_schedule_type'],
'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 = PaymentsResponse;
return this.apiClient.callApi(
'/payments', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the simplePayment operation.
* @callback module:api/PaymentApi~simplePaymentCallback
* @param {String} error Error message, if any.
* @param {module:models/SimplePaymentResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Simple Payment
* The API is used to make payments to service a customer account. Client systems can provide the unique identifier for the payment in their system as payment_reference. Fee amount and fee type are conditional and should be provided if the details of the fee to be charged are maintained in the client system. The fee types that are supported in EBPP are add_to_principal and bill_separately. Alternatively, the fee information can be setup in EBPP, in which case, these fields are ignored. If fee information is setup in the system, the details of the fee are returned in the response. This API updates the details of the customer, customer account and the funding account if those exist in EBPP or creates them otherwise.
* @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/SimplePaymentRequest} simple_payment_request JSON containing all the fields required to make a payment.
* @param {Object} opts Optional parameters
* @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {module:models/String} opts.save_funding_account query param
* @param {module:api/PaymentApi~simplePaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/SimplePaymentResponse}
*/
this.simplePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, simple_payment_request, opts, callback) {
opts = opts || {};
var postBody = simple_payment_request;
var pathParams = {
};
var queryParams = {
'save_funding_account': opts['save_funding_account']
};
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 = SimplePaymentResponse;
return this.apiClient.callApi(
'/payments', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the updatePayment operation.
* @callback module:api/PaymentApi~updatePaymentCallback
* @param {String} error Error message, if any.
* @param {module:models/PaymentResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Update Payment
* The API is used to edit a payment. Only payments in scheduled status can be edited.
* @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/UpdatePaymentRequest} update_payment_request Details of the Payment to be updated.
* @param {Object} opts Optional parameters
* @param {String} opts.requestor The identifier for the requestor of the API. If the requestor_type is <b>system</b>, requestor is optional.
* @param {String} opts.x_opay_headers Intended for the future use.
* @param {module:api/PaymentApi~updatePaymentCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/PaymentResponse}
*/
this.updatePayment = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_payment, id_customer, update_payment_request, opts, callback) {
opts = opts || {};
var postBody = update_payment_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']
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = PaymentResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/payments/{ID_PAYMENT}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
};
return exports;
}));