Esempio n. 1
0
 public bool Execute(CreditAuthorizationContext context)
 {
     context.ReservationId = _gateway.ReserveCredit(
         context.CreditCardNumber,
         context.Amount);
     return(context.ReservationId != Guid.Empty);
 }
Esempio n. 2
0
 public bool Execute(CreditAuthorizationContext context)
 {
     context.AuthToken = _gateway.CompleteTransaction(
         context.CreditCardNumber,
         context.ReservationId);
     return(context.AuthToken != String.Empty);
 }
Esempio n. 3
0
 public bool Execute(CreditAuthorizationContext context)
 {
     try
     {
         return(_gateway.ValidateCard(context.CreditCardNumber));
     }
     catch (InvalidOperationException)
     {
         return(false);
     }
 }
        public bool PerformFullCreditProcess(
            string cardNumber,
            decimal amount,
            out string authToken)
        {
            var context = new CreditAuthorizationContext
            {
                CreditCardNumber = cardNumber,
                Amount           = amount
            };

            foreach (var step in _steps)
            {
                if (!step.Execute(context))
                {
                    break;
                }
            }

            authToken = context.AuthToken;
            return(false);
        }