added dummy function for dynamic bodyshop
This commit is contained in:
@@ -15,19 +15,30 @@ const url = process.env.NODE_ENV
|
|||||||
? "https://secure.cpteller.com/api/custapi.cfc?method=autoterminal"
|
? "https://secure.cpteller.com/api/custapi.cfc?method=autoterminal"
|
||||||
: "https://test.cpteller.com/api/custapi.cfc?method=autoterminal";
|
: "https://test.cpteller.com/api/custapi.cfc?method=autoterminal";
|
||||||
|
|
||||||
|
const getShopCredentials = () => {
|
||||||
|
// add parametes for the request
|
||||||
|
// TODO: Implement retrieval logic later.
|
||||||
|
|
||||||
|
return {
|
||||||
|
merchantkey: "3B8068", //This should be dynamic
|
||||||
|
apikey: "Oepn2B.XqRgzAqHqvOOmYUxD2VW.vGSipi", //This should be dynamic
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
exports.lightbox_credentials = async (req, res) => {
|
exports.lightbox_credentials = async (req, res) => {
|
||||||
//req.user contains firebase decoded credentials
|
//req.user contains firebase decoded credentials
|
||||||
// can add bodyshopid to req.body
|
// can add bodyshopid to req.body
|
||||||
//Server side query to get API credentials for that shop and generatae link
|
//Server side query to get API credentials for that shop and generatae link
|
||||||
|
|
||||||
|
const shopCredentials = getShopCredentials();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const options = {
|
const options = {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "content-type": "application/x-www-form-urlencoded" },
|
headers: { "content-type": "application/x-www-form-urlencoded" },
|
||||||
//TODO: Move these to environment variables/database.
|
//TODO: Move these to environment variables/database.
|
||||||
data: qs.stringify({
|
data: qs.stringify({
|
||||||
merchantkey: "3B8068", //This should be dynamic
|
...shopCredentials,
|
||||||
apikey: "Oepn2B.XqRgzAqHqvOOmYUxD2VW.vGSipi", //This should be dynamic
|
|
||||||
operatingenv:
|
operatingenv:
|
||||||
process.env.NODE_ENV === undefined
|
process.env.NODE_ENV === undefined
|
||||||
? process.env.NODE_ENV
|
? process.env.NODE_ENV
|
||||||
|
|||||||
Reference in New Issue
Block a user