added dummy function for dynamic bodyshop

This commit is contained in:
swtmply
2023-03-15 03:44:33 +08:00
parent 07b7394fec
commit 56c366e9e8

View File

@@ -15,19 +15,30 @@ const url = process.env.NODE_ENV
? "https://secure.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) => {
//req.user contains firebase decoded credentials
// can add bodyshopid to req.body
//Server side query to get API credentials for that shop and generatae link
const shopCredentials = getShopCredentials();
try {
const options = {
method: "POST",
headers: { "content-type": "application/x-www-form-urlencoded" },
//TODO: Move these to environment variables/database.
data: qs.stringify({
merchantkey: "3B8068", //This should be dynamic
apikey: "Oepn2B.XqRgzAqHqvOOmYUxD2VW.vGSipi", //This should be dynamic
...shopCredentials,
operatingenv:
process.env.NODE_ENV === undefined
? process.env.NODE_ENV