UNPKG

cybersource-rest-client

Version:

Node.js SDK for the CyberSource REST API

184 lines (155 loc) 9.09 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/DeAssociationRequestBody', 'model/DeviceDeAssociateV3Request', 'model/InlineResponse2007', 'model/InlineResponse206', 'model/InlineResponse4008', 'model/InlineResponse401', 'model/InlineResponse4032', 'model/InlineResponse4043', 'model/InlineResponse5003'], 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/DeAssociationRequestBody'), require('../model/DeviceDeAssociateV3Request'), require('../model/InlineResponse2007'), require('../model/InlineResponse206'), require('../model/InlineResponse4008'), require('../model/InlineResponse401'), require('../model/InlineResponse4032'), require('../model/InlineResponse4043'), require('../model/InlineResponse5003')); } else { // Browser globals (root is window) if (!root.CyberSource) { root.CyberSource = {}; } root.CyberSource.DeviceDeAssociationApi = factory(root.Authentication.MLEUtility, root.CyberSource.ApiClient, root.CyberSource.DeAssociationRequestBody, root.CyberSource.DeviceDeAssociateV3Request, root.CyberSource.InlineResponse2007, root.CyberSource.InlineResponse206, root.CyberSource.InlineResponse4008, root.CyberSource.InlineResponse401, root.CyberSource.InlineResponse4032, root.CyberSource.InlineResponse4043, root.CyberSource.InlineResponse5003); } }(this, function(MLEUtility, ApiClient, DeAssociationRequestBody, DeviceDeAssociateV3Request, InlineResponse2007, InlineResponse206, InlineResponse4008, InlineResponse401, InlineResponse4032, InlineResponse4043, InlineResponse5003) { 'use strict'; /** * DeviceDeAssociation service. * @module api/DeviceDeAssociationApi * @version 0.0.1 */ /** * Constructs a new DeviceDeAssociationApi. * @alias module:api/DeviceDeAssociationApi * @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 deleteTerminalAssociation operation. * @callback module:api/DeviceDeAssociationApi~deleteTerminalAssociationCallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * De-associate a device from merchant or account V2 * The current association of the device will be removed and will be assigned back to parent in the hierarchy based on internal logic * @param {module:model/DeAssociationRequestBody} deAssociationRequestBody de association of the deviceId in the request body. * @param {module:api/DeviceDeAssociationApi~deleteTerminalAssociationCallback} callback The callback function, accepting three arguments: error, data, response */ this.deleteTerminalAssociation = function(deAssociationRequestBody, callback) { var postBody = deAssociationRequestBody; // verify the required parameter 'deAssociationRequestBody' is set if (deAssociationRequestBody === undefined || deAssociationRequestBody === null) { throw new Error("Missing the required parameter 'deAssociationRequestBody' when calling deleteTerminalAssociation"); } var SdkTracker = require('../utilities/tracking/SdkTracker'); var sdkTracker = new SdkTracker(); postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/DeAssociationRequestBody', 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 = null; //check isMLE for an api method 'this.deleteTerminalAssociation' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'deleteTerminalAssociation'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/dms/v2/devices/deassociate', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/dms/v2/devices/deassociate', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } /** * Callback function to receive the result of the postDeAssociateV3Terminal operation. * @callback module:api/DeviceDeAssociationApi~postDeAssociateV3TerminalCallback * @param {String} error Error message, if any. * @param {Array.<module:model/InlineResponse2007>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * De-associate a device from merchant to account or reseller and from account to reseller * A device will be de-associated from its current organization and moved up in the hierarchy. The device's new position will be determined by a specified destination, either an account or a portfolio. If no destination is provided, the device will default to the currently logged-in user. * @param {Array.<module:model/DeviceDeAssociateV3Request>} deviceDeAssociateV3Request deviceId that has to be de-associated to the destination organizationId. * @param {module:api/DeviceDeAssociationApi~postDeAssociateV3TerminalCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/InlineResponse2007>} */ this.postDeAssociateV3Terminal = function(deviceDeAssociateV3Request, callback) { var postBody = deviceDeAssociateV3Request; // verify the required parameter 'deviceDeAssociateV3Request' is set if (deviceDeAssociateV3Request === undefined || deviceDeAssociateV3Request === null) { throw new Error("Missing the required parameter 'deviceDeAssociateV3Request' when calling postDeAssociateV3Terminal"); } var SdkTracker = require('../utilities/tracking/SdkTracker'); var sdkTracker = new SdkTracker(); postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'Array.<module:model/DeviceDeAssociateV3Request>', 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/json;charset=UTF-8']; var returnType = [InlineResponse2007]; //check isMLE for an api method 'this.postDeAssociateV3Terminal' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'postDeAssociateV3Terminal'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/dms/v3/devices/deassociate', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/dms/v3/devices/deassociate', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } }; return exports; }));