private ActionResult Processing_Bank(int claim, PaymentMode payment) { ActionResult result4; if (payment == null) { throw new ArgumentNullException("payment"); } PaymentBeforeProcessingResult result = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam); if (result == null) { throw new Exception("cannot get payment details"); } if (!result.success) { throw new Exception("payment details fail"); } try { List <ReportParam> list = new List <ReportParam>(); ReportParam item = new ReportParam { Name = "vClaimList", Value = claim.ToString() }; list.Add(item); string str = ConfigurationManager.AppSettings["report_PrintInvoice"]; if (string.IsNullOrEmpty(str)) { throw new Exception("report_PrintInvoice is empty"); } ReportResult result2 = ReportServer.BuildReport(str, ReportFormat.pdf, list.ToArray()); if (result2 == null) { throw new Exception("report data is empty"); } MemoryStream fileStream = new MemoryStream(result2.Content); FileStreamResult result3 = new FileStreamResult(fileStream, "application/pdf") { FileDownloadName = string.Format("invoice_{0}.pdf", claim) }; result4 = result3; } catch (Exception exception) { Tracing.ServiceTrace.TraceEvent(TraceEventType.Error, 0, exception.ToString()); throw; } return(result4); }
private ActionResult Processing_PayU(int claim, PaymentMode payment) { if (payment == null) { throw new System.ArgumentNullException("payment"); } PaymentBeforeProcessingResult beforePaymentResult = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam); if (beforePaymentResult == null) { throw new System.Exception("cannot get payment details"); } if (!beforePaymentResult.success) { throw new System.Exception("payment details fail"); } return(base.View("PaymentSystems\\PayU", new ProcessingContext { Reservation = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claim), PaymentMode = payment, BeforePaymentResult = beforePaymentResult })); }
private ActionResult Processing_Uniteller(int claim, PaymentMode payment) { if (payment == null) { throw new ArgumentNullException("payment"); } PaymentBeforeProcessingResult result = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam); if (result == null) { throw new Exception("cannot get payment details"); } if (!result.success) { throw new Exception("payment details fail"); } ProcessingContext model = new ProcessingContext { Reservation = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claim), PaymentMode = payment, BeforePaymentResult = result }; return(base.View(@"PaymentSystems\Uniteller", model)); }
private ActionResult Processing_PayPal(int claim, PaymentMode payment) { if (payment == null) { throw new System.ArgumentNullException("payment"); } PaymentBeforeProcessingResult beforePaymentResult = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam); if (beforePaymentResult == null) { throw new System.Exception("cannot get payment details"); } if (!beforePaymentResult.success) { throw new System.Exception("payment details fail"); } System.Collections.Generic.List <PaymentDetailsType> paymentDetails = new System.Collections.Generic.List <PaymentDetailsType>(); PaymentDetailsType paymentDetail = new PaymentDetailsType(); paymentDetail.AllowedPaymentMethod = new AllowedPaymentMethodType?(AllowedPaymentMethodType.ANYFUNDINGSOURCE); CurrencyCodeType currency = (CurrencyCodeType)EnumUtils.GetValue(payment.payrest.currency, typeof(CurrencyCodeType)); PaymentDetailsItemType paymentItem = new PaymentDetailsItemType(); paymentItem.Name = string.Format(PaymentStrings.ResourceManager.Get("PaymentForOrderFormat"), claim); paymentItem.Amount = new BasicAmountType(new CurrencyCodeType?(currency), payment.payrest.total.ToString("#.00", System.Globalization.NumberFormatInfo.InvariantInfo)); paymentItem.Quantity = new int?(1); paymentItem.ItemCategory = new ItemCategoryType?(ItemCategoryType.PHYSICAL); paymentItem.Description = string.Format("Booking #{0}", claim); paymentDetail.PaymentDetailsItem = new System.Collections.Generic.List <PaymentDetailsItemType> { paymentItem }; paymentDetail.PaymentAction = new PaymentActionCodeType?(PaymentActionCodeType.SALE); paymentDetail.OrderTotal = new BasicAmountType(paymentItem.Amount.currencyID, paymentItem.Amount.value); paymentDetails.Add(paymentDetail); SetExpressCheckoutRequestDetailsType ecDetails = new SetExpressCheckoutRequestDetailsType(); ecDetails.ReturnURL = new Uri(base.Request.BaseServerAddress(), base.Url.Action("processingresult", new { id = "paypal", success = true })).ToString(); ecDetails.CancelURL = new Uri(base.Request.BaseServerAddress(), base.Url.Action("processingresult", new { id = "paypal", success = false })).ToString(); ecDetails.NoShipping = "1"; ecDetails.AllowNote = "0"; ecDetails.SolutionType = new SolutionTypeType?(SolutionTypeType.SOLE); ecDetails.SurveyEnable = "0"; ecDetails.PaymentDetails = paymentDetails; ecDetails.InvoiceID = beforePaymentResult.invoiceNumber; SetExpressCheckoutRequestType request = new SetExpressCheckoutRequestType(); request.Version = "104.0"; request.SetExpressCheckoutRequestDetails = ecDetails; SetExpressCheckoutReq wrapper = new SetExpressCheckoutReq(); wrapper.SetExpressCheckoutRequest = request; System.Collections.Generic.Dictionary <string, string> config = PaymentController.PayPal_CreateConfig(); PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(config); SetExpressCheckoutResponseType setECResponse = service.SetExpressCheckout(wrapper); System.Collections.Generic.KeyValuePair <string, string> sandboxConfig = config.FirstOrDefault((System.Collections.Generic.KeyValuePair <string, string> m) => m.Key == "mode"); string sandboxServer = (sandboxConfig.Key != null && sandboxConfig.Value == "sandbox") ? ".sandbox" : ""; return(base.View("PaymentSystems\\PayPal", new ProcessingContext { Reservation = BookingProvider.GetReservationState(UrlLanguage.CurrentLanguage, claim), PaymentMode = payment, BeforePaymentResult = beforePaymentResult, RedirectUrl = string.Format("https://www{0}.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={1}", sandboxServer, base.Server.UrlEncode(setECResponse.Token)) })); // return new RedirectResult(string.Format("https://www{0}.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={1}", sandboxServer, base.Server.UrlEncode(setECResponse.Token))); }