UNPKG

cybersource-rest-client

Version:

Node.js SDK for the CyberSource REST API

178 lines (151 loc) 6.8 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/Body', 'model/TssV2GetEmvTags200Response', 'model/TssV2PostEmvTags200Response'], 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/Body'), require('../model/TssV2GetEmvTags200Response'), require('../model/TssV2PostEmvTags200Response')); } else { // Browser globals (root is window) if (!root.CyberSource) { root.CyberSource = {}; } root.CyberSource.EMVTagDetailsApi = factory(root.Authentication.MLEUtility, root.CyberSource.ApiClient, root.CyberSource.Body, root.CyberSource.TssV2GetEmvTags200Response, root.CyberSource.TssV2PostEmvTags200Response); } }(this, function(MLEUtility, ApiClient, Body, TssV2GetEmvTags200Response, TssV2PostEmvTags200Response) { 'use strict'; /** * EMVTagDetails service. * @module api/EMVTagDetailsApi * @version 0.0.1 */ /** * Constructs a new EMVTagDetailsApi. * @alias module:api/EMVTagDetailsApi * @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 getEmvTags operation. * @callback module:api/EMVTagDetailsApi~getEmvTagsCallback * @param {String} error Error message, if any. * @param {module:model/TssV2GetEmvTags200Response} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve the EMV Dictionary * Returns the entire EMV tag dictionary * @param {module:api/EMVTagDetailsApi~getEmvTagsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TssV2GetEmvTags200Response} */ this.getEmvTags = function(callback) { var postBody = null; if ('GET' == 'POST') { postBody = '{}'; } var pathParams = { }; var queryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json;charset=utf-8']; var accepts = ['application/json;charset=utf-8']; var returnType = TssV2GetEmvTags200Response; //check isMLE for an api method 'this.getEmvTags' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'getEmvTags'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/tss/v2/transactions/emvTagDetails', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/tss/v2/transactions/emvTagDetails', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } /** * Callback function to receive the result of the parseEmvTags operation. * @callback module:api/EMVTagDetailsApi~parseEmvTagsCallback * @param {String} error Error message, if any. * @param {module:model/TssV2PostEmvTags200Response} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Parse an EMV String * Pass an EMV Tag-Length-Value (TLV) string for parsing. * @param {module:model/Body} body * @param {module:api/EMVTagDetailsApi~parseEmvTagsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TssV2PostEmvTags200Response} */ this.parseEmvTags = function(body, callback) { var postBody = body; // verify the required parameter 'body' is set if (body === undefined || body === null) { throw new Error("Missing the required parameter 'body' when calling parseEmvTags"); } var SdkTracker = require('../utilities/tracking/SdkTracker'); var sdkTracker = new SdkTracker(); postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/Body', this.apiClient.merchantConfig.runEnvironment, this.apiClient.merchantConfig.defaultDeveloperId); var pathParams = { }; var queryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json;charset=utf-8']; var accepts = ['application/hal+json;charset=utf-8']; var returnType = TssV2PostEmvTags200Response; //check isMLE for an api method 'this.parseEmvTags' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'parseEmvTags'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/tss/v2/transactions/emvTagDetails', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/tss/v2/transactions/emvTagDetails', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } }; return exports; }));