Пример #1
0
        public void ShouldProcessValidMessage()
        {
            PaymentRequest request = GetValidPaymentRequest();

            _bankClient.ProcessTransaction(Arg.Any <TransactionRequest>()).Returns(new TransactionResponse {
                Status = true
            });
            var response = _service.ProcessPayment(request);

            Assert.That(response.status, Is.EqualTo(true));
            Assert.That(string.IsNullOrEmpty(response.Message));
        }
Пример #2
0
        public static bool ProcessPayment(Order order, PaymentInfo paymentInfo, IPaymentGatewayService paymentGateway)
        {
            if (order != null && order.Product != null)
            {
                PaymentStatus paymentStatus;
                if (paymentGateway.ProcessPayment(paymentInfo, out paymentStatus))
                {
                    IEnumerable <IPaymentAction> actions = PaymentActionFactory.Get(order.Product.ProductType);

                    foreach (var action in actions)
                    {
                        action.PerformAction(order, paymentStatus);
                    }
                }
            }

            return(true);
        }