fix: format prices in notifications, change partial payment label, and add session holding notify API

This commit is contained in:
2026-08-21 20:17:30 +03:30
parent 6839685a21
commit 4c07ca2ae1
9 changed files with 145 additions and 14 deletions
+21 -1
View File
@@ -382,13 +382,33 @@ const resolveVariablesList = (def, storedVariables) => {
.filter(Boolean);
};
const isPriceSlot = (slot = '', name = '') => {
const s = String(slot).toLowerCase();
const n = String(name).toLowerCase();
return s.includes('amount') || s.includes('price') || s.includes('tuition') || s.includes('fee')
|| n.includes('amount') || n.includes('price') || n.includes('tuition') || n.includes('fee') || n.includes('cost');
};
const formatPriceValue = (val) => {
if (val === null || val === undefined || val === '') return '';
const str = String(val).trim();
const rawNum = Number(str.replace(/,/g, ''));
if (!Number.isNaN(rawNum) && Number.isFinite(rawNum)) {
return rawNum.toLocaleString('en-US');
}
return str;
};
const buildSmsParameters = (variables, valuesBySlot = {}) => {
return normalizeVariablesInput(variables, null)
.map((item) => {
const name = sanitizeVariableName(item?.name);
if (!name) return null;
const slot = item?.slot;
const value = slot ? valuesBySlot?.[slot] : '';
let value = slot ? valuesBySlot?.[slot] : '';
if (isPriceSlot(slot, name) && value != null && value !== '') {
value = formatPriceValue(value);
}
return {
name,
value: String(value ?? '')