public async Task GetInvoicePaymentInvoiceNumberTest() { var request = new InvoicePaymentListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret); request.SearchParameters.Add(InvoicePaymentSearchParameters.InvoiceNumber, 15); var InvoicePaymentList = await InvoicePaymentService.GetInvoicePaymentsAsync(request); Assert.IsTrue(InvoicePaymentList.Data.ToList().Count > 0); }
public async Task GetInvoicePaymentsListTest() { var request = new InvoicePaymentListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret) { }; var InvoicePaymentList = await InvoicePaymentService.GetInvoicePaymentsAsync(request); Assert.IsNotNull(InvoicePaymentList); }
public void GetInvoicesPaymentPaginationTest() { var request = new InvoicePaymentListRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret); request.Limit = 100; request.Page = 1; var InvoicePayments = new List <InvoicePaymentSubset>(); ListedResourceResponse <InvoicePaymentSubset> response; do { response = InvoicePaymentService.GetInvoicePaymentsAsync(request).GetAwaiter().GetResult(); InvoicePayments.AddRange(response.Data); request.Page = response.MetaInformation.CurrentPage + 1; } while (response.MetaInformation.CurrentPage != response.MetaInformation.TotalPages); Assert.IsTrue(InvoicePayments.Count > 0); }
public static async Task <ListedResourceResponse <InvoicePaymentSubset> > GetInvoicePaymentsAsync(InvoicePaymentListRequest listRequest) { var apiRequest = new FortnoxApiClientRequest <ListedResourceResponse <InvoicePaymentSubset> >(HttpMethod.Get, listRequest.AccessToken, listRequest.ClientSecret, ApiEndpoints.InvoicePayments); apiRequest.SetPageAndLimit(listRequest.Page, listRequest.Limit); foreach (var param in listRequest.SearchParameters) { apiRequest.AddSearchParam(param.Key.ToString().ToLower(), param.Value); } return(await FortnoxAPIClient.CallAsync(apiRequest)); }