mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
add optional transactionLinkId in x-com-tx handshake
This commit is contained in:
parent
8dc38d4121
commit
d9843583c4
@ -111,6 +111,7 @@ export async function processXComCompleteTransaction(
|
||||
memo,
|
||||
senderUser,
|
||||
recipientGradidoId,
|
||||
dbTransactionLink?.id,
|
||||
)
|
||||
methodLogger.debug('processXComPendingSendCoins result: ', pendingResult)
|
||||
if (pendingResult && pendingResult.vote && pendingResult.recipGradidoID) {
|
||||
@ -123,6 +124,7 @@ export async function processXComCompleteTransaction(
|
||||
memo,
|
||||
senderUser,
|
||||
pendingResult,
|
||||
dbTransactionLink?.id,
|
||||
)
|
||||
methodLogger.debug('processXComCommittingSendCoins result: ', committingResult)
|
||||
if (!committingResult.vote) {
|
||||
@ -183,6 +185,7 @@ export async function processXComPendingSendCoins(
|
||||
memo: string,
|
||||
sender: dbUser,
|
||||
recipientIdentifier: string,
|
||||
transactionLinkId?: number,
|
||||
): Promise<SendCoinsResponseJwtPayloadType | null> {
|
||||
let voteResult: SendCoinsResponseJwtPayloadType
|
||||
const methodLogger = createLogger(`processXComPendingSendCoins`)
|
||||
@ -196,7 +199,8 @@ export async function processXComPendingSendCoins(
|
||||
amount: amount.toString(),
|
||||
memo: memo.substring(0, 5),
|
||||
sender: new UserLoggingView(sender),
|
||||
recipientIdentifier
|
||||
recipientIdentifier,
|
||||
transactionLinkId
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -236,7 +240,8 @@ export async function processXComPendingSendCoins(
|
||||
senderCom.communityUuid!,
|
||||
sender.gradidoID,
|
||||
fullName(sender.firstName, sender.lastName),
|
||||
sender.alias
|
||||
sender.alias,
|
||||
transactionLinkId
|
||||
)
|
||||
if(methodLogger.isDebugEnabled()) {
|
||||
methodLogger.debug(`ready for voteForSendCoins with payload=${payload}`)
|
||||
@ -297,6 +302,7 @@ export async function processXComPendingSendCoins(
|
||||
pendingTx.userId = sender.id
|
||||
pendingTx.userGradidoID = sender.gradidoID
|
||||
pendingTx.userName = fullName(sender.firstName, sender.lastName)
|
||||
pendingTx.linkedTransactionId = transactionLinkId
|
||||
if(methodLogger.isDebugEnabled()) {
|
||||
methodLogger.debug(`initialized sender pendingTX=${new PendingTransactionLoggingView(pendingTx)}`)
|
||||
}
|
||||
@ -346,6 +352,7 @@ export async function processXComCommittingSendCoins(
|
||||
memo: string,
|
||||
sender: dbUser,
|
||||
recipient: SendCoinsResult,
|
||||
transactionLinkId?: number,
|
||||
): Promise<SendCoinsResult> {
|
||||
const methodLogger = createLogger(`processXComCommittingSendCoins`)
|
||||
const handshakeID = randombytes_random().toString()
|
||||
@ -362,6 +369,7 @@ export async function processXComCommittingSendCoins(
|
||||
memo: memo.substring(0, 5),
|
||||
sender: new UserLoggingView(sender),
|
||||
recipient: new SendCoinsResultLoggingView(recipient),
|
||||
transactionLinkId,
|
||||
}
|
||||
)
|
||||
}
|
||||
@ -404,6 +412,7 @@ export async function processXComCommittingSendCoins(
|
||||
pendingTx.userGradidoID!,
|
||||
pendingTx.userName!,
|
||||
sender.alias,
|
||||
pendingTx.transactionLinkId,
|
||||
)
|
||||
payload.recipientCommunityUuid = pendingTx.linkedUserCommunityUuid
|
||||
? pendingTx.linkedUserCommunityUuid
|
||||
|
||||
@ -104,6 +104,7 @@ export class SendCoinsResolver {
|
||||
pendingTx.userCommunityUuid = authArgs.recipientCommunityUuid
|
||||
pendingTx.userGradidoID = receiverUser.gradidoID
|
||||
pendingTx.userName = fullName(receiverUser.firstName, receiverUser.lastName)
|
||||
pendingTx.transactionLinkId = authArgs.transactionLinkId
|
||||
|
||||
await DbPendingTransaction.insert(pendingTx)
|
||||
const responseArgs = new SendCoinsResponseJwtPayloadType(
|
||||
|
||||
@ -92,6 +92,7 @@ export async function settlePendingReceiveTransaction(
|
||||
transactionReceive.decayStart = receiveBalance ? receiveBalance.decay.start : null
|
||||
transactionReceive.previous = receiveBalance ? receiveBalance.lastTransactionId : null
|
||||
transactionReceive.linkedTransactionId = pendingTx.linkedTransactionId
|
||||
transactionReceive.transactionLinkId = pendingTx.transactionLinkId
|
||||
await queryRunner.manager.insert(dbTransaction, transactionReceive)
|
||||
logger.debug(`receive Transaction inserted: ${new TransactionLoggingView(transactionReceive)}`)
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ export class SendCoinsJwtPayloadType extends JwtPayloadType {
|
||||
senderUserUuid: string
|
||||
senderUserName: string
|
||||
senderAlias?: string | null
|
||||
transactionLinkId?: number | null
|
||||
|
||||
constructor(
|
||||
handshakeID: string,
|
||||
@ -25,6 +26,7 @@ export class SendCoinsJwtPayloadType extends JwtPayloadType {
|
||||
senderUserUuid: string,
|
||||
senderUserName: string,
|
||||
senderAlias?: string | null,
|
||||
transactionLinkId?: number | null,
|
||||
) {
|
||||
super(handshakeID)
|
||||
this.tokentype = SendCoinsJwtPayloadType.SEND_COINS_TYPE
|
||||
@ -37,5 +39,6 @@ export class SendCoinsJwtPayloadType extends JwtPayloadType {
|
||||
this.senderUserUuid = senderUserUuid
|
||||
this.senderUserName = senderUserName
|
||||
this.senderAlias = senderAlias
|
||||
this.transactionLinkId = transactionLinkId
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user