Beispiel #1
0
        private async Task GetPaymentDetailsAsync(MerchantOrderViewModel merchantOrder)
        {
            HttpResponseMessage response = _getToSecureHttpEndpointWithRetries.Get(apiClientUrl: "https://localhost:44379/payments/" + merchantOrder.PaymentId, idServerUrl: "https://localhost:5001", "client", "secret", "CheckoutApi").Result;

            if (response.IsSuccessStatusCode)
            {
                GetPaymentResponse deserialisedResponse = await response.Content.ReadAsAsync <GetPaymentResponse>();

                merchantOrder.MaskedCardNumber = deserialisedResponse.MaskedCardNumber;
                merchantOrder.ProviderVerifiedPaymentStatus = deserialisedResponse.Succeeded;
            }
        }
        public ActionResult Create(MerchantOrderViewModel vm)
        {
            var orderLocal = AutoMapper.Mapper.Map <Model.OrderLocal>(vm);
            var business   = GEPED.Utils.Resolver.Get <IOrderBusiness>();
            var response   = business.Save(orderLocal);

            TempData["Entity"]     = response.Entity;
            TempData["Messages"]   = response.Messages;
            TempData["StatusCode"] = response.StatusCode;

            return(RedirectToAction("Result"));
        }
Beispiel #3
0
        private MerchantOrdersViewModel MapFrom(string merchantId, IEnumerable <Order> orders)
        {
            var merchantOrders = new List <MerchantOrderViewModel>();

            foreach (var order in orders)
            {
                var merchantOrderProducts  = new List <MerchantOrderProductViewModel>();
                var merchantOrderViewModel = new MerchantOrderViewModel()
                {
                    InvoiceId    = order.InvoiceId,
                    OrderStatus  = order.Status.ToString(),
                    Amount       = order.TotalAmount,
                    CurrencyCode = order.CurrencyCode,
                    PaymentId    = order.PaymentId ?? "0",
                };

                foreach (var orderItem in order.OrderItems)
                {
                    var merchantOrderProductViewModel = new MerchantOrderProductViewModel()
                    {
                        Title  = orderItem.Title,
                        Amount = orderItem.Price.ToString("N2")
                    };
                    merchantOrderProducts.Add(merchantOrderProductViewModel);
                }
                merchantOrderViewModel.MerchentOrderProductViewModels = merchantOrderProducts;
                merchantOrders.Add(merchantOrderViewModel);
            }
            ;

            var merchantOrdersViewModel = new MerchantOrdersViewModel()
            {
                MerchantId = merchantId
            };

            merchantOrdersViewModel.MerchantOrders = merchantOrders;
            return(merchantOrdersViewModel);
        }