public async Task ZipClient_ThrowsUnauthorisedAccessException_WhenNoClientAuthDetails()
        {
            using (var client = new ZipClient
                                (
                       new ZipClientConfiguration
                       (
                           null,
                           null,
                           ZipEnvironment.NewZealand.Test
                       )
                                ))
            {
                var request = new CreateOrderRequest()
                {
                    TerminalId = "2531",
                    Order      = new ZipOrder()
                    {
                        Amount = 10.5M,
                        CustomerApprovalCode = "AA05",
                        MerchantReference    = System.Guid.NewGuid().ToString(),
                        Operator             = "Test",
                        PaymentFlow          = ZipPaymentFlow.Payment
                    }
                };

                await Assert.ThrowsExceptionAsync <UnauthorizedAccessException>
                (
                    async() => { await client.CreateOrderAsync(request); }
                );
            }
        }
예제 #2
0
        private async Task ExpandAsync()
        {
            NotifyInstallProgressChanged(STAGE_EXPAND, 0);
            using (var client = new ZipClient())
            {
                client.UnzipProgressChanged += (sender, e) => NotifyInstallProgressChanged(STAGE_EXPAND, e.ProgressPercentage);
                var archive = await ApplicationData.Current.TemporaryFolder.GetFileAsync(Archive);

                var expand = await GetOrMakeExpandFolderAsync(ExpandPath);

                await client.UnzipArchiveTaskAsync(archive.Path, expand.Path);
            }
        }
        /// <summary>
        /// Registers resources that classes will depend on
        /// </summary>
        /// <returns>Task.</returns>
        protected virtual Task RegisterResources(IProgress <double> progress)
        {
            return(Task.Run(() =>
            {
                RegisterSingleInstance(ConfigurationManager);
                RegisterSingleInstance <IApplicationHost>(this);

                RegisterSingleInstance <IApplicationPaths>(ApplicationPaths);

                TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, Logger);

                RegisterSingleInstance(JsonSerializer);
                RegisterSingleInstance(XmlSerializer);

                RegisterSingleInstance(LogManager);
                RegisterSingleInstance(Logger);

                RegisterSingleInstance(TaskManager);

                FileSystemManager = CreateFileSystemManager();
                RegisterSingleInstance(FileSystemManager);

                HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, Logger, FileSystemManager, ConfigurationManager);
                RegisterSingleInstance(HttpClient);

                NetworkManager = CreateNetworkManager();
                RegisterSingleInstance(NetworkManager);

                SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, NetworkManager, LogManager);
                RegisterSingleInstance(SecurityManager);

                InstallationManager = new InstallationManager(Logger, this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, NetworkManager, ConfigurationManager);
                RegisterSingleInstance(InstallationManager);

                ZipClient = new ZipClient();
                RegisterSingleInstance(ZipClient);

                IsoManager = new IsoManager();
                RegisterSingleInstance(IsoManager);

                RegisterModules();
            }));
        }
예제 #4
0
        /// <summary>
        /// Registers resources that classes will depend on
        /// </summary>
        protected async Task RegisterResources(IProgress <double> progress)
        {
            RegisterSingleInstance(ConfigurationManager);
            RegisterSingleInstance <IApplicationHost>(this);

            RegisterSingleInstance <IApplicationPaths>(ApplicationPaths);

            RegisterSingleInstance(JsonSerializer);
            RegisterSingleInstance(MemoryStreamFactory);
            RegisterSingleInstance(SystemEvents);

            RegisterSingleInstance(LogManager, false);
            RegisterSingleInstance(Logger);

            RegisterSingleInstance(EnvironmentInfo);

            RegisterSingleInstance(FileSystemManager);

            HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory, GetDefaultUserAgent);
            RegisterSingleInstance(HttpClient);

            RegisterSingleInstance(NetworkManager);

            TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager, SystemEvents);
            RegisterSingleInstance(TaskManager);

            RegisterSingleInstance(XmlSerializer);

            RegisterSingleInstance(CryptographyProvider);

            SocketFactory = new SocketFactory(LogManager.GetLogger("SocketFactory"));
            RegisterSingleInstance(SocketFactory);

            //RegisterSingleInstance(PowerManagement);

            InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, ConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime);
            RegisterSingleInstance(InstallationManager);

            ZipClient = new ZipClient(FileSystemManager);
            RegisterSingleInstance(ZipClient);

            progress.Report(100);
        }
        /// <summary>
        /// Registers resources that classes will depend on
        /// </summary>
        /// <returns>Task.</returns>
        protected virtual Task RegisterResources(IProgress <double> progress)
        {
            RegisterSingleInstance(ConfigurationManager);
            RegisterSingleInstance <IApplicationHost>(this);

            RegisterSingleInstance <IApplicationPaths>(ApplicationPaths);

            TaskManager = new TaskManager(ApplicationPaths, JsonSerializer, LogManager.GetLogger("TaskManager"), FileSystemManager);

            RegisterSingleInstance(JsonSerializer);
            RegisterSingleInstance(XmlSerializer);
            RegisterSingleInstance(MemoryStreamProvider);

            RegisterSingleInstance(LogManager);
            RegisterSingleInstance(Logger);

            RegisterSingleInstance(TaskManager);

            RegisterSingleInstance(FileSystemManager);

            HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamProvider);
            RegisterSingleInstance(HttpClient);

            NetworkManager = CreateNetworkManager(LogManager.GetLogger("NetworkManager"));
            RegisterSingleInstance(NetworkManager);

            SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager);
            RegisterSingleInstance(SecurityManager);

            InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager);
            RegisterSingleInstance(InstallationManager);

            ZipClient = new ZipClient(FileSystemManager);
            RegisterSingleInstance(ZipClient);

            IsoManager = new IsoManager();
            RegisterSingleInstance(IsoManager);

            return(Task.FromResult(true));
        }