Exemplo n.º 1
0
        // throws exception if payment is rejected
        public void ProcessPayment(string merchantId, CreditCardDetails cardInfo, decimal amount)
        {
            if (amount < 0)
            {
                throw new Exception("The amount value must be positive !");
            }

            Console.WriteLine("Process payment");
        }
Exemplo n.º 2
0
        public bool ProcessProviderPayType(string merchantId,
                                           string cardNumber, string expiration,
                                           decimal amount)
        {
            var provider = new PaySalProvider();

            try
            {
                var cardInfo = new CreditCardDetails(cardNumber, expiration);
                provider.ProcessPayment(merchantId, cardInfo, amount);
                return(true);
            }
            catch
            {
                return(false);
            }
        }