public async Task <IActionResult> AddPaymentAndCommit([FromBody] dto.AddPaymentToBookingRequestData addPaymentToBookingRequestData) { try { //var httpConnectionFeature = _httpContextAccessor.HttpContext.Features.Get<IHttpConnectionFeature>(); //var ipaddress = httpConnectionFeature?.RemoteIpAddress.ToString(); //ipaddress = !string.IsNullOrEmpty(ipaddress) ? ipaddress.Trim() : ""; //ipaddress = ipaddress.Length > 20 ? ipaddress.Substring(0, 20) : ipaddress; //var acceptTypes = _httpContextAccessor.HttpContext.Request.Headers["Accept"]; //var userAgent = _httpContextAccessor.HttpContext.Request.Headers["User-Agent"]; //var x = await _paymentService.AddPaymentToBooking(new dto.AddPaymentToBookingRequestData //{ // //AccountNumber = "5123456789012346", // MC normal card // //PaymentMethodCode = "MC", // //AccountNumber = "4005550000000001", // VI normal card // //PaymentMethodCode = "VI", // //AccountNumber = "4557012345678902", // VI 3DS card // //PaymentMethodCode = "VI", // AccountNumber = "5313581000123430", // MC 3DS card // PaymentMethodCode = "MC", // //AccountNumber = "5265742978143572", // MC Decline card // //PaymentMethodCode = "MC", // //AccountNumber = "4532406346746108", // VI Decline card // //PaymentMethodCode = "VI", // CVVCode = "123", // Expiration = new DateTime(2021, 5, 1), // AccountHolderName = "john smith", // //QuotedAmount = sellResponse.BookingUpdateResponseData.Success.PNRAmount.BalanceDue, // //QuotedCurrencyCode = "SAR", // //ThreeDSecureRequest = new dto.ThreeDSecureRequest // //{ // // //BrowserAccept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", // // RemoteIpAddress = "139.134.5.36", // // //BrowserUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36", // // TermUrl = "http://localhost:5000/tds/blah", // // BrowserAccept = acceptTypes, // // //RemoteIpAddress = ipaddress, // // BrowserUserAgent = userAgent, // //} //}); var addPaymentResult = await _paymentService.AddPaymentToBooking(addPaymentToBookingRequestData); var commitResponse = await _bookingService.CommitBooking(); //var addInProcResponse = await _bookingService.AddInProcessPaymentToBooking(); var postCommitResponse = await _bookingService.GetPostCommitResults(); await _sessionBag.SetBookingStateNotInSync(); return(new OkObjectResult(commitResponse)); } catch (Exception e) { return(e.ErrorActionResult()); } }
public async Task <dto.AddPaymentToBookingResponse> AddPaymentToBooking(dto.AddPaymentToBookingRequestData request) { var addPaymentToBookingRequestData = Mapper.Map <AddPaymentToBookingRequestData>(request); var response = await _bookingManagerClient.AddPaymentToBookingAsync(new AddPaymentToBookingRequest { ContractVersion = _navApiContractVer, MessageContractVersion = _navMsgContractVer, Signature = await _sessionBag.Signature(), EnableExceptionStackTrace = false, addPaymentToBookingReqData = addPaymentToBookingRequestData }); return(Mapper.Map <dto.AddPaymentToBookingResponse>(response)); }
public async Task <IActionResult> Post([FromBody] dto.AddPaymentToBookingRequestData request) { return(new OkObjectResult(await _paymentsService.AddPaymentToBooking(request))); }