This commit is contained in:
aozhiwei 2024-06-27 14:51:34 +08:00
parent 2a96c0ab55
commit 1b8a26fafe

View File

@ -47,12 +47,13 @@ async function webhooks(req, rsp) {
const events = []; const events = [];
let sdkEnv = config.Environment.PRODUCTION; let sdkEnv = config.Environment.PRODUCTION;
if (utils.isOnlineEnv()) { if (!utils.isOnlineEnv()) {
console.log('SANDBOX Environment');
sdkEnv = config.Environment.SANDBOX; sdkEnv = config.Environment.SANDBOX;
} }
await webhook.handle( // this method will handle the subscription confirmation and signature & sender verification await webhook.handle( // this method will handle the subscription confirmation and signature & sender verification
req.body, req.body,
config.Environment.SANDBOX, // or config.Environment.PRODUCTION sdkEnv, // or config.Environment.PRODUCTION
{ {
all: (event) => { // all events will trigger this handler, even if they have a specific handler already. all: (event) => { // all events will trigger this handler, even if they have a specific handler already.
events.push(event); events.push(event);