Exemplo n.º 1
0
        private async Task ImportInternal()
        {
            if (gameEquipments == null)
            {
                gameEquipments = LoadGameEquipments();
                if (gameEquipments == null)
                {
                    return;
                }
            }

            ISaveDataService saveDataService = ServicesContainer.GetService <ISaveDataService>();

            if (saveDataService == null)
            {
                return;
            }

            IList <SaveDataInfo> saveDataInfoItems = saveDataService.GetSaveInfo();

            if (saveDataInfoItems == null)
            {
                return;
            }

            IList <Task <IList <EquipmentsSaveSlotInfo> > > allTasks = saveDataInfoItems
                                                                       .Select(ReadSaveData)
                                                                       .ToList();

            await Task.WhenAll(allTasks);

            IList <EquipmentsSaveSlotInfo> allSlots = allTasks
                                                      .SelectMany(x => x.Result)
                                                      .ToList();

            EquipmentsSaveSlotInfo selected;

            if (allSlots.Count > 1)
            {
                selected = saveSlotInfoSelector(allSlots);
                if (selected == null)
                {
                    return;
                }
            }
            else
            {
                selected = allSlots[0];
            }

            System.Windows.MessageBox.Show("Save data import done.", "Import", System.Windows.MessageBoxButton.OK);

            ApplySaveDataEquipments(selected);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the current API logger.
        /// </summary>
        /// <param name="service">The service.</param>
        /// <returns></returns>
        /// <exception cref="System.InvalidOperationException">The IPGPLogger is not registered in the Api Services.</exception>
        public static IPGPLogger GetCurrentApiLogger(this ServicesContainer service)
        {
            var logger = ApiServicesHelper.GetRegisteredService <IPGPLogger>();

            if (logger == null)
            {
                throw new InvalidOperationException("The IPGPLogger is not registered in the ApiServiceHelper.");
            }

            return(logger);
        }
Exemplo n.º 3
0
        private static T GetServiceOrThrow <T>(this ServicesContainer services)
        {
            T result = services.GetService <T>();

            if (result == null)
            {
                throw Error.InvalidOperation(SRResources.DependencyResolverNoService, typeof(T).FullName);
            }

            return(result);
        }
        public PorticoEcommerceTests()
        {
            ServicesContainer.ConfigureService(new GatewayConfig {
                SecretApiKey   = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A",
                ServiceUrl     = "https://cert.api2.heartlandportico.com",
                OpenPathApiKey = "fteaWC5MYeVKdZ2EaQASDDgCtAS4Fh2zrzW4Yyds",
                OpenPathApiUrl = "http://localhost:35808/v1/globalpayments"
            });

            card = TestCards.VisaManual();
        }
Exemplo n.º 5
0
 public void Init()
 {
     ServicesContainer.ConfigureService(new GatewayConfig {
         MerchantId     = "heartlandgpsandbox",
         AccountId      = "hpp",
         SharedSecret   = "secret",
         RebatePassword = "******",
         RefundPassword = "******",
         ServiceUrl     = "https://api.sandbox.realexpayments.com/epage-remote.cgi"
     });
 }
Exemplo n.º 6
0
        static RedjsHandler()
        {
            string appId    = "52cf3e6e-25df-4dd7-a7a1-db8a7718c3b0";
            string appKey   = "81a452a9-ca88-11ea-bc97-1418772e9399";
            var    code     = @"CEd7yntcMdP81/6DRwpK6gj1bAvjmA38hRJOnrWUCboX4vDCcyOS9XdseEYDn9qw\r\nVADhu9q37gJdD8mKWQ6PfMeFPoB9pP6eJakLAjfiLz0=";
            var    expireAt = ServicesContainer.RegistCode(appId, appKey, code);
            var    host     = System.Web.Configuration.WebConfigurationManager.AppSettings["sourceHost"];

            //host = "http://221.226.117.23:8080/";
            ServicesContainer.AddService(new WebUIService(host, "", "index.html"));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Executes the authorization builder against the gateway.
        /// </summary>
        /// <returns>Transaction</returns>
        public override Transaction Execute(string configName = "default")
        {
            base.Execute(configName);

            var client = ServicesContainer.Instance.GetClient(configName);

            // initialize an OpenPathGateway to process side integration if OpenPathApiKey is provided
            var openPathGatewayInterface = client as IOpenPathGateway;

            // create a new instance of openpath gateway object
            var openpathGateway = new OpenPathGateway()
                                  .WithOpenPathApiKey(openPathGatewayInterface?.OpenPathApiKey)
                                  .WithOpenPathApiUrl(openPathGatewayInterface?.OpenPathApiUrl);

            // process the side integration if apikey and url has value
            if (openpathGateway.IsValidForSideIntegration())
            {
                // sets the builder to the gateway
                openpathGateway.WithAuthorizationBuilder(this);

                // Perform OpenPath side integration
                // Throws exception if transaction is declined, rejected, error, queued
                var openPathResult = openpathGateway.Process();

                // if the transaction is already processed by OpenPath just return a new transaction for now
                if (openPathResult.Status == OpenPathStatusType.Processed)
                {
                    // TODO: map the reponse of gateway connector from OpenPathResult object to Transaction
                    return(new Transaction {
                        OpenPathResponse = openPathResult
                    });
                }
                else if (openPathResult.Status == OpenPathStatusType.BouncedBack)
                {
                    // this means that the transaction passed all the validations in OpenPath but not processed
                    // and a new GatewayConfiguration object was returned, use the new config to initialize a new client
                    // the configuration can be found in OpenPath > Connectors

                    ServicesContainer.ConfigureService(openPathResult.BouncebackConfig, "bounceBackConfig");
                    base.Execute("bounceBackConfig");
                    client = ServicesContainer.Instance.GetClient("bounceBackConfig");
                }
            }

            var authorizationResult = client.ProcessAuthorization(this);

            // sends the transaction id to OpenPath
            if (openpathGateway.IsValidForSideIntegration())
            {
                openpathGateway.WithPaymentTransactionId(authorizationResult.TransactionId).SaveTransactionId();
            }

            return(authorizationResult);
        }
 public GetInformationTests()
 {
     _service = new PayFacService();
     ServicesContainer.ConfigureService(new PorticoConfig()
     {
         CertificationStr    = "5dbacb0fc504dd7bdc2eadeb7039dd",
         TerminalID          = "7039dd",
         Environment         = Environment.TEST,
         X509CertificatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"ProPay\TestData\testCertificate.crt"),
         ProPayUS            = true
     });
 }
        // Helper for ReadAs() to get a ModelBinderProvider to read FormUrl data.
        private static ModelBinderProvider CreateModelBindingProvider(
            HttpActionContext actionContext
            )
        {
            Contract.Assert(actionContext != null);

            ServicesContainer cs = actionContext.ControllerContext.Configuration.Services;
            IEnumerable <ModelBinderProvider> providers = cs.GetModelBinderProviders();
            ModelBinderProvider modelBinderProvider     = new CompositeModelBinderProvider(providers);

            return(modelBinderProvider);
        }
Exemplo n.º 10
0
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <ApplicationDbContext>(options =>
                                                         options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddDbContext <PKShopContext>(options =>
                                                  options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddDbContext <EventStoreContext>(options =>
                                                      options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));

            services.AddIdentity <ApplicationUser, IdentityRole>()
            .AddEntityFrameworkStores <ApplicationDbContext>()
            .AddDefaultTokenProviders();

            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
            .AddCookie(o =>
            {
                o.LoginPath        = new PathString("/login");
                o.AccessDeniedPath = new PathString("/home/access-denied");
            })
            .AddFacebook(o =>
            {
                o.AppId     = Configuration["Authentication:Facebook:AppId"];
                o.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
            })
            .AddGoogle(googleOptions =>
            {
                googleOptions.ClientId     = Configuration["Authentication:Google:ClientId"];
                googleOptions.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
            });

            services.AddMvc();
            services.AddScoped <ServiceFactory>(x => x.GetService);

            services.AddMediatR(typeof(Startup));
            services.AddAutoMapperSetup();

            var builder = new ContainerBuilder();

            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .AsImplementedInterfaces();

            DomainContainer.Load(builder);
            BusContainer.Load(builder);
            IndentityContainer.Load(builder);
            ServicesContainer.Load(builder);
            DataContainer.Load(builder);
            builder.Populate(services);
            Container = builder.Build();

            return(new AutofacServiceProvider(Container));
        }
        public static void ClassInitialize(TestContext context)
        {
            ServicesContainer.ConfigureService(new GpApiConfig {
                AppId         = APP_ID,
                AppKey        = APP_KEY,
                RequestLogger = new RequestConsoleLogger(),
            });

            SampleAction = ReportingService.FindActionsPaged(1, 1)
                           .Where(SearchCriteria.StartDate, DateTime.UtcNow.AddDays(-5))
                           .Execute().Results?.FirstOrDefault();
        }
Exemplo n.º 12
0
        public AutoSubCertification()
        {
            ServicesContainer.ConfigureService(new GatewayConfig {
                SecretApiKey = "skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw",
                ServiceUrl   = "https://cert.api2.heartlandportico.com"
            }, "retail");

            ServicesContainer.ConfigureService(new GatewayConfig {
                SecretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A",
                ServiceUrl   = "https://cert.api2.heartlandportico.com"
            }, "ecomm");
        }
Exemplo n.º 13
0
 public void Init()
 {
     ServicesContainer.ConfigureService(new GpEcomConfig {
         MerchantId   = "heartlandgpsandbox",
         AccountId    = "api",
         SharedSecret = "secret",
         //Channel = "ECOM",
         RebatePassword = "******",
         RefundPassword = "******",
         RequestLogger  = new RequestConsoleLogger()
     });
 }
Exemplo n.º 14
0
        /// <summary>
        /// Gets an exception handler that calls the registered handler service, if any, and ensures exceptions do not
        /// accidentally propagate to the host.
        /// </summary>
        /// <param name="services">The services container.</param>
        /// <returns>
        /// An exception handler that calls any registered handler and ensures exceptions do not accidentally propagate
        /// to the host.
        /// </returns>
        public static IExceptionHandler GetHandler(ServicesContainer services)
        {
            if (services == null)
            {
                throw new ArgumentNullException("services");
            }

            Lazy <IExceptionHandler> exceptionServicesHandler = services.ExceptionServicesHandler;

            Contract.Assert(exceptionServicesHandler != null);
            return(exceptionServicesHandler.Value);
        }
Exemplo n.º 15
0
    /// <summary>
    /// Invoke method
    /// </summary>
    /// <param name="context"></param>
    /// <returns></returns>
    public async Task Invoke(HttpContext context)
    {
        var scontainer = ServicesContainer.GetServices();

        context.Items.Add("DewServiceContainer", scontainer);
        _action?.Invoke(scontainer);
        if (_asyncAction != null)
        {
            await _asyncAction.Invoke(scontainer);
        }
        await _next(context);
    }
Exemplo n.º 16
0
        public static MySQLServiceDBConfiguration SetConnectionString(string ConnectionString)
        {
            var value = new MySQLServiceDBConfiguration();

            value.ConnectionString = ConnectionString;

            ServicesContainer.AddSingleton <MySQLServiceDBConfiguration>(value);

            ServicesContainer.AddTransient <MySQLService>();

            return(value);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Gets an exception handler that calls the registered handler service, if any, and ensures exceptions do not
        /// accidentally propagate to the host.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns>
        /// An exception handler that calls any registered handler and ensures exceptions do not accidentally propagate
        /// to the host.
        /// </returns>
        public static IExceptionHandler GetHandler(HttpConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            ServicesContainer services = configuration.Services;

            Contract.Assert(services != null);
            return(GetHandler(services));
        }
Exemplo n.º 18
0
        /// <summary>Gets an exception logger that calls all registered logger services.</summary>
        /// <param name="services">The services container.</param>
        /// <returns>A composite logger.</returns>
        public static IExceptionLogger GetLogger(ServicesContainer services)
        {
            if (services == null)
            {
                throw Error.ArgumentNull("services");
            }

            Lazy <IExceptionLogger> exceptionServicesLogger = services.ExceptionServicesLogger;

            Contract.Assert(exceptionServicesLogger != null);
            return(exceptionServicesLogger.Value);
        }
Exemplo n.º 19
0
 public GpEcomReportingTest()
 {
     ServicesContainer.ConfigureService(new GpEcomConfig {
         DataClientId     = "2413abd8-ea1f-4f0e-a4b5-eb5ca682efe2",
         DataClientSecret = "nQ3eO3gV1sV7qC7vX8vY3nB1qR4oQ0dH6wI6wN4aA1oA3sP3aL",
         DataClientUserId = "INTAPIUK",
         MerchantId       = "heartlandgpsandbox",
         AccountId        = "api",
         SharedSecret     = "secret",
         Timeout          = 240000,
     });
 }
Exemplo n.º 20
0
 public static void ConfigureDocumentationProvider(string absoluteDocPath, ServicesContainer services)
 {
     try
     {
         var docProvider = new XmlCommentDocumentationProvider(absoluteDocPath);
         services.Replace(typeof(IDocumentationProvider), docProvider);
     }
     catch (FileNotFoundException)
     {
         throw new Exception("Please enable \"XML documentation file\" in project properties with default (bin\\Sample.WebApi.XML) value or edit value in App_Start\\SwaggerNet.cs");
     }
 }
Exemplo n.º 21
0
        /// <summary>Gets an exception logger that calls all registered logger services.</summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns>A composite logger.</returns>
        public static IExceptionLogger GetLogger(ProcessorConfiguration configuration)
        {
            if (configuration == null)
            {
                throw Error.ArgumentNull("configuration");
            }

            ServicesContainer services = configuration.Services;

            Contract.Assert(services != null);
            return(GetLogger(services));
        }
Exemplo n.º 22
0
        public void Test_007_ChargeStoredCard_from_different_configs()
        {
            ServicesContainer.ConfigureService(new GpEcomConfig
            {
                MerchantId     = "heartlandgpsandbox",
                AccountId      = "3dsecure",
                RefundPassword = "******",
                SharedSecret   = "secret",
                RequestLogger  = new RequestConsoleLogger()
            });

            var paymentMethod = new_customer.AddPaymentMethod(PaymentId("Credit"), new CreditCardData
            {
                Number         = "4263970000005262",
                ExpMonth       = 5,
                ExpYear        = DateTime.Now.AddYears(2).Year,
                CardHolderName = "James Mason"
            }).Create("test");

            Assert.IsNotNull(paymentMethod);
            var response = paymentMethod.Charge(12m)
                           .WithRecurringInfo(RecurringType.Fixed, RecurringSequence.First)
                           .WithCurrency("USD")
                           .Execute("test");

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            var pm = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));

            pm.Delete(configName: "test");

            var paymentMethod2 = new_customer.AddPaymentMethod(PaymentId("Credit"), new CreditCardData
            {
                Number         = "4263970000005262",
                ExpMonth       = 5,
                ExpYear        = DateTime.Now.AddYears(2).Year,
                CardHolderName = "James Mason 2"
            }).Create();

            Assert.IsNotNull(paymentMethod2);
            var response2 = paymentMethod2.Charge(12m)
                            .WithRecurringInfo(RecurringType.Fixed, RecurringSequence.First)
                            .WithCurrency("USD")
                            .Execute();

            Assert.IsNotNull(response2);
            Assert.AreEqual("00", response2.ResponseCode);

            var pm2 = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));

            pm2.Delete();
        }
Exemplo n.º 23
0
        public void Init()
        {
            ServicesContainer.ConfigureService(new PorticoConfig {
                SecretApiKey = "skapi_cert_MaePAQBr-1QAqjfckFC8FTbRTT120bVQUlfVOjgCBw"
            });

            card = new GiftCard {
                Number = "5022440000000000007"
            };
            track = new GiftCard {
                TrackData = "%B5022440000000000098^^391200081613?;5022440000000000098=391200081613?"
            };
        }
Exemplo n.º 24
0
 public static void ClassInitialize(TestContext context)
 {
     ServicesContainer.ConfigureService(new GpApiConfig {
         AppId   = APP_ID,
         AppKey  = APP_KEY,
         Country = "GB",
         ChallengeNotificationUrl = "https://ensi808o85za.x.pipedream.net/",
         MethodNotificationUrl    = "https://ensi808o85za.x.pipedream.net/",
         MerchantContactUrl       = "https://enp4qhvjseljg.x.pipedream.net/",
         RequestLogger            = new RequestConsoleLogger(),
         EnableLogging            = true
     });
 }
Exemplo n.º 25
0
        public MySQLService() : base(ServicesContainer.GetService <MySQLServiceDBConfiguration>().Options)
        {
            Options = ServicesContainer.GetService <MySQLServiceDBConfiguration>();

            var method = this.GetType().GetMethod("Set");

            var result = Options.Assembly.GetTypes().Where(x => x.GetInterface("IEntityMySQL", true) != null);

            foreach (var item in result)
            {
                DbSetCollection.Add(item, method.MakeGenericMethod(item).Invoke(this, null));
            }
        }
Exemplo n.º 26
0
        internal static T GetServiceOrThrow <T>(this ServicesContainer services) where T : class
        {
            Contract.Requires(services != null);

            T service = services.GetService <T>();

            if (service == null)
            {
                throw Error.InvalidOperation(Resources.DependencyResolverNoService, typeof(T).FullName);
            }

            return(service);
        }
Exemplo n.º 27
0
        public CheckCertification()
        {
            ServicesContainer.ConfigureService(new PorticoConfig {
                SecretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A"
            });

            address = new Address {
                StreetAddress1 = "123 Main St.",
                City           = "Downtown",
                State          = "NJ",
                PostalCode     = "12345"
            };
        }
Exemplo n.º 28
0
        static void GetAllOrders()
        {
            var ordersCollection = ServicesContainer.GetService <IMongoCollection <Order> >();

            Console.WriteLine("----- Get All Orders -----");
            var orders = ordersCollection.Find(p => p.ProductsAndQuantity.Count > 0).ToList();

            foreach (var order in orders)
            {
                Console.WriteLine("OrderId: {0} | CustomerId: {1} | ProductsAndQuantity: {2} | Status: {3}", order.OrderId, order.CustomerId, order.ProductsAndQuantity.Count, order.Status);
            }
            Console.WriteLine("\n");
        }
Exemplo n.º 29
0
        static void GetAllProducts()
        {
            var productsCollection = ServicesContainer.GetService <IMongoCollection <Product> >();

            Console.WriteLine("----- Get All Products -----");
            var productsForOrder = productsCollection.Find(p => p.InStockAmmount > 0).ToList();

            foreach (var product in productsForOrder)
            {
                Console.WriteLine("Name: {0} | Description: {1} | InStockAmmount: {2} | ProductId: {3}", product.Name, product.Description, product.InStockAmmount, product.ProductId);
            }
            Console.WriteLine("\n");
        }
Exemplo n.º 30
0
 public ProPayFundsTests()
 {
     _service = new PayFacService();
     ServicesContainer.ConfigureService(new PorticoConfig()
     {
         CertificationStr    = "5dbacb0fc504dd7bdc2eadeb7039dd",
         TerminalID          = "7039dd",
         Environment         = Environment.TEST,
         X509CertificatePath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"ProPay\TestData\testCertificate.crt"),
         //X509CertificateBase64String = "MIICpDCCAYygAwIBAgIIS7Y5fijJytIwDQYJKoZIhvcNAQENBQAwETEPMA0GA1UEAwwGUFJPUEFZMB4XDTE5MDkxOTAwMDAwMFoXDTI5MDkxOTAwMDAwMFowEzERMA8GA1UEAwwIMTI3LjAuMDEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCCwvq2ho43oeeGX3L9+2aD7bna7qjdLwWumeIpwhPZLa44MeQ5100wy4W2hKk3pOb5yaHqyhzoHDriveQnq/EpZJk9m7sizXsxZtBHtt+wghSZjdNhnon3R54SH5J7oEPybRSAKXSEzHjN+kCu7W3TmXSLve6YuODnjUpbOcAsHG2wE+zpCoEbe8toH5Tt7g8HzEc5mJYkkILTq6j9pwDE50r2NVbV3SXwmQ1ifxf54Z9EFB5bQv5cI3+GL/VwlQeJdiKMGj1rs8zTR8TjbAjVlJbz6bBkFItUsqexgwAHIJZAaU7an8ZamGRlPjf6dp3mOEu4B47igNj5KOSgCNdRAgMBAAEwDQYJKoZIhvcNAQENBQADggEBAF88u367yrduqd3PfEIo2ClaI2QPRIIWKKACMcZDl3z1BzVzNFOZNG2vLcSuKnGRH89tJPCjyxdJa0RyDTkXMSLqb5FgUseEjmj3ULAvFqLZNW35PY9mmlmCY+S3CC/bQR4iyPLo8lsRq0Nl6hlvB440+9zS8UQjtc2957QgcXfD427UJb698gXzsfQcNeaQWy8pNm7FzDfHTJbo/t6FOpmfR+RMZky9FrlWabInkrkf3w2XJL0uUAYU9jGQa+l/vnZD2KNzs1mO1EqkS6yB/fsn85mkgGe4Vfbo9GQ/S+KmDujewFA0ma7O03fy1W5v6Amn/nAcFTCddVL3BDNEtOM=",
         ProPayUS = true
     });
 }