diff --git a/src/Mollie.Api/Client/Abstract/ICaptureClient.cs b/src/Mollie.Api/Client/Abstract/ICaptureClient.cs index da0623a0..1bb9f70d 100644 --- a/src/Mollie.Api/Client/Abstract/ICaptureClient.cs +++ b/src/Mollie.Api/Client/Abstract/ICaptureClient.cs @@ -10,6 +10,6 @@ public interface ICaptureClient : IBaseMollieClient { Task GetCaptureAsync(UrlObjectLink url); Task> GetCaptureListAsync(string paymentId, bool testmode = false); Task> GetCaptureListAsync(UrlObjectLink> url); - Task CreateCapture(string paymentId, CaptureRequest captureRequest, bool testmode = false); + Task CreateCapture(string paymentId, CaptureRequest captureRequest); } } diff --git a/src/Mollie.Api/Client/CaptureClient.cs b/src/Mollie.Api/Client/CaptureClient.cs index dae76be7..554fa52e 100644 --- a/src/Mollie.Api/Client/CaptureClient.cs +++ b/src/Mollie.Api/Client/CaptureClient.cs @@ -42,10 +42,9 @@ public async Task> GetCaptureListAsync(UrlObjectLi return await GetAsync(url).ConfigureAwait(false); } - public async Task CreateCapture(string paymentId, CaptureRequest captureRequest, bool testmode = false) { + public async Task CreateCapture(string paymentId, CaptureRequest captureRequest) { ValidateRequiredUrlParameter(nameof(paymentId), paymentId); - var queryParameters = BuildQueryParameters(testmode); - return await PostAsync($"payments/{paymentId}/captures{queryParameters.ToQueryString()}", captureRequest) + return await PostAsync($"payments/{paymentId}/captures", captureRequest) .ConfigureAwait(false); } diff --git a/src/Mollie.Api/Models/Capture/Request/CaptureRequest.cs b/src/Mollie.Api/Models/Capture/Request/CaptureRequest.cs index 73bd1433..42644ab3 100644 --- a/src/Mollie.Api/Models/Capture/Request/CaptureRequest.cs +++ b/src/Mollie.Api/Models/Capture/Request/CaptureRequest.cs @@ -20,13 +20,18 @@ public record CaptureRequest { /// [JsonConverter(typeof(RawJsonConverter))] public string? Metadata { get; set; } - + + /// + /// Oauth only - Optional – Set this to true to make this capture for a test payment + /// + public bool? Testmode { get; set; } + public void SetMetadata(object metadataObj, JsonSerializerSettings? jsonSerializerSettings = null) { Metadata = JsonConvert.SerializeObject(metadataObj, jsonSerializerSettings); } - + public override string ToString() { return $"Amount: {Amount} Description: {Description}"; } } -} \ No newline at end of file +}