mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into 2134-send-email-when-admin-writes-message-to-contribution
This commit is contained in:
commit
f261e76a38
@ -8,7 +8,10 @@ import { Context, getUser } from '@/server/context'
|
|||||||
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
||||||
import { getCustomRepository, getConnection } from '@dbTools/typeorm'
|
import { getCustomRepository, getConnection } from '@dbTools/typeorm'
|
||||||
|
|
||||||
import { sendTransactionReceivedEmail } from '@/mailer/sendTransactionReceivedEmail'
|
import {
|
||||||
|
sendTransactionLinkRedeemedEmail,
|
||||||
|
sendTransactionReceivedEmail,
|
||||||
|
} from '@/mailer/sendTransactionReceivedEmail'
|
||||||
|
|
||||||
import { Transaction } from '@model/Transaction'
|
import { Transaction } from '@model/Transaction'
|
||||||
import { TransactionList } from '@model/TransactionList'
|
import { TransactionList } from '@model/TransactionList'
|
||||||
@ -154,6 +157,19 @@ export const executeTransaction = async (
|
|||||||
memo,
|
memo,
|
||||||
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
|
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
|
||||||
})
|
})
|
||||||
|
if (transactionLink) {
|
||||||
|
await sendTransactionLinkRedeemedEmail({
|
||||||
|
senderFirstName: recipient.firstName,
|
||||||
|
senderLastName: recipient.lastName,
|
||||||
|
recipientFirstName: sender.firstName,
|
||||||
|
recipientLastName: sender.lastName,
|
||||||
|
email: sender.email,
|
||||||
|
senderEmail: recipient.email,
|
||||||
|
amount,
|
||||||
|
memo,
|
||||||
|
overviewURL: CONFIG.EMAIL_LINK_OVERVIEW,
|
||||||
|
})
|
||||||
|
}
|
||||||
logger.info(`finished executeTransaction successfully`)
|
logger.info(`finished executeTransaction successfully`)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { backendLogger as logger } from '@/server/logger'
|
import { backendLogger as logger } from '@/server/logger'
|
||||||
import Decimal from 'decimal.js-light'
|
import Decimal from 'decimal.js-light'
|
||||||
import { sendEMail } from './sendEMail'
|
import { sendEMail } from './sendEMail'
|
||||||
import { transactionReceived } from './text/transactionReceived'
|
import { transactionLinkRedeemed, transactionReceived } from './text/transactionReceived'
|
||||||
|
|
||||||
export const sendTransactionReceivedEmail = (data: {
|
export const sendTransactionReceivedEmail = (data: {
|
||||||
senderFirstName: string
|
senderFirstName: string
|
||||||
@ -26,3 +26,27 @@ export const sendTransactionReceivedEmail = (data: {
|
|||||||
text: transactionReceived.de.text(data),
|
text: transactionReceived.de.text(data),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const sendTransactionLinkRedeemedEmail = (data: {
|
||||||
|
email: string
|
||||||
|
senderFirstName: string
|
||||||
|
senderLastName: string
|
||||||
|
recipientFirstName: string
|
||||||
|
recipientLastName: string
|
||||||
|
senderEmail: string
|
||||||
|
amount: Decimal
|
||||||
|
memo: string
|
||||||
|
overviewURL: string
|
||||||
|
}): Promise<boolean> => {
|
||||||
|
logger.info(
|
||||||
|
`sendEmail(): to=${data.recipientFirstName} ${data.recipientLastName},
|
||||||
|
<${data.email}>,
|
||||||
|
subject=${transactionLinkRedeemed.de.subject},
|
||||||
|
text=${transactionLinkRedeemed.de.text(data)}`,
|
||||||
|
)
|
||||||
|
return sendEMail({
|
||||||
|
to: `${data.recipientFirstName} ${data.recipientLastName} <${data.email}>`,
|
||||||
|
subject: transactionLinkRedeemed.de.subject,
|
||||||
|
text: transactionLinkRedeemed.de.text(data),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@ -29,6 +29,37 @@ Mit freundlichen Grüßen,
|
|||||||
dein Gradido-Team
|
dein Gradido-Team
|
||||||
|
|
||||||
|
|
||||||
|
Link zu deinem Konto: ${data.overviewURL}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export const transactionLinkRedeemed = {
|
||||||
|
de: {
|
||||||
|
subject: 'Gradido link eingelösst',
|
||||||
|
text: (data: {
|
||||||
|
email: string
|
||||||
|
senderFirstName: string
|
||||||
|
senderLastName: string
|
||||||
|
recipientFirstName: string
|
||||||
|
recipientLastName: string
|
||||||
|
senderEmail: string
|
||||||
|
amount: Decimal
|
||||||
|
memo: string
|
||||||
|
overviewURL: string
|
||||||
|
}): string =>
|
||||||
|
`Hallo ${data.recipientFirstName} ${data.recipientLastName}
|
||||||
|
|
||||||
|
${data.senderFirstName} ${data.senderLastName} (${
|
||||||
|
data.senderEmail
|
||||||
|
}) hat soeben deinen Link eingelösst.
|
||||||
|
Betrag: ${data.amount.toFixed(2).replace('.', ',')} GDD,
|
||||||
|
Memo: ${data.memo}
|
||||||
|
|
||||||
|
Bitte antworte nicht auf diese E-Mail!
|
||||||
|
|
||||||
|
Mit freundlichen Grüßen,
|
||||||
|
dein Gradido-Team
|
||||||
|
|
||||||
Link zu deinem Konto: ${data.overviewURL}`,
|
Link zu deinem Konto: ${data.overviewURL}`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user