Click here to Skip to main content
15,894,405 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there..
I have a problem, and really don`t know how to solve it.
So, this is the task, it`s about making orderds on e-shop (the last part when user have to enter credit card number, security code and date of expiring).
So this is the query for saving credit card info:

C#
using (DataContext dc = new DataContext())
            {
                eCreditCard ek = new eCreditCard();
                var query2 = (from y in dc.eUsers
                             where y.name + " " + y.lname == Session["LoggedUser"].ToString()
                             select y).SingleOrDefault();



                var query3 = (from x in dc.eCreditCards
                             where x.UserFK==query2.id
                             select x).SingleOrDefault();


if(query3==null) // so, if there are no credit card for this logged user, it save all required data!
{
                    ek.CreditCardNumber = txt_cnumber.Text;
                    ek.SecurityCode = txt_code.Text;
                    ek.ExDate = DateTime.Parse(txt_dateEx.Text);
                    ek.UserFK = query2.id;

                    OrdersController.SaveCard(ek);
}
else
{
/*here I have big problem! I want simple thing: if there are credit card for that user, just to update some records (security code, date of expiration..)
I have tried like this:*/
ek.CreditCardNumber = txt_cnumber.Text;
                    ek.SecurityCode = txt_code.Text;
                    ek.ExDate = DateTime.Parse(txt_dateEx.Text);
                    ek.UserFK = query2.id;
dc.SubmitChanges();
//but don`t work. Doesnt change the record.
}


ANY suggesstions?! I would really appreciate it!
Posted

1 solution

Well this is probable not the solution that you are looking for, but do not store credit card information. The PCI regulations specifically forbid storing of any of the following: Unencrypted credit card number, CVV or CVV2, Pin blocks, PIN numbers, Track 1 or 2 data. Any of the above found in databases, log files, audit trails, backup’s etc. can result in serious consequences for the merchant, especially if a compromise has taken place. Basically by accepting to take credit cards you agree to be PCI compliant. If you want to be able you store the card information for future transactions then a lot of payment gateways give you the ability to store that information on their end and you just use a web service when you want to do any future transactions with that card.
 
Share this answer
 
Comments
Maciej Los 8-Jun-12 11:14am    
Good advise, my 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900