UNPKG

cybersource-rest-client

Version:

Node.js SDK for the CyberSource REST API

192 lines (166 loc) 8.61 kB
/** * CyberSource Merged Spec * All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html * * OpenAPI spec version: 0.0.1 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 2.4.38 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['Authentication/MLEUtility', 'ApiClient', 'model/ReportingV3ReportDefinitionsGet200Response', 'model/ReportingV3ReportDefinitionsNameGet200Response', 'model/Reportingv3ReportDownloadsGet400Response'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../authentication/util/MLEUtility'), require('../ApiClient'), require('../model/ReportingV3ReportDefinitionsGet200Response'), require('../model/ReportingV3ReportDefinitionsNameGet200Response'), require('../model/Reportingv3ReportDownloadsGet400Response')); } else { // Browser globals (root is window) if (!root.CyberSource) { root.CyberSource = {}; } root.CyberSource.ReportDefinitionsApi = factory(root.Authentication.MLEUtility, root.CyberSource.ApiClient, root.CyberSource.ReportingV3ReportDefinitionsGet200Response, root.CyberSource.ReportingV3ReportDefinitionsNameGet200Response, root.CyberSource.Reportingv3ReportDownloadsGet400Response); } }(this, function(MLEUtility, ApiClient, ReportingV3ReportDefinitionsGet200Response, ReportingV3ReportDefinitionsNameGet200Response, Reportingv3ReportDownloadsGet400Response) { 'use strict'; /** * ReportDefinitions service. * @module api/ReportDefinitionsApi * @version 0.0.1 */ /** * Constructs a new ReportDefinitionsApi. * @alias module:api/ReportDefinitionsApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ var exports = function(configObject, apiClient) { this.apiClient = apiClient || ApiClient.instance; this.apiClient.setConfiguration(configObject); /** * Callback function to receive the result of the getResourceInfoByReportDefinition operation. * @callback module:api/ReportDefinitionsApi~getResourceInfoByReportDefinitionCallback * @param {String} error Error message, if any. * @param {module:model/ReportingV3ReportDefinitionsNameGet200Response} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Report Definition * View the attributes of an individual report type. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation/) * @param {String} reportDefinitionName Name of the Report definition to retrieve * @param {Object} opts Optional parameters * @param {String} opts.subscriptionType The subscription type for which report definition is required. By default the type will be CUSTOM. Valid Values: - CLASSIC - CUSTOM - STANDARD * @param {String} opts.reportMimeType The format for which the report definition is required. By default the value will be CSV. Valid Values: - application/xml - text/csv * @param {String} opts.organizationId Valid Organization Id * @param {module:api/ReportDefinitionsApi~getResourceInfoByReportDefinitionCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ReportingV3ReportDefinitionsNameGet200Response} */ this.getResourceInfoByReportDefinition = function(reportDefinitionName, opts, callback) { opts = opts || {}; var postBody = null; if ('GET' == 'POST') { postBody = '{}'; } // verify the required parameter 'reportDefinitionName' is set if (reportDefinitionName === undefined || reportDefinitionName === null) { throw new Error("Missing the required parameter 'reportDefinitionName' when calling getResourceInfoByReportDefinition"); } var pathParams = { 'reportDefinitionName': reportDefinitionName }; var queryParams = { 'subscriptionType': opts['subscriptionType'], 'reportMimeType': opts['reportMimeType'], 'organizationId': opts['organizationId'] }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json;charset=utf-8']; var accepts = ['application/hal+json']; var returnType = ReportingV3ReportDefinitionsNameGet200Response; //check isMLE for an api method 'this.getResourceInfoByReportDefinition' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'getResourceInfoByReportDefinition'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/reporting/v3/report-definitions/{reportDefinitionName}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/reporting/v3/report-definitions/{reportDefinitionName}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } /** * Callback function to receive the result of the getResourceV2Info operation. * @callback module:api/ReportDefinitionsApi~getResourceV2InfoCallback * @param {String} error Error message, if any. * @param {module:model/ReportingV3ReportDefinitionsGet200Response} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Reporting Resource Information * View a list of supported reports and their attributes before subscribing to them. * @param {Object} opts Optional parameters * @param {String} opts.subscriptionType Valid Values: - CLASSIC - CUSTOM - STANDARD * @param {String} opts.organizationId Valid Organization Id * @param {module:api/ReportDefinitionsApi~getResourceV2InfoCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ReportingV3ReportDefinitionsGet200Response} */ this.getResourceV2Info = function(opts, callback) { opts = opts || {}; var postBody = null; if ('GET' == 'POST') { postBody = '{}'; } var pathParams = { }; var queryParams = { 'subscriptionType': opts['subscriptionType'], 'organizationId': opts['organizationId'] }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json;charset=utf-8']; var accepts = ['application/hal+json']; var returnType = ReportingV3ReportDefinitionsGet200Response; //check isMLE for an api method 'this.getResourceV2Info' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'getResourceV2Info'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/reporting/v3/report-definitions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/reporting/v3/report-definitions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } }; return exports; }));