(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'models/AddFundingAccountRequest', 'models/DeleteFundingAccountRequest', 'models/DeleteResponse', 'models/ErrorResponseVo', 'models/FundingAccountResponse', 'models/FundingAccountsResponse', 'models/ReplaceFundingAccountRequest', 'models/UpdateFundingAccountRequest'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('../models/AddFundingAccountRequest'), require('../models/DeleteFundingAccountRequest'), require('../models/DeleteResponse'), require('../models/ErrorResponseVo'), require('../models/FundingAccountResponse'), require('../models/FundingAccountsResponse'), require('../models/ReplaceFundingAccountRequest'), require('../models/UpdateFundingAccountRequest'));
} else {
// Browser globals (root is window)
if (!root.OrbipayPaymentsapiClient) {
root.OrbipayPaymentsapiClient = {};
}
root.OrbipayPaymentsapiClient.FundingAccountApi = factory(root.OrbipayPaymentsapiClient.ApiClient, root.OrbipayPaymentsapiClient.AddFundingAccountRequest, root.OrbipayPaymentsapiClient.DeleteFundingAccountRequest, root.OrbipayPaymentsapiClient.DeleteResponse, root.OrbipayPaymentsapiClient.ErrorResponseVo, root.OrbipayPaymentsapiClient.FundingAccountResponse, root.OrbipayPaymentsapiClient.FundingAccountsResponse, root.OrbipayPaymentsapiClient.ReplaceFundingAccountRequest, root.OrbipayPaymentsapiClient.UpdateFundingAccountRequest);
}
}(this, function(ApiClient, AddFundingAccountRequest, DeleteFundingAccountRequest, DeleteResponse, ErrorResponseVo, FundingAccountResponse, FundingAccountsResponse, ReplaceFundingAccountRequest, UpdateFundingAccountRequest) {
'use strict';
/**
* FundingAccount service.
* @module api/FundingAccountApi
*/
/**
* <h3 style="color:red"> This class subject to change without prior notice, Please dont use this class directly. </h3>
* Constructs a new FundingAccountApi.
* @alias module:api/FundingAccountApi
* @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 addFundingAccount operation.
* @callback module:api/FundingAccountApi~addFundingAccountCallback
* @param {String} error Error message, if any.
* @param {module:models/FundingAccountResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Add Funding Account
* This API is used to add a funding account for the customer. The funding account is available for servicing all the customer accounts the customer holds. An exhaustive set of account types are supported as funding accounts as indicated in the field account_subtype. ABA routing number and account sub-type are mandatory for bank accounts. Expiry date, address fields and Card CVV are required for card accounts.
* @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/AddFundingAccountRequest} add_funding_account_request JSON containing all the attributes of the Funding account to be added to 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/FundingAccountApi~addFundingAccountCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/FundingAccountResponse}
*/
this.addFundingAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, add_funding_account_request, opts, callback) {
opts = opts || {};
var postBody = add_funding_account_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'],
'trace_id': opts['trace_id']
};
var formParams = {
};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = FundingAccountResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the deleteFundingAccount operation.
* @callback module:api/FundingAccountApi~deleteFundingAccountCallback
* @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 Funding Account
* The Delete Funding Account API is used to delete the funding account of a customer. All pending payments made with that account are cancelled upon deletion of the funding account.
* @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_funding_account The unique identifier assigned by EBPP to the Funding Account.
* @param {String} id_customer The unique identifier assigned by EBPP to the customer.
* @param {module:models/DeleteFundingAccountRequest} delete_funding_account_request Details of account to be deleted.
* @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/FundingAccountApi~deleteFundingAccountCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/DeleteResponse}
*/
this.deleteFundingAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_funding_account, id_customer, delete_funding_account_request, opts, callback) {
opts = opts || {};
var postBody = delete_funding_account_request;
var pathParams = {
'ID_FUNDING_ACCOUNT': id_funding_account,
'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 = DeleteResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts/{ID_FUNDING_ACCOUNT}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the getFundingAccount operation.
* @callback module:api/FundingAccountApi~getFundingAccountCallback
* @param {String} error Error message, if any.
* @param {module:models/FundingAccountResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Funding Account
* The Get Funding Account API is used to retrieve the details of the funding account based on the 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_funding_account The unique identifier assigned by EBPP to the Funding Account.
* @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/FundingAccountApi~getFundingAccountCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/FundingAccountResponse}
*/
this.getFundingAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_funding_account, id_customer, opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {
'ID_FUNDING_ACCOUNT': id_funding_account,
'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 = FundingAccountResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts/{ID_FUNDING_ACCOUNT}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the replaceFundingAccount operation.
* @callback module:api/FundingAccountApi~replaceFundingAccountCallback
* @param {String} error Error message, if any.
* @param {module:models/FundingAccountResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Replace Funding Account
* The API is used to replace the funding account details. The type of the funding account cannot be replaced. In other words, a card account cannot be replaced to a bank account and vice versa. CVV is mandatory to make any change to a card account.Replacing a funding account updates the account information on all pending payments made using that account but does not change the details on payments that have been completed.
* @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_funding_account The unique identifier assigned by EBPP to the Funding Account.
* @param {String} id_customer The unique identifier assigned by EBPP to the customer.
* @param {module:models/ReplaceFundingAccountRequest} replace_funding_account_request JSON containing all the attributes of the Funding account to be replaced.
* @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/FundingAccountApi~replaceFundingAccountCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/FundingAccountResponse}
*/
this.replaceFundingAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_funding_account, id_customer, replace_funding_account_request, opts, callback) {
opts = opts || {};
var postBody = replace_funding_account_request;
var pathParams = {
'ID_FUNDING_ACCOUNT': id_funding_account,
'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 = FundingAccountResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts/{ID_FUNDING_ACCOUNT}/replacement', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the retrieveFundingAccounts operation.
* @callback module:api/FundingAccountApi~retrieveFundingAccountsCallback
* @param {String} error Error message, if any.
* @param {module:models/FundingAccountsResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Retrieve Funding Accounts
* This API is used to retrieve all the funding accounts associated with a customer. Accounts can be filtered using the account number, the ABA routing number (for bank accounts), the account status, account type, account sub-type and others mentioned below. The results are sorted based on their last_modified_time in descending order. The API responds with the first page of the list of funding accounts matching the criteria.
* @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.
* @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.page_size The maximum number of objects returned in the query.
* @param {String} opts.account_number The Account Number to get details of.
* @param {Array.<module:models/String>} opts.status The status of the funding account in EBPP. This can take multiple values in the format key=value1&key=value2....
* @param {String} opts.aba_routing_number The ABA/Routing number for the bank account.
* @param {Array.<module:models/String>} opts.account_type The type of the funding account. This can take multiple values in the format key=value1&key=value2....
* @param {module:models/String} opts.account_subtype The sub type of the funding account. This is derived by EBPP in the case of card funding accounts.
* @param {module:api/FundingAccountApi~retrieveFundingAccountsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/FundingAccountsResponse}
*/
this.retrieveFundingAccounts = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {
'ID_CUSTOMER': id_customer
};
var queryParams = {
'page_size': opts['page_size']
};
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 = {
'account_number': opts['account_number'],
'status': this.apiClient.buildCollectionParam(opts['status'], 'multi'),
'aba_routing_number': opts['aba_routing_number'],
'account_type': this.apiClient.buildCollectionParam(opts['account_type'], 'multi'),
'account_subtype': opts['account_subtype']
};
var authNames = [];
var contentTypes = ['application/x-www-form-urlencoded'];
var accepts = ['application/json'];
var returnType = FundingAccountsResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts/lists', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the retrieveFundingAccountsPage operation.
* @callback module:api/FundingAccountApi~retrieveFundingAccountsPageCallback
* @param {String} error Error message, if any.
* @param {module:models/FundingAccountsResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Retrieve Funding Accounts Pagination
* This API is used to paginate through the list of funding accounts returned in the Retrieve Funding Accounts API.
* @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 {String} query_id query id of the Retrieve/Search Accounts lookup.
* @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.page_size The maximum number of objects returned in the query.
* @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/FundingAccountApi~retrieveFundingAccountsPageCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/FundingAccountsResponse}
*/
this.retrieveFundingAccountsPage = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_customer, query_id, opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {
'ID_CUSTOMER': id_customer
};
var queryParams = {
'page_size': opts['page_size'],
'query_id': 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 = [];
var accepts = ['application/json'];
var returnType = FundingAccountsResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts/lists', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
/**
* Callback function to receive the result of the updateFundingAccount operation.
* @callback module:api/FundingAccountApi~updateFundingAccountCallback
* @param {String} error Error message, if any.
* @param {module:models/FundingAccountResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Update Funding Account
* The API is used to edit the funding account details. The type of the funding account cannot be changed. In other words, a card account cannot be changed to a bank account and vice versa. The sub-type of a bank account can be changed. For e.g., a saving account can be updated to a money market account. However, the sub-type cannot be updated for a card account. CVV is mandatory to make any change to a card account. The Id of the funding account gets updated to a new value if the account number is updated. Editing a funding account updates the account information on all pending payments made using that account but does not change the details on payments that have been completed. <br><br> Below are the possible funding account state transformation. | from_status | to_status | allowed requestor_type | | ------------ | ------------ | ------------ | | active | deleted| <ul> <li>external_user</li> <li> client_agent</li> <li> system</li> <li> customer</li></ul> | | active | frozen | <ul> <li>external_user </li> <li> client_agent </li> <li> system</li></ul> | | active | inactive | <ul> <li>external_user </li> <li> client_agent </li> <li> system</li></ul> | | active | unverified | <ul> <li>system</li></ul> | | frozen | active | <ul> <li>external_user </li> <li> client_agent</li></ul> | | inactive | active | <ul> <li>external_user </li> <li> client_agent </li> <li> system</li></ul> |
* @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_funding_account The unique identifier assigned by EBPP to the Funding Account.
* @param {String} id_customer The unique identifier assigned by EBPP to the customer.
* @param {module:models/UpdateFundingAccountRequest} update_funding_account_request JSON containing all the attributes of the Funding account to be updated.
* @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/FundingAccountApi~updateFundingAccountCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:models/FundingAccountResponse}
*/
this.updateFundingAccount = function(channel, client_key, product, timestamp, idempotent_request_key, requestor_type, id_funding_account, id_customer, update_funding_account_request, opts, callback) {
opts = opts || {};
var postBody = update_funding_account_request;
var pathParams = {
'ID_FUNDING_ACCOUNT': id_funding_account,
'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 = FundingAccountResponse;
return this.apiClient.callApi(
'/customers/{ID_CUSTOMER}/fundingaccounts/{ID_FUNDING_ACCOUNT}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
};
};
return exports;
}));