UNPKG

cybersource-rest-client-typescript

Version:
100 lines (86 loc) 4.23 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.3.0 * * Do not edit the class manually. * */ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['ApiClient', 'model/GenerateUnifiedCheckoutCaptureContextRequest', 'model/InlineResponse4006'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. module.exports = factory(require('../ApiClient'), require('../model/GenerateUnifiedCheckoutCaptureContextRequest'), require('../model/InlineResponse4006')); } else { // Browser globals (root is window) if (!root.CyberSource) { root.CyberSource = {}; } root.CyberSource.UnifiedCheckoutCaptureContextApi = factory(root.CyberSource.ApiClient, root.CyberSource.GenerateUnifiedCheckoutCaptureContextRequest, root.CyberSource.InlineResponse4006); } }(this, function(ApiClient, GenerateUnifiedCheckoutCaptureContextRequest, InlineResponse4006) { 'use strict'; /** * UnifiedCheckoutCaptureContext service. * @module api/UnifiedCheckoutCaptureContextApi * @version 0.0.1 */ /** * Constructs a new UnifiedCheckoutCaptureContextApi. * @alias module:api/UnifiedCheckoutCaptureContextApi * @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 generateUnifiedCheckoutCaptureContext operation. * @callback module:api/UnifiedCheckoutCaptureContextApi~generateUnifiedCheckoutCaptureContextCallback * @param {String} error Error message, if any. * @param {'String'} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Generate Unified Checkout Capture Context * Generate a one-time use capture context used for the invocation of Unified Checkout. The Request wil contain all of the parameters for how Unified Checkout will operate within a client webpage. The resulting payload will be a JWT signed object that can be used to initiate Unified Checkout within a merchant web page * @param {module:model/GenerateUnifiedCheckoutCaptureContextRequest} generateUnifiedCheckoutCaptureContextRequest * @param {module:api/UnifiedCheckoutCaptureContextApi~generateUnifiedCheckoutCaptureContextCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link 'String'} */ this.generateUnifiedCheckoutCaptureContext = function(generateUnifiedCheckoutCaptureContextRequest, callback) { var postBody = generateUnifiedCheckoutCaptureContextRequest; // verify the required parameter 'generateUnifiedCheckoutCaptureContextRequest' is set if (generateUnifiedCheckoutCaptureContextRequest === undefined || generateUnifiedCheckoutCaptureContextRequest === null) { throw new Error("Missing the required parameter 'generateUnifiedCheckoutCaptureContextRequest' when calling generateUnifiedCheckoutCaptureContext"); } var pathParams = { }; var queryParams = { }; var headerParams = { }; var formParams = { }; var authNames = []; var contentTypes = ['application/json;charset=utf-8']; var accepts = ['application/jwt']; var returnType = 'String'; return this.apiClient.callApi( '/up/v1/capture-contexts', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }; return exports; }));