Exemplo n.º 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;
 }
Exemplo n.º 2
0
        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;

        }
Exemplo n.º 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;
        }
Exemplo n.º 4
0
        public void SendMail(Order order) {

        }
Exemplo n.º 5
0
        public void PostExecution(Order order) {

        }
Exemplo n.º 6
0
        public void AuthorizationFailed(Order order) {

        }
Exemplo n.º 7
0
        public void AuthorizationSuccess(Order order) {

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