Exemple #1
0
        public SubmitPaymentResponse SubmitPayment(BillingInformation billingInfo, string token)
        {
            SubmitPaymentResponse result = null;

            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(ConstantData.ApiURL.ToString() + "Payment/SubmitPayment");
                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                    var myContent   = JsonConvert.SerializeObject(billingInfo);
                    var buffer      = Encoding.UTF8.GetBytes(myContent);
                    var byteContent = new ByteArrayContent(buffer);
                    byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");



                    var response = client.PostAsync(client.BaseAddress, byteContent).Result;

                    if (response.IsSuccessStatusCode)
                    {
                        var responseStream = response.Content.ReadAsStringAsync().Result;
                        result = JsonConvert.DeserializeObject <SubmitPaymentResponse>(responseStream);
                    }
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
 public ProcessPaymentPage(decimal balanceDue, int agreementId, int locationIdForPayment, AgreementReview agreementReview, ExtendAgreementRequest request)
 {
     InitializeComponent();
     this.balanceDue           = balanceDue;
     amountLAbel.Text          = "$ " + balanceDue.ToString("0.00");
     creditCardRequest         = new GetAllCustomerMobileCreditCardRequest();
     creditCards               = null;
     customerId                = (int)App.Current.Properties["CustomerId"];
     token                     = App.Current.Properties["currentToken"].ToString();
     billingInformation        = new BillingInformation();
     PaymentResponse           = null;
     this.agreementId          = agreementId;
     this.locationIdForPayment = locationIdForPayment;
     this.agreementReview      = agreementReview;
     submitPaymentAndExtendAgreementRequest = new SubmitPaymentAndExtendAgreementRequest();
     if (agreementReview != null)
     {
         isExtendAgreement = true;
     }
     else if (agreementReview == null)
     {
         isExtendAgreement = false;
     }
     promotionMobileRequest  = new GetPromotionMobileRequest();
     promotionMobileResponse = null;
     appliedPromoId          = 0;
     extendAgreemetRequest   = request;
     extendAgreementResponse = null;
 }
Exemple #3
0
        public ActionResult <SubmitPaymentResponse> CreatePayment([FromBody] SubmitPaymentRequest paymentRequest)
        {
            // mock processing time
            Thread.Sleep(5000);

            // create response with "Completed" status
            var response = new SubmitPaymentResponse(paymentRequest.PaymentId, "Completed");

            return(response);
        }
Exemple #4
0
        public SubmitPaymentResponse SubmitPaymentAndExtendAgreement(SubmitPaymentAndExtendAgreementRequest submitPaymentAndExtendAgreementRequest, string token)
        {
            SubmitPaymentResponse mobileResponse = null;

            try
            {
                mobileResponse = reservationservice.SubmitPaymentAndExtendAgreement(submitPaymentAndExtendAgreementRequest, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(mobileResponse);
        }
Exemple #5
0
        public SubmitPaymentResponse SubmitPayment(BillingInformation billingInfo, string token)
        {
            SubmitPaymentResponse mobileResponse = null;

            try
            {
                mobileResponse = reservationservice.SubmitPayment(billingInfo, token);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(mobileResponse);
        }
        //public SummaryOfChargesPage()
        //{

        //    //if ((int)App.Current.Properties["CustomerId"] == 0)
        //    //{
        //    //    loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.LogInTool.png", assembly);

        //    //}
        //    //else
        //    //{
        //    //    loginIcon.IconImageSource = ImageSource.FromResource("MaxVonGrafKftMobile.Assets.logOutTool.png", assembly);
        //    //}
        //}

        public SummaryOfChargesPage(ReservationView reservationView, VehicleViewByTypeForMobile selectedVehicle)
        {
            InitializeComponent();
            var assembly = typeof(SummaryOfChargesPage);

            this.reservationView             = reservationView;
            summaryMobileRequest             = new GetCalculateSummaryMobileRequest();
            summaryMobileResponsecs          = null;
            ReservationMobileResponse        = null;
            ReservationMobileRequest         = new CreateReservationMobileRequest();
            summaryMobileRequest.reservation = reservationView;
            token = App.Current.Properties["currentToken"].ToString();
            termsandConditionByTypeRequest          = new GetTermsandConditionByTypeRequest();
            termsandConditionByTypeRequest.clientId = Constants.ClientId;
            termsandConditionByTypeRequest.typeId   = 3;
            termsandConditionByTypeResponse         = null;
            this.selectedVehicle = selectedVehicle;
            startDateLabel.Text  = ((DateTime)reservationView.StartDate).ToString("ddd MM/dd/yyyy");
            endDateLabel.Text    = ((DateTime)reservationView.EndDate).ToString("ddd MM/dd/yyyy");
            startTimeLabel.Text  = ((DateTime)reservationView.StartDate).ToString("hh:mm tt");
            endTimeLabel.Text    = ((DateTime)reservationView.EndDate).ToString("hh:mm tt");
            if (selectedVehicle.VehicleImageUrl != null)
            {
                vehilcleTypeImage.Source = ImageSource.FromUri(new Uri(selectedVehicle.VehicleImageUrl));
            }
            vehicleSampleLabel.Text = selectedVehicle.vehicleName;
            vehilcleTypeLabel.Text  = selectedVehicle.VehicleType;
            priceLabel.Text         = "Days: " + selectedVehicle.RateDetail.TotalDays.ToString();
            emailInvoiceRequest     = new EmailInvoiceRequest();
            emailResponse           = null;
            creditCardRequest       = new GetAllCustomerMobileCreditCardRequest();
            creditCards             = null;
            customerId = (int)App.Current.Properties["CustomerId"];

            billingInformation = new BillingInformation();
            submitPaymentandCreateReservationRequest = new SubmitPaymentandCreateReservationRequest();
            PaymentResponse = null;

            //imgSelect.Source = "iconCircleSelected.png";
        }
 public ProcessPaymentPage(decimal amountWantToPay, ReservationView reservationView)
 {
     InitializeComponent();
     this.amountWantToPay = amountWantToPay;
     this.reservationView = reservationView;
     amountLAbel.Text     = "$ " + amountWantToPay.ToString("0.00");
     creditCardRequest    = new GetAllCustomerMobileCreditCardRequest();
     creditCards          = null;
     customerId           = (int)App.Current.Properties["CustomerId"];
     token = App.Current.Properties["currentToken"].ToString();
     billingInformation = new BillingInformation();
     PaymentResponse    = null;
     agreementId        = 0;
     submitPaymentAndUpDateReservationRequest = new SubmitPaymentAndUpDateReservationRequest();
     paynowBtn.Text          = "Pay and extend now";
     isExtendAgreement       = false;
     promotionMobileRequest  = new GetPromotionMobileRequest();
     promotionMobileResponse = null;
     summaryMobileRequest    = new GetCalculateSummaryMobileRequest();
     summaryMobileResponsecs = null;
     appliedPromoId          = 0;
 }
        private async void paynowBtn_Clicked(object sender, EventArgs e)
        {
            int         selectedCardId = 0;
            CreditCards selectedCard   = null;

            foreach (var item in cardDetails)
            {
                if (item.isCardSelect == "iconCircleSelected.png")
                {
                    selectedCardId = item.cardId;
                }
            }
            if (selectedCardId > 0)
            {
                foreach (CreditCards cc in creditCards.listCard)
                {
                    if (cc.CreditCardId == selectedCardId)
                    {
                        selectedCard = cc;
                    }
                }
                if (isExtendAgreement)
                {
                    if (selectedCard != null)
                    {
                        billingInformation.FirstName     = Constants.customerDetails.FirstName;
                        billingInformation.LastName      = Constants.customerDetails.LastName;
                        billingInformation.Email         = Constants.customerDetails.Email;
                        billingInformation.Address       = Constants.customerDetails.Address1;
                        billingInformation.City          = Constants.customerDetails.City;
                        billingInformation.State         = Constants.customerDetails.StateName;
                        billingInformation.ZipCode       = Constants.customerDetails.ZipCode;
                        billingInformation.Country       = Constants.customerDetails.CountryName;
                        billingInformation.phone         = Constants.customerDetails.hPhone;
                        billingInformation.CustomerId    = customerId;
                        billingInformation.PaymentType   = "Advance Payment";
                        billingInformation.PaymentAmount = Convert.ToDouble(balanceDue);

                        billingInformation.NameOnCard              = selectedCard.NameOnCard;
                        billingInformation.CreditCardNumber        = selectedCard.CreditCardNo;
                        billingInformation.CreditCardNumberDisplay = selectedCard.CreditCardNoForDisplay;
                        billingInformation.SecurityCode            = selectedCard.CreditCardCVSNo;
                        billingInformation.ExpiryMonth             = selectedCard.Month;
                        billingInformation.ExpiryYear              = selectedCard.Year;
                        billingInformation.CreditCardType          = selectedCard.CreditCardType;
                        billingInformation.CreditCardId            = (int)selectedCard.CreditCardId;

                        billingInformation.LocationId = locationIdForPayment;

                        billingInformation.FullName    = Constants.customerDetails.FirstName;
                        billingInformation.PaymentInfo = new PaymentReferenceInfo();
                        //billingInformation.PaymentInfo.ResevationId = ReservationMobileResponse.ReserveId;
                        billingInformation.PaymentInfo.AgreementId    = agreementId;
                        billingInformation.PaymentInfo.PaymentType    = "Advance Payment";
                        billingInformation.PaymentInfo.PaymentDate    = DateTime.Now;
                        billingInformation.PaymentInfo.PaymentDateStr = DateTime.Now.ToString("MM/dd/yyyy").Replace("-", "/");
                        billingInformation.PaymentInfo.PaymentMode    = PaymentMode.Payment;
                        billingInformation.PaymentInfo.PaymentBy      = Constants.customerDetails.FirstName;
                        ReservationController reservationController = new ReservationController();
                        submitPaymentAndExtendAgreementRequest.agreementReview    = agreementReview;
                        submitPaymentAndExtendAgreementRequest.billingInformation = billingInformation;
                        bool busy = false;
                        if (!busy)
                        {
                            try
                            {
                                busy = true;
                                await PopupNavigation.Instance.PushAsync(new LoadingPopup("."));

                                await Task.Run(async() =>
                                {
                                    try
                                    {
                                        PaymentResponse = reservationController.SubmitPaymentAndExtendAgreement(submitPaymentAndExtendAgreementRequest, token);
                                    }
                                    catch (Exception ex)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                            finally
                            {
                                busy = false;
                                await PopupNavigation.Instance.PopAsync();

                                if (PaymentResponse != null)
                                {
                                    if (PaymentResponse.Status)
                                    {
                                        if (PaymentResponse.Data != null)
                                        {
                                            if (PaymentResponse.Data.extendAgreementResponse != null)
                                            {
                                                if (PaymentResponse.Data.extendAgreementResponse.agreementReview.AgreementID > 0)
                                                {
                                                    await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your rental extension was successful. ", 1));
                                                }
                                                else if (PaymentResponse.RefundStatus)
                                                {
                                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Your payment will refund shortly. "));
                                                }
                                                else
                                                {
                                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Please contact us for your refund. "));
                                                }
                                            }
                                            else if (PaymentResponse.RefundStatus)
                                            {
                                                await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Your payment will refund shortly. "));
                                            }
                                            else
                                            {
                                                await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Please contact us for your refund. "));
                                            }
                                        }
                                        else if (PaymentResponse.RefundStatus)
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Your payment will refund shortly. "));
                                        }
                                        else
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Please contact us for your refund. "));
                                        }
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, " + PaymentResponse.message.ToUpper() + ". Please Try Again."));
                                    }
                                }
                                else
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try with another card details."));
                                }
                            }
                        }
                    }

                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new Error_popup("Please select a credit card."));
                    }
                }
                else if (agreementId > 0)
                {
                    if (selectedCard != null)
                    {
                        billingInformation.FirstName     = Constants.customerDetails.FirstName;
                        billingInformation.LastName      = Constants.customerDetails.LastName;
                        billingInformation.Email         = Constants.customerDetails.Email;
                        billingInformation.Address       = Constants.customerDetails.Address1;
                        billingInformation.City          = Constants.customerDetails.City;
                        billingInformation.State         = Constants.customerDetails.StateName;
                        billingInformation.ZipCode       = Constants.customerDetails.ZipCode;
                        billingInformation.Country       = Constants.customerDetails.CountryName;
                        billingInformation.phone         = Constants.customerDetails.hPhone;
                        billingInformation.CustomerId    = customerId;
                        billingInformation.PaymentType   = "Advance Payment";
                        billingInformation.PaymentAmount = Convert.ToDouble(balanceDue);

                        billingInformation.NameOnCard              = selectedCard.NameOnCard;
                        billingInformation.CreditCardNumber        = selectedCard.CreditCardNo;
                        billingInformation.CreditCardNumberDisplay = selectedCard.CreditCardNoForDisplay;
                        billingInformation.SecurityCode            = selectedCard.CreditCardCVSNo;
                        billingInformation.ExpiryMonth             = selectedCard.Month;
                        billingInformation.ExpiryYear              = selectedCard.Year;
                        billingInformation.CreditCardType          = selectedCard.CreditCardType;
                        billingInformation.CreditCardId            = (int)selectedCard.CreditCardId;

                        billingInformation.LocationId = locationIdForPayment;

                        billingInformation.FullName    = Constants.customerDetails.FirstName;
                        billingInformation.PaymentInfo = new PaymentReferenceInfo();
                        //billingInformation.PaymentInfo.ResevationId = ReservationMobileResponse.ReserveId;
                        billingInformation.PaymentInfo.AgreementId    = agreementId;
                        billingInformation.PaymentInfo.PaymentType    = "Advance Payment";
                        billingInformation.PaymentInfo.PaymentDate    = DateTime.Now;
                        billingInformation.PaymentInfo.PaymentDateStr = DateTime.Now.ToString("MM/dd/yyyy").Replace("-", "/");
                        billingInformation.PaymentInfo.PaymentMode    = PaymentMode.Payment;
                        billingInformation.PaymentInfo.PaymentBy      = Constants.customerDetails.FirstName;
                        ReservationController reservationController = new ReservationController();

                        bool busy = false;
                        if (!busy)
                        {
                            try
                            {
                                busy = true;
                                await PopupNavigation.Instance.PushAsync(new LoadingPopup("."));

                                await Task.Run(async() =>
                                {
                                    try
                                    {
                                        PaymentResponse = reservationController.SubmitPayment(billingInformation, token);
                                    }
                                    catch (Exception ex)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                            finally
                            {
                                busy = false;
                                await PopupNavigation.Instance.PopAsync();

                                if (PaymentResponse != null)
                                {
                                    if (PaymentResponse.Status)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your payment Successfull. ", 1));
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, " + PaymentResponse.message.ToUpper() + ". Please Try Again."));
                                    }
                                }
                                else
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try with another card details."));
                                }
                            }
                        }
                    }

                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new Error_popup("Please select a credit card."));
                    }
                }
                else
                {
                    if (selectedCard != null)
                    {
                        billingInformation.FirstName     = Constants.customerDetails.FirstName;
                        billingInformation.LastName      = Constants.customerDetails.LastName;
                        billingInformation.Email         = Constants.customerDetails.Email;
                        billingInformation.Address       = Constants.customerDetails.Address1;
                        billingInformation.City          = Constants.customerDetails.City;
                        billingInformation.State         = Constants.customerDetails.StateName;
                        billingInformation.ZipCode       = Constants.customerDetails.ZipCode;
                        billingInformation.Country       = Constants.customerDetails.CountryName;
                        billingInformation.phone         = Constants.customerDetails.hPhone;
                        billingInformation.CustomerId    = customerId;
                        billingInformation.PaymentType   = "Advance Payment";
                        billingInformation.PaymentAmount = Convert.ToDouble(amountWantToPay);

                        billingInformation.NameOnCard              = selectedCard.NameOnCard;
                        billingInformation.CreditCardNumber        = selectedCard.CreditCardNo;
                        billingInformation.CreditCardNumberDisplay = selectedCard.CreditCardNoForDisplay;
                        billingInformation.SecurityCode            = selectedCard.CreditCardCVSNo;
                        billingInformation.ExpiryMonth             = selectedCard.Month;
                        billingInformation.ExpiryYear              = selectedCard.Year;
                        billingInformation.CreditCardType          = selectedCard.CreditCardType;
                        billingInformation.CreditCardId            = (int)selectedCard.CreditCardId;

                        billingInformation.LocationId = (int)reservationView.StartLocationId;

                        billingInformation.FullName    = Constants.customerDetails.FirstName;
                        billingInformation.PaymentInfo = new PaymentReferenceInfo();
                        billingInformation.PaymentInfo.ResevationId = reservationView.ReserveId;
                        //billingInformation.PaymentInfo.AgreementId = agreementId;
                        billingInformation.PaymentInfo.PaymentType    = "Advance Payment";
                        billingInformation.PaymentInfo.PaymentDate    = DateTime.Now;
                        billingInformation.PaymentInfo.PaymentDateStr = DateTime.Now.ToString("MM/dd/yyyy").Replace("-", "/");
                        billingInformation.PaymentInfo.PaymentMode    = PaymentMode.Payment;
                        billingInformation.PaymentInfo.PaymentBy      = Constants.customerDetails.FirstName;
                        ReservationController reservationController = new ReservationController();
                        submitPaymentAndUpDateReservationRequest.billingInformation       = billingInformation;
                        submitPaymentAndUpDateReservationRequest.reservationMobileRequest = new UpdateReservationMobileRequest();

                        submitPaymentAndUpDateReservationRequest.reservationMobileRequest.reservationData = reservationView;
                        bool busy = false;
                        if (!busy)
                        {
                            try
                            {
                                busy = true;
                                await PopupNavigation.Instance.PushAsync(new LoadingPopup("."));

                                await Task.Run(async() =>
                                {
                                    try
                                    {
                                        PaymentResponse = reservationController.SubmitPaymentAndExtendReservation(submitPaymentAndUpDateReservationRequest, token);
                                    }
                                    catch (Exception ex)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                            finally
                            {
                                busy = false;
                                await PopupNavigation.Instance.PopAsync();

                                if (PaymentResponse != null)
                                {
                                    if (PaymentResponse.Status)
                                    {
                                        if (PaymentResponse.Data != null)
                                        {
                                            if (PaymentResponse.Data.updateReserResponse != null)
                                            {
                                                if (PaymentResponse.Data.updateReserResponse.ReservID > 0)
                                                {
                                                    await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Your rental extension was successful. ", 1));
                                                }
                                                else if (PaymentResponse.RefundStatus)
                                                {
                                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Your payment will refund shortly. "));
                                                }
                                                else
                                                {
                                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Please contact us for your refund. "));
                                                }
                                            }
                                            else if (PaymentResponse.RefundStatus)
                                            {
                                                await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Your payment will refund shortly. "));
                                            }
                                            else
                                            {
                                                await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Please contact us for your refund. "));
                                            }
                                        }
                                        else if (PaymentResponse.RefundStatus)
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Your payment will refund shortly. "));
                                        }
                                        else
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your extention failed. Please contact us for your refund. "));
                                        }
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Please contact Jax ride share rentals for refund."));
                                    }
                                }
                                else
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try with another card details."));
                                }
                            }
                        }
                    }

                    else
                    {
                        await PopupNavigation.Instance.PushAsync(new Error_popup("Please select a credit card."));
                    }
                }
            }
        }
        private async void SubmitPaymentDetails(CreateReservationMobileRequest reservationMobileRequest)
        {
            submitPaymentandCreateReservationRequest.reservationMobileRequest = reservationMobileRequest;

            int         selectedCardId = 0;
            CreditCards selectedCard   = null;

            foreach (var item in cardDetails)
            {
                if (item.isCardSelect == "iconCircleSelected.png")
                {
                    selectedCardId = item.cardId;
                }
            }


            if (selectedCardId > 0)
            {
                foreach (CreditCards cc in creditCards.listCard)
                {
                    if (cc.CreditCardId == selectedCardId)
                    {
                        selectedCard = cc;
                    }
                }
            }

            if (selectedCard != null)
            {
                billingInformation.FirstName     = Constants.customerDetails.FirstName;
                billingInformation.LastName      = Constants.customerDetails.LastName;
                billingInformation.Email         = Constants.customerDetails.Email;
                billingInformation.Address       = Constants.customerDetails.Address1;
                billingInformation.City          = Constants.customerDetails.City;
                billingInformation.State         = Constants.customerDetails.StateName;
                billingInformation.ZipCode       = Constants.customerDetails.ZipCode;
                billingInformation.Country       = Constants.customerDetails.CountryName;
                billingInformation.phone         = Constants.customerDetails.hPhone;
                billingInformation.CustomerId    = customerId;
                billingInformation.PaymentType   = "Advance Payment";
                billingInformation.PaymentAmount = Convert.ToDouble(summaryMobileResponsecs.rate.ReservationSummary.EstimatedTotal);

                billingInformation.NameOnCard              = selectedCard.NameOnCard;
                billingInformation.CreditCardNumber        = selectedCard.CreditCardNo;
                billingInformation.CreditCardNumberDisplay = selectedCard.CreditCardNoForDisplay;
                billingInformation.SecurityCode            = selectedCard.CreditCardCVSNo;
                billingInformation.ExpiryMonth             = selectedCard.Month;
                billingInformation.ExpiryYear              = selectedCard.Year;
                billingInformation.CreditCardType          = selectedCard.CreditCardType;
                billingInformation.CreditCardId            = (int)selectedCard.CreditCardId;

                billingInformation.LocationId = (int)ReservationMobileRequest.reversationData.StartLocationId;

                billingInformation.FullName    = Constants.customerDetails.FirstName;
                billingInformation.PaymentInfo = new PaymentReferenceInfo();
                //billingInformation.PaymentInfo.ResevationId = ReservationMobileResponse.ReserveId;
                //billingInformation.PaymentInfo.AgreementId = ReservationMobileResponse.ReserveId;
                billingInformation.PaymentInfo.PaymentType    = "Advance Payment";
                billingInformation.PaymentInfo.PaymentDate    = DateTime.Now;
                billingInformation.PaymentInfo.PaymentDateStr = DateTime.Now.ToString();
                billingInformation.PaymentInfo.PaymentMode    = PaymentMode.Payment;
                billingInformation.PaymentInfo.PaymentBy      = Constants.customerDetails.FirstName;
                ReservationController reservationController = new ReservationController();
                submitPaymentandCreateReservationRequest.billingInformation = billingInformation;

                if (App.Current.Properties.ContainsKey("LastCreditCardId"))
                {
                    App.Current.Properties["LastCreditCardId"] = (int)selectedCard.CreditCardId;
                }
                else
                {
                    App.Current.Properties.Add("LastCreditCardId", (int)selectedCard.CreditCardId);
                }
                bool busy = false;
                if (!busy)
                {
                    try
                    {
                        busy = true;
                        await PopupNavigation.Instance.PushAsync(new LoadingPopup("."));

                        await Task.Run(async() =>
                        {
                            try
                            {
                                PaymentResponse = reservationController.SubmitPaymentAndCreateReservation(submitPaymentandCreateReservationRequest, token);
                            }
                            catch (Exception ex)
                            {
                                await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        await PopupNavigation.Instance.PushAsync(new ErrorWithClosePagePopup(ex.Message));
                    }
                    finally
                    {
                        busy = false;
                        if (PopupNavigation.Instance.PopupStack.Count == 1)
                        {
                            await PopupNavigation.Instance.PopAllAsync();
                        }
                        if (PopupNavigation.Instance.PopupStack.Count > 1)
                        {
                            if (PopupNavigation.Instance.PopupStack[PopupNavigation.Instance.PopupStack.Count - 1].GetType() != typeof(ErrorWithClosePagePopup))
                            {
                                await PopupNavigation.Instance.PopAllAsync();
                            }
                        }

                        if (PaymentResponse != null)
                        {
                            if (PaymentResponse.Status)
                            {
                                if (PaymentResponse.Data != null)
                                {
                                    if (PaymentResponse.Data.reservationRespose != null)
                                    {
                                        if (PaymentResponse.Data.reservationRespose.ReserveId > 0)
                                        {
                                            await PopupNavigation.Instance.PushAsync(new SuccessPopUp("Congrats! Your payment was successful! You will receive an email once your insurance card has been issued. Please DO NOT attempt to pick up the vehicle until then.", 1));
                                        }
                                        else if (PaymentResponse.RefundStatus)
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Your payment will refund shortly. "));
                                        }
                                        else
                                        {
                                            await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Please contact us for your refund. "));
                                        }
                                    }
                                    else if (PaymentResponse.RefundStatus)
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Your payment will refund shortly. "));
                                    }
                                    else
                                    {
                                        await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Please contact us for your refund. "));
                                    }
                                }
                                else if (PaymentResponse.RefundStatus)
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Your payment will refund shortly. "));
                                }
                                else
                                {
                                    await PopupNavigation.Instance.PushAsync(new Error_popup("Sorry, Your booking failed. Please contact us for your refund. "));
                                }
                            }
                            else
                            {
                                await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try again with another card details."));
                            }
                        }
                        else
                        {
                            await PopupNavigation.Instance.PushAsync(new Error_popup("SORRY, YOUR PAYMENT PROCESS FAILED, Please try again with another card details."));
                        }
                    }
                }
            }
            else
            {
                await PopupNavigation.Instance.PushAsync(new Error_popup("Please select a valid card details"));
            }
        }