EConnect.Psb.AspNetCore.Mvc
0.9.30
See the version list below for details.
dotnet add package EConnect.Psb.AspNetCore.Mvc --version 0.9.30
NuGet\Install-Package EConnect.Psb.AspNetCore.Mvc -Version 0.9.30
<PackageReference Include="EConnect.Psb.AspNetCore.Mvc" Version="0.9.30" />
paket add EConnect.Psb.AspNetCore.Mvc --version 0.9.30
#r "nuget: EConnect.Psb.AspNetCore.Mvc, 0.9.30"
// Install EConnect.Psb.AspNetCore.Mvc as a Cake Addin #addin nuget:?package=EConnect.Psb.AspNetCore.Mvc&version=0.9.30 // Install EConnect.Psb.AspNetCore.Mvc as a Cake Tool #tool nuget:?package=EConnect.Psb.AspNetCore.Mvc&version=0.9.30
EConnect PSB .NET Client
A reference implementation meant as an example of how to use the PSB api using C#.
The Procurement Service Bus (PSB) provides a cloud managed connection to eDelivery networks like the Peppol network.
Requirements
- .NET Core 2.0 or higher / .NET Framework 4.6.1 or higher
Install
Go through the Getting started documentation.
Install the package in your project, through NuGet or another tool of choice.
Install-Package EConnect.Psb
API references
For an explanation of the API please refer to the following documentation.
Setup
Make sure to initialise the service and setup the proper authentication.
Hostbuilder
The recommended way to setup the PSB APIs is to use a hostbuilder, enabling dependency injection.
builder.Services.AddPsbService(_ =>
{
_.Username = "{username}";
_.Password = "{password}";
_.PsbUrl = "{psbUrl}";
_.IdentityUrl = "{identityUrl}";
_.ClientId = "{clientId}";
_.ClientSecret = "{clientSecret}";
_.SubscriptionKey = "{SubscriptionKey}";
});
After the PsbService is initialised the following APIs can be used:
- IPsbMeApi
- IPsbHookApi
- IPsbPeppolApi
- IPsbPurchaseInvoiceApi
- IPsbPurchaseOrderApi
- IPsbSalesInvoiceApi
- IPsbSalesOrderApi
- IPsbGenericApi
For example, it's now possible to inject the sales invoice API into your controller:
public YourController(IPsbSalesInvoiceApi salesInvoice)
{
_salesInvoice = salesInvoice;
}
All API interfaces are public which makes it possible to mock them.
Example (web) hostbuilder
An example of the hostbuilder can be found in the project EConnect.Psb.Web.Example
. In this project the .net client
can be used to send an invoice via Peppol
.
Additionally, the supplied webhook receiver
shows a simple implementation to receive invoices from Peppol
.
PsbServiceHost
Use the PsbServiceHost when it is not possible to use a dependency framework.
using (var psb = PsbServiceHost.Create(_ =>
{
_.Username = "{username}";
_.Password = "{password}";
_.PsbUrl = "{psbUrl}";
_.IdentityUrl = "{identityUrl}";
_.ClientId = "{clientId}";
_.ClientSecret = "{clientSecret}";
_.SubscriptionKey = "{SubscriptionKey}";
}
))
{
// Example for QueryRecipientParty
var res = await psb.SalesInvoice.QueryRecipientParty("{senderPartyId}", new[] { "{receiverPartyId}" }).ConfigureAwait(false);
Console.WriteLine(res);
}
Example console application
An example of the PsbServiceHost can be found in the project EConnect.Psb.ConsoleNet.Example
.
AspNetCore Mvc
The EConnect.Psb.AspNetCore.Mvc package makes it easy to validate a Psb webhook by simply adding an attribute on top of your method in your MVC controller. The Psb webhooks are secured by the X-EConnect-Signature. This package will validate that signature for you.
Hardcoded secret
[PsbWebhook("mySecret")]
public IActionResult Webhook([PsbWebhookValidSentOn] PsbWebHookEvent @event)
{
//...
}
Secret from config
[PsbWebhookOptions("webhook")]
public IActionResult Webhook([PsbWebhookValidSentOn] PsbWebHookEvent @event)
{
//...
}
Read more
If you want to know more about Peppol e-procurement or other procurement networks, please refer to the Procurement Service Bus introduction page
.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- EConnect.Psb (>= 0.9.30)
- Microsoft.AspNetCore.Http (>= 2.2.2)
- Microsoft.AspNetCore.Mvc.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.2.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.