Add metadata to invoice webhook event (#4370)

close #4223
This commit is contained in:
Umar Bolatov 2022-11-28 00:50:52 -08:00 committed by GitHub
parent 45edd330f5
commit 420954ed00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
namespace BTCPayServer.Client.Models
{
@ -19,6 +16,7 @@ namespace BTCPayServer.Client.Models
[JsonProperty(Order = 1)] public string StoreId { get; set; }
[JsonProperty(Order = 2)] public string InvoiceId { get; set; }
[JsonProperty(Order = 3)] public JObject Metadata { get; set; }
}
public class WebhookInvoiceSettledEvent : WebhookInvoiceEvent

View File

@ -157,6 +157,7 @@ namespace BTCPayServer.HostedServices
webhookEvent.DeliveryId = delivery.Id;
webhookEvent.WebhookId = webhook.Id;
webhookEvent.OriginalDeliveryId = delivery.Id;
webhookEvent.Metadata = invoiceEvent.Invoice.Metadata.ToJObject();
webhookEvent.IsRedelivery = false;
webhookEvent.Timestamp = delivery.Timestamp;
var context = new WebhookDeliveryRequest(webhook.Id, webhookEvent, delivery, webhookBlob);

View File

@ -673,7 +673,12 @@
"type": "string",
"description": "The invoice id of the invoice's event",
"nullable": false
}
},
"metadata": {
"type": "object",
"description": "User-supplied metadata added to the invoice at the time of its creation",
"nullable": false
}
}
}
]