From 56c366e9e80c61cad8c2c75140f231f9a905b7b1 Mon Sep 17 00:00:00 2001 From: swtmply Date: Wed, 15 Mar 2023 03:44:33 +0800 Subject: [PATCH] added dummy function for dynamic bodyshop --- server/intellipay/intellipay.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server/intellipay/intellipay.js b/server/intellipay/intellipay.js index 1ee08b38d..6196dc729 100644 --- a/server/intellipay/intellipay.js +++ b/server/intellipay/intellipay.js @@ -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