Merge pull request #3606 from gradido/3605-correct-disbursement-email-to-sender-of-tx-link

fix(backend): remove sending email after disbursement, because it is done in core...processXComSendCoins
This commit is contained in:
clauspeterhuebner 2026-03-04 18:14:05 +01:00 committed by GitHub
commit d9703fb847
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 21 deletions

View File

@ -570,7 +570,7 @@ export class TransactionLinkResolver {
} catch (e) {
const errmsg = `Error on creating Redeem JWT: error=${e}`
methodLogger.error(errmsg)
throw new LogError(errmsg)
throw new Error(errmsg)
}
}
@ -612,19 +612,19 @@ export class TransactionLinkResolver {
if (!senderCom) {
const errmsg = `Sender community not found with uuid=${senderCommunityUuid}`
methodLogger.error(errmsg)
throw new LogError(errmsg)
throw new Error(errmsg)
}
const senderFedCom = await DbFederatedCommunity.findOneBy({ publicKey: senderCom.publicKey })
if (!senderFedCom) {
const errmsg = `Sender federated community not found with publicKey=${senderCom.publicKey}`
methodLogger.error(errmsg)
throw new LogError(errmsg)
throw new Error(errmsg)
}
const recipientCom = await getCommunityByUuid(recipientCommunityUuid)
if (!recipientCom) {
const errmsg = `Recipient community not found with uuid=${recipientCommunityUuid}`
methodLogger.error(errmsg)
throw new LogError(errmsg)
throw new Error(errmsg)
}
const client = DisbursementClientFactory.getInstance(senderFedCom)
if (client instanceof V1_0_DisbursementClient) {
@ -663,17 +663,18 @@ export class TransactionLinkResolver {
if (methodLogger.isDebugEnabled()) {
methodLogger.debug('Disburse JWT was sent successfully with result=', result)
}
/* don't send email here, because it is sent by the sender community
const senderUser = await findUserByIdentifier(senderGradidoId, senderCommunityUuid)
if (!senderUser) {
const errmsg = `Sender user not found with identifier=${senderGradidoId}`
methodLogger.error(errmsg)
throw new LogError(errmsg)
throw new Error(errmsg)
}
const recipientUser = await findUserByIdentifier(recipientGradidoId, recipientCommunityUuid)
if (!recipientUser) {
const errmsg = `Recipient user not found with identifier=${recipientGradidoId}`
methodLogger.error(errmsg)
throw new LogError(errmsg)
throw new Error(errmsg)
}
if (recipientUser.emailContact?.email !== null) {
if (methodLogger.isDebugEnabled()) {
@ -719,6 +720,7 @@ export class TransactionLinkResolver {
)
}
}
*/
} catch (e) {
const errmsg = `Disburse JWT was not sent successfully with error=${e}`
methodLogger.error(errmsg)

View File

@ -214,6 +214,7 @@ export const executeTransaction = async (
transactionAmount: amount,
})
if (transactionLink) {
const recipientCom = await getCommunityName(recipient.communityUuid)
await sendTransactionLinkRedeemedEmail({
firstName: sender.firstName,
lastName: sender.lastName,
@ -221,7 +222,7 @@ export const executeTransaction = async (
language: sender.language,
senderFirstName: recipient.firstName,
senderLastName: recipient.lastName,
senderEmail: recipient.emailContact.email,
senderEmail: recipientCom, // recipient.emailContact.email,
transactionAmount: amount,
transactionMemo: memo,
})

View File

@ -25,6 +25,7 @@ CONFIG.EMAIL_SENDER = 'info@gradido.net'
CONFIG.EMAIL_SMTP_HOST = testMailServerHost
CONFIG.EMAIL_SMTP_PORT = testMailServerPort
CONFIG.EMAIL_TLS = testMailTLS
CONFIG.EMAIL_TEST_MODUS = false
mock.module('nodemailer', () => {
return {

View File

@ -172,19 +172,6 @@ export async function processXComCompleteTransaction(
)
}
}
/*
await sendTransactionReceivedEmail({
firstName: foreignUser.firstName,
lastName: foreignUser.lastName,
email: foreignUser.emailContact.email,
language: foreignUser.language,
memo,
senderFirstName: senderUser.firstName,
senderLastName: senderUser.lastName,
senderEmail: senderUser.emailContact.email,
transactionAmount: new Decimal(amount),
})
*/
if (dbTransactionLink) {
await sendTransactionLinkRedeemedEmail({
firstName: senderUser.firstName,
@ -193,7 +180,7 @@ export async function processXComCompleteTransaction(
language: senderUser.language,
senderFirstName: foreignUser.firstName,
senderLastName: foreignUser.lastName,
senderEmail: 'unknown', // foreignUser.emailContact.email,
senderEmail: recipientCom.name!, // foreignUser.emailContact.email,
transactionAmount: new Decimal(amount),
transactionMemo: memo,
})