public void Handle(PayPalExpressCheckoutPaymentCancelled @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.IsCancelled = true; context.Save(orderReport); } } }
public void Handle(PayPalExpressCheckoutPaymentCancelled @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.IsCancelled = true; context.SaveChanges(); } }