Пример #1
0
        static async Task Main(string[] args)
        {
            var clientOpitons = new ClientOptions
            {
                AuthServiceUrl    = "https://coretest.isim360.com",
                InvoiceServiceUrl = "https://efaturaservicetest.isim360.com",
                Auth = new ClientOptions.AuthOption
                {
                    ClientId = "serviceApi",
                    Username = "******",
                    Password = "******"
                }
            };
            var client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            // tek servis ise memory kullanılabilir, aksi halde redis vb kullanılmalı
            var distributedCacheProvider = new MemoryDistributedCache(
                new OptionsWrapper <MemoryDistributedCacheOptions>(new MemoryDistributedCacheOptions()));
            var authClient = new AuthClient(clientOpitons, client, distributedCacheProvider);

            FlurlHttp.Configure(settings => settings.HttpClientFactory = new PollyHttpClientFactory(authClient));
            var clientFactory       = new PerBaseUrlFlurlClientFactory();
            var outboxInvoiceClient = new OutboxInvoiceClient(clientOpitons, clientFactory);
            var inboxInvoiceClient  = new InboxInvoiceClient(clientOpitons, clientFactory);
            var commonClient        = new CommonClient(clientOpitons, clientFactory);
            var earchiveClient      = new EArchiveInvoiceClient(clientOpitons, clientFactory);

            var currencies = await commonClient.CurrencyCodeList();

            currencies.ForEach(c => System.Console.WriteLine($"{c.Code} {c.Name}"));


            System.Console.ReadLine();
        }
Пример #2
0
 public InboxInvoiceTests(StartupFixture fixture)
 {
     inboxInvoiceClient = fixture.ServiceProvider.GetRequiredService <InboxInvoiceClient>();
 }
 public InboxInvoiceController(InboxInvoiceClient inboxInvoiceClient)
 {
     this.inboxInvoiceClient = inboxInvoiceClient;
 }