wise webhook
This commit is contained in:
@@ -8,7 +8,6 @@ Imports VERAG_PROG_ALLGEMEIN
|
||||
|
||||
|
||||
|
||||
|
||||
Public Class BasicAuthenticationAttribute
|
||||
Inherits AuthorizationFilterAttribute
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
Imports System.IO
|
||||
Imports System.Net.Http
|
||||
Imports System.Reflection
|
||||
Imports System.Web.Http
|
||||
Imports System.Web.Http
|
||||
Imports System.Web.Http.Description
|
||||
Imports System.Web.Routing
|
||||
Imports Microsoft.Extensions.Options
|
||||
Imports Swashbuckle.Application
|
||||
Imports NSwag.AspNet.Owin
|
||||
Imports System.IO
|
||||
Imports System.Reflection
|
||||
|
||||
|
||||
|
||||
@@ -87,12 +86,13 @@ Public Class SwaggerConfig
|
||||
|
||||
Public Shared Sub Register(ByVal config As HttpConfiguration)
|
||||
|
||||
RouteTable.Routes.MapOwinPath("swagger", Function(app) As Owin.IAppBuilder
|
||||
RouteTable.Routes.MapOwinPath("swagger", Sub(app)
|
||||
|
||||
|
||||
|
||||
app.UseSwaggerUi(GetType(WebApiApplication).Assembly, Function(settings) As SwaggerUiSettings(Of NSwag.Generation.WebApi.WebApiOpenApiDocumentGeneratorSettings)
|
||||
settings.MiddlewareBasePath = "/swagger"
|
||||
settings.GeneratorSettings.OperationProcessors.Add(New WiseWebhookExampleProcessor())
|
||||
settings.GeneratorSettings.DefaultUrlTemplate = "api/{controller}/{id}"
|
||||
settings.DocumentTitle = descr
|
||||
settings.DocExpansion = "list"
|
||||
@@ -102,8 +102,7 @@ Public Class SwaggerConfig
|
||||
|
||||
|
||||
|
||||
Return app
|
||||
End Function)
|
||||
End Sub)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
31
VERAG_REST_SERVER/App_Start/WiseWebhookExampleProcessor.vb
Normal file
31
VERAG_REST_SERVER/App_Start/WiseWebhookExampleProcessor.vb
Normal file
@@ -0,0 +1,31 @@
|
||||
Imports NSwag.Generation.Processors
|
||||
Imports NSwag.Generation.Processors.Contexts
|
||||
Imports NJsonSchema
|
||||
|
||||
Public Class WiseWebhookExampleProcessor
|
||||
Implements IOperationProcessor
|
||||
|
||||
Public Function Process(context As OperationProcessorContext) As Boolean Implements IOperationProcessor.Process
|
||||
If context.ControllerType.Name = "WiseController" AndAlso context.MethodInfo.Name = "Webhook" Then
|
||||
Dim operation = context.OperationDescription.Operation
|
||||
If operation.RequestBody IsNot Nothing AndAlso operation.RequestBody.Content.ContainsKey("application/json") Then
|
||||
Dim content = operation.RequestBody.Content("application/json")
|
||||
content.Example = New With {
|
||||
.event_type = "balance.credit",
|
||||
.data = New With {
|
||||
.id = 123456789,
|
||||
.balance_id = 99887766,
|
||||
.amount = New With {
|
||||
.value = 1500.00,
|
||||
.currency = "EUR"
|
||||
},
|
||||
.occurred_at = "2025-12-06T10:15:30Z",
|
||||
.description = "Incoming transfer",
|
||||
.sender_name = "ACME GmbH"
|
||||
}
|
||||
}
|
||||
End If
|
||||
End If
|
||||
Return True
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user