UNPKG

cybersource-rest-client

Version:

Node.js SDK for the CyberSource REST API

189 lines (161 loc) 8.71 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/InlineResponse2002', 'model/InlineResponse2013', 'model/InlineResponse4007', 'model/InlineResponse4041', 'model/InlineResponse4221', 'model/InlineResponse5002', 'model/PostRegistrationBody'], 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/InlineResponse2002'), require('../model/InlineResponse2013'), require('../model/InlineResponse4007'), require('../model/InlineResponse4041'), require('../model/InlineResponse4221'), require('../model/InlineResponse5002'), require('../model/PostRegistrationBody')); } else { // Browser globals (root is window) if (!root.CyberSource) { root.CyberSource = {}; } root.CyberSource.MerchantBoardingApi = factory(root.Authentication.MLEUtility, root.CyberSource.ApiClient, root.CyberSource.InlineResponse2002, root.CyberSource.InlineResponse2013, root.CyberSource.InlineResponse4007, root.CyberSource.InlineResponse4041, root.CyberSource.InlineResponse4221, root.CyberSource.InlineResponse5002, root.CyberSource.PostRegistrationBody); } }(this, function(MLEUtility, ApiClient, InlineResponse2002, InlineResponse2013, InlineResponse4007, InlineResponse4041, InlineResponse4221, InlineResponse5002, PostRegistrationBody) { 'use strict'; /** * MerchantBoarding service. * @module api/MerchantBoardingApi * @version 0.0.1 */ /** * Constructs a new MerchantBoardingApi. * @alias module:api/MerchantBoardingApi * @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 getRegistration operation. * @callback module:api/MerchantBoardingApi~getRegistrationCallback * @param {String} error Error message, if any. * @param {module:model/InlineResponse2002} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Gets all the information on a boarding registration * This end point will get all information of a boarding registration * @param {String} registrationId Identifies the boarding registration to be updated * @param {module:api/MerchantBoardingApi~getRegistrationCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/InlineResponse2002} */ this.getRegistration = function(registrationId, callback) { var postBody = null; if ('GET' == 'POST') { postBody = '{}'; } // verify the required parameter 'registrationId' is set if (registrationId === undefined || registrationId === null) { throw new Error("Missing the required parameter 'registrationId' when calling getRegistration"); } var pathParams = { 'registrationId': registrationId }; var queryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse2002; //check isMLE for an api method 'this.getRegistration' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'getRegistration'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/boarding/v1/registrations/{registrationId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/boarding/v1/registrations/{registrationId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } /** * Callback function to receive the result of the postRegistration operation. * @callback module:api/MerchantBoardingApi~postRegistrationCallback * @param {String} error Error message, if any. * @param {module:model/InlineResponse2013} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create a boarding registration * Boarding Product is specifically for resellers who onboard merchants to resell their services to merchants and help integrate REST API into their systems. The Boarding API is designed to simplify and streamline the onboarding process of merchants by enabling administrators and developers to: 1. Enable and Configure Products: The API helps in adding new products to an existing organization and configuring them to suit specific needs. 2. Update Merchant Information: The API allows for updating an organization's information efficiently. 3. Manage Payment Integration: It provides templates for secure payment integration and management. * @param {module:model/PostRegistrationBody} postRegistrationBody Boarding registration data * @param {Object} opts Optional parameters * @param {String} opts.vCIdempotencyId defines idempotency of the request * @param {module:api/MerchantBoardingApi~postRegistrationCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/InlineResponse2013} */ this.postRegistration = function(postRegistrationBody, opts, callback) { opts = opts || {}; var postBody = postRegistrationBody; // verify the required parameter 'postRegistrationBody' is set if (postRegistrationBody === undefined || postRegistrationBody === null) { throw new Error("Missing the required parameter 'postRegistrationBody' when calling postRegistration"); } var SdkTracker = require('../utilities/tracking/SdkTracker'); var sdkTracker = new SdkTracker(); postBody = sdkTracker.insertDeveloperIdTracker(postBody, 'module:model/PostRegistrationBody', this.apiClient.merchantConfig.runEnvironment, this.apiClient.merchantConfig.defaultDeveloperId); var pathParams = { }; var queryParams = { }; var headerParams = { 'v-c-idempotency-id': opts['vCIdempotencyId'] }; var formParams = { }; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = InlineResponse2013; //check isMLE for an api method 'this.postRegistration' var inboundMLEStatus = 'false'; var isMLEForApi = MLEUtility.checkIsMLEForAPI(this.apiClient.merchantConfig, inboundMLEStatus, 'postRegistration'); if (isMLEForApi === true) { MLEUtility.encryptRequestPayload(this.apiClient.merchantConfig, postBody).then(postBody => { return this.apiClient.callApi( '/boarding/v1/registrations', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); }); } else { return this.apiClient.callApi( '/boarding/v1/registrations', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } } }; return exports; }));