Example #1
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            string postData = PostData;
            var cookieManager = new RequestCookieManager(Request.Cookies);

            var billingAddress = cookieManager.GetBillingAddress();
            var sessionId = cookieManager.GetSessionId();
            var authenticationId = cookieManager.GetAuthenticationId();
            if (string.IsNullOrEmpty(authenticationId) || string.IsNullOrEmpty(sessionId) || billingAddress == null)
            {
                RedirectToPreviousPage();
            }
            else
            {
                var isOfflineBooking = cookieManager.IsOfflineBooking;
                var voucherCode = cookieManager.GetVoucherCode();
                if (isOfflineBooking)
                {
                    var token = cookieManager.GetToken();
                    if (token == null)
                    {
                        RedirectToPreviousPage();
                    }
                    else
                    {
                        var isOfflineDataSet = SetOfflineParametersInSession(sessionId, authenticationId, token, voucherCode);
                        if (isOfflineDataSet == false)
                        {
                            RedirectToPreviousPage();
                        }
                    }
                }
                var paymentService = new PaymentService();
                postData = paymentService.GetPostData(authenticationId, sessionId, billingAddress);
            }

            Response.Clear();
            Response.Write(postData);
            Response.End();
        }