-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from ibanity/new-einvoicing-webhook
New eInvoicing webhook
- Loading branch information
Showing
3 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
src/Client/Webhooks/Models/eInvoicing/InboundDocumentNew.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Ibanity.Apis.Client.Webhooks.Models.eInvoicing | ||
{ | ||
/// <summary> | ||
/// A webhook payload delivered whenever there is a new document available. | ||
/// </summary> | ||
#pragma warning disable CA1711 // Identifiers should not have incorrect suffix | ||
public class InboundDocumentNew : JsonApi.Data, IWebhookEvent | ||
#pragma warning restore CA1711 // Identifiers should not have incorrect suffix | ||
{ | ||
/// <summary> | ||
/// Unique identifier of the associated document. | ||
/// </summary> | ||
[DataMember(Name = "documentId", EmitDefaultValue = false)] | ||
public Guid DocumentId { get; set; } | ||
|
||
/// <summary> | ||
/// Unique identifier of the associated supplier. | ||
/// </summary> | ||
[DataMember(Name = "supplierId", EmitDefaultValue = false)] | ||
public Guid SupplierId { get; set; } | ||
|
||
/// <summary> | ||
/// When this notification was created. | ||
/// </summary> | ||
[DataMember(Name = "createdAt", EmitDefaultValue = false)] | ||
public DateTimeOffset CreatedAt { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// A webhook payload delivered whenever there is a new document available. | ||
/// </summary> | ||
#pragma warning disable CA1711 // Identifiers should not have incorrect suffix | ||
public class NestedInboundDocumentNew : PayloadData<InboundDocumentNewAttributes, InboundDocumentNewRelationships> | ||
#pragma warning restore CA1711 // Identifiers should not have incorrect suffix | ||
{ | ||
/// <inheritdoc /> | ||
public override IWebhookEvent Flatten() => | ||
new InboundDocumentNew | ||
{ | ||
Id = Id, | ||
Type = Type, | ||
DocumentId = Guid.Parse(Relationships.Document.Data.Id), | ||
SupplierId = Guid.Parse(Relationships.Supplier.Data.Id), | ||
CreatedAt = Attributes.CreatedAt | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// Payload attributes delivered whenever there is a new document available. | ||
/// </summary> | ||
public class InboundDocumentNewAttributes | ||
{ | ||
/// <summary> | ||
/// When this notification was created. | ||
/// </summary> | ||
[DataMember(Name = "createdAt", EmitDefaultValue = false)] | ||
public DateTimeOffset CreatedAt { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Payload relationships delivered whenever there is a new document available. | ||
/// </summary> | ||
public class InboundDocumentNewRelationships | ||
{ | ||
/// <summary> | ||
/// A Peppol Inbound Document reference. | ||
/// </summary> | ||
[DataMember(Name = "document", EmitDefaultValue = false)] | ||
public Relationship Document { get; set; } | ||
|
||
/// <summary> | ||
/// A Supplier reference. | ||
/// </summary> | ||
[DataMember(Name = "supplier", EmitDefaultValue = false)] | ||
public Relationship Supplier { get; set; } | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
src/Client/Webhooks/Models/eInvoicing/PeppolRegistrationsUpdated.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Ibanity.Apis.Client.Webhooks.Models.eInvoicing | ||
{ | ||
/// <summary> | ||
/// A webhook payload delivered whenever a peppol registration is updated to registered or registration-failed. | ||
/// </summary> | ||
public class PeppolRegistrationsUpdated : JsonApi.Data, IWebhookEvent | ||
{ | ||
/// <summary> | ||
/// Unique identifier of the associated supplier. | ||
/// </summary> | ||
[DataMember(Name = "supplierId", EmitDefaultValue = false)] | ||
public Guid SupplierId { get; set; } | ||
|
||
/// <summary> | ||
/// When this notification was created. | ||
/// </summary> | ||
[DataMember(Name = "createdAt", EmitDefaultValue = false)] | ||
public DateTimeOffset CreatedAt { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// A webhook payload delivered whenever a peppol registration is updated to registered or registration-failed. | ||
/// </summary> | ||
public class NestedPeppolRegistrationsUpdated : PayloadData<PeppolRegistrationsUpdatedAttributes, PeppolRegistrationsUpdatedRelationships> | ||
{ | ||
/// <inheritdoc /> | ||
public override IWebhookEvent Flatten() => | ||
new PeppolRegistrationsUpdated | ||
{ | ||
Id = Id, | ||
Type = Type, | ||
SupplierId = Guid.Parse(Relationships.Supplier.Data.Id), | ||
CreatedAt = Attributes.CreatedAt | ||
}; | ||
} | ||
|
||
/// <summary> | ||
/// Payload attributes delivered whenever a peppol registration is updated to registered or registration-failed. | ||
/// </summary> | ||
public class PeppolRegistrationsUpdatedAttributes | ||
{ | ||
/// <summary> | ||
/// When this notification was created. | ||
/// </summary> | ||
[DataMember(Name = "createdAt", EmitDefaultValue = false)] | ||
public DateTimeOffset CreatedAt { get; set; } | ||
} | ||
|
||
/// <summary> | ||
/// Payload relationships delivered whenever a peppol registration is updated to registered or registration-failed. | ||
/// </summary> | ||
public class PeppolRegistrationsUpdatedRelationships | ||
{ | ||
/// <summary> | ||
/// A Supplier reference. | ||
/// </summary> | ||
[DataMember(Name = "supplier", EmitDefaultValue = false)] | ||
public Relationship Supplier { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters