Skip to main content

EVENT SOURCES

Event Sources

Transaction Repository provides two event sources to retrieve data on your webhooks at the same time as the service processes it. To learn more about event sources and how to use them, please see the External Events documentation, this page only covers the Event Source configuration for the Transaction repository.

Transactions

This Event Source provides a way to receive ZIP (DEFLATE algorithm) archives with transactions using a webhook.

idtxr.transactions.v1
typeapplication/zip
descriptionPosLogv6 transaction xml file, zipped

Example webhook


import { inflateSync } from 'zlib';

function webhookController(request, response) {
const body = request.body;
const type = body.type;

if (type === 'txr.transactions.v1') {
const data = body.data;
const transaction = inflateSync(Buffer.from(data, 'base64'));

// Do something with the transaction
}

response.status(200).send();
}

Sequence gaps

This Event Source provides a way to receive notifications about transaction sequence gaps happening within the system.

idtxr.sequence-gaps.v1
typeapplication/json
descriptionTransactions for which sequence gaps were detected

Example webhook


function webhookController(request, response) {
const body = request.body;
const type = body.type;

if (type === 'txr.sequence-gaps.v1') {
const data = body.data;
const sequenceGap = JSON.parse(Buffer.from(data, 'base64'));

console.log(sequenceGap);

// {
// tenantId: 'CIR7nQwtS0rA6t0S6ejd',
// transactionId: '001;01;23;2021-11-1417:13:10;4',
// businessUnitId: '01',
// }


// Do something with the sequence gap
}

response.status(200).send();
}