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