Skip to content

Commit 86b73ee

Browse files
Mustache File updates
1 parent 6260526 commit 86b73ee

File tree

2 files changed

+44
-155
lines changed

2 files changed

+44
-155
lines changed

src/ApiClient.js

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
* NOTE: This class is auto generated by the swagger code generator program.
88
* https://github.com/swagger-api/swagger-codegen.git
99
*
10-
* Swagger Codegen version: 2.3.0
10+
* Swagger Codegen version: 2.2.3
1111
*
1212
* Do not edit the class manually.
1313
*
1414
*/
1515

16-
(function(root, factory) {
16+
(function (root, factory) {
1717
if (typeof define === 'function' && define.amd) {
1818
// AMD. Register as an anonymous module.
1919
define(['superagent', 'querystring'], factory);
@@ -27,7 +27,7 @@
2727
}
2828
root.CyberSource.ApiClient = factory(root.superagent, root.querystring);
2929
}
30-
}(this, function(superagent, querystring) {
30+
}(this, function (superagent, querystring) {
3131
'use strict';
3232

3333
/**
@@ -42,11 +42,11 @@
4242
* @alias module:ApiClient
4343
* @class
4444
*/
45-
var exports = function() {
45+
var exports = function () {
4646
/**
4747
* The base URL against which to resolve every API call's (relative) path.
4848
* @type {String}
49-
* @default https://apitest.cybersource.com
49+
* @default https://api.cybersource.com
5050
*/
5151
this.basePath = 'https://apitest.cybersource.com'.replace(/\/+$/, '');
5252

@@ -93,9 +93,9 @@
9393
this.agent = new superagent.agent();
9494
}
9595

96-
/**
97-
* The filepath where reports are downloaded
98-
*/
96+
/**
97+
* The filepath where reports are downloaded
98+
*/
9999
this.downloadFilePath = '';
100100
};
101101

@@ -104,7 +104,7 @@
104104
* @param param The actual parameter.
105105
* @returns {String} The string representation of <code>param</code>.
106106
*/
107-
exports.prototype.paramToString = function(param) {
107+
exports.prototype.paramToString = function (param) {
108108
if (param == undefined || param == null) {
109109
return '';
110110
}
@@ -121,13 +121,13 @@
121121
* @param {Object} pathParams The parameter values to append.
122122
* @returns {String} The encoded path with parameter values substituted.
123123
*/
124-
exports.prototype.buildUrl = function(path, pathParams) {
124+
exports.prototype.buildUrl = function (path, pathParams) {
125125
if (!path.match(/^\//)) {
126126
path = '/' + path;
127127
}
128128
var url = this.basePath + path;
129129
var _this = this;
130-
url = url.replace(/\{([\w-]+)\}/g, function(fullMatch, key) {
130+
url = url.replace(/\{([\w-]+)\}/g, function (fullMatch, key) {
131131
var value;
132132
if (pathParams.hasOwnProperty(key)) {
133133
value = _this.paramToString(pathParams[key]);
@@ -150,7 +150,7 @@
150150
* @param {String} contentType The MIME content type to check.
151151
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
152152
*/
153-
exports.prototype.isJsonMime = function(contentType) {
153+
exports.prototype.isJsonMime = function (contentType) {
154154
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
155155
};
156156

@@ -159,7 +159,7 @@
159159
* @param {Array.<String>} contentTypes
160160
* @returns {String} The chosen content type, preferring JSON.
161161
*/
162-
exports.prototype.jsonPreferredMime = function(contentTypes) {
162+
exports.prototype.jsonPreferredMime = function (contentTypes) {
163163
for (var i = 0; i < contentTypes.length; i++) {
164164
if (this.isJsonMime(contentTypes[i])) {
165165
return contentTypes[i];
@@ -173,13 +173,13 @@
173173
* @param param The parameter to check.
174174
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
175175
*/
176-
exports.prototype.isFileParam = function(param) {
176+
exports.prototype.isFileParam = function (param) {
177177
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
178178
if (typeof require === 'function') {
179179
var fs;
180180
try {
181181
fs = require('fs');
182-
} catch (err) {}
182+
} catch (err) { }
183183
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
184184
return true;
185185
}
@@ -209,7 +209,7 @@
209209
* @param {Object.<String, Object>} params The parameters as object properties.
210210
* @returns {Object.<String, Object>} normalized parameters.
211211
*/
212-
exports.prototype.normalizeParams = function(params) {
212+
exports.prototype.normalizeParams = function (params) {
213213
var newParams = {};
214214
for (var key in params) {
215215
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
@@ -290,9 +290,9 @@
290290
* @param {Object} request The request object created by a <code>superagent()</code> call.
291291
* @param {Array.<String>} authNames An array of authentication method names.
292292
*/
293-
exports.prototype.applyAuthToRequest = function(request, authNames) {
293+
exports.prototype.applyAuthToRequest = function (request, authNames) {
294294
var _this = this;
295-
authNames.forEach(function(authName) {
295+
authNames.forEach(function (authName) {
296296
var auth = _this.authentications[authName];
297297
switch (auth.type) {
298298
case 'basic':
@@ -317,7 +317,7 @@
317317
break;
318318
case 'oauth2':
319319
if (auth.accessToken) {
320-
request.set({'Authorization': 'Bearer ' + auth.accessToken});
320+
request.set({ 'Authorization': 'Bearer ' + auth.accessToken });
321321
}
322322
break;
323323
default:
@@ -348,8 +348,8 @@
348348
}
349349
return exports.convertToType(data, returnType);
350350
};
351-
352-
// Code added by Infosys dev team
351+
352+
// Code added by Infosys dev team
353353

354354
var AuthenticationSDK = require('cybersource-rest-auth');
355355
/**
@@ -361,7 +361,7 @@
361361

362362
this.merchantConfig = new AuthenticationSDK.MerchantConfig(configObject);
363363
this.constants = AuthenticationSDK.Constants;
364-
this.basePath = this.constants.HTTP_URL_PREFIX + this.merchantConfig.getRequestHost();
364+
this.basePath = this.constants.HTTP_URL_PREFIX + this.merchantConfig.getRequestHost();
365365
this.logger = AuthenticationSDK.Logger.getLogger(this.merchantConfig);
366366
}
367367

@@ -416,7 +416,7 @@
416416

417417
return headerParams;
418418
}
419-
419+
420420
/**
421421
* Callback function to receive the result of the operation.
422422
* @callback module:ApiClient~callApiCallback
@@ -443,8 +443,8 @@
443443
* @returns {Object} The SuperAgent request object.
444444
*/
445445
exports.prototype.callApi = function callApi(path, httpMethod, pathParams,
446-
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
447-
returnType, callback) {
446+
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
447+
returnType, callback) {
448448

449449
var _this = this;
450450
var url = this.buildUrl(path, pathParams);
@@ -455,11 +455,11 @@
455455

456456
// set query parameters
457457
if (httpMethod.toLowerCase() === this.constants.GET && this.cache === false) {
458-
queryParams['_'] = new Date().getTime();
458+
queryParams['_'] = new Date().getTime();
459459
}
460460
request.query(this.normalizeParams(queryParams));
461461

462-
/**
462+
/**
463463
*added by infosys team, to generate requestTarget with pathParam
464464
*/
465465
var requestTarget = this.buildRequestTarget(path, pathParams, queryParams);
@@ -469,8 +469,8 @@
469469
|| httpMethod.toLowerCase() === this.constants.PUT) {
470470
bodyParam = JSON.stringify(bodyParam, null, 0);
471471
}
472-
headerParams = this.callAuthenticationHeader(httpMethod, requestTarget, bodyParam, headerParams);
473-
472+
headerParams = this.callAuthenticationHeader(httpMethod, requestTarget, bodyParam, headerParams);
473+
474474
// set header parameters
475475
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
476476

@@ -480,7 +480,7 @@
480480
var contentType = this.jsonPreferredMime(contentTypes);
481481
if (contentType) {
482482
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
483-
if(contentType != 'multipart/form-data') {
483+
if (contentType != 'multipart/form-data') {
484484
request.type(contentType);
485485
}
486486
} else if (!request.header['Content-Type']) {
@@ -508,7 +508,7 @@
508508
var accept = this.jsonPreferredMime(accepts);
509509
if (accept) {
510510
request.accept(accept);
511-
/* Code for downloading file from stream */
511+
/* Code for downloading file from stream */
512512
if (accept === 'application/xml') {
513513
var fs = require('fs');
514514
var stream = fs.createWriteStream(this.downloadFilePath);
@@ -524,7 +524,7 @@
524524
}
525525

526526
// Attach previously saved cookies, if enabled
527-
if (this.enableCookies){
527+
if (this.enableCookies) {
528528
if (typeof window === 'undefined') {
529529
this.agent.attachCookies(request);
530530
}
@@ -533,14 +533,13 @@
533533
}
534534
}
535535

536-
537-
request.end(function(error, response) {
536+
request.end(function (error, response) {
538537
if (callback) {
539538
var data = null;
540539
if (!error) {
541540
try {
542541
data = _this.deserialize(response, returnType);
543-
if (_this.enableCookies && typeof window === 'undefined'){
542+
if (_this.enableCookies && typeof window === 'undefined') {
544543
_this.agent.saveCookies(response);
545544
}
546545
} catch (err) {
@@ -592,13 +591,13 @@
592591
}
593592
return requestTarget;
594593
};
595-
594+
596595
/**
597596
* Parses an ISO-8601 string representation of a date value.
598597
* @param {String} str The date value as a string.
599598
* @returns {Date} The parsed date object.
600599
*/
601-
exports.parseDate = function(str) {
600+
exports.parseDate = function (str) {
602601
return new Date(str.replace(/T/i, ' '));
603602
};
604603

@@ -611,7 +610,7 @@
611610
* all properties on <code>data<code> will be converted to this type.
612611
* @returns An instance of the specified type or null or undefined if data is null or undefined.
613612
*/
614-
exports.convertToType = function(data, type) {
613+
exports.convertToType = function (data, type) {
615614
if (data === null || data === undefined)
616615
return data
617616

@@ -627,7 +626,7 @@
627626
case 'Date':
628627
return this.parseDate(String(data));
629628
case 'Blob':
630-
return data;
629+
return data;
631630
default:
632631
if (type === Object) {
633632
// generic object, return directly
@@ -638,7 +637,7 @@
638637
} else if (Array.isArray(type)) {
639638
// for array type like: ['String']
640639
var itemType = type[0];
641-
return data.map(function(item) {
640+
return data.map(function (item) {
642641
return exports.convertToType(item, itemType);
643642
});
644643
} else if (typeof type === 'object') {
@@ -672,7 +671,7 @@
672671
* @param data {Object|Array} The REST data.
673672
* @param obj {Object|Array} The target object or array.
674673
*/
675-
exports.constructFromObject = function(data, obj, itemType) {
674+
exports.constructFromObject = function (data, obj, itemType) {
676675
if (Array.isArray(data)) {
677676
for (var i = 0; i < data.length; i++) {
678677
if (data.hasOwnProperty(i))

0 commit comments

Comments
 (0)