Skip to content

Commit d408dea

Browse files
authored
Merge pull request #34 from ibanity/rename-peppol-document
Rename Peppol document
2 parents 287a3ad + a28844a commit d408dea

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-8
lines changed

src/Client/Products/eInvoicing/EInvoicingClient.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,15 @@ public class EInvoicingClient : ProductClient<ITokenProviderWithoutCodeVerifier>
2121
public EInvoicingClient(IApiClient apiClient, ITokenProviderWithoutCodeVerifier tokenService, IClientAccessTokenProvider clientAccessTokenService, ICustomerAccessTokenProvider customerTokenService)
2222
: base(apiClient, tokenService, clientAccessTokenService, customerTokenService)
2323
{
24+
var peppolOutboundDocuments = new PeppolOutboundDocuments(apiClient, clientAccessTokenService, UrlPrefix);
25+
2426
Suppliers = new Suppliers(apiClient, clientAccessTokenService, UrlPrefix);
2527
PeppolCustomerSearches = new PeppolCustomerSearches(apiClient, clientAccessTokenService, UrlPrefix);
2628
PeppolRegistrations = new PeppolRegistrations(apiClient, clientAccessTokenService, UrlPrefix);
2729
PeppolInvoices = new PeppolInvoices(apiClient, clientAccessTokenService, UrlPrefix);
2830
PeppolCreditNotes = new PeppolCreditNotes(apiClient, clientAccessTokenService, UrlPrefix);
29-
PeppolOutboundDocuments = PeppolDocuments = new PeppolOutboundDocuments(apiClient, clientAccessTokenService, UrlPrefix);
31+
PeppolDocuments = peppolOutboundDocuments;
32+
PeppolOutboundDocuments = peppolOutboundDocuments;
3033
PeppolInboundDocuments = new PeppolInboundDocuments(apiClient, clientAccessTokenService, UrlPrefix);
3134
ZoomitCustomerSearches = new ZoomitCustomerSearches(apiClient, clientAccessTokenService, UrlPrefix);
3235
ZoomitInvoices = new ZoomitInvoices(apiClient, clientAccessTokenService, UrlPrefix);

src/Client/Products/eInvoicing/Models/PeppolDocument.cs renamed to src/Client/Products/eInvoicing/Models/PeppolOutboundDocument.cs

+8-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
namespace Ibanity.Apis.Client.Products.eInvoicing.Models
77
{
88
/// <summary>
9-
/// Peppol document
9+
/// Peppol outbound document
1010
/// </summary>
1111
[DataContract]
12-
public class PeppolDocument : Identified<Guid>
12+
public class PeppolOutboundDocument : Identified<Guid>
1313
{
1414
/// <summary>
1515
/// When this peppol document was created. Formatted according to &lt;a href&#x3D;&#39;https://en.wikipedia.org/wiki/ISO_8601&#39;&gt;ISO8601&lt;/a&gt; spec
@@ -34,4 +34,10 @@ public class PeppolDocument : Identified<Guid>
3434
[DataMember(Name = "status", EmitDefaultValue = false)]
3535
public string Status { get; set; }
3636
}
37+
38+
/// <summary>
39+
/// Peppol outbound document
40+
/// </summary>
41+
/// <remarks>To maintain backwards compatibility.</remarks>
42+
public class PeppolDocument : PeppolOutboundDocument { }
3743
}

src/Client/Products/eInvoicing/PeppolOutboundDocuments.cs

+35-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Linq;
34
using System.Threading;
45
using System.Threading.Tasks;
56
using Ibanity.Apis.Client.Http;
@@ -9,7 +10,7 @@
910
namespace Ibanity.Apis.Client.Products.eInvoicing
1011
{
1112
/// <inheritdoc cref="IPeppolOutboundDocuments" />
12-
public class PeppolOutboundDocuments : ResourceClient<PeppolDocument, object, object, object, ClientAccessToken>, IPeppolOutboundDocuments, IPeppolDocuments
13+
public class PeppolOutboundDocuments : ResourceClient<PeppolOutboundDocument, object, object, object, ClientAccessToken>, IPeppolOutboundDocuments, IPeppolDocuments
1314
{
1415
private const string EntityName = "peppol/documents";
1516

@@ -24,7 +25,7 @@ public PeppolOutboundDocuments(IApiClient apiClient, IAccessTokenProvider<Client
2425
{ }
2526

2627
/// <inheritdoc />
27-
public Task<EInvoicingCollection<PeppolDocument>> List(ClientAccessToken token, DateTimeOffset? fromStatusChanged, DateTimeOffset? toStatusChanged, long? pageNumber = null, int? pageSize = null, CancellationToken? cancellationToken = null)
28+
public Task<EInvoicingCollection<PeppolOutboundDocument>> List(ClientAccessToken token, DateTimeOffset? fromStatusChanged, DateTimeOffset? toStatusChanged, long? pageNumber = null, int? pageSize = null, CancellationToken? cancellationToken = null)
2829
{
2930
var parameters = new List<(string, string)>();
3031

@@ -36,6 +37,21 @@ public Task<EInvoicingCollection<PeppolDocument>> List(ClientAccessToken token,
3637

3738
return InternalPageBasedList(token, null, parameters, pageNumber, pageSize, cancellationToken);
3839
}
40+
41+
/// <inheritdoc />
42+
async Task<EInvoicingCollection<PeppolDocument>> IPeppolDocuments.List(ClientAccessToken token, DateTimeOffset? fromStatusChanged, DateTimeOffset? toStatusChanged, long? pageNumber, int? pageSize, CancellationToken? cancellationToken)
43+
{
44+
var collection = await List(token, fromStatusChanged, toStatusChanged, pageNumber, pageSize, cancellationToken).ConfigureAwait(false);
45+
46+
return new EInvoicingCollection<PeppolDocument>
47+
{
48+
Items = collection.Items.Cast<PeppolDocument>().ToList(),
49+
ContinuationToken = collection.ContinuationToken,
50+
Number = collection.Number,
51+
Size = collection.Size,
52+
Total = collection.Total
53+
};
54+
}
3955
}
4056

4157
/// <summary>
@@ -52,13 +68,27 @@ public interface IPeppolOutboundDocuments
5268
/// <param name="pageNumber">Number of page that should be returned. Must be included to use page-based pagination.</param>
5369
/// <param name="pageSize">Number (1-2000) of document resources that you want to be returned. Defaults to 2000.</param>
5470
/// <param name="cancellationToken">Allow to cancel a long-running task</param>
55-
/// <returns>A list of Peppol Document resources</returns>
56-
Task<EInvoicingCollection<PeppolDocument>> List(ClientAccessToken token, DateTimeOffset? fromStatusChanged, DateTimeOffset? toStatusChanged, long? pageNumber = null, int? pageSize = null, CancellationToken? cancellationToken = null);
71+
/// <returns>A list of Peppol Outbound Document resources</returns>
72+
Task<EInvoicingCollection<PeppolOutboundDocument>> List(ClientAccessToken token, DateTimeOffset? fromStatusChanged, DateTimeOffset? toStatusChanged, long? pageNumber = null, int? pageSize = null, CancellationToken? cancellationToken = null);
5773
}
5874

5975
/// <summary>
6076
/// Peppol Outbound Document
6177
/// </summary>
6278
/// <remarks>To maintain backwards compatibility.</remarks>
63-
public interface IPeppolDocuments : IPeppolOutboundDocuments { }
79+
public interface IPeppolDocuments
80+
{
81+
/// <summary>
82+
/// List Peppol Outbound Documents
83+
/// </summary>
84+
/// <param name="token">Authentication token</param>
85+
/// <param name="fromStatusChanged">Start of the document status change period scope. Must be within 7 days of the toStatusChanged date-time.</param>
86+
/// <param name="toStatusChanged">End of the document status change period scope. Must be equal to or later than fromStatusChanged. Defaults to the current date-time.</param>
87+
/// <param name="pageNumber">Number of page that should be returned. Must be included to use page-based pagination.</param>
88+
/// <param name="pageSize">Number (1-2000) of document resources that you want to be returned. Defaults to 2000.</param>
89+
/// <param name="cancellationToken">Allow to cancel a long-running task</param>
90+
/// <returns>A list of Peppol Outbound Document resources</returns>
91+
/// <remarks>To maintain backwards compatibility.</remarks>
92+
Task<EInvoicingCollection<PeppolDocument>> List(ClientAccessToken token, DateTimeOffset? fromStatusChanged, DateTimeOffset? toStatusChanged, long? pageNumber = null, int? pageSize = null, CancellationToken? cancellationToken = null);
93+
}
6494
}

0 commit comments

Comments
 (0)