public async Task <PaymentResponse> ICheapPaymentGateway(Payment payment_model, int retry)
 {
     try
     {
         _counter.ProcessCheapPaymentCount++;
         return(await AddPayment(payment_model));
     }
     catch (Exception ex)
     {
         _logger.LogError("transaction failed", ex);
         return(null);
     }
 }
Пример #2
0
        /// <summary>
        /// Get an instance of Application
        /// </summary>
        /// <param name="parentLogger">Logger implementation</param>
        public Application(ILoggerInterface parentLogger)
        {
            NewRelic.Api.Agent.NewRelic.SetApplicationName("IisChef");

            NewRelicAgentExtensions.AddCustomParameter("server", Environment.MachineName);
            NewRelicAgentExtensions.AddCustomParameter("user", Environment.UserName);

            BindingRedirectHandler.DoBindingRedirects(AppDomain.CurrentDomain);

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls
                                                    | SecurityProtocolType.Tls11
                                                    | SecurityProtocolType.Tls12
                                                    | SecurityProtocolType.Ssl3;

            // Check current account
            var identity  = WindowsIdentity.GetCurrent();
            var principal = new WindowsPrincipal(identity);

            parentLogger.LogInfo(false, $"Chef app started with identity '{identity.Name}'");

            if (!principal.IsInRole(WindowsBuiltInRole.Administrator))
            {
                parentLogger.LogError("Not running under full admin privileges.");

                if (Debugger.IsAttached)
                {
                    throw new Exception("You must run the deployer with full privileges.");
                }
            }

            // Use the parent logger, at least until we can build a file based one...
            this.Logger = parentLogger;
        }