Skip to content
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

Move testmode parameter from query string to request body on CaptureClient.CreateCapture #401

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Mollie.Api/Client/Abstract/ICaptureClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ public interface ICaptureClient : IBaseMollieClient {
Task<CaptureResponse> GetCaptureAsync(UrlObjectLink<CaptureResponse> url);
Task<ListResponse<CaptureResponse>> GetCaptureListAsync(string paymentId, bool testmode = false);
Task<ListResponse<CaptureResponse>> GetCaptureListAsync(UrlObjectLink<ListResponse<CaptureResponse>> url);
Task<CaptureResponse> CreateCapture(string paymentId, CaptureRequest captureRequest, bool testmode = false);
Task<CaptureResponse> CreateCapture(string paymentId, CaptureRequest captureRequest);
}
}
5 changes: 2 additions & 3 deletions src/Mollie.Api/Client/CaptureClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ public async Task<ListResponse<CaptureResponse>> GetCaptureListAsync(UrlObjectLi
return await GetAsync(url).ConfigureAwait(false);
}

public async Task<CaptureResponse> CreateCapture(string paymentId, CaptureRequest captureRequest, bool testmode = false) {
public async Task<CaptureResponse> CreateCapture(string paymentId, CaptureRequest captureRequest) {
ValidateRequiredUrlParameter(nameof(paymentId), paymentId);
var queryParameters = BuildQueryParameters(testmode);
return await PostAsync<CaptureResponse>($"payments/{paymentId}/captures{queryParameters.ToQueryString()}", captureRequest)
return await PostAsync<CaptureResponse>($"payments/{paymentId}/captures", captureRequest)
.ConfigureAwait(false);
}

Expand Down
11 changes: 8 additions & 3 deletions src/Mollie.Api/Models/Capture/Request/CaptureRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,18 @@ public record CaptureRequest {
/// </summary>
[JsonConverter(typeof(RawJsonConverter))]
public string? Metadata { get; set; }


/// <summary>
/// Oauth only - Optional – Set this to true to make this capture for a test payment
/// </summary>
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}";
}
}
}
}
Loading