From 20480239fb59e6e546a485953b6373c3147f3521 Mon Sep 17 00:00:00 2001 From: Wisley Alves Date: Thu, 24 Aug 2023 22:58:30 -0300 Subject: [PATCH] chore(index): set function checkBillet --- functions/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/functions/index.js b/functions/index.js index ff19e1c..622eea4 100644 --- a/functions/index.js +++ b/functions/index.js @@ -24,6 +24,8 @@ const { app, procedures } = require('./ecom.config') // https://github.com/ecomplus/application-sdk const { ecomServerIps, setup } = require('@ecomplus/application-sdk') +const checkBillet = require('./lib/banrisul/check-billet') + server.use(bodyParser.urlencoded({ extended: false })) server.use(bodyParser.json()) @@ -143,3 +145,12 @@ exports.updateTokens = functions.pubsub.schedule(cron).onRun(() => { }) }) console.log(`-- Sheduled update E-Com Plus tokens '${cron}'`) + +// schedule check billets +const cronCheckBillets = '10 3 * * *' +exports.checkBillets = functions.pubsub.schedule(cronCheckBillets).onRun(() => { + return prepareAppSdk().then(appSdk => { + return checkBillet(admin, appSdk) + }) +}) +console.log(`-- Sheduled check billets Banrisul '${cronCheckBillets}'`)