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
+13 -1
View File
@@ -10,7 +10,8 @@ const {
rialsToToman,
isPaidTransaction,
sumPaidTransactions,
remainingPayable
remainingPayable,
formatPrice
} = require('./paymentAmount');
describe('payment amount helpers', () => {
@@ -40,6 +41,17 @@ describe('payment amount helpers', () => {
});
});
describe('formatPrice', () => {
it('formats numbers and numeric strings with decimal thousand separators', () => {
assert.equal(formatPrice(8000000), '8,000,000');
assert.equal(formatPrice('8000000'), '8,000,000');
assert.equal(formatPrice(500000), '500,000');
assert.equal(formatPrice(0), '0');
assert.equal(formatPrice(''), '');
assert.equal(formatPrice(null), '');
});
});
describe('rialsToToman', () => {
it('drops one zero so spreadsheet Rials become website Toman', () => {
assert.equal(rialsToToman(110_000_000), 11_000_000);