public async Task HandleAsync(AccountValidatePassedMessage message) { if (message.TransactionType == (byte)TransactionTypes.TransferTransaction) { if (message.PreparationType == PreparationTypes.DebitPreparation) { await _commandService.SendAsync(new PreCommitWithdrawTransactionPreparationCommand { Id = message.Id, Items = message.Items, AggregateRootId = message.AccountId, TransactionId = message.TransactionId, TransactionType = message.TransactionType, InitiatorId = message.TransactionId, InitiatorType = (byte)AggregateRootTypes.TransferTransaction, Amount = message.Amount }); } else if (message.PreparationType == PreparationTypes.CreditPreparation) { await _commandService.SendAsync(new PreCommitDepositTransactionPreparationCommand { Id = message.Id, Items = message.Items, AggregateRootId = message.AccountId, TransactionId = message.TransactionId, TransactionType = message.TransactionType, InitiatorId = message.TransactionId, InitiatorType = (byte)AggregateRootTypes.TransferTransaction, Amount = message.Amount }); } } }
public Task <AsyncTaskResult> HandleAsync(AccountValidatePassedMessage message) { return(_commandService.SendAsync(new ConfirmAccountValidatePassedCommand(message.TransactionId, message.AccountId) { Id = message.Id, Items = message.Items })); }
public Task <AsyncTaskResult <IApplicationMessage> > HandleAsync(ValidateAccountCommand command) { var applicationMessage = default(ApplicationMessage); //此处应该会调用外部接口验证账号是否合法,这里仅仅简单通过账号是否以INVALID字符串开头来判断是否合法;根据账号的合法性,返回不同的应用层消息 if (command.AggregateRootId.StartsWith("INVALID")) { applicationMessage = new AccountValidateFailedMessage(command.AggregateRootId, command.TransactionId, "账户不合法."); } else { applicationMessage = new AccountValidatePassedMessage(command.AggregateRootId, command.TransactionId); } return(Task.FromResult(new AsyncTaskResult <IApplicationMessage>(AsyncTaskStatus.Success, applicationMessage))); }
public Task HandleAsync(ICommandContext context, ValidateAccountCommand command) { var applicationMessage = default(ApplicationMessage); //此处应该会调用外部接口验证账号是否合法,这里仅仅简单通过账号是否以INVALID字符串开头来判断是否合法;根据账号的合法性,返回不同的应用层消息 if (command.AggregateRootId.StartsWith("INVALID")) { applicationMessage = new AccountValidateFailedMessage(command.AggregateRootId, command.TransactionId, command.TransactionType, command.PreparationType, "账户不合法."); } else { applicationMessage = new AccountValidatePassedMessage(command.AggregateRootId, command.TransactionId, command.TransactionType, command.PreparationType, command.Amount); } context.SetApplicationMessage(applicationMessage); return(Task.CompletedTask); }
public Task HandleAsync(AccountValidatePassedMessage message) { Console.WriteLine("账户验证已通过,交易ID:{0},账户:{1}", message.TransactionId, message.AccountId); return(Task.CompletedTask); }
public Task <AsyncTaskResult> HandleAsync(AccountValidatePassedMessage message) { Console.WriteLine("账户验证已通过,交易ID:{0},账户:{1}", message.TransactionId, message.AccountId); return(Task.FromResult(AsyncTaskResult.Success)); }
public Task HandleAsync(AccountValidatePassedMessage message) { _logger.InfoFormat("账户验证已通过,交易ID:{0},账户:{1}", message.TransactionId, message.AccountId); return(Task.CompletedTask); }
public async Task HandleAsync(AccountValidatePassedMessage message) { await _commandService.SendAsync(new ConfirmAccountValidatePassedCommand(message.TransactionId, message.AccountId) { Id = message.Id, Items = message.Items }); }