-
Notifications
You must be signed in to change notification settings - Fork 24
Add web hook support for nets #1599
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ivarne
wants to merge
16
commits into
main
Choose a base branch
from
fix/nets-callback
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d6d6377
Use IAuthenticationTokenResolver and support StorageAuthenticationMet…
ivarne 65b58b5
Test infrastructure changes
ivarne e17b3fd
Implement the hook and and receiver.
ivarne 7309091
Use Constants for AltinnTaskType
ivarne 999d9d2
Add appropriate restrictions on payment webhook
ivarne cce4669
CodeRabbit suggestions
ivarne 3b89187
More code rabbit suggestions
ivarne 5e2103a
Last coderabbit fixes?
ivarne d7fb105
Add test for instanceClient.UpdateDataValues
ivarne 792dfe7
Fix tests
ivarne 6205413
Merge remote-tracking branch 'origin/main' into fix/nets-callback
ivarne 7b637b2
Improve test coverage
ivarne 6e0c636
Fix a few testin issues
ivarne b160dc3
dispose httpResponseMessage
ivarne 39d05c0
Add scope docs and mark api as AllowAnonymous to be clear about intent
ivarne 8d60bc6
Add [AllowAnonymous] to PublicApiTests
ivarne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,47 @@ | ||
| namespace Altinn.App.Core.Constants; | ||
|
|
||
| /// <summary> | ||
| /// Constants for Altinn task types. | ||
| /// </summary> | ||
| internal static class AltinnTaskTypes | ||
| { | ||
| /// <summary> | ||
| /// The payment task type. | ||
| /// </summary> | ||
| public const string Payment = "payment"; | ||
|
|
||
| /// <summary> | ||
| /// The signing task type. | ||
| /// </summary> | ||
| public const string Signing = "signing"; | ||
|
|
||
| /// <summary> | ||
| /// The data task type for collecting data from the user in a form. | ||
| /// </summary> | ||
| public const string Data = "data"; | ||
|
|
||
| /// <summary> | ||
| /// The feedback task type for waiting for a service owner integration to push update the instance. | ||
| /// </summary> | ||
| public const string Feedback = "feedback"; | ||
|
|
||
| /// <summary> | ||
| /// Service task type for generating a pdf document. | ||
| /// </summary> | ||
| public const string Pdf = "pdf"; | ||
|
|
||
| /// <summary> | ||
| /// The eFormidling task type when waiting for confirmation that the instance has been sent to eFormidling. | ||
| /// </summary> | ||
| public const string EFormidling = "eFormidling"; | ||
|
|
||
| /// <summary> | ||
| /// The FiksArkiv task type. | ||
| /// </summary> | ||
| public const string FiksArkiv = "fiksArkiv"; | ||
|
|
||
| /// <summary> | ||
| /// The confirmation task type. (Simple version of Sign without creating a signature document) | ||
| /// </summary> | ||
| public const string Confirmation = "confirmation"; | ||
| } |
52 changes: 52 additions & 0 deletions
52
src/Altinn.App.Core/Features/Payment/Processors/Nets/Models/NetsCompleteWebhookPayload.cs
This file contains hidden or 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,52 @@ | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Altinn.App.Core.Features.Payment.Processors.Nets.Models; | ||
|
|
||
| /// <summary> | ||
| /// Payload received from Nets when a payment is completed. | ||
| /// </summary> | ||
| public sealed class NetsCompleteWebhookPayload | ||
| { | ||
| /// <summary> | ||
| /// The unique identifier of the payment. | ||
| /// </summary> | ||
| [JsonPropertyName("id")] | ||
| public required string Id { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The MerchantId of the payment. | ||
| /// </summary> | ||
| [JsonPropertyName("merchantId")] | ||
| public required int MerchantId { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Timestamp of when the payment was created. | ||
| /// </summary> | ||
| [JsonPropertyName("timestamp")] | ||
| public required DateTimeOffset Timestamp { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The event name. | ||
| /// </summary> | ||
| [JsonPropertyName("event")] | ||
| public required string EventName { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// The data of the payment. | ||
| /// </summary> | ||
| [JsonPropertyName("data")] | ||
| public required NetsCompleteWebhookPayloadData Data { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Represents the detailed data contained within the payload of a completed payment notification from Nets. | ||
| /// </summary> | ||
| public sealed class NetsCompleteWebhookPayloadData | ||
| { | ||
| /// <summary> | ||
| /// The unique identifier of the payment. | ||
| /// </summary> | ||
| [JsonPropertyName("paymentId")] | ||
| public required string PaymentId { get; set; } | ||
| //TODO: Add other properties if needed in the future | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.