Vereniging-COIN.Sdk.NP
1.6.4
dotnet add package Vereniging-COIN.Sdk.NP --version 1.6.4
NuGet\Install-Package Vereniging-COIN.Sdk.NP -Version 1.6.4
<PackageReference Include="Vereniging-COIN.Sdk.NP" Version="1.6.4" />
paket add Vereniging-COIN.Sdk.NP --version 1.6.4
#r "nuget: Vereniging-COIN.Sdk.NP, 1.6.4"
// Install Vereniging-COIN.Sdk.NP as a Cake Addin #addin nuget:?package=Vereniging-COIN.Sdk.NP&version=1.6.4 // Install Vereniging-COIN.Sdk.NP as a Cake Tool #tool nuget:?package=Vereniging-COIN.Sdk.NP&version=1.6.4
.NET Number Portability SDK
Introduction
This SDK supports secured access to the number portability API.
For a quick start, follow the steps below:
Setup
Sample Project for the Number Portability API
A sample project is provided in the number-portability-sdk-samples
directory.
NuGet Package
This SDK is published as the NuGet package 'Vereniging-COIN.Sdk.NP'.
Configure Credentials
For secure access credentials are required.
- Check this README to find out how to configure these.
- In summary you will need:
- a consumer name
- a private key file (or a
System.Security.Cryptography.RSA
instance containing this key) - a file containing the encrypted Hmac secret
(or a
System.Security.Cryptography.HMACSHA256
instance containing this (decrypted) secret)
- These can be used to create instances of the
NumberPortabilityService
and theSseConsumer
, which is needed for theNumberPortabilityMessageConsumer
.
Messages
NpMessage.cs shows how the number portability domain has been structured.
The interfaces from this file can be used to define methods that can accept any message.
Coin.Sdk.NP.Messages.V3.Utils contains the useful static methods TypeName
and Deserialize
.
Send Messages
The NumberPortabilityService has a SendMessage
method to send any number portability message - wrapped in an instance of the MessageEnvelope class -
to the API.
Consume Messages
Create Message Listener
For message consumption, the number portability API makes use of HTTP's ServerSentEvents.
The SDK offers a Listener interface INumberPortabilityMessageListener
which is triggered upon reception of a message payload.
Whenever the API doesn't send any other message for 20 seconds, it sends an empty 'heartbeat' message, which triggers the OnKeepAlive() method.
Start consuming messages
The NumberPortabilityMessageConsumer
has three startConsuming...()
methods for consuming messages, of which startConsumingUnconfirmed()
is most useful.
All these methods need an instance of the INumberPortabilityMessageListener
.
Consume specific messages using filters
The NumberPortabilityMessageConsumer
provides various filters for message consumption. The filters are:
MessageType
: All possible message types, including errors. Use theMessageType
-enumeration to indicate which messages have to be consumed.- confirmation status: By using
startConsumingAll()
, all messages will be received, both confirmed and unconfirmed.
Note: this enables the consumption of the whole message history. Therefore, this requires you to supply an implementation of theIOffsetPersister
interface. The purpose of this interface is to track themessage-id
of the last received and processed message. In the case of a reconnect, message consumption will then resume where it left off. offset
: starts consuming messages based on the givenmessage-id
offset. Note: it is the responsibility of the client to keep track of theoffset
.
Confirm Messages
Once a consumed message has been processed it needs to be confirmed.
To confirm a message use the NumberPortabilityService.sendConfirmation(id)
method.
Error Handling
The number portability API can return errors in one of two ways:
The server received an incorrect payload and replies with an error response (synchronous)
The REST layer of the system only performs basic payload checks, such as swagger schema validity and message authorization. Any errors in these checks are immediately returned as an error reply. The
NumberPortabilityService.SendMessage
method returns these asErrorResponse
. Other http errors are thrown asHttpListenerException
.As a ServerSentEvent containing an
ErrorFoundMessage
(asynchronous)The system performs detailed functional validation, such as number range validation etc, asynchronously. Errors in this stage are sent via a
ServerSentEvent
.Note:
ErrorFound
messages need to be confirmed like any other message received via aServerSentEvent
.
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 | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | 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.1
- 3v.EvtSource (>= 2.0.0)
- Vereniging-COIN.Sdk.Common (>= 1.6.10)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Vereniging-COIN.Sdk.NP:
Package | Downloads |
---|---|
COINNP.Client
Provides a 'wrapper' for vereniging COIN's Number Portability Library that hides a few 'oddities' of working with the NP messages and message consumer / listener. This library aims to provide a more 'idiomatic C#' API which uses modern C# concepts like immutable records, nullable aware and proper types like DateTimeOffset or bool where COIN's implementation mostly only provides strings. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.6.4 | 440 | 6/12/2024 | |
1.6.3 | 79 | 6/12/2024 | |
1.6.2 | 77 | 6/12/2024 | |
1.5.0 | 2,321 | 9/14/2023 | |
1.4.4 | 462 | 9/14/2023 | |
1.4.3 | 1,244 | 4/17/2023 | |
1.4.2 | 1,410 | 12/14/2022 | |
1.4.1 | 850 | 11/28/2022 | |
1.4.0 | 741 | 11/28/2022 | |
1.3.0 | 3,861 | 6/17/2021 | |
1.2.1 | 883 | 3/1/2021 | |
1.2.0 | 871 | 1/5/2021 | |
1.1.1 | 923 | 10/30/2020 | |
1.1.0 | 975 | 10/27/2020 | |
1.0.10 | 923 | 10/2/2020 | |
1.0.9 | 920 | 9/8/2020 | |
1.0.8 | 1,080 | 9/3/2020 | |
1.0.7 | 992 | 8/31/2020 | |
1.0.6 | 1,025 | 8/31/2020 | |
1.0.5 | 1,054 | 8/4/2020 | |
1.0.4 | 1,005 | 8/3/2020 | |
1.0.3 | 1,078 | 6/23/2020 | |
1.0.2 | 1,080 | 6/23/2020 | |
1.0.1 | 1,061 | 6/22/2020 | |
1.0.0 | 1,025 | 6/22/2020 |