Ejemplo n.º 1
0
 public VakifBankOdeme(VakifBankParamterBuilder param)
 {
     this._param = param;
 }
        public VakifBankResponse VakifBankOdemeYap(EravsePaymentParameters eravseParameter)
        {
            VakifBankResponse response = null;

            if (eravseParameter.Bank != PaymentEnums.Banks.DefaultBank)
            {
                if (eravseParameter.Bank == PaymentEnums.Banks.VakifBank)
                {
                    response = new VakifBankResponse();
                }


                using (Datasets.GatewayContextDataContext db = new Datasets.GatewayContextDataContext())
                {
                    var User = db.PaymentCustomers.Where(r => r.UserGuid == eravseParameter.CompanyCode && r.Password == eravseParameter.Password);
                    if (User.Count() > 0)
                    {
                        #region + + +  VAKIFBANK + + +


                        if (eravseParameter.Bank == PaymentEnums.Banks.VakifBank)
                        {
                            VakifBankParamterBuilder _builder = new VakifBankParamterBuilder();

                            Datasets.CustomerParameter customerParameter = db.CustomerParameters.First(r => r.CustomerRowId == User.First().UserGuid&& r.Bank == (int)eravseParameter.Bank);
                            byte[] b = customerParameter.Parameters;

                            _builder = (VakifBankParamterBuilder)SerializeProccess.Deserialize(b);

                            _builder.kkno    = eravseParameter.CardNo;
                            _builder.gectar  = eravseParameter.LastValidYear + eravseParameter.LastValidMount;
                            _builder.cvc     = eravseParameter.Cvc.ToString(CultureInfo.InvariantCulture);
                            _builder.tutar   = "000000000100";
                            _builder.khip    = eravseParameter.ClientIp;
                            _builder.taksits = "0" + eravseParameter.Installment.ToString();

                            using (VakifBankOdeme odeme = new VakifBankOdeme(_builder))
                            {
                                response = odeme.VakifOdemeYap();
                            }
                        }
                        #endregion
                    }
                }
            }
            else
            {
                response = new VakifBankResponse
                {
                    Kod   = PaymentEnums.EravseReturnCode.BankKodeNotValid.ToString(),
                    Mesaj = GetEravseResponseMessageFromReturnCode(PaymentEnums.EravseReturnCode.BankKodeNotValid)
                };
            }



            // LOGIN KONTROL
            // EGER DB BAGLANTISI YAPACAKSANIZ ORNEK OLARAK VERILMISTIR.


            //Classes.VakifBankParamterBuilder builerder = new VakifBankParamterBuilder{

            //kullanici ="0001",
            //sifre ="00000000",
            //islem = PaymentEnums.VakifBankIslem.PRO,
            //uyeno = "000000000",
            //posno="00000000",
            //provno="000000",
            //islemyeri = PaymentEnums.VakifBankIslemYeri.I,
            //uyeref="200501011234567890",
            //vbref ="6527BB1815F9AB1DE864A488E5198663002D0000",
            //xcip ="ABABABABAB",
            //ucaf=""
            //};


            //builerder.kkno = EravseParameter.CardNo.ToString();
            //builerder.gectar = EravseParameter.LastValidYear.ToString() + EravseParameter.LastValidMount.ToString();
            //builerder.cvc = EravseParameter.CVC.ToString();
            //builerder.tutar = "000000000100";
            //builerder.khip = EravseParameter.ClientIP;

            //using (Datasets.GatewayContextDataContext db  = new Datasets.GatewayContextDataContext())
            //{
            //    Datasets.CustomerParameter cp = new Datasets.CustomerParameter {
            //        Id = Guid.NewGuid(),
            //    CustomerRowId = Guid.Parse("46dd9004-39e2-4b15-aa55-3c85a4ce279a"),
            //    Bank = 1,
            //    Parameters =  Classes.SerializeProccess.Serialize(builerder)
            //    };

            //    db.CustomerParameters.InsertOnSubmit(cp);
            //    db.SubmitChanges();
            //}



            //using (Classes.VakifBankOdeme Odeme = new Classes.VakifBankOdeme(Param))
            //{
            //    return Odeme.VakifOdemeYap();

            //}


            return(response);
        }