/// <summary>
        /// Insertion de la carte rejetée
        /// dans la table des traces
        /// </summary>
        /// <param name="card">Informations carte</param>
        /// <param name="orderCode">Numéro de la transaction BIBIT</param>
        /// <param name="status">Statut</param>
        /// <param name="fullError">Error complète</param>
        /// <param name="completeResponse">Response complète</param>
        public void LogCard(CardInfos card, string orderCode, string status, string fullError, string completeResponse)
        {
            string request = "INSERT INTO CreditCardLog (ComCode,PerCode,Service,Token,TruncatedPAN"
                             + ",Source,OrderCode,Status,Error,CompleteResponse"
                             + ",CreationDate,CreationUser,CardType) VALUES (@comcode, @percode, @service, @token, @truncatedPAN, "
                             + "@source, @orderCode, @status, @fullError, @completeResponse, @creationDate, @creationUser,@cardType)";
            // objet command
            SqlCommand command = new SqlCommand(request, GetConnection());

            try
            {
                command.Parameters.Add("@comcode", SqlDbType.VarChar, 20);
                command.Parameters.Add("@percode", SqlDbType.VarChar, 20);
                command.Parameters.Add("@service", SqlDbType.VarChar, 50);
                command.Parameters.Add("@token", SqlDbType.VarChar, 50);
                command.Parameters.Add("@truncatedPAN", SqlDbType.VarChar, 20);
                command.Parameters.Add("@source", SqlDbType.VarChar, 50);
                command.Parameters.Add("@orderCode", SqlDbType.VarChar, 50);
                command.Parameters.Add("@status", SqlDbType.VarChar, 50);
                command.Parameters.Add("@fullError", SqlDbType.VarChar, 200);
                command.Parameters.Add("@completeResponse", SqlDbType.VarChar, 4000);
                command.Parameters.Add("@creationDate", SqlDbType.DateTime);
                command.Parameters.Add("@creationUser", SqlDbType.VarChar, 100);
                command.Parameters.Add("@cardType", SqlDbType.VarChar, 50);

                command.Parameters["@comcode"].Value          = Util.Nvl(card.GetCustomerCode(), string.Empty);
                command.Parameters["@percode"].Value          = Util.Nvl(card.GetTravellerCode(), string.Empty);
                command.Parameters["@service"].Value          = Util.Nvl(card.GetService(), string.Empty);
                command.Parameters["@token"].Value            = Util.Nvl(card.GetToken(), string.Empty);
                command.Parameters["@truncatedPAN"].Value     = Util.Nvl(card.GetTruncatedPAN(), string.Empty);
                command.Parameters["@source"].Value           = GetApplicationName();
                command.Parameters["@orderCode"].Value        = Util.Nvl(orderCode, string.Empty);
                command.Parameters["@status"].Value           = status;
                command.Parameters["@fullError"].Value        = Util.Nvl(fullError, string.Empty);
                command.Parameters["@completeResponse"].Value = Util.Nvl(completeResponse, string.Empty);
                command.Parameters["@creationDate"].Value     = DateTime.Now;
                command.Parameters["@creationUser"].Value     = GetLogin();
                command.Parameters["@cardType"].Value         = card.GetCardType();

                // Exécution de la requête
                command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                // Une exception a été levée lors de l'insertion
                throw new Exception(GetMessages().GetString("CreditCardLogConnection.LogCard.Error", e.Message, true));
            }
            finally
            {
                DisposeCommand(command);
            }
        }
예제 #2
0
        public void SetValues(UserInfo useri, string pan)
        {
            SetUser(useri);
            this.PAN = pan;

            // On vérifier le numéro de carte (test de Luhn)
            CardInfos ci = Services.CheckCreditCard(useri, pan, Const.EmptyDate, null, null, string.Empty, false,
                                                    //>>EGE-76833 : [BO] Lodged Card - First card rejected on 1€ check
                                                    // false, null, null, null, null, false, 0);
                                                    false, null, null, null, null, 0, string.Empty);

            //>>EGE-76833 : [BO] Lodged Card - First card rejected on 1€ check

            this.TruncatedPAN  = ci.GetTruncatedPAN();//CreditCardVerifier.TruncatePan(pan);
            this.shortCardType = ci.GetShortCardType();
            this.cardType      = ci.GetCardType();
        }
예제 #3
0
 public void SetValues(CardInfos card)
 {
     SetExpirationDate(Util.ConvertDateToString(card.GetExpirationDate(), Const.DateFormat_ddMMyyyyHHmmss));
     // Short Expiration
     SetShortExpirationDate(card.GetShortExpirationDate());
     // Type de carte
     SetCardType(card.GetCardType());
     // Type de carte (court)
     SetShortCardType(card.GetShortCardType());
     // PAN tronqué
     SetTruncatedPan(card.GetTruncatedPAN());
     // MII
     SetMII(card.GetMII());
     // MII Issuer Category
     SetMIIIssuerCategory(card.GetMIIIssuerCategory());
     this.ci = card;
 }
예제 #4
0
        public void SetCard(CardInfos card)
        {
            tb_cardname.Text = card.Name;
            CardType[] typeArray = card.GetCardTypes();
            string     level     = "";
            string     atkdef    = "";
            string     attribute = "";

            if (typeArray.Contains(CardType.Magie) || typeArray.Contains(CardType.Piège))
            {
            }
            else
            {
                if (!typeArray.Contains(CardType.Link))
                {
                    if (typeArray.Contains(CardType.Pendule))
                    {
                        level = string.Format("◊{0}    {1}◊", card.LScale, card.RScale);
                    }
                    else
                    {
                        level = card.Level + "★";
                    }

                    atkdef = string.Format("{0}/{1}", card.Atk, card.Def);
                }
                else
                {
                    LinkMarker[] markers = card.GetLinkMarkers();
                    atkdef = card.Atk + "/LINK-" + markers.Count();

                    level = GetStringLinksMarkers(markers);
                }
                attribute = string.Format("{0}|{1}", card.GetRace(), card.GetAttribute());
            }
            tb_cardlevel.Text     = level;
            tb_cardatkdef.Text    = atkdef;
            tb_cardattribute.Text = attribute;
            tb_cardtype.Text      = card.GetCardType();
            tb_carddesc.Text      = card.Description;

            img_card.Source = FormExecution.AssetsManager.GetPics(new string[] { "BattleCityAlpha", "pics", card.Id + ".jpg" });
        }
예제 #5
0
        /// <summary>
        /// Affectation des valeurs
        /// </summary>
        /// <param name="BOtoken">Token FrontOffice</param>
        /// <param name="pan">Numéro de carte</param>
        /// <param name="expirationDate">Date d'expiration</param>
        /// <param name="ri">Information validation numéro de carte</param>
        public void SetValues(string token, string pan, string csc, CardInfos ri)
        {
            this.Token = token;
            this.PAN   = pan;
            this.CSC   = csc;

            if (ri != null)
            {
                this.TruncatedPAN      = ri.GetTruncatedPAN();
                this.CardType          = ri.GetCardType();
                this.ShortCardType     = ri.GetShortCardType();
                this.MII               = ri.GetMII();
                this.MIIIssuerCategory = ri.GetMIIIssuerCategory();
            }
            else
            {
                this.TruncatedPAN = CreditCardVerifier.TruncatePan(pan);
            }
        }
        private void SetCard(CardInfos card)
        {
            tb_cardname.Text = card.Name;
            CardType[] typeArray = card.GetCardTypes();
            string     level     = "";
            string     atkdef    = "";
            string     attribute = "";

            if (typeArray.Contains(CardType.Magie) || typeArray.Contains(CardType.Piège))
            {
            }
            else
            {
                if (!typeArray.Contains(CardType.Link))
                {
                    if (typeArray.Contains(CardType.Pendule))
                    {
                        level = string.Format("◊{0}    {1}◊", card.LScale, card.RScale);
                    }
                    else
                    {
                        level = card.Level + "★";
                    }

                    atkdef = string.Format("{0}/{1}", card.Atk, card.Def);
                }
                else
                {
                    LinkMarker[] markers = card.GetLinkMarkers();
                    atkdef = card.Atk + "/LINK-" + markers.Count();

                    level = GetStringLinksMarkers(markers);
                }
                attribute = string.Format("{0}|{1}", card.GetRace(), card.GetAttribute());
            }
            tb_cardlevel.Text     = level;
            tb_cardatkdef.Text    = atkdef;
            tb_cardattribute.Text = attribute;
            tb_cardtype.Text      = card.GetCardType();
            tb_carddesc.Text      = card.Description;
        }
예제 #7
0
 /// <summary>
 /// Affectation des valeurs
 /// </summary>
 /// <param name="BOtoken">Token FrontOffice</param>
 /// <param name="pan">Numéro de carte</param>
 /// <param name="expirationDate">Date d'expiration</param>
 /// <param name="ri">Information validation numéro de carte</param>
 public void SetValues(long BOtoken, string pan, DateTime expirationDate, CardInfos ri)
 {
     this.BOToken        = BOtoken;
     this.PAN            = pan;
     this.TruncatedPAN   = CreditCardVerifier.TruncatePan(pan);
     this.ExpirationDate = expirationDate;
     SetShortExpirationDate(Util.GetShortExpirationDate(GetExpirationDate()));
     if (ri != null)
     {
         this.Cvc               = ri.GetCvc();
         this.CardType          = ri.GetCardType();
         this.ShortCardType     = ri.GetShortCardType();
         this.MII               = ri.GetMII();
         this.MIIIssuerCategory = ri.GetMIIIssuerCategory();
         //--> EGE-62034 : Revamp - CCE - Change Financial flow update
         //this.NavisionCardLabel = ri.GetNavisionCardLabel();
         this.NavisionCardLabel = ri.GetNavisionFinancialFlow();
         //<-- EGE-62034 : Revamp - CCE - Change Financial flow update
         this.NavisionCardType         = ri.GetNavisionCardType();
         this.IsNavisionPaymentAirplus = ri.GetNavisionPaymentAirPlus();
         this.IsNavisionPaymentBTA     = ri.GetNavisionPaymentBTA();
         this.IsNavisionLodgedCard     = ri.GetNavisionLodgedCard();
     }
 }
예제 #8
0
        /// <summary>
        /// Return Financial and enhanced flow
        /// from navision
        /// </summary>
        /// <param name="user">User information</param>
        /// <param name="ci">Card information</param>
        /// <returns>Updated card information</returns>
        public static void GetPaymentSettings(UserInfo user, CardInfos ci)
        {
            Navision nws = null;

            try
            {
                // instanciate a new webservice
                nws = new Navision();

                // prepare return
                NAV_CardTypeProviders res = new NAV_CardTypeProviders();

                // call the method
                nws.GetMerchantAndEnhancedFlow(NavWsLogin, NavWsPassword, ci.GetPOS(), ci.GetNavisionCardName()
                                               , Util.ConvertIntToBool(ci.GetNavisionLodgedCard()), ci.GetCardNumber().Substring(0, 6), ref res);

                //nws.GetMerchantAndEnhancedFlow("s-sqlsvc-nav", "G3kt*138!", "france", "VISA", false, "411111", ref res);

                // Let's check if we have an exception code
                NavException10 navExcep = res.NavException[0];

                // retrieve exception code
                string exceptionCode = navExcep.NavExceptionCode[0];

                if (!String.IsNullOrEmpty(exceptionCode))
                {
                    // We have an exception
                    // Let's see how kind of error we have here
                    switch (exceptionCode)
                    {
                    case ERROR_CODE_PROVIDER_NOT_FOUND:
                        // Provider not found..no mapping for this card
                        // We will put default values
                        ci.SetNavisionFinancialFlow(string.Empty);
                        ci.SetNavisionEnhancedFlow(string.Empty);
                        ci.SetOnlineValidation(CREDIT_CARD_NO_ONLINE_VALIDATION);
                        return;

                    case ERROR_CODE_CARD_TYPE_UNKNOWN:
                        // unknow card type
                        // just raise the issue to the caller
                        throw new Exception(user.GetMessages().GetString("CardTypeNotAllowedByNavision", ci.GetTruncatedPAN(), ci.GetCardType(), true));

                    default:
                        throw new Exception(navExcep.NavExceptionDesc[0]);
                    }
                }


                // everything is fine
                // we have the mapping
                NAV_CardTypeProvider ret = res.NAV_CardTypeProvider[0];
                // let's put values
                ci.SetNavisionFinancialFlow(ret.FinancialFlow);
                ci.SetNavisionEnhancedFlow(ret.EnhancedFlow);
                ci.SetOnlineValidation(ret.OnlineCheck);
            }
            finally
            {
                if (nws != null)
                {
                    nws.Dispose();
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Vérification des cartes BIBIT
        /// via un service RBS (Royal Bank of Scotland)
        /// </summary>
        /// <param name="user">Compte utilisateur</param>
        /// <param name="card">Informations carte</param>
        /// <param name="timeOut">Timeout (s)</param>
        /// <returns>BibitVerifierResult</returns>
        public static ProviderVerifierResult CheckCard(UserInfo user, CardInfos card, int timeOut)
        {
            ProviderVerifierResult retval = new ProviderVerifierResult();

            try
            {
                // Do we need to do zero amount validation?
                bool doZeroValidation = (card.GetOnlineValidation() == CardInfos.CardOnlineValidations.ZERO_AMOUNT);

                // Construction de la requête
                RBSPaymentServiceRequest rs = new RBSPaymentServiceRequest(user, card, doZeroValidation);

                Services.WriteOperationStatusToLog(user, String.Format(" - Info : Online validation : Try {0} for card type = {1}, truncated PAN = {2}, POS = {3}",
                                                                       (doZeroValidation ? "Zero Amount" : "One Amount"), card.GetCardType(), card.GetTruncatedPAN(), card.GetPOS()));

                // Appel du service et récupération de la réponse
                // if the zero amount is enabled then we will send zero amount first
                // if the card was refused, then we will try with one amount
                string response = HttpUtil.HttpPost(user, RBSServiceUrl, RBSServiceLogin, RBSServicePassword, rs.GetXML(), timeOut);

                // Traitement de la réponse
                RBSPaymentServiceResponse res = new RBSPaymentServiceResponse(response);

                Services.WriteOperationStatusToLog(user, String.Format(" - Info : Online validation : {0} validation done (Valid = {1}) for card type = {2}, truncated PAN = {3}, POS = {4}",
                                                                       (doZeroValidation ? "Zero Amount" : "One Amount"), res.isSuccess(), card.GetCardType(), card.GetTruncatedPAN(), card.GetPOS()));

                // We have our response
                // that's not the end. If the card was refused and we have send zero amount validation
                // if that case, we need to try with one amount
                if (!res.isSuccess() && doZeroValidation)
                {
                    Services.WriteOperationStatusToLog(user, String.Format(" - Info : Online validation - Zero Amount Validation : the card was refused..we will try with One amount for card type = {0}, truncated PAN = {1}, POS = {2}",
                                                                           card.GetCardType(), card.GetTruncatedPAN(), card.GetPOS()));

                    // the card was refused with Zero amount
                    // let's try with one amount
                    rs = new RBSPaymentServiceRequest(user, card, false);

                    // let's try again with one amount
                    response = HttpUtil.HttpPost(user, RBSServiceUrl, RBSServiceLogin, RBSServicePassword, rs.GetXML(), timeOut);

                    // let's parse response
                    res = new RBSPaymentServiceResponse(response);

                    Services.WriteOperationStatusToLog(user, String.Format(" - Info : Online validation - One Amount validation after Zero done (Valid = {0}) for card type = {1}, truncated PAN = {2}, POS = {3}"
                                                                           , res.isSuccess(), card.GetCardType(), card.GetTruncatedPAN(), card.GetPOS()));
                }


                // et retour du statut
                // on va egalement retourner la réponse entière du service RBS
                // de plus on ajoute le numéro de la transaction
                retval.SetSuccess(res.isSuccess());
                retval.SetCompleteResponse(res.GetInputResponse());
                retval.SetOrderCode(rs.GetOrderCode());
            }
            catch (WebException ex)
            {
                // Récupération de l'exception
                string code = Const.StatusConnectionError;
                if (ex.Status.Equals(WebExceptionStatus.Timeout))
                {
                    // On a eu un timeout
                    // il faut tracer cette erreur dans une table
                    // avant de lever l'exception
                    code = Const.StatusTimeOut;
                }
                retval.SetInformationCode(code);
                retval.SetInformationMessage(ex.Message);
            }
            catch (Exception e)
            {
                // Erreur lors de la vérication de la carte
                // via le service RBS
                // L'erreur peut être un TimeOut
                // Dans tous les cas, on doit ignorer cette exception
                // et informer le client que la carte est valide

                retval.SetInformationCode(Const.StatusConnectionError);
                retval.SetInformationMessage(e.ToString());
            }
            return(retval);
        }