public void Handle(PayPalPaymentCancellationFailed @event) { using (var context = _contextFactory.Invoke()) { var detail = context.Set <OrderPaymentDetail>().Find(@event.SourceId); if ((detail == null) || (detail.Type != PaymentType.PayPal)) { throw new InvalidOperationException("Payment not found"); } detail.Error = @event.Reason; context.SaveChanges(); } }
public void Handle(PayPalPaymentCancellationFailed @event) { using (var context = _contextFactory.Invoke()) { var payment = context.Find <OrderPaymentDetail>(@event.SourceId); if (payment != null) { var orderReport = context.Find <OrderReportDetail>(payment.OrderId); orderReport.Payment.Error = @event.Reason; orderReport.Payment.IsCancelled = true; context.Save(orderReport); } } }