private static void GetSettings() { XmlDocument xmlDoc = new XmlDocument(); XmlNode xmlNode; try { //Load provider object from configuration objProvider = m_ProviderConfiguration.Providers[m_ProviderConfiguration.DefaultProvider]; gatewaySettings = new GatewaySettings(); //get transaction url attribute gatewaySettings.TransactionURL = objProvider.transactionUrl; gatewaySettings.Login = objProvider.login; gatewaySettings.TransactionKey = objProvider.transactionKey; gatewaySettings.Password = objProvider.Password; gatewaySettings.DelimData = objProvider.delimitedData.ToString(); gatewaySettings.DelimChar = "&"; gatewaySettings.Version = objProvider.version; gatewaySettings.TestMode = objProvider.transactionTest.ToString(); gatewaySettings.DeviceType = objProvider.deviceType; gatewaySettings.MarketType = objProvider.marketType; if (string.IsNullOrEmpty(gatewaySettings.TransactionURL)) { throw new GatewayException("TransactionURL cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Login)) { throw new GatewayException("Login cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.TransactionKey)) { throw new GatewayException("TransactionKey cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.DelimData)) { gatewaySettings.DelimData = "TRUE"; } if (string.IsNullOrEmpty(gatewaySettings.DelimChar)) { gatewaySettings.DelimChar = "&"; } if (string.IsNullOrEmpty(gatewaySettings.TestMode)) { gatewaySettings.DelimData = "FALSE"; } } catch (Exception ex) { LogMessage("Error while reading the gateway settings - " + ex.Message); throw new GatewayException("An error occured while reading the gateway settings", ex); } }
public void CanSetGatewayCredentialSupportsShouldProcess() { commandRuntimeMock.Setup(c => c.ShouldProcess(ClusterName, It.IsAny <string>())).Returns(true); hdinsightManagementMock.Setup( c => c.UpdateGatewayCredential(ResourceGroupName, ClusterName, It.Is <UpdateGatewaySettingsParameters>( param => param.IsCredentialEnabled.HasValue && param.UserName == _httpCred.UserName && param.Password == _httpCred.Password.ConvertToString()))) .Verifiable(); var gatewaySettings = new GatewaySettings("true", _httpCred.UserName, _httpCred.Password.ConvertToString()); hdinsightManagementMock.Setup(c => c.GetGatewaySettings(ResourceGroupName, ClusterName)) .Returns(gatewaySettings) .Verifiable(); setcmdlet.ExecuteCmdlet(); commandRuntimeMock.VerifyAll(); commandRuntimeMock.Verify( f => f.WriteObject( It.Is <AzureHDInsightGatewaySettings>( rsp => rsp.IsCredentialEnabled == gatewaySettings.IsCredentialEnabled && rsp.UserName == gatewaySettings.UserName && rsp.Password == gatewaySettings.Password)), Times.Once); }
public void Include(EntityData otherData) { Alerts.AddRange(otherData.Alerts); EmailAlertRecipients.AddRange(otherData.EmailAlertRecipients); SmsAlertRecipients.AddRange(otherData.SmsAlertRecipients); AlertReports.AddRange(otherData.AlertReports); AlertRules.AddRange(otherData.AlertRules); ApplicationLanguages.AddRange(otherData.ApplicationLanguages); ContentLanguages.AddRange(otherData.ContentLanguages); Countries.AddRange(otherData.Countries); DataCollectors.AddRange(otherData.DataCollectors); Districts.AddRange(otherData.Districts); GatewaySettings.AddRange(otherData.GatewaySettings); HeadManagerConsents.AddRange(otherData.HeadManagerConsents); HealthRisks.AddRange(otherData.HealthRisks); HealthRiskLanguageContents.AddRange(otherData.HealthRiskLanguageContents); Localizations.AddRange(otherData.Localizations); LocalizedTemplates.AddRange(otherData.LocalizedTemplates); NationalSocieties.AddRange(otherData.NationalSocieties); Notifications.AddRange(otherData.Notifications); Projects.AddRange(otherData.Projects); SupervisorUserProjects.AddRange(otherData.SupervisorUserProjects); ProjectHealthRisks.AddRange(otherData.ProjectHealthRisks); RawReports.AddRange(otherData.RawReports); Regions.AddRange(otherData.Regions); Reports.AddRange(otherData.Reports); Users.AddRange(otherData.Users); UserNationalSocieties.AddRange(otherData.UserNationalSocieties); Villages.AddRange(otherData.Villages); Zones.AddRange(otherData.Zones); }
public Shard(GatewaySettings settings, ShardInfo info, IGatewayRatelimiter ratelimiter, string url, ILogger logger) { _jsonSerializerOptions = new JsonSerializerOptions().ConfigureForMyriad(); _settings = settings; _info = info; _ratelimiter = ratelimiter; _url = url; _logger = logger.ForContext <Shard>().ForContext("ShardId", info.ShardId); _stateManager = new ShardStateManager(info, _jsonSerializerOptions, logger) { HandleEvent = HandleEvent, SendHeartbeat = SendHeartbeat, SendIdentify = SendIdentify, SendResume = SendResume, Connect = ConnectInner, Reconnect = Reconnect, }; _stateManager.OnHeartbeatReceived += latency => { HeartbeatReceived?.Invoke(latency); }; _conn = new ShardConnection(_jsonSerializerOptions, _logger); }
public RouteHandler(IServerConfigurationHandler _serverConfigurationHandler, IHttpContextAccessor _httpContext, IUserContext _userContext, GatewaySettings _gatewaySettings) { this.serverConfigurationHandler = _serverConfigurationHandler; this.httpContext = _httpContext; this.userContext = _userContext; this.gatewaySettings = _gatewaySettings; }
public NativeGatewayServer(IAgentLibrary agentLibrary, Guid sessionUid, GatewaySettings gatewaySettings) { _disposableTracker = new DisposableTracker(this); _agentLibrary = agentLibrary; _gatewaySettings = gatewaySettings; _token = agentLibrary.GatewayServerCreate(sessionUid); _handlers = new Dictionary <byte, INativeDataHandler>(); }
public ManagedGatewayServer(IStreamFactory streamFactory, GatewaySettings gatewaySettings) { _disposableTracker = new DisposableTracker(this); _gatewaySettings = gatewaySettings; _streamFactory = streamFactory; _handlers = new IManagedDataHandler[DataHandlersMaxCount]; _streams = new List <GatewayStream>(); }
private static void GetSettings() { XmlDocument xmlDoc = new XmlDocument(); XmlNode xmlNode; try { //Load provider object from configuration objProvider = m_ProviderConfiguration.Providers[m_ProviderConfiguration.DefaultProvider]; gatewaySettings = new GatewaySettings(); //get transaction url attribute gatewaySettings.Login = objProvider.login; gatewaySettings.Version = objProvider.version; gatewaySettings.MerchantId = objProvider.MerchantId; gatewaySettings.TerminalId = objProvider.TerminalId; gatewaySettings.IndustryType = objProvider.IndustryType; gatewaySettings.Bin = objProvider.Bin; gatewaySettings.TransactionURL = objProvider.transactionUrl; gatewaySettings.TransactionKey = objProvider.Password; if (string.IsNullOrEmpty(gatewaySettings.TransactionURL)) { throw new GatewayException("TransactionURL cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Login)) { throw new GatewayException("Login cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.TransactionKey)) { throw new GatewayException("TransactionKey cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.DelimData)) { gatewaySettings.DelimData = "TRUE"; } if (string.IsNullOrEmpty(gatewaySettings.DelimChar)) { gatewaySettings.DelimData = "|"; } if (string.IsNullOrEmpty(gatewaySettings.TestMode)) { gatewaySettings.DelimData = "FALSE"; } } catch (Exception ex) { throw new GatewayException("An error occured while reading the gateway settings", ex); } }
public GatewayMessageSender(GatewaySettings settings, ILogger logger) { _settings = settings; _logger = logger; var retryPolicy = new RetryExponential(TimeSpan.FromSeconds(3), TimeSpan.FromMinutes(3), 25); _sender = new MessageSender(settings.ServieBusConnectionString, settings.SendQueueName, retryPolicy); _logger.Information($"Conneted SmsSender '{settings.ServiceName}' to outgoing queue: '{settings.SendQueueName}' "); }
public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvcCore(opt => opt.Filters.Add <GlobalExceptionFilter>()) .AddDataAnnotations() .AddAuthorization() .AddJsonFormatters(); services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => { options.Authority = Configuration["IdentityUrl"]; options.RequireHttpsMetadata = false; options.ApiName = "tags"; }); DapperConfig.Init(); services.AddSingleton(Configuration); var builder = new ContainerBuilder(); var gatewaySettings = new GatewaySettings { TagsUrl = Configuration["TagsUrl"], LocksUrl = Configuration["LocksUrl"] }; builder.Register(x => new Gateway(gatewaySettings)) .As <IGateway>() .SingleInstance(); builder.RegisterType <TagsService>() .As <ITagsService>() .SingleInstance(); builder.RegisterType <TagsRepository>() .As <ITagsRepository>() .SingleInstance(); builder.RegisterType <IdentityService>() .As <IIdentityService>() .SingleInstance(); builder.RegisterType <HttpContextAccessor>() .As <IHttpContextAccessor>() .SingleInstance(); builder.RegisterType <TokensClient>() .As <ITokensClient>() .SingleInstance(); builder.Populate(services); ApplicationContainer = builder.Build(); return(new AutofacServiceProvider(ApplicationContainer)); }
public Shard(ILogger logger, Uri uri, GatewaySettings settings, ShardInfo info, ShardSessionInfo?sessionInfo = null) { _logger = logger.ForContext <Shard>(); _uri = uri; Settings = settings; ShardInfo = info; SessionInfo = sessionInfo ?? new ShardSessionInfo(); }
public MqttMessageHandler(IHttpClientFactory factory, IServiceProvider provider, IOptions <GatewaySettings> settings, ILogger <MqttMessageHandler> logger) { this.m_logger = logger; this.m_factory = factory; this.m_settings = settings.Value; this.m_provider = provider; }
internal static IManageReceiveChannels CreateChannelManager(ReadOnlySettings settings) { var channels = GatewaySettings.GetConfiguredChannels(settings); if (channels.Any()) { return(new ConfigurationBasedChannelManager(channels)); } return(new ConventionBasedChannelManager(settings.EndpointName())); }
public GatewayMessageReceiver(GatewaySettings settings, ITextMessageProcessors processors, ILogger logger) { _logger = logger; _processors = processors; var subscription = EntityNameHelper.FormatSubscriptionPath(settings.ListenToTopic, settings.ServiceName); _receiver = new MessageReceiver(settings.ServieBusConnectionString, subscription); _receiver.RegisterMessageHandler(NewMessagReceivedHandler, ExceptionReceivedHandler); _logger.Information($"Conneted SmsReciever to {settings.ServiceName}"); }
public override ProcessPaymentResult ProcessPayment(ProcessPaymentEvaluationContext context) { var retVal = new ProcessPaymentResult(); GatewaySettings settings = new GatewaySettings(); settings.setCredentials(ProfileId, ProfileKey) //.setVerbose(true) .setHostUrl(GatewaySettings.URL_CERT); Gateway gateway = new Gateway(settings); GatewayRequest request = new GatewayRequest(GatewayRequest.TransactionType.SALE); if (string.IsNullOrEmpty(context.Payment.OuterId)) { request.setCardData(context.BankCardInfo.BankCardNumber, context.BankCardInfo.BankCardMonth.ToString() + context.BankCardInfo.BankCardYear); request.setCurrencyCode(context.Payment.Currency); if (context.Payment.BillingAddress != null) { request.setBillingAddress(context.Payment.BillingAddress.ToString(), context.Payment.BillingAddress.Zip); } } else { request.setTokenData(context.Payment.OuterId, string.Empty); } request.setAmount(context.Order.Sum.ToString(CultureInfo.InvariantCulture)); GatewayResponse response = gateway.run(request); var transactionId = response.getTransactionId(); var errorCode = response.getErrorCode(); if (errorCode.Equals("000")) { context.Payment.AuthorizedDate = DateTime.UtcNow; context.Payment.CapturedDate = DateTime.UtcNow; retVal.OuterId = context.Payment.OuterId = transactionId; retVal.NewPaymentStatus = context.Payment.PaymentStatus = PaymentStatus.Paid; retVal.IsSuccess = context.Payment.IsApproved = true; } else { retVal.NewPaymentStatus = PaymentStatus.Voided; retVal.Error = string.Format("MeS error {0}", errorCode); } return(retVal); }
public GatewayManager( ILogger <GatewayService> log, IOptions <ChainSettings> chainSettings, IOptions <GatewaySettings> gatewaySettings, IServiceProvider serviceProvider, GatewayConnectionManager connectionManager) { this.log = log; this.chainSettings = chainSettings.Value; this.gatewaySettings = gatewaySettings.Value; this.serviceProvider = serviceProvider; Connections = connectionManager; }
public void InitializeGatewaySettings() { using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "InitializeGatewaySettings")) { try { GatewaySettings.ConnectionString = _configStore.ConnectionString; GatewaySettings.ExtConnectionString = _configStore.ExtSysMsgConnectionString; GatewaySettings.IsWSCallMessage = _configStore.IsWSCallMessage; GatewaySettings.IsPlayerCacheResponseRequired = _configStore.IsPlayerCacheResponseRequired; GatewaySettings.AddGetResponseFromCache("PT77", _configStore.IsGetResponseFromCache); GatewaySettings.AddAlwaysSendRequestsToSocket("PT77", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddAlwaysSendRequestsToSocket("PT65", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddAlwaysSendRequestsToSocket("PT66", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddAlwaysSendRequestsToSocket("PT10", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddAlwaysSendRequestsToSocket("PT81", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddAlwaysSendRequestsToSocket("PT37", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddAlwaysSendRequestsToSocket("PT38", _configStore.IsAlwaysSendRequestsViaSocket); GatewaySettings.AddWebServiceRequestNeeded("PT77", _configStore.IsPDWSCallRequired); GatewaySettings.AddWebServiceRequestNeeded("PT65", _configStore.IsPDWSCallRequired); GatewaySettings.AddWebServiceRequestNeeded("PT66", _configStore.IsPDWSCallRequired); GatewaySettings.AddWebServiceRequestNeeded("PT10", _configStore.IsPDWSCallRequired); GatewaySettings.AddWebServiceRequestNeeded("PT37", _configStore.IsPDWSCallRequired); GatewaySettings.AddWebServiceRequestNeeded("PT38", _configStore.IsPDWSCallRequired); GatewaySettings.AddWebServiceRequestNeeded("CA12", _configStore.IsCACallRequiredForWithdrawal); GatewaySettings.AddWebServiceRequestNeeded("CA21", _configStore.IsCACallRequiredForWithdrawal); GatewaySettings.AddWebServiceRequestNeeded("CA41", _configStore.IsCACallRequiredForDeposit); GatewaySettings.AddWebServiceRequestNeeded("CA43", _configStore.IsCACallRequiredForDeposit); GatewaySettings.AddWebServiceRequestNeeded("CA52", _configStore.IsCACallRequiredForBalance); GatewaySettings.AddWebServiceRequestNeeded("PT81", _configStore.IsPT81WSCallRequired); GatewaySettings.SDTMultipleClientSockets = _configStore.IsMultipleSocketClientCallsRequired; GatewaySettings.SDTWSURL = _configStore.CMPWebServiceURL; GatewaySettings.PCGatewayURL = ConfigurationManager.AppSettings["PCGatewayURL"]; GatewaySettings.UseCMP123 = ConfigurationManager.AppSettings["UseCMP123"]; GatewaySettings.SocketSendWithoutReconnect = _configStore.SocketSendWithoutReconnect; GatewaySettings.SocketSendRetryCount = _configStore.SocketSendRetryCount; } catch (Exception ex) { method.Exception(ex); } } }
public static IServiceCollection AddGateways(this IServiceCollection services, Action <GatewaySettings> configureSettings) { services.AddSingleton(serviceProvider => { var gatewaySettings = new GatewaySettings(); configureSettings(gatewaySettings); return(gatewaySettings); }); services.AddHttpClient <IStarshipGateway, StarshipGateway>(); return(services); }
/// <summary> /// Called when the features is activated /// </summary> protected override void Setup(FeatureConfigurationContext context) { var storageConfiguration = context.Settings.Get <GatewayDeduplicationConfiguration>(); storageConfiguration.Setup(context.Settings); var transportDefinition = context.Settings.Get <TransportDefinition>(); ConfigureTransaction(context); var channelManager = CreateChannelManager(context.Settings); RegisterChannels(context, channelManager, out var channelSenderFactory, out var channelReceiverFactory); var logicalAddress = new QueueAddress(context.Settings.EndpointQueueName(), null, null, "gateway"); var gatewayInputAddress = transportDefinition.ToTransportAddress(logicalAddress); var retryPolicy = context.Settings.Get <Func <IncomingMessage, Exception, int, TimeSpan> >("Gateway.Retries.RetryPolicy"); var sender = new GatewayMessageSender( gatewayInputAddress, channelManager, new MessageNotifier(), context.Settings.LocalAddress(), GetConfigurationBasedSiteRouter(context)); context.AddSatelliteReceiver("Gateway", gatewayInputAddress, PushRuntimeSettings.Default, (config, errorContext) => GatewayRecoverabilityPolicy.Invoke(errorContext, retryPolicy, config), (builder, messageContext, cancellationToken) => sender.SendToDestination(messageContext, builder.GetRequiredService <IMessageDispatcher>(), CreateForwarder(channelSenderFactory, builder.GetServices <IDataBus>()?.FirstOrDefault()), cancellationToken)); var configuredSitesKeys = GatewaySettings.GetConfiguredSites(context.Settings) .Select(s => s.Key) .ToList(); context.Pipeline.Register("RouteToGateway", new RouteToGatewayBehavior(gatewayInputAddress, configuredSitesKeys), "Reroutes gateway messages to the gateway"); context.Pipeline.Register("GatewayIncomingBehavior", new GatewayIncomingBehavior(), "Extracts gateway related information from the incoming message"); context.Pipeline.Register("GatewayOutgoingBehavior", new GatewayOutgoingBehavior(), "Puts gateway related information on the headers of outgoing messages"); context.RegisterStartupTask(b => new GatewayReceiverStartupTask( channelManager, channelReceiverFactory, GetEndpointRouter(context), b.GetRequiredService <IMessageDispatcher>(), storageConfiguration.CreateStorage(b), b.GetServices <IDataBus>()?.FirstOrDefault(), gatewayInputAddress, transportDefinition.TransportTransactionMode)); }
public void ProcessPayment_successfull() { //arrange GatewaySettings settings = new GatewaySettings(); settings.setCredentials(ProfileId, ProfileKey) //.setVerbose(true) .setHostUrl(GatewaySettings.URL_CERT); Gateway gateway = new Gateway(settings); var request = CreatePayRequest(); //act var response = gateway.run(request); //assert Assert.NotNull(response.getTransactionId()); Assert.Equal("000", response.getErrorCode()); }
public override ProcessPaymentResult ProcessPayment(ProcessPaymentEvaluationContext context) { var retVal = new ProcessPaymentResult(); GatewaySettings settings = new GatewaySettings(); settings.setCredentials(ProfileId, ProfileKey) .setVerbose(true) .setHostUrl(GatewaySettings.URL_CERT); Gateway gateway = new Gateway(settings); GatewayRequest request = new GatewayRequest(GatewayRequest.TransactionType.SALE); if (string.IsNullOrEmpty(context.Payment.OuterId)) { request.setCardData("4012888812348882", "1216"); } else { request.setTokenData(context.Payment.OuterId, string.Empty); } request.setAmount("1.03"); GatewayResponse response = gateway.run(request); var tranId = response.getTransactionId(); var errorCode = response.getErrorCode(); if (errorCode.Equals("000")) { retVal.OuterId = tranId; retVal.IsSuccess = true; retVal.NewPaymentStatus = PaymentStatus.Pending; //maybe } else { retVal.NewPaymentStatus = PaymentStatus.Voided; retVal.Error = string.Format("Mes error {0}", errorCode); } return(retVal); }
public void Initialize(System.Xml.Linq.XElement xmlSettings) { try { gatewaySettings = new GatewaySettings(); //get transaction url attribute if (xmlSettings.Attribute("ApiEndPoint") != null) { gatewaySettings.ApiEndPoint = xmlSettings.Attribute("ApiEndPoint").Value; } if (xmlSettings.Attribute("User") != null) { gatewaySettings.User = xmlSettings.Attribute("User").Value; } if (xmlSettings.Attribute("Password") != null) { gatewaySettings.Password = xmlSettings.Attribute("Password").Value; } if (xmlSettings.Attribute("Signature") != null) { gatewaySettings.Signature = xmlSettings.Attribute("Signature").Value; } if (xmlSettings.Attribute("Version") != null) { gatewaySettings.Version = xmlSettings.Attribute("Version").Value; } if (xmlSettings.Attribute("ErrorLanguage") != null) { gatewaySettings.ErrorLanguage = xmlSettings.Attribute("ErrorLanguage").Value; } if (xmlSettings.Attribute("DetailLevel") != null) { gatewaySettings.DetailLevel = xmlSettings.Attribute("DetailLevel").Value; } if (xmlSettings.Attribute("RequestDataBinding") != null) { gatewaySettings.RequestDataBinding = xmlSettings.Attribute("RequestDataBinding").Value; } if (xmlSettings.Attribute("ResponseDataBinding") != null) { gatewaySettings.ResponseDataBinding = xmlSettings.Attribute("ResponseDataBinding").Value; } if (xmlSettings.Attribute("AppID") != null) { gatewaySettings.AppID = xmlSettings.Attribute("AppID").Value; } if (xmlSettings.Attribute("PartnerName") != null) { gatewaySettings.PartnerName = xmlSettings.Attribute("PartnerName").Value; } if (xmlSettings.Attribute("CurrencyCode") != null) { gatewaySettings.CurrencyCode = xmlSettings.Attribute("CurrencyCode").Value; } if (xmlSettings.Attribute("ActionType") != null) { gatewaySettings.ActionType = xmlSettings.Attribute("ActionType").Value; } if (xmlSettings.Attribute("FeesPayer") != null) { gatewaySettings.FeesPayer = xmlSettings.Attribute("FeesPayer").Value; } if (xmlSettings.Attribute("RedirectUrl") != null) { gatewaySettings.RedirectUrl = xmlSettings.Attribute("RedirectUrl").Value; } if (xmlSettings.Attribute("ReceiverEmail") != null) { gatewaySettings.ReceiverEmail = xmlSettings.Attribute("ReceiverEmail").Value; } if (xmlSettings.Attribute("DelimChar") != null) { gatewaySettings.DelimChar = xmlSettings.Attribute("DelimChar").Value; } if (string.IsNullOrEmpty(gatewaySettings.ApiEndPoint)) { throw new PaymentProviderException("ApiEndPoint cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.User)) { throw new PaymentProviderException("User cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Password)) { throw new PaymentProviderException("Password cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Signature)) { throw new PaymentProviderException("Signature cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.ActionType)) { throw new PaymentProviderException("ActionType cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.ReceiverEmail)) { throw new PaymentProviderException("ReceiverEmail cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.DelimData)) { gatewaySettings.DelimData = "TRUE"; } if (string.IsNullOrEmpty(gatewaySettings.DelimChar)) { gatewaySettings.DelimChar = "|"; } } catch (Exception ex) { throw new PaymentProviderException("An error occured while reading the gateway settings", ex); } }
public void Initialize(System.Xml.Linq.XElement xmlSettings) { try { gatewaySettings = new GatewaySettings(); //get transaction url attribute if (xmlSettings.Attribute("transactionUrl") != null) { gatewaySettings.TransactionURL = xmlSettings.Attribute("transactionUrl").Value; } if (xmlSettings.Attribute("login") != null) { gatewaySettings.Login = xmlSettings.Attribute("login").Value; } if (xmlSettings.Attribute("password") != null) { gatewaySettings.Password = xmlSettings.Attribute("password").Value; } if (xmlSettings.Attribute("transactionKey") != null) { gatewaySettings.TransactionKey = xmlSettings.Attribute("transactionKey").Value; } if (xmlSettings.Attribute("delimitedData") != null) { gatewaySettings.DelimData = xmlSettings.Attribute("delimitedData").Value; } gatewaySettings.DelimChar = "&"; if (xmlSettings.Attribute("version") != null) { gatewaySettings.Version = xmlSettings.Attribute("version").Value; } if (xmlSettings.Attribute("transactionTest") != null) { gatewaySettings.TestMode = xmlSettings.Attribute("transactionTest").Value; } if (xmlSettings.Attribute("requestType") != null) { gatewaySettings.RequestType = xmlSettings.Attribute("requestType").Value; } if (xmlSettings.Attribute("deviceType") != null) { gatewaySettings.DeviceType = xmlSettings.Attribute("deviceType").Value; } if (xmlSettings.Attribute("marketType") != null) { gatewaySettings.MarketType = xmlSettings.Attribute("marketType").Value; } if (string.IsNullOrEmpty(gatewaySettings.TransactionURL)) { throw new PaymentProviderException("TransactionURL cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Login)) { throw new PaymentProviderException("Login cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.TransactionKey)) { throw new PaymentProviderException("TransactionKey cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.DelimData)) { gatewaySettings.DelimData = "TRUE"; } if (string.IsNullOrEmpty(gatewaySettings.DelimChar)) { gatewaySettings.DelimData = "|"; } if (string.IsNullOrEmpty(gatewaySettings.TestMode)) { gatewaySettings.DelimData = "FALSE"; } } catch (Exception ex) { throw new PaymentProviderException("An error occured while reading the gateway settings", ex); } }
public void Initialize(System.Xml.Linq.XElement xmlSettings) { try { gatewaySettings = new GatewaySettings(); //get transaction url attribute if (xmlSettings.Attribute("transactionUrl") != null) { gatewaySettings.TransactionURL = xmlSettings.Attribute("transactionUrl").Value; } if (xmlSettings.Attribute("user") != null) { gatewaySettings.User = xmlSettings.Attribute("user").Value; } if (xmlSettings.Attribute("password") != null) { gatewaySettings.Password = xmlSettings.Attribute("password").Value; } if (xmlSettings.Attribute("merchantId") != null) { gatewaySettings.MerchantId = xmlSettings.Attribute("merchantId").Value; } if (xmlSettings.Attribute("reportGroup") != null) { gatewaySettings.ReportGroup = xmlSettings.Attribute("reportGroup").Value; } if (xmlSettings.Attribute("orderSource") != null) { gatewaySettings.OrderSource = xmlSettings.Attribute("orderSource").Value; } if (xmlSettings.Attribute("delimitedData") != null) { gatewaySettings.DelimData = xmlSettings.Attribute("delimitedData").Value; } if (xmlSettings.Attribute("DelimChar") != null) { gatewaySettings.DelimChar = xmlSettings.Attribute("DelimChar").Value; } if (xmlSettings.Attribute("version") != null) { gatewaySettings.Version = xmlSettings.Attribute("version").Value; } if (xmlSettings.Attribute("transactionTest") != null) { gatewaySettings.TestMode = xmlSettings.Attribute("transactionTest").Value; } if (xmlSettings.Attribute("deviceType") != null) { gatewaySettings.DeviceType = xmlSettings.Attribute("deviceType").Value; } if (xmlSettings.Attribute("requestType") != null) { gatewaySettings.RequestType = xmlSettings.Attribute("requestType").Value; } if (string.IsNullOrEmpty(gatewaySettings.TransactionURL)) { throw new PaymentProviderException("TransactionURL cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.User)) { throw new PaymentProviderException("User cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.Password)) { throw new PaymentProviderException("Password cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.MerchantId)) { throw new PaymentProviderException("MerchantId cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.ReportGroup)) { throw new PaymentProviderException("ReportGroup cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.OrderSource)) { throw new PaymentProviderException("OrderSource cannot be null"); } if (string.IsNullOrEmpty(gatewaySettings.DelimData)) { gatewaySettings.DelimData = "TRUE"; } if (string.IsNullOrEmpty(gatewaySettings.DelimChar)) { gatewaySettings.DelimChar = "|"; } if (string.IsNullOrEmpty(gatewaySettings.TestMode)) { gatewaySettings.TestMode = "FALSE"; } } catch (Exception ex) { CSCore.CSLogger.Instance.LogException(ex.Message, ex.InnerException); throw new PaymentProviderException("An error occured while reading the gateway settings", ex); } }
public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddMvcCore(opt => opt.Filters.Add <GlobalExceptionFilter>()) .AddDataAnnotations() .AddAuthorization() .AddJsonFormatters(); services.AddAuthentication("Bearer") .AddIdentityServerAuthentication(options => { options.Authority = Configuration["IdentityUrl"]; options.RequireHttpsMetadata = false; options.ApiName = "locks"; }); DapperConfig.Init(); services.AddSingleton(Configuration); var builder = new ContainerBuilder(); var gatewaySettings = new GatewaySettings { TagsUrl = Configuration["TagsUrl"], LocksUrl = Configuration["LocksUrl"] }; builder.Register(x => new Gateway(gatewaySettings)) .As <IGateway>() .SingleInstance(); builder.RegisterType <LocksTagsService>() .As <ILocksTagsService>() .SingleInstance(); builder.RegisterType <LocksService>() .As <ILocksService>() .SingleInstance(); builder.RegisterType <TokensClient>() .As <ITokensClient>() .SingleInstance(); builder.RegisterType <LocksRepository>() .As <ILocksRepository>() .SingleInstance(); builder.RegisterType <LocksTagsRepository>() .As <ILocksTagsRepository>() .SingleInstance(); builder.RegisterType <IdentityService>() .As <IIdentityService>() .SingleInstance(); builder.RegisterType <HttpContextAccessor>() .As <IHttpContextAccessor>() .SingleInstance(); builder.RegisterType <EventPublisher>() .As <IEventPublisher>() .SingleInstance(); builder.Register(context => { var bus = Bus.Factory.CreateUsingRabbitMq(cfg => { cfg.Host(new Uri(Configuration["RabbitMq.Url"]), h => { h.Username(Configuration["RabbitMq.Username"]); h.Password(Configuration["RabbitMq.Password"]); }); }); return(bus); }) .SingleInstance() .As <IBusControl>() .As <IBus>(); builder.Populate(services); ApplicationContainer = builder.Build(); return(new AutofacServiceProvider(ApplicationContainer)); }
public AzureHDInsightGatewaySettings(GatewaySettings gatewaySettings) { this.IsCredentialEnabled = gatewaySettings.IsCredentialEnabled; this.UserName = gatewaySettings.UserName; this.Password = gatewaySettings.Password; }
public Locks(GatewaySettings settings) : base(settings) { Client.BaseAddress = new Uri(settings.LocksUrl); }
/// <summary> /// Validate gateway settings /// </summary> /// <param name="expectedUserName"></param> /// <param name="expectedUserPassword"></param> /// <param name="actualGatewaySettings"></param> public static void ValidateGatewaySettings(string expectedUserName, string expectedUserPassword, GatewaySettings actualGatewaySettings) { Assert.NotNull(actualGatewaySettings); Assert.Equal("true", actualGatewaySettings.IsCredentialEnabled); Assert.Equal(expectedUserName, actualGatewaySettings.UserName); Assert.Equal(expectedUserPassword, actualGatewaySettings.Password); }
public SqlRepository(IOptions <GatewaySettings> gatewayOptions) { _myConfiguration = gatewayOptions.Value; // optional null check here }
public void SetUp() { channelManager = new ConfigurationBasedChannelManager(GatewaySettings.GetConfiguredChannels(new SettingsHolder())); activeChannels = channelManager.GetReceiveChannels(); defaultChannel = channelManager.GetDefaultChannel(); }