public SetOrderPaymentResponse SetOrderPayment(SetOrderPaymentRequest paymentRequest)
        {
            SetOrderPaymentResponse paymentResponse = new SetOrderPaymentResponse();

            Order order = _orderRepository.FindBy(paymentRequest.OrderId);

            try
            {
                order.SetPayment(PaymentFactory.CreatePayment(paymentRequest.PaymentToken,
                        paymentRequest.Amount, paymentRequest.PaymentMerchant
                    ));

                _orderRepository.Save(order);
                _uow.Commit();
            }
            catch (OrderAlreadyPaidForException ex)
            {
                //  Out of scope of case study: Refund the payment using the payment service...
                LoggingFactory.GetLogger().Log(ex.Message);
            }
            catch (PaymentAmountDoesNotEqualOrderTotalException ex)
            {
                //  Out of scope of case study: Refund the payment using the payment service...
                LoggingFactory.GetLogger().Log(ex.Message);
            }

            paymentResponse.Order = order.ConvertToOrderView();

            return paymentResponse;
        }
        public void PaymentCallBack(FormCollection collection)
        {   
                int orderId = _paymentService.GetOrderIdFor(collection);            
                GetOrderRequest request = new GetOrderRequest() {OrderId = orderId};                  

                GetOrderResponse response =  _orderService.GetOrder(request);
                
                OrderPaymentRequest orderPaymentRequest = response.Order.ConvertToOrderPaymentRequest();
                
                TransactionResult transactionResult = _paymentService.HandleCallBack(orderPaymentRequest, collection);
                
                if (transactionResult.PaymentOk)
                {
                    SetOrderPaymentRequest paymentRequest = new SetOrderPaymentRequest();
                    paymentRequest.Amount = transactionResult.Amount;
                    paymentRequest.PaymentToken = transactionResult.PaymentToken;
                    paymentRequest.PaymentMerchant = transactionResult.PaymentMerchant;
                    paymentRequest.OrderId = orderId;
                   
                    _orderService.SetOrderPayment(paymentRequest);
                }
                else
                {
                    LoggingFactory.GetLogger().Log(String.Format("Payment not ok for order id {0}, payment token {1}", orderId, transactionResult.PaymentToken));
                }                              
        }