public GetOrderResponse GetOrder(GetOrderRequest request)
 {
     GetOrderResponse response = new GetOrderResponse();
     Order order = _orderRepository.FindBy(request.OrderId);
     response.Order = order.ConvertToOrderView();
     return response;
 }
 public ActionResult CreatePaymentFor(int orderId)
 {
     GetOrderRequest request = new GetOrderRequest() { OrderId = orderId };
     GetOrderResponse response = _orderService.GetOrder(request);
     OrderPaymentRequest orderPaymentRequest = response.Order.ConvertToOrderPaymentRequest();
     PaymentPostData paymentPostData = _paymentService.GeneratePostDataFor(orderPaymentRequest);
     return View("PaymentPost", paymentPostData);
 }
 public ActionResult Detail(int orderId)
 {
     GetOrderRequest request = new GetOrderRequest() { OrderId = orderId };
     GetOrderResponse response = _orderService.GetOrder(request);
     CustomerOrderView orderView = new CustomerOrderView();
     orderView.BasketSummary = base.GetBasketSummaryView();
     orderView.Order = response.Order;
     return View(orderView);
 }
 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));
     }
 }