private string vpayRequest(string outputTrigger)
        {
            mwqBillerServiceProxy.PostPaymentPVTRequest request = new mwqBillerServiceProxy.PostPaymentPVTRequest
             {
                 kioskPayDateTime = this.Transaction.Date,
                 TransId = Convert.ToInt64(this.Transaction.Id),
                 ticketNumber = this.Transaction.AccountNumber,
                 CurrentBalance = Convert.ToDouble(this.Transaction.BalanceDue),
                 //NewBalance = this.Transaction.AmountDue,
                 paidAmount = Convert.ToDouble(this.Transaction.AmountPaid),
                 KioskId = this.Transaction.MachineId,
                 paymentIdentifier = this.Transaction.Id,
                 //ticketNumber = this.Transaction.Id,
                 //StimulateResponse = this.Transaction.StimulateBackend,
                 //Language = (Transaction.SelectedLanguageKey == "english") ? KioskLanguage.English :KioskLanguage.Arabic,
                 //ServiceType = MawaqifBackendProxy.MawaqifServiceType.ViolationPayment,
                 //PaymentMode = (this.Transaction.CardPayment) ? MBMEPaymentMode.CARD : MBMEPaymentMode.CASH,
                 //AppliedFee = this.Transaction.AppliedFeeAmount
             };

            mwqBillerServiceProxy.PostPaymentPVTResponse response = new  mwqBillerServiceProxy.PostPaymentPVTResponse { ResponseCode = -2 };

            //Kiosk Stimulate Response
            if (Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"]))
            {
                if (log.IsInfoEnabled) log.Info("mawaqif, Checking standalone configuration" + Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"]).ToString());
                outputTrigger = SUBMITACTION;
                Thread.Sleep(1000);
            }
            else
            {
                try
                {
                    //ValidateCertificate.RegisterCallback();
                    using (mwqBillerServiceProxy.BillerServiceClient client = new  mwqBillerServiceProxy.BillerServiceClient())
                    {
                        response = client.PostPVTPayment(request);
                        trnsLoggedLocaly = true;
                    }
                }
                catch (EndpointNotFoundException ex)
                {
                    this.Transaction.PostingFailed = true;
                    Trace.WriteLine(ex.Message);

                }
                catch (CommunicationException ex)
                {
                    this.Transaction.PostingFailed = true;
                    Trace.WriteLine(ex.Message);
                }
                catch (Exception ex)
                {
                    this.Transaction.PostingFailed = true;
                    Trace.WriteLine(ex.Message);
                }
                finally
                {
                    //ValidateCertificate.DeregisterCallback();
                    //this.Transaction.TxnId = response.TxnId;

                    //if (response.TxnId > 0)
                    //{
                    //    this.Transaction.TxnId = response.TxnId;
                    //    this.Transaction.ReceiptNumber = response.TxnId.ToString();
                    //}

                    this.Transaction.TxnId = Convert.ToInt64(response.BillerTxnRefNum);
                    this.Transaction.ReceiptNumber = response.BillerTxnRefNum;

                    if (!trnsLoggedLocaly)
                    {
                        bool trans = this.LogTransactionToLocalDb();
                        trnsLoggedLocaly = true;
                    }
                    outputTrigger = SUBMITACTION;
                }

                //Check for Biller Response
                if (response.ResponseCode == 0)
                {
                    outputTrigger = SUBMITACTION;
                }
                else
                {
                    if (response.ResponseCode == 3)
                    {
                        this.Transaction.Message = response.response_message;
                        outputTrigger = BILLERERRORACTION;
                        this.Transaction.TransactionFailed = true;
                    }
                    else
                    {
                        outputTrigger = SUBMITACTION;
                        this.Transaction.TransactionFailed = false;
                    }

                }

            }

            return outputTrigger;
        }
        private void vpayRequest(ref string outputTrigger)
        {
            outputTrigger = ERRORACTION;

            mwqBillerServiceProxy.GetPVTRequest request = new mwqBillerServiceProxy.GetPVTRequest
            {
                //TransactionTime = Transaction.Date,
                ConsumerNumber = this.TransactionContext.AccountNumber,
                TransId = Convert.ToInt64(this.Transaction.Id),
                KioskId = this.Transaction.MachineId,

                //StimulateResponse = this.Transaction.StimulateBackend,
                //Locale = this.Transaction.LocaleId,
                //ServiceType = MawaqifBackendProxy.MawaqifServiceType.ViolationPayment,
                //Language = (Transaction.SelectedLanguageKey == "english") ? MawaqifBackendProxy.KioskLanguage.English : MawaqifBackendProxy.KioskLanguage.Arabic,
            };

            mwqBillerServiceProxy.GetPVTResponse response = new mwqBillerServiceProxy.GetPVTResponse
            {
                ResponseCode = -1
            };

            //ValidateCertificate.RegisterCallback();
            using (mwqBillerServiceProxy.BillerServiceClient client = new mwqBillerServiceProxy.BillerServiceClient())
            {
                try
                {
                    response = client.GetPVT(request);
                }
                catch (Exception ex)
                {
                    outputTrigger = ERRORACTION;
                    //Trace.WriteLine(ex.Message);
                    if (log.IsInfoEnabled) log.Info("caught exception in PVTGetBalance." + ex.Message);
                }
                finally
                {
                    //this.Transaction.TxnId = response.TxnId;
                    this.Transaction.ReceiptNumber = this.Transaction.Id; //response.TxnId.ToString();
                    //ValidateCertificate.DeregisterCallback();
                }
            }

            //KS TODO : Logging.
            //if (response.ResponseCode == Convert.ToInt16(MBMEServiceResponse.Success).ToString())
            if (response.ResponseCode == 0)
            {
                //this.Transaction.AccountNumber = response.AccountNumber;
                Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US");
                this.Transaction.IssueDate = response.issueDate.ToString((this.Transaction.LocaleId == "en") ?
                    "dd/MM/yyyy HH:mm:ss" : "HH:mm:ss yyyy/MM/dd");
                //this.Transaction.IssueDate = response.IssueDate.ToString("dd/MM/yyyy HH:mm:ss");
                this.Transaction.PlateNumber = response.PlateNumber;
                this.Transaction.BalanceDue = Convert.ToDouble(response.amount).ToString("0.00");
                this.Transaction.AmountDue = Convert.ToDouble(response.amount).ToString("0.00");
                this.Transaction.Country = response.country;
                this.Transaction.Category = response.category;
                this.Transaction.PVTType = response.type;
                this.Transaction.StageMessage = response.response_message;
                outputTrigger = SUBMITACTION;
            }
            else
            {
                this.Transaction.AccountNumber = string.Empty;
                if (this.Transaction.InvalidCount < this.State.RetryCount)
                {
                    if (response.ResponseCode > 0)
                    {
                        Transaction.InvalidCount++;
                        Transaction.Message = response.response_message;
                        outputTrigger = BILLERERRORACTION;
                    }
                    else
                    {
                        outputTrigger = ERRORACTION;
                    }
                }
                else
                    outputTrigger = ERRORACTION;
            }
        }