mastercard-api-core
Version:
Core functionality for MasterCard API
101 lines (90 loc) • 3.53 kB
JavaScript
/*
* Copyright 2016 MasterCard International.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
* Neither the name of the MasterCard International Incorporated nor the names of its
* contributors may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
var pkgJson = require('../package.json');
/**
* This module defines is an object with constant values.
*
* @class constants
* @static
*/
var constants = {};
/**
* Version of the SDK
* Retrieved from package.json
*
* @type {string}
*/
constants.CORE = "mastercard-api-core(nodejs)";
constants.VERSION = pkgJson.version;
/**
* Returns the SDK Core Version
* @returns {String}
*/
constants.getCoreVersion = function () {
return constants.CORE+":"+constants.VERSION;
};
/**
* This is the Environment enums which are idenfified in the system
*/
constants.Environment = {
PRODUCTION: "production",
PRODUCTION_MTF: "production_mtf",
PRODUCTION_ITF: "production_itf",
SANDBOX: "sandbox",
SANDBOX_STATIC: "sandbox_static",
SANDBOX_MTF: "sandbox_mtf",
SANDBOX_ITF: "sandbox_itf",
STAGE: "stage",
STAGE_MTF: "stage_mtf",
STAGE_ITF: "stage_itf",
DEV: "dev",
LOCALHOST: "localhost",
OTHER: "other",
ITF: "itf",
PERF: "perf"
};
/**
* This is the Mapping where an environment is mapped to
* Host and Context
*/
constants.Mapping = {
"production": ["https://api.mastercard.com", null],
"production_mtf": ["https://api.mastercard.com", "mtf"],
"production_itf": ["https://api.mastercard.com", "itf"],
"sandbox": ["https://sandbox.api.mastercard.com", null],
"sandbox_static": ["https://sandbox.api.mastercard.com", "static"],
"sandbox_mtf": ["https://sandbox.api.mastercard.com", "mtf"],
"sandbox_itf": ["https://sandbox.api.mastercard.com", "itf"],
"stage": ["https://stage.api.mastercard.com", null],
"stage_mtf": ["https://stage.api.mastercard.com", "mtf"],
"stage_itf": ["https://stage.api.mastercard.com", "itf"],
"dev": ["https://dev.api.mastercard.com", null],
"localhost": ["http://localhost:8081", null],
"itf": ["https://itf.api.mastercard.com", null],
"perf": ["https://perf.api.mastercard.com", null]
};
module.exports = constants;