public static void OrderProcessing(OrderObject order) { Console.WriteLine("\n\n\nValidating credit card number..."); Console.WriteLine("*********************ORDER CONFIRMATION***********************"); //TO-DO Call BankService to validate credit card string c = Convert.ToString(order.getCard()); // card encrypt ServiceClient convert = new ServiceClient(); c = convert.Encrypt(c); //IF credit card is valid do the following if (Program.bs.validate(c)) { //Calcuates total charge for room order double totalCharge = ((double)order.getAmount() * (double)salePrice * .1) + ((double)order.getAmount() * (double)salePrice); //Send confirmation back to travelAgency Console.WriteLine("{0} has successfully placed order with {1} for {2} rooms.", order.getSender(), order.getRec(), order.getAmount()); Console.WriteLine("Price: {0} (${1} x {2})", ((double)order.getAmount() * (double)salePrice), (double)salePrice, (double)order.getAmount()); Console.WriteLine("Tax: ${0}", ((double)order.getAmount() * (double)salePrice * .1)); Console.WriteLine("Grand Total: ${0} \nCard Number: {1}", totalCharge, order.getCard()); Console.WriteLine("*********************************************************\n\n\n"); } else { //Send message back to travelAgency saying creditCard invalid Console.WriteLine("Error: Agency {0} could not place order with {1} due to invalid card number: {2}", order.getSender(), order.getRec(), order.getCard()); } }
public string encode(OrderObject item) { passed = item; byte[] s = Encoding.UTF8.GetBytes(passed.getSender()); string result = Convert.ToBase64String(s); string cc = Convert.ToString(passed.getCard()); byte[] c = Encoding.UTF8.GetBytes(cc); result += " " + Convert.ToBase64String(c); byte[] r = Encoding.UTF8.GetBytes(passed.getRec()); result += " " + Convert.ToBase64String(r); string aa = Convert.ToString(passed.getAmount()); byte[] a = Encoding.UTF8.GetBytes(aa); result += " " + Convert.ToBase64String(a); return(result); }