Skip to content

Commit

Permalink
Add metadata property to CaptureRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Dec 2, 2023
1 parent 1ac3c95 commit ccd991d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/Mollie.Api/Models/Capture/Request/CaptureRequest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace Mollie.Api.Models.Capture.Request {
using Mollie.Api.JsonConverters;
using Newtonsoft.Json;

namespace Mollie.Api.Models.Capture.Request {
public class CaptureRequest {
/// <summary>
/// The amount to capture.
Expand All @@ -9,5 +12,21 @@ public class CaptureRequest {
/// The description of the capture you are creating.
/// </summary>
public string Description { get; set; }

/// <summary>
/// Provide any data you like, for example a string or a JSON object. We will save the data alongside the capture.
/// Whenever you fetch the capture with our API, we will also include the metadata. You can use up to
/// approximately 1kB.
/// </summary>
[JsonConverter(typeof(RawJsonConverter))]
public string Metadata { get; set; }

public void SetMetadata(object metadataObj, JsonSerializerSettings jsonSerializerSettings = null) {
this.Metadata = JsonConvert.SerializeObject(metadataObj, jsonSerializerSettings);
}

public override string ToString() {
return $"Amount: {this.Amount} Description: {this.Description}";
}
}
}

0 comments on commit ccd991d

Please sign in to comment.