Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.4.0] - 2025-07-08

- Feat: send alert message

## [2.3.2] - 2025-01-28

- Fix: payment 0
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orderingstack/pos-integrator-core",
"version": "2.3.3",
"version": "2.4.0",
"description": "Ordering Stack POS integrator core - library for easy developing POS integrations with Ordering Stack platform.",
"scripts": {
"test": "jest",
Expand Down
43 changes: 43 additions & 0 deletions src/authorization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,46 @@ export async function checkAndOptionallyAskForCredentials(
} while (!token);
return token;
}

export enum AlertSeverity {
DEBUG,
INFO,
WARN,
ERROR,
CRITICAL,
}

export async function sendAlertMessage(
accessToken: string,
message: {
source: string;
eventName: string;
severity: AlertSeverity;
dateTime?: string;
user?: string;
tenant?: string;
orderId?: string;
venues?: string[];
params?: Record<string, string>;
},
) {
if (!message.dateTime) message.dateTime = new Date().toISOString();
try {
const response = await axios.post(
`${process.env.BASE_URL}/alert-service/message`,
message,
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${accessToken}`,
},
},
);
return { data: response.data };
} catch (error) {
return {
data: null,
error: error,
};
}
}