Esempio n. 1
0
        private CardServiceClient GetWCFClient()
        {
            CardServiceClient _client = null;
            bool succes = false;

            try
            {
                Utils.ToCardLog("CreateWCFClient");
                NetTcpBinding binding = new NetTcpBinding(SecurityMode.Transport);

                binding.Security.Message.ClientCredentialType   = MessageCredentialType.Windows;
                binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;
                binding.Security.Transport.ProtectionLevel      = System.Net.Security.ProtectionLevel.EncryptAndSign;

                string uri = @"net.tcp://192.168.254.139/CardService/CardService.svc";

                EndpointAddress endpoint = new EndpointAddress(new Uri(uri));

                _client = new PDiscountCard.MBProxi.CardServiceClient(binding, endpoint);

                _client.ClientCredentials.Windows.ClientCredential.Domain   = "";
                _client.ClientCredentials.Windows.ClientCredential.UserName = "******";
                _client.ClientCredentials.Windows.ClientCredential.Password = "******";
                return(_client);
            }

            catch (Exception ex)
            {
                string mess = ex.Message;
                succes  = false;
                _client = null;
                Utils.ToCardLog("Error CreateWCFClient " + ex.Message);
                return(null);
            }
        }
Esempio n. 2
0
        internal static MBProxi.PBCustomerInfo AuthWithoutWindow(long id)
        {
            MBProxi.PBCustomerInfo result = null;

            try
            {
                if (id > 0)
                {
                    using (CardServiceClient client = GetWCFClient())
                    {
                        if (client != null && client.Online())
                        {
                            var response = client.PBCustomerAuth(id);

                            if (response != null && response.Result != null)
                            {
                                if (response.Result.Auth)
                                {
                                    result = response.Result;
                                }
                            }
                        }
                    }
                }
            }
            catch { }

            return(result);
        }
        protected virtual void GetFee()
        {
            outputTrigger = ERRORACTION;
            // Reset respective TransactionContext context fields.

            try
            {
                if (Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"]))
                {
                    Thread.Sleep(1000);
                    this.TransactionContext.AppliedFee = 2.35;
                    outputTrigger = "submit";
                }
                else
                {
                    CardFeeRequest request = new CardFeeRequest
                    {
                         KioskTxnrefnum = this.TransactionContext.Id,
                         ServiceKey = this.TransactionContext.DispatcherAction
                    };

                    CardFeeResponse response = new CardFeeResponse{
                         Success = false
                    };

                    using (CardServiceClient client = new CardServiceClient())
                    {
                        response = client.GetCardFee(request);
                    }

                    if (response.Success)
                    {
                        outputTrigger = SUBMITACTION;
                        this.TransactionContext.AppliedFee = response.FeePercentage;
                    }
                    else
                        outputTrigger = ERRORACTION;
                }
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled) log.Error("DU,caught exception GetAppliedFee try  block for TransactionContextid:" + this.TransactionContext.Id + "." + ex.Message);
            }
            finally
            {
                ViewGrid.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DGetFeeProcessed(ChangeState), outputTrigger);
            }
        }
Esempio n. 4
0
        void digitKeyboardOkClc(object sender, double Value)
        {
            if (digitKeyboard.CurentDouble > 0)
            {
                long validationCode = (long)digitKeyboard.CurentDouble;

                if (_lastId != validationCode)
                {
                    try
                    {
                        _lastId = validationCode;

                        using (CardServiceClient client = GetWCFClient())
                        {
                            if (client != null && client.Online())
                            {
                                var response = client.PBCustomerAuth(validationCode);

                                if (response != null && response.Result != null)
                                {
                                    if (response.Result.Auth)
                                    {
                                        ProcUser = response.Result;
                                        Out();
                                    }
                                    else
                                    {
                                        this.footerText.Foreground = Brushes.Black;
                                        this.footerText.Text       = "  Гость не найден";
                                    }
                                }
                                else
                                {
                                    this.footerText.Foreground = Brushes.Red;
                                    this.footerText.Text       = "  Ошибка ответа сервиса";
                                }
                            }
                            else
                            {
                                this.footerText.Foreground = Brushes.Red;
                                this.footerText.Text       = "  CardService offline";
                            }
                        }
                    }
                    catch { }
                }
            }
        }
Esempio n. 5
0
 private DataSet CallGetOnesCard(string pMemberId)
 {
     using (var cardClient = new CardServiceClient())
     {
         DataSet ds = null;
         try
         {
             ds = cardClient.GetOnesCard(pMemberId);
         }
         catch (SoapException ex)
         {
             HZLogger.Error(ex);
         }
         return ds;
     }
 }
        protected override void GetFee()
        {
            string outputTrigger = ERRORACTION;

            try
            {
                if (Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"]))
                {
                    Thread.Sleep(1000);
                    this.TransactionContext.AppliedFee = 2.35;
                    switch (this.Transaction.ServiceType)
                    {
                        case MawaqifServiceType.AccountTopUp:
                            outputTrigger = "topupsubmit";
                            break;
                        case MawaqifServiceType.PermitRenewal:
                            outputTrigger = "rpsubmit";
                            break;
                        case MawaqifServiceType.ViolationPayment:
                            outputTrigger = "pvtsubmit";
                            break;
                    }
                }
                else
                {
                    CardFeeRequest request = new CardFeeRequest
                    {
                        KioskTxnrefnum = this.TransactionContext.Id,
                        ServiceKey = this.TransactionContext.DispatcherAction
                    };

                    CardFeeResponse response = new CardFeeResponse
                    {
                        Success = false
                    };

                    using (CardServiceClient client = new CardServiceClient())
                    {
                        response = client.GetCardFee(request);
                    }

                    if (response.Success)
                    {
                        switch (this.Transaction.ServiceType)
                        {
                            case MawaqifServiceType.AccountTopUp:
                                outputTrigger = "topupsubmit";
                                break;
                            case MawaqifServiceType.PermitRenewal:
                                outputTrigger = "rpsubmit";
                                break;
                            case MawaqifServiceType.ViolationPayment:
                                outputTrigger = "pvtsubmit";
                                break;
                        }
                        this.TransactionContext.AppliedFee = response.FeePercentage;
                    }
                    else
                        outputTrigger = ERRORACTION;
                }
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled) log.Error("Mawaqif,caught exception GetAppliedFee try  block for TransactionContextid:" + this.TransactionContext.Id + "." + ex.Message);
            }
            finally
            {
                ViewGrid.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DGetFeeProcessed(ChangeState), outputTrigger);
            }
        }
        private void PostCardDetails()
        {
            if (log.IsInfoEnabled) log.Info("Postcarddetails started");

            try
            {
                CardRequest request = new CardRequest
                {
                    Ac = this.TransactionContext.AC,
                    AcInfo = this.TransactionContext.ACInfo,
                    AID = this.TransactionContext.AID,
                    AppName = this.TransactionContext.AppName,
                    AuthNum = this.TransactionContext.AuthNum,
                    KioskTxnRefNum = this.TransactionContext.Id,
                    MerchantId = this.TransactionContext.MerchantID,
                    TerminalId = this.TransactionContext.TerminalID,
                    TSI = this.TransactionContext.TSI,
                    TVR = this.TransactionContext.TVR,
                    CardNumber = this.TransactionContext.CardNo
                };

                if (Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"]))
                {
                    Thread.Sleep(1000);
                    this.TransactionContext.AppliedFee = 2.35;
                    if (log.IsInfoEnabled) log.InfoFormat("Post Card Details in Stimulation Mode : {0}", TransactionContext.Id);
                }
                else
                {
                    using (CardServiceClient client = new CardServiceClient())
                    {
                        int result = client.PostCardDetails(request);

                        if (result > 1)
                        {
                            if (log.IsInfoEnabled) log.InfoFormat("Card Details posted successfully for TxnRefnum : {0}", TransactionContext.Id);

                        }
                        else
                        {
                            if (log.IsInfoEnabled) log.InfoFormat("Card Details Posting failed for TxnRefnum : {0}", TransactionContext.Id);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (log.IsErrorEnabled) log.ErrorFormat("Error while Posting card details : {0}", ex.Message);
            }

            if (log.IsInfoEnabled) log.Info("Postcarddetails completed");
        }