Exemple #1
0
 public static Transaction CreateTransaction(Order order, string authCode, string processor) {
     Transaction result=new Transaction();
     result.OrderID = order.OrderID;
     result.Amount = order.Total;
     result.AuthorizationCode = authCode;
     result.Processor = processor;
     result.TransactionDate = DateTime.Now;
     result.TransactionID = Guid.NewGuid();
     result.TransactionErrors = new List<string>();
     return result;
 }
        public Transaction AuthorizeCreditCard(Order order) {
            
            //this is a fake processor for testing...
            //if there are transaction errors, 
            //pop them into the TransactionErrors on the Transaction object
            //for display to the end user
            string authCode = System.Guid.NewGuid().ToString().Substring(0, 10);

            Transaction t = Transaction.CreateTransaction(order, authCode, "FakePaymentGateway");

            return t;

        }
Exemple #3
0
        public static Order FindCurrentOrCreateNew(string userName){
            
            var db = new KonaDB();

            Order result = Order.SingleOrDefault(x => x.UserName == userName && x.OrderStatusID == (int)OrderStatus.NotCheckedOut);

            if (result == null) {
                result = new Order();
                result.OrderID = Guid.NewGuid();
                result.UserName = userName;
                result.UserLanguageCode = System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName;
                result.OrderStatusID = (int)OrderStatus.NotCheckedOut;
                result.Add("");
            } else {
                result.ShippingAddress = Address.SingleOrDefault(x => x.AddressID == result.ShippingAddressID);
                result.BillingAddress = Address.SingleOrDefault(x => x.AddressID == result.BillingAddressID);
            }
            return result;
        }
Exemple #4
0
        public void SendMail(Order order) {

        }
        public void PostExecution(Order order) {

        }
        public void AuthorizationFailed(Order order) {

        }
        public void AuthorizationSuccess(Order order) {

        }
 public bool PreExecution(Order order) {
     return true;
 }
Exemple #9
0
 public string CreateOrderNumber(Order order) {
     return  "MVC-"+Guid.NewGuid().ToString().Substring(0, 8);
 }