EConnect.Psb
0.9.30
See the version list below for details.
dotnet add package EConnect.Psb --version 0.9.30
NuGet\Install-Package EConnect.Psb -Version 0.9.30
<PackageReference Include="EConnect.Psb" Version="0.9.30" />
paket add EConnect.Psb --version 0.9.30
#r "nuget: EConnect.Psb, 0.9.30"
// Install EConnect.Psb as a Cake Addin #addin nuget:?package=EConnect.Psb&version=0.9.30 // Install EConnect.Psb as a Cake Tool #tool nuget:?package=EConnect.Psb&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
- IdentityModel (>= 6.1.0)
- Microsoft.Extensions.Http (>= 7.0.0)
- Microsoft.Extensions.Options (>= 7.0.1)
- System.Net.Http.Json (>= 7.0.1)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EConnect.Psb:
Package | Downloads |
---|---|
EConnect.Psb.AspNetCore.Mvc
The offical .NET C# API client for the eConnect Procurement Service Bus (PSB) for Asp.NetCore MVC |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.9.31 | 164 | 6/11/2024 |
0.9.30 | 139 | 6/8/2024 |
0.9.29 | 176 | 4/4/2024 |
0.9.28 | 174 | 3/7/2024 |
0.9.27 | 270 | 6/7/2023 |
0.9.26 | 448 | 2/1/2023 |
0.9.25 | 675 | 6/20/2022 |
0.9.24 | 661 | 5/4/2022 |
0.1.23 | 407 | 5/2/2022 |
0.1.22 | 423 | 4/10/2022 |
0.1.21 | 412 | 3/30/2022 |
0.1.20 | 390 | 3/21/2022 |
0.1.19 | 393 | 3/15/2022 |
0.1.18 | 413 | 3/14/2022 |
0.1.17 | 431 | 3/14/2022 |
0.1.16 | 411 | 3/11/2022 |