fix: format prices in notifications, change partial payment label, and add session holding notify API
This commit is contained in:
@@ -7,7 +7,7 @@ const Course = require('../components/courses/courseModel');
|
||||
const eventEmitter = require('../events/eventEmitter');
|
||||
const EVENT_NAMES = require('../constants/eventNames');
|
||||
const logger = require('../utils/logger');
|
||||
const { getPayableAmount } = require('../utils/paymentAmount');
|
||||
const { getPayableAmount, formatPrice } = require('../utils/paymentAmount');
|
||||
const { notifyAction } = require('../utils/actionNotify');
|
||||
const { sendPaymentReminderSms } = require('../utils/senders/smsMessages');
|
||||
const { resolveNotifyFlags } = require('../utils/notifyResolver');
|
||||
@@ -30,6 +30,7 @@ const notifyPaymentReminder = async (payment, user) => {
|
||||
}
|
||||
|
||||
const amountDue = getPayableAmount(payment) - (payment.paidAmount || 0);
|
||||
const formattedAmountDue = formatPrice(amountDue);
|
||||
|
||||
await notifyAction({
|
||||
actionKey: 'paymentReminder',
|
||||
@@ -37,7 +38,7 @@ const notifyPaymentReminder = async (payment, user) => {
|
||||
phoneNumber: user.phoneNumber,
|
||||
email: user.email,
|
||||
subject: 'یادآوری سررسید پرداخت',
|
||||
body: `یادآوری: مبلغ ${amountDue} تومان تا ${formatDueDate(payment.dueDate)} سررسید دارد. کد صورتحساب: ${payment.uniqueCode || ''}`,
|
||||
body: `یادآوری: مبلغ ${formattedAmountDue} تومان تا ${formatDueDate(payment.dueDate)} سررسید دارد. کد صورتحساب: ${payment.uniqueCode || ''}`,
|
||||
smsHandler: () => sendPaymentReminderSms(user.phoneNumber, {
|
||||
fullName: user.name || '',
|
||||
amount: amountDue,
|
||||
|
||||
Reference in New Issue
Block a user