public void Handle(CancelThirdPartyProcessorPayment command) { var payment = repository.GetByKey(command.PaymentId); if (payment != null) { var processor = new PaymentProcessor(payment); processor.Cancel(); context.RegisterModified(processor.Payment); context.Commit(); } else { Trace.TraceError("Failed to locate the payment entity with id {0} for the cancelled third party payment.", command.PaymentId); } }
public void Handle(CancelThirdPartyProcessorPayment command) { using (var repository = this._contextFactory()) { var payment = repository.Find(command.PaymentId); if (payment != null) { payment.Cancel(); repository.Save(payment); } else { Trace.TraceError("Failed to locate the payment entity with id {0} for the cancelled third party payment", command.PaymentId); } } }
public void Handle(CancelThirdPartyProcessorPayment command) { var repository = this._contextFactory(); using (repository as IDisposable) { var payment = repository.Find(command.PaymentId); if (payment != null) { payment.Cancel(); repository.Save(payment); _commandBus.Send(new NotifyUserOfFailedfullPayment { UserEmail = command.UserEmail, Username = command.UserEmail, UserId = command.UserId, PaymentId = command.PaymentId }); } else { Trace.TraceError("Failed to locate the payment entity with id {0} for the cancelled third party payment.", command.PaymentId); } } }