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