UNPKG

@paciolan/cybersource-sdk

Version:
234 lines (233 loc) 14.4 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.TransientTokenDataApi = exports.TransientTokenDataApiFactory = exports.TransientTokenDataApiFp = exports.TransientTokenDataApiAxiosParamCreator = void 0; /* tslint:disable */ /* eslint-disable */ /** * 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 * Do not edit the class manually. */ const axios_1 = __importDefault(require("axios")); const AuthenticationHeader_1 = require("../authentication/core/AuthenticationHeader"); // Some imports not used depending on template conditions // @ts-ignore const base_1 = require("../base"); /** * TransientTokenDataApi - axios parameter creator * @export */ const TransientTokenDataApiAxiosParamCreator = function (configuration) { return { /** * Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform. * @summary Get Payment Credentials * @param {string} jti The jti field contained within the Transient token returned from a successful Unified Checkout transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPaymentCredentialsForTransientToken: (jti, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'jti' is not null or undefined if (jti === null || jti === undefined) { throw new base_1.RequiredError('jti', 'Required parameter jti was null or undefined when calling getPaymentCredentialsForTransientToken.'); } const localVarPath = `/up/v1/payment-credentials/{jti}` .replace(`{${"jti"}}`, encodeURIComponent(String(jti))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); const authHeader = new AuthenticationHeader_1.AuthenticationHeader(); authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options)); localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }), /** * Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details. * @summary Get Transient Token Data * @param {string} transientToken Transient Token returned by the Unified Checkout application. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionForTransientToken: (transientToken, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'transientToken' is not null or undefined if (transientToken === null || transientToken === undefined) { throw new base_1.RequiredError('transientToken', 'Required parameter transientToken was null or undefined when calling getTransactionForTransientToken.'); } const localVarPath = `/up/v1/payment-details/{transientToken}` .replace(`{${"transientToken"}}`, encodeURIComponent(String(transientToken))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); const authHeader = new AuthenticationHeader_1.AuthenticationHeader(); authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options)); localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }), }; }; exports.TransientTokenDataApiAxiosParamCreator = TransientTokenDataApiAxiosParamCreator; /** * TransientTokenDataApi - functional programming interface * @export */ const TransientTokenDataApiFp = function (configuration) { return { /** * Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform. * @summary Get Payment Credentials * @param {string} jti The jti field contained within the Transient token returned from a successful Unified Checkout transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPaymentCredentialsForTransientToken(jti, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.TransientTokenDataApiAxiosParamCreator)(configuration).getPaymentCredentialsForTransientToken(jti, options); return (axios = axios_1.default, basePath = base_1.BASE_PATH) => { const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url }); return axios.request(axiosRequestArgs); }; }); }, /** * Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details. * @summary Get Transient Token Data * @param {string} transientToken Transient Token returned by the Unified Checkout application. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionForTransientToken(transientToken, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.TransientTokenDataApiAxiosParamCreator)(configuration).getTransactionForTransientToken(transientToken, options); return (axios = axios_1.default, basePath = base_1.BASE_PATH) => { const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url }); return axios.request(axiosRequestArgs); }; }); }, }; }; exports.TransientTokenDataApiFp = TransientTokenDataApiFp; /** * TransientTokenDataApi - factory interface * @export */ const TransientTokenDataApiFactory = function (configuration, basePath, axios) { return { /** * Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform. * @summary Get Payment Credentials * @param {string} jti The jti field contained within the Transient token returned from a successful Unified Checkout transaction * @param {*} [options] Override http request option. * @throws {RequiredError} */ getPaymentCredentialsForTransientToken(jti, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransientTokenDataApiFp)(configuration).getPaymentCredentialsForTransientToken(jti, options).then((request) => request(axios, basePath)); }); }, /** * Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details. * @summary Get Transient Token Data * @param {string} transientToken Transient Token returned by the Unified Checkout application. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTransactionForTransientToken(transientToken, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransientTokenDataApiFp)(configuration).getTransactionForTransientToken(transientToken, options).then((request) => request(axios, basePath)); }); }, }; }; exports.TransientTokenDataApiFactory = TransientTokenDataApiFactory; /** * TransientTokenDataApi - object-oriented interface * @export * @class TransientTokenDataApi * @extends {BaseAPI} */ class TransientTokenDataApi extends base_1.BaseAPI { /** * Retrieve the Payment data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will return PCI payment data captured by the Unified Checkout platform. * @summary Get Payment Credentials * @param {string} jti The jti field contained within the Transient token returned from a successful Unified Checkout transaction * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransientTokenDataApi */ getPaymentCredentialsForTransientToken(jti, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransientTokenDataApiFp)(this.configuration).getPaymentCredentialsForTransientToken(jti, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Retrieve the data captured by Unified Checkout. This API is used to retrieve the detailed data represented by the Transient Token. This API will not return PCI payment data (PAN). Include the Request ID in the GET request to retrieve the transaction details. * @summary Get Transient Token Data * @param {string} transientToken Transient Token returned by the Unified Checkout application. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof TransientTokenDataApi */ getTransactionForTransientToken(transientToken, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.TransientTokenDataApiFp)(this.configuration).getTransactionForTransientToken(transientToken, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } } exports.TransientTokenDataApi = TransientTokenDataApi;