/// <inheritdoc /> public virtual async Task SendTransactionResponse(IAgentContext agentContext, string transactionId, ConnectionRecord connection) { TransactionResponseMessage message = new TransactionResponseMessage() { Transaction = transactionId }; await MessageService.SendAsync(agentContext.Wallet, message, connection); }
/// <inheritdoc /> public virtual async Task ProcessTransactionAsync(IAgentContext agentContext, TransactionResponseMessage connectionTransactionMessage, ConnectionRecord connection) { Logger.LogInformation(CustomLoggingEvents.ProcessTransaction, "To {1}", connection.TheirDid); var transactionRecord = await RecordService.GetAsync <TransactionRecord>(agentContext.Wallet, connectionTransactionMessage.Transaction); if (!transactionRecord.Used) { transactionRecord.ConnectionRecord = connection; if (transactionRecord.ProofRequest != null) { var(message, record) = await ProofService.CreateRequestAsync(agentContext, transactionRecord.ProofRequest); transactionRecord.ProofRecordId = record.Id; var deleteId = Guid.NewGuid().ToString(); message.AddDecorator(deleteId, "delete_id"); record.SetTag("delete_id", deleteId); record.ConnectionId = connection.Id; message.Comment = transactionRecord.ProofComment; await RecordService.UpdateAsync(agentContext.Wallet, record); await MessageService.SendAsync(agentContext.Wallet, message, connection); } if (transactionRecord.OfferConfiguration != null) { var(credentialOfferMessage, credentialRecord) = await CredentialService.CreateOfferAsync(agentContext, transactionRecord.OfferConfiguration, connection.Id); transactionRecord.CredentialRecordId = credentialRecord.Id; credentialOfferMessage.Comment = transactionRecord.CredentialComment; await MessageService.SendAsync(agentContext.Wallet, credentialOfferMessage, connection); } transactionRecord.Used = true; await RecordService.UpdateAsync(agentContext.Wallet, transactionRecord); } else { var message = new TransactionErrorMessage() { Transaction = transactionRecord.Id }; await MessageService.SendAsync(agentContext.Wallet, message, connection); } }