public static PaywallReceipt GetReceiptForInvoice(Guid invoiceId)
 {
     PaywallReceipt re = new PaywallReceipt();
     try
     {
         PaymentGateway pg = new PaymentGateway();
         var invoice = pg.GetDisplayInvoice(invoiceId);
         re.InvoiceStatus = invoice.InvoiceStatus;
         re.InvoiceId = invoice.InvoiceId;
         re.NameOfPayment = invoice.Paywall.Name;
         re.DescriptionOfPayment = invoice.Paywall.Description;
         re.EmailForReceipt = invoice.InvoiceBilling.Email;
         re.PaywallId = invoice.Paywall.PaywallId;
         re.Expires = invoice.Paywall.ValidUntil;
         re.GeneratedPassword = invoice.Paywall.PaywallPassword;
         re.AmountPaid = invoice.Paywall.Price;
         re.AmountRefunded = invoice.Refunds.Sum(x => x.RefundAmount);
         re.MerchantId= invoice.Merchant.MerchantId;
         re.Location = invoice.Paywall.PaywallLocation;
                     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return re;
 }
 public ActionResult ViewPaywallReceipt(string id)
 {
     PaywallReceipt receipt = new PaywallReceipt();
     try
     {
         receipt = PaywallReceipt.GetReceiptForInvoice(new Guid(id));
     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return View(receipt);
 }