Link bonus notifications to bonus program
This commit is contained in:
@@ -234,6 +234,10 @@ async function applyManualOrderStatus(context, order, manager, status) {
|
||||
context.prisma,
|
||||
referralBonus.transaction.userId,
|
||||
`Начислен бонус: ${toFloat(referralBonus.transaction.amount)} за заказ ${updated.code}.`,
|
||||
{
|
||||
buttonUrl: buildFrontendAppUrl(buildBonusProgramPath('auto-balance')),
|
||||
buttonText: 'Открыть бонусную программу',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -480,6 +484,18 @@ function buildUserOrderPath(orderId, role) {
|
||||
: `/orders/${normalizedOrderId}`;
|
||||
}
|
||||
|
||||
function buildBonusProgramPath(entry = 'bonus-message') {
|
||||
const normalizedEntry = String(entry || '').trim();
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (normalizedEntry) {
|
||||
params.set('entry', normalizedEntry);
|
||||
}
|
||||
|
||||
const query = params.toString();
|
||||
return query ? `/bonus-program?${query}` : '/bonus-program';
|
||||
}
|
||||
|
||||
async function notifyOrderStakeholders(context, order, status, note) {
|
||||
const recipients = [order.customerId, order.managerId].filter(Boolean);
|
||||
if (!recipients.length) {
|
||||
@@ -1894,6 +1910,10 @@ export const resolvers = {
|
||||
context.prisma,
|
||||
transaction.userId,
|
||||
`Начислен бонус: ${toFloat(transaction.amount)}. Причина: ${transaction.reason}`,
|
||||
{
|
||||
buttonUrl: buildFrontendAppUrl(buildBonusProgramPath('manual-balance')),
|
||||
buttonText: 'Открыть бонусную программу',
|
||||
},
|
||||
);
|
||||
|
||||
return transaction;
|
||||
@@ -1938,6 +1958,10 @@ export const resolvers = {
|
||||
context.prisma,
|
||||
withdrawal.requesterId,
|
||||
`Заявка на вывод вознаграждения обновлена: ${withdrawal.status}.${withdrawal.reviewComment ? ` Комментарий: ${withdrawal.reviewComment}` : ''}`,
|
||||
{
|
||||
buttonUrl: buildFrontendAppUrl(buildBonusProgramPath('withdrawal-review')),
|
||||
buttonText: 'Проверить бонусную программу',
|
||||
},
|
||||
);
|
||||
|
||||
return withdrawal;
|
||||
|
||||
Reference in New Issue
Block a user