Exemplo n.º 1
0
        public string NotPciDssCheckoutSendCardDetailsFromMerchant(string invoiceId, string userId, string senderCardNumber, string senderCvv, string senderCardExpiryMonth, string senderCardExpiryYear)
        {
            IdempotentVerificationCheck(invoiceId);
            var   checkout = _queryCheckoutApplicationService.GetCheckoutFromBasket(userId);
            var   orderId  = Guid.NewGuid().ToString();
            Order order    = new Order()
            {
                OrderId = orderId, InvoiceId = invoiceId, UserId = userId, MerchantId = checkout.SellerMerchantId, Status = OrderStatus.Ordered, CurrencyCode = checkout.CurrencyCode, OrderItems = checkout.CheckoutProductViewModels.ToList().Select(x => new OrderItem {
                    OrderItemId = Guid.NewGuid().ToString(), OrderId = orderId, Title = x.Title, Price = x.Price
                })
            };

            _orderRepository.Add(order);

            var dto = new MakeGuestToMerchantPaymentRequest {
                OrderId = orderId, InvoiceId = invoiceId, UserId = order.UserId, RecipientMerchantId = checkout.SellerMerchantId, Amount = checkout.TotalCost, CurrencyCode = checkout.CurrencyCode, SenderCardNumber = senderCardNumber, SenderCvv = senderCvv, SenderCardExpiryMonth = senderCardExpiryMonth, SenderCardExpiryYear = senderCardExpiryYear
            };
            var response = _postToSecureHttpEndpointWithRetries.Post(apiClientUrl: "https://localhost:44379/Payments", idServerUrl: "https://localhost:5001", "client", "secret", "CheckoutApi", dto);

            if (response.IsSuccessStatusCode)
            {
                order.Status = OrderStatus.Paid;
                _orderRepository.Update(order);
            }
            return(order.OrderId);
        }
        public IActionResult Index()
        {
            var subjectIdFromContext = "2b837f52-becd-4938-8a35-0906d8c7d591";
            var checkout             = _queryCheckoutApplicationService.GetCheckoutFromBasket(subjectIdFromContext);

            return(View(checkout));
        }