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