예제 #1
0
        private async Task <List <SupplierInvoiceFileConnections> > GetConnections()
        {
            var request = new SupplierInvoiceFileConnectionListRequest(
                connectionSettings.AccessToken,
                connectionSettings.ClientSecret
                );

            return((await SupplierInvoiceFileConnectionService.GetSupplierInvoiceFileConnectionsAsync(request)).Data?.ToList());
        }
예제 #2
0
        public async Task ItCanGetConnections()
        {
            var request = new SupplierInvoiceFileConnectionListRequest(
                connectionSettings.AccessToken,
                connectionSettings.ClientSecret
                );
            var response = await SupplierInvoiceFileConnectionService.GetSupplierInvoiceFileConnectionsAsync(request);

            Assert.IsNotNull(response);
            Assert.IsNotNull(response.Data);
        }
예제 #3
0
        public static async Task <SupplierInvoiceFileConnection> GetSupplierInvoiceFileConnectionAsync(
            SupplierInvoiceFileConnectionListRequest listRequest,
            string fileId)
        {
            var apiRequest = new FortnoxApiClientRequest <SingleResource <SupplierInvoiceFileConnection> >(
                HttpMethod.Get,
                listRequest.AccessToken,
                listRequest.ClientSecret,
                $"{ApiEndpoints.SupplierInvoiceFileConnections}/{fileId}"
                );

            return((await FortnoxAPIClient.CallAsync(apiRequest)).Data);
        }
예제 #4
0
        public static async Task <ListedResourceResponse <SupplierInvoiceFileConnections> > GetSupplierInvoiceFileConnectionsAsync(
            SupplierInvoiceFileConnectionListRequest listRequest)
        {
            var apiRequest = new FortnoxApiClientRequest <ListedResourceResponse <SupplierInvoiceFileConnections> >(
                HttpMethod.Get,
                listRequest.AccessToken,
                listRequest.ClientSecret,
                ApiEndpoints.SupplierInvoiceFileConnections
                );

            apiRequest.SetPageAndLimit(listRequest.Page, listRequest.Limit);

            return(await FortnoxAPIClient.CallAsync(apiRequest));
        }
예제 #5
0
        public async Task ItCanGetAConnection()
        {
            var connections = await GetConnections();

            if (connections == null || !connections.Any())
            {
                Assert.Inconclusive("No connections exist between a file and a supplier invoice in the system");
            }

            var request = new SupplierInvoiceFileConnectionListRequest(
                connectionSettings.AccessToken,
                connectionSettings.ClientSecret
                );
            var response = await SupplierInvoiceFileConnectionService.GetSupplierInvoiceFileConnectionAsync(
                request,
                connections.First().FileId
                );

            Assert.IsNotNull(response);
            Assert.AreEqual(connections.First().FileId, response.FileId);
        }