This code provides mock data and configurations for testing interactions with Eloqua's API, simulating real-world scenarios without requiring live connections.
npm run import -- "eloqua import blueprints"
function getImportData() {
return {
"AccountId": '1234',
"ActProduct": 'premium',
"EmailAddress": "brian.cullinan@swiftpage.com",
"ExpirationMonth": '12',
"ExpirationYear": '2017',
"Last4DigitsOfCard": '1234',
"Quantity": 5,
"RenewalDate": '11/12/2017',
"RenewalsStatus": "Drew loves marketing!",
"RepName": 'Brian',
"RORName": 'James',
"RORNumber": '1111',
"State": 'AZ',
}
}
function getOauthToken() {
return {
"access_token": "access_token",
"token_type": "bearer",
"expires_in": 28800,
"refresh_token": "refresh_token",
"expires": (new Date()).getTime() + 28800
}
}
function getEloquaConfig() {
return {
"authorize_uri":"http://localhost:18888/auth/oauth2/authorize",
"token_uri":"http://localhost:18888/auth/oauth2/token",
"rest_api_url":"http://localhost:18888",
"rest_client_id":"client-id",
"rest_secret":"secret",
"rest_api_company": "swiftpage",
"rest_api_user":"username",
"rest_api_password":"password"
}
}
module.exports = {
getImportData,
getOauthToken,
getEloquaConfig
};
// Import Data Model
const IMPORT_DATA_MODEL = {
accountId: '',
actProduct: '',
emailAddress: '',
expirationMonth: '',
expirationYear: '',
last4DigitsOfCard: '',
quantity: 0,
renewalDate: '',
renewalsStatus: '',
repName: '',
rorName: '',
rorNumber: '',
state: '',
};
// Implement a function to populate the import data model
function createImportData() {
const data = {...IMPORT_DATA_MODEL };
data.accountId = '1234';
data.actProduct = 'premium';
data.emailAddress = 'brian.cullinan@swiftpage.com';
data.expirationMonth = '12';
data.expirationYear = '2017';
data.last4DigitsOfCard = '1234';
data.quantity = 5;
data.renewalDate = '11/12/2017';
data.renewalsStatus = 'Drew loves marketing!';
data.repName = 'Brian';
data.rorName = 'James';
data.rorNumber = '1111';
data.state = 'AZ';
return data;
}
// OAuth Token Model
const OAUTH_TOKEN_MODEL = {
accessToken: '',
tokenType: '',
expiresIn: 0,
refreshToken: '',
expires: 0,
};
// Implement a function to create an OAuth token
function createOauthToken() {
const token = {...OAUTH_TOKEN_MODEL };
token.accessToken = 'access_token';
token.tokenType = 'bearer';
token.expiresIn = 28800;
token.refreshToken ='refresh_token';
token.expires = new Date().getTime() + 28800;
return token;
}
// Eloqua Configuration Model
const ELOQUA_CONFIG_MODEL = {
authorizeUri: '',
tokenUri: '',
restApiUrl: '',
clientId: '',
secret: '',
company: '',
userId: '',
password: '',
};
// Implement a function to create an Eloqua configuration
function createEloquaConfig() {
const config = {...ELOQUA_CONFIG_MODEL };
config.authorizeUri = 'http://localhost:18888/auth/oauth2/authorize';
config.tokenUri = 'http://localhost:18888/auth/oauth2/token';
config.restApiUrl = 'http://localhost:18888';
config.clientId = 'client-id';
config.secret ='secret';
config.company ='swiftpage';
config.userId = 'username';
config.password = 'password';
return config;
}
// Export the functions
module.exports = {
createImportData,
createOauthToken,
createEloquaConfig,
};
This code defines three functions that provide mock data for interacting with Eloqua, a marketing automation platform.
Here's a breakdown:
getImportData()
:
AccountId
, ActProduct
, EmailAddress
, ExpirationMonth
, etc., which are likely used to define customer information or subscription details.getOauthToken()
:
access_token
, token_type
, expires_in
, refresh_token
, and expires
, simulating a valid access token for authentication with Eloqua's API.getEloquaConfig()
:
authorize_uri
, token_uri
, rest_api_url
, rest_client_id
, rest_secret
, rest_api_company
, rest_api_user
, and rest_api_password
. These are used to connect to Eloqua's API endpoints and authenticate requests.Purpose:
This code likely serves as a testing utility or a placeholder for real Eloqua API interactions in a development environment. It provides pre-defined data and configurations to simulate real-world scenarios without requiring actual connections to Eloqua's servers.