Beispiel #1
0
        public async Task <BasePaymentResponse> ValidateTokenizedCard(CreditCardDetails creditCard, string cvv, string kountSessionId, Account account)
        {
            try
            {
                var request = new TokenizeValidateRequest
                {
                    Token             = creditCard.Token,
                    Cvv               = cvv,
                    SessionId         = kountSessionId,
                    Email             = account.Email,
                    BillingFullName   = creditCard.NameOnCard,
                    CustomerIpAddress = _ipAddressManager.GetIPAddress()
                };

                if (creditCard.ZipCode.HasValue())
                {
                    request.ZipCode = creditCard.ZipCode;
                }

                var response = await CmtPaymentServiceClient.PostAsync(request);

                return(new BasePaymentResponse
                {
                    IsSuccessful = response.ResponseCode == 1,
                    Message = response.ResponseMessage
                });
            }
            catch (Exception e)
            {
                _logger.Maybe(x => x.LogMessage("Error during card validation"));
                _logger.Maybe(x => x.LogError(e));

                var message   = e.Message;
                var exception = e as AggregateException;
                if (exception != null)
                {
                    message = exception.InnerException.Message;
                }

                return(new BasePaymentResponse
                {
                    IsSuccessful = false,
                    Message = message
                });
            }
        }
        public async Task <OrderStatusDetail> CreateOrder(CreateOrderRequest order)
        {
            order.ClientLanguageCode = _localize.CurrentLanguage;
            order.CustomerIpAddress  = _ipAddressManager.GetIPAddress();

            var orderDetail = await UseServiceClientAsync <OrderServiceClient, OrderStatusDetail>(service => service.CreateOrder(order));

            Logger.LogMessage("CreateOrder ID : {0}", order.Id);

            if (!order.PickupDate.HasValue)                                   // Check if this is a scheduled ride
            {
                UserCache.Set("LastOrderId", orderDetail.OrderId.ToString()); // Need to be cached as a string because of a jit error on device
            }

            Task.Run(() => _accountService.RefreshCache(true)).FireAndForget();

            return(orderDetail);
        }
        public IActionResult FinalVote(int catId, int nomId)
        {
            var newModel = new Vote()
            {
                CategoryId    = catId,
                NomineeId     = nomId,
                PhoneIPAdress = iPAddress.GetIPAddress()
            };
            var result = Services.AddVote(newModel);

            if (result == true)
            {
                return(RedirectToAction("Index", "Vote"));
            }
            return(BadRequest($"Award Category already voted for!"));
        }
Beispiel #4
0
        private List <string> GetIpAddressesOutput()
        {
            var entries = new List <string>();

            entries.Add("IP Addresses");

            var cellIp = _ipAddressManager.GetIPAddress();

            foreach (var ip in _ipAddressManager.GetIPAddresses())
            {
                entries.Add(string.Format("\t{0}{1}: {2}", ip.Key, cellIp.ToSafeString() == ip.Value.ToSafeString() ? "*" : "", ip.Value));
            }

            entries.Add(string.Empty);

            return(entries);
        }