Esempio n. 1
0
        /// <summary>
        /// Vérification du Code de sécurité de la carte
        /// </summary>
        /// <param name="user">Compte utilisateur</param>
        /// <param name="card">Informations carte</param>
        /// <param name="csc">CSV</param>
        public static void IsValidCSC(UserInfo user, CardInfos card, string csc)
        {
            // Vérifions le csc
            if (String.IsNullOrEmpty(csc))
            {
                // Le csc est vide!
                // On s'arrête la
                throw new Exception(user.GetMessages().GetString("EmptyCSC", true));
            }

            // Le csc a été renseigné, on va le vérifier plus en détail
            if (!Util.IsDigit(csc))
            {
                // Le csc doit être numérique
                throw new Exception(user.GetMessages().GetString("NotNumericCSC", true));
            }

            // On va valider le CSC en fonction du type de carte
            switch (card.GetNavisionCardType())
            {
            case CreditCardVerifier.NavisionCardTypeVisa:
            case CreditCardVerifier.NavisionCardTypeEurocardMastercard:
                // CVV2
                // 3 chiffres
                if (csc.Length != 3)
                {
                    throw new Exception(user.GetMessages().GetString("InvalidCSCLenght", true));
                }
                break;

            case CreditCardVerifier.NavisionCardTypeAmericanExpress:
                // CID
                // 4 chiffres
                if (csc.Length != 4)
                {
                    throw new Exception(user.GetMessages().GetString("InvalidCSCLenght", true));
                }
                break;

            default:

                break;
            }
        }
Esempio n. 2
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();
     }
 }
Esempio n. 3
0
        /// <summary>
        /// Insert credit card in Navision
        /// </summary>
        /// <param name="user">User information</param>
        /// <param name="pos">market</param>
        /// <param name="comcode">customer code</param>
        /// <param name="cc1">analytical code 1</param>
        /// <param name="percode">traveler code</param>
        /// <param name="service">product</param>
        /// <param name="retval">value returned</param>
        /// <param name="cardInfos">card informations</param>
        /// <param name="forceWarning">force warning flag</param>
        /// <param name="contextSource">context source for transactional card</param>
        /// <param name="context">context information for transactional card</param>
        public static void InsertPaymentCard(UserInfo user, string pos, string comcode, string cc1, string percode, string service,
                                             InsertCardInNavisionResult retval, CardInfos cardInfos, int forceWarning, string contextSource, string context)
        {
            Navision nws = null;

            try
            {
                // Define a new navision ws connection
                nws = new Navision();

                // prepare output
                Nav_InsertPaymentCard ni = new Nav_InsertPaymentCard();

                // insert credit card
                nws.InsertPaymentCard(NavWsLogin, NavWsPassword, pos, comcode, String.IsNullOrEmpty(percode) ? string.Empty : percode
                                      , String.IsNullOrEmpty(cc1) ? string.Empty : cc1
                                      , Util.ConvertDateToString(cardInfos.GetExpirationDate(), Const.DateFormat_yyyysMMsdd), cardInfos.GetNavisionCardType(),
                                      cardInfos.GetDescription(), cardInfos.GetNavisionLodgedCard(), Util.CorrectServiceForNavision(service), user.GetLogin(),
                                      cardInfos.GetToken(), cardInfos.GetTruncatedPAN(),
                                      cardInfos.GetFirstCardReference(), cardInfos.IsNavisionTransactional(), forceWarning, contextSource, context, ref ni);
                // set value
                retval.SetValues(ni);
            }
            finally
            {
                // Let's dispose now
                if (nws != null)
                {
                    nws.Dispose();
                }
            }
        }