Skip to content

Commit 8c17074

Browse files
authored
Merge pull request #8 from CyberSource/cybersource-rest-client-bugfix-dec17
bug fixes
2 parents fe950af + 6c7a505 commit 8c17074

23 files changed

+33
-32
lines changed

src/ApiClient.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +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();
364365
this.logger = AuthenticationSDK.Logger.getLogger(this.merchantConfig);
365366
}
366367

@@ -377,17 +378,17 @@
377378
this.merchantConfig.setRequestType(httpMethod)
378379
this.merchantConfig.setRequestJsonData(requestBody);
379380

380-
this.logger.info("Authentication Type : " + this.merchantConfig.getAuthenticationType());
381+
this.logger.info('Authentication Type : ' + this.merchantConfig.getAuthenticationType());
381382
this.logger.info(this.constants.REQUEST_TYPE + ' : ' + httpMethod.toUpperCase());
382383

383384
var token = AuthenticationSDK.Authorization.getToken(this.merchantConfig, this.logger);
384385

385-
if (this.merchantConfig.getAuthenticationType() === this.constants.JWT) {
386-
token = "Bearer " + token;
386+
if (this.merchantConfig.getAuthenticationType().toLowerCase() === this.constants.JWT) {
387+
token = 'Bearer ' + token;
387388
headerParams['Authorization'] = token;
388389
this.logger.info(this.constants.AUTHORIZATION + ' : ' + token);
389390
}
390-
else if (this.merchantConfig.getAuthenticationType() === this.constants.HTTP) {
391+
else if (this.merchantConfig.getAuthenticationType().toLowerCase() === this.constants.HTTP) {
391392
var date = new Date(Date.now()).toUTCString();
392393

393394
if (httpMethod.toLowerCase() === this.constants.POST
@@ -405,11 +406,11 @@
405406
headerParams['signature'] = token;
406407
headerParams['User-Agent'] = this.constants.USER_AGENT_VALUE;
407408

408-
this.logger.info("v-c-merchant-id : " + this.merchantConfig.getMerchantID());
409-
this.logger.info("date : " + date);
410-
this.logger.info("host : " + this.merchantConfig.getRequestHost());
411-
this.logger.info("signature : " + token);
412-
this.logger.info("User-Agent : " + headerParams['User-Agent']);
409+
this.logger.info('v-c-merchant-id : ' + this.merchantConfig.getMerchantID());
410+
this.logger.info('date : ' + date);
411+
this.logger.info('host : ' + this.merchantConfig.getRequestHost());
412+
this.logger.info('signature : ' + token);
413+
this.logger.info('User-Agent : ' + headerParams['User-Agent']);
413414
this.logger.info(this.constants.END_TRANSACTION);
414415
}
415416

src/api/CaptureApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/CreditApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/FlexTokenApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/InstrumentIdentifierApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/InstrumentIdentifiersApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/KeyGenerationApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/NotificationOfChangesApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/PaymentInstrumentsApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

src/api/PaymentsApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* @param {module:ApiClient} apiClient Optional API client implementation to use,
4444
* default to {@link module:ApiClient#instance} if unspecified.
4545
*/
46-
var exports = function(configObject, apiClient = undefined) {
46+
var exports = function(configObject, apiClient) {
4747
this.apiClient = apiClient || ApiClient.instance;
4848

4949
this.apiClient.setConfiguration(configObject);

0 commit comments

Comments
 (0)