public PaymentEngineConnector(string loginDomain, string accessKey, string storeCode, string deviceCode, string customWebServiceUrl = null)
        {
            string baseUrl;

            ServiceURLHelper.GetServiceURL();
            if (ServiceURLHelper.Service_Urls != null && !string.IsNullOrWhiteSpace(ServiceURLHelper.Service_Urls.PaymentApiUrl))
            {
                customWebServiceUrl = ServiceURLHelper.Service_Urls.PaymentApiUrl;
            }

            if (!string.IsNullOrWhiteSpace(customWebServiceUrl))
            {
                baseUrl = customWebServiceUrl;
            }
            else if (loginDomain.StartsWith("localhost", StringComparison.InvariantCultureIgnoreCase))
            {
                baseUrl = "http://" + loginDomain;
            }
            else if (loginDomain.StartsWith("127.0.0.1", StringComparison.InvariantCultureIgnoreCase))
            {
                baseUrl = "http://" + loginDomain;
            }
            else
            {
                baseUrl = string.Format("https://{0}-ws.bloyal.com", loginDomain);
            }
            _webserviceUrl = String.Format("{0}/ws35/PaymentEngine.svc", baseUrl);
            _accessKey     = accessKey;
            _storeCode     = storeCode;
            _deviceCode    = deviceCode;
        }
        /// <summary>
        /// CFDBase constructor
        /// </summary>
        public CFDBase()
        {
            try
            {
                var configurationHelper = ConfigurationHelper.NewInstance;  // Update the Configuration Instance

                if (!configurationHelper.IS_Test_Virtual_Client_Connection && !configurationHelper.IS_Test_BLoyal_Connection)
                {
                    return;
                }

                if (configurationHelper != null && configurationHelper.ENABLE_bLOYAL)
                {
                    _configurationHelper = configurationHelper;

                    // Update bLoyal Service URL
                    ServiceURLHelper.UpdateServiceURL();

                    var dinerwareProvider = new DinerwareProvider();

                    GetTenders(dinerwareProvider);
                    GetDiscountSets(dinerwareProvider, configurationHelper);
                }
            }
            catch (Exception ex)
            {
                _loggerHelper.WriteLogError(ex, "CFDBase - constructor");
            }
        }
        public LoyaltyEngineServices()
        {
            SetupResolver();

            ServiceURLHelper.GetServiceURL();

            if (ServiceURLHelper.Service_Urls != null)
            {
                _service = new LoyaltyService(ServiceURLHelper.Service_Urls.LoyaltyEngineApiUrl, _conFigHelper.ACCESS_KEY);
                //_service = new LoyaltyService("http://localhost:49653", _conFigHelper.ACCESS_KEY);

                SNIPPET_Config_URL = !string.IsNullOrWhiteSpace(_conFigHelper.SNIPPET_URL) ? _conFigHelper.SNIPPET_URL : ServiceURLHelper.Service_Urls.POSSnippetsUrl;
            }
        }
        public override void ButtonPressed(object parentForm, Dinerware.User currentUser)
        {
            try
            {
                if (!ConfigurationHelper.Instance.IS_Test_Virtual_Client_Connection || !ConfigurationHelper.Instance.IS_Test_BLoyal_Connection)
                {
                    frmConfigurationSettingsWarning frmConfigurationSettingsWarning = new frmConfigurationSettingsWarning();
                    frmConfigurationSettingsWarning.ShowDialog();
                    return;
                }

                if (ConfigurationHelper.Instance.ENABLE_bLOYAL)
                {
                    // Update bLoyal Service URL
                    var bLoyalService = ServiceURLHelper.UpdateServiceURL();
                    DinerwareEngineService.VirtualClientClient virtualDinerwareClient;
                    var endPointAddress = new System.ServiceModel.EndpointAddress(ConfigurationHelper.Instance.URL_VIRTUALCLIENT);
                    var binding         = new System.ServiceModel.BasicHttpBinding();
                    binding.Security.Mode  = System.ServiceModel.BasicHttpSecurityMode.None;
                    virtualDinerwareClient = new DinerwareEngineService.VirtualClientClient(binding, endPointAddress);
                    var allTenders = virtualDinerwareClient.GetAllTenderTypes(0);

                    var tendersString = new List <string>();
                    foreach (var tender in allTenders)
                    {
                        tendersString.Add($"{tender.TenderTypeName}");
                    }

                    if (bLoyalService != null)
                    {
                        var           response = Newtonsoft.Json.JsonConvert.SerializeObject(bLoyalService);
                        List <string> msg      = new List <string>();
                        msg.Add("GetServiceUrls Succeeded.  ");
                        msg.Add("  ");
                        msg.Add($"   LoginDomain: {ConfigurationHelper.Instance.LOGIN_DOMAIN}");
                        msg.Add($"   Dinerware Tender Names: {string.Join(", ", tendersString)}");
                        msg.Add($"   Director: {bLoyalService.DirectorUrl}");
                        msg.Add("  ");
                        msg.Add($"   LoyaltyEngineApi: {bLoyalService.LoyaltyEngineApiUrl}");
                        msg.Add($"   OrderEngineApi: {bLoyalService.OrderEngineApiUrl}");
                        msg.Add($"   GridApi: {bLoyalService.GridApiUrl}");
                        msg.Add($"   PaymentApi: {bLoyalService.PaymentApiUrl}");
                        msg.Add($"   WebSnippetsApi: {bLoyalService.WebSnippetsApiUrl}");
                        msg.Add($"   EngagementEngineApi: {bLoyalService.EngagementEngineApiUrl}");
                        msg.Add("  ");
                        msg.Add($"   POSSnippetsUrl: {bLoyalService.POSSnippetsUrl}");
                        msg.Add($"   MyMobileLoyaltyUrl: {bLoyalService.MyMobileLoyaltyUrl}");
                        msg.Add($"   WebSnippetsUrl: {bLoyalService.WebSnippetsUrl}");
                        msg.Add($"   LoggingApiUrl: {bLoyalService.LoggingApiUrl}");
                        frmGetbLoyalServiceURLs show = new frmGetbLoyalServiceURLs(msg);
                        show.ShowDialog();
                    }
                    else
                    {
                        frmUpdatebLoyalServiceUrlMsg frmServiceMsg = new frmUpdatebLoyalServiceUrlMsg(true);
                        frmServiceMsg.ShowDialog();
                    }
                }
                else
                {
                    DisableEnablebLoyalFunctionality disableShow = new DisableEnablebLoyalFunctionality();
                    disableShow.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.Instance.WriteLogError(ex, "Update bLoyal Service Url OEButtonPressed");
            }
        }
Exemple #5
0
 public string ReplaceSIServiceUrl(string originalUrl)
 {
     return(ServiceURLHelper.ReplaceServiceUrl(originalUrl, this.SIServiceAddress, this.SIServicePort));
 }