@kontist/mock-solaris
Advanced tools
@@ -301,2 +301,3 @@ "use strict"; | ||
router.post("/webhooks", checkRequestHostHeader, (0, safeRequestHandler_1.safeRequestHandler)(webhooksAPI.createWebhookHandler)); | ||
router.delete("/webhooks/:webhookType", checkRequestHostHeader, (0, safeRequestHandler_1.safeRequestHandler)(webhooksAPI.deleteWebhookHandler)); | ||
// HEALTH CHECK | ||
@@ -303,0 +304,0 @@ app.get("/health", (req, res) => { |
@@ -29,2 +29,3 @@ import { DeviceActivityPayload, DeviceConsent, DeviceConsentPayload, MockPerson } from "./helpers/types"; | ||
export declare const saveWebhook: (webhook: any) => any; | ||
export declare const deleteWebhook: (webhookType: string) => any; | ||
export declare const flushDb: () => any; | ||
@@ -31,0 +32,0 @@ export declare const getPersonBookings: (person: any) => any; |
@@ -30,3 +30,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getPersonOrigin = exports.getDeviceActivities = exports.createDeviceActivity = exports.updateDeviceConsent = exports.getDeviceConsents = exports.createDeviceConsent = exports.setPersonOrigin = exports.getPersonByDeviceId = exports.getCard = exports.getPersonByFraudCaseId = exports.getCardData = exports.saveCardReference = exports.hasCardReference = exports.getCardReferences = exports.getSmsToken = exports.getPersonBookings = exports.flushDb = exports.saveWebhook = exports.saveSepaDirectDebitReturn = exports.getSepaDirectDebitReturns = exports.getWebhookByType = exports.getWebhooks = exports.findPersonByAccountIBAN = exports.findPersonByAccountId = exports.findPersonByAccountField = exports.getAllIdentifications = exports.getAllPersons = exports.saveBooking = exports.saveDeviceChallenge = exports.deleteDeviceChallenge = exports.getDeviceChallenge = exports.saveDevice = exports.getDevicesByPersonId = exports.getAllDevices = exports.getDevice = exports.deleteMobileNumber = exports.saveMobileNumber = exports.getMobileNumber = exports.saveTaxIdentifications = exports.getTaxIdentifications = exports.savePerson = exports.getTechnicalUserPerson = exports.getPerson = exports.migrate = void 0; | ||
exports.getPersonOrigin = exports.getDeviceActivities = exports.createDeviceActivity = exports.updateDeviceConsent = exports.getDeviceConsents = exports.createDeviceConsent = exports.setPersonOrigin = exports.getPersonByDeviceId = exports.getCard = exports.getPersonByFraudCaseId = exports.getCardData = exports.saveCardReference = exports.hasCardReference = exports.getCardReferences = exports.getSmsToken = exports.getPersonBookings = exports.flushDb = exports.deleteWebhook = exports.saveWebhook = exports.saveSepaDirectDebitReturn = exports.getSepaDirectDebitReturns = exports.getWebhookByType = exports.getWebhooks = exports.findPersonByAccountIBAN = exports.findPersonByAccountId = exports.findPersonByAccountField = exports.getAllIdentifications = exports.getAllPersons = exports.saveBooking = exports.saveDeviceChallenge = exports.deleteDeviceChallenge = exports.getDeviceChallenge = exports.saveDevice = exports.getDevicesByPersonId = exports.getAllDevices = exports.getDevice = exports.deleteMobileNumber = exports.saveMobileNumber = exports.getMobileNumber = exports.saveTaxIdentifications = exports.getTaxIdentifications = exports.savePerson = exports.getTechnicalUserPerson = exports.getPerson = exports.migrate = void 0; | ||
const lodash_1 = __importDefault(require("lodash")); | ||
@@ -344,2 +344,6 @@ const bluebird_1 = __importDefault(require("bluebird")); | ||
exports.saveWebhook = saveWebhook; | ||
const deleteWebhook = (webhookType) => { | ||
return redisClient.delAsync(`${process.env.MOCKSOLARIS_REDIS_PREFIX}:webhook:${webhookType}`); | ||
}; | ||
exports.deleteWebhook = deleteWebhook; | ||
const flushDb = () => { | ||
@@ -346,0 +350,0 @@ return redisClient.flushdbAsync(); |
export declare const indexWebhooksHandler: (req: any, res: any) => Promise<void>; | ||
export declare const createWebhookHandler: (req: any, res: any) => Promise<void>; | ||
export declare const deleteWebhookHandler: (req: any, res: any) => Promise<void>; |
@@ -29,3 +29,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createWebhookHandler = exports.indexWebhooksHandler = void 0; | ||
exports.deleteWebhookHandler = exports.createWebhookHandler = exports.indexWebhooksHandler = void 0; | ||
const node_uuid_1 = __importDefault(require("node-uuid")); | ||
@@ -68,2 +68,9 @@ const db_1 = require("../db"); | ||
exports.createWebhookHandler = createWebhookHandler; | ||
const deleteWebhookHandler = async (req, res) => { | ||
const { webhookType } = req.params; | ||
log.info("deleteWebhook", { webhookType }); | ||
await (0, db_1.deleteWebhook)(webhookType); | ||
res.status(204).send(); | ||
}; | ||
exports.deleteWebhookHandler = deleteWebhookHandler; | ||
//# sourceMappingURL=webhooks.js.map |
{ | ||
"name": "@kontist/mock-solaris", | ||
"version": "1.0.64", | ||
"version": "1.0.65", | ||
"description": "Mock Service for Solaris API", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
1040229
0.13%17727
0.08%70
1.45%