/// <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(); } } }
/// <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(); } }
/// <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(); } } }