public static IEnumerable <IEvent> Handle(this Order order, CompletePayment command) { if (order.Packed && order.Payed) { yield return(new GoodsShipped()); } }
public override PaymentCompleteResult Complete(string orderRef) { IPaymentCompleter completer = new CompletePayment( new UpdateTransactionDetails(null, _paymentManager), _paymentManager, _paymentActions); return(completer.Complete(this, orderRef)); }
public async Task Handle(CompletePayment message, IMessageHandlerContext context) { var payment = await this.DbContext.Payments.FirstOrDefaultAsync(p => p.PaymentId == message.PaymentId); if (payment != null) { payment.PaymentStatus = PaymentStatus.Completed; await this.DbContext.SaveChangesAsync(); this.Data.Completed = true; } }
public async Task <Unit> Handle(CompletePayment command, CancellationToken cancellationToken) { try { await paymentRepository.GetAndUpdate( command.PaymentId, payment => payment.Complete(), cancellationToken); } catch { await paymentRepository.GetAndUpdate( command.PaymentId, payment => payment.Discard(DiscardReason.UnexpectedError), cancellationToken); } return(Unit.Value); }
public void Handle(ICommandContext context, CompletePayment command) { context.Get <Payments.Payment>(command.AggregateRootId).Complete(); }
public static IEnumerable <IEvent> Handle(this Order order, CompletePayment command) => new[] { new PaymentComplete() };
public async Task HandleAsync(ICommandContext context, CompletePayment command) { var payment = await context.GetAsync <Payment>(command.AggregateRootId); payment.Complete(); }