Closed andregeuze closed 15 hours ago
Hi @andregeuze , that is very strange indeed. The IMollieSecretManager
interface and it's default implementation are newly added in version 4.4.
The code I have inside of AddMollieApi
should register a default implementation if you don't pass any custom implementation in the MollieOptions
object. This is the code in question:
if (mollieOptions.CustomMollieSecretManager != null) {
services.AddScoped(typeof(IMollieSecretManager), mollieOptions.CustomMollieSecretManager);
}
else {
services.AddScoped<IMollieSecretManager, DefaultMollieSecretManager>(_ =>
new DefaultMollieSecretManager(mollieOptions.ApiKey));
}
The example Blazor project also does not have a custom implementation, it just passes in the api key from the configuration. Very similar to what you are doing.
builder.Services.AddMollieApi(options => {
options.ApiKey = builder.Configuration["Mollie:ApiKey"]!;
options.RetryPolicy = MollieHttpRetryPolicies.TransientHttpErrorRetryPolicy();
});
Could you perhaps share a small demo project where you reproduce this issue? Then I can investigate a bit further.
Hi @andregeuze ,
Another reason this could potentially happen is if you are using different versions of the library in different projects of your solution. For example:
YourProject.AspNet references version 4.3 and calls the AddMollieApi
method in Program.cs
YourProject.BusinessLogic references version 4.4 and attempts to create a service with a dependency on IPaymentClient
Do you think that is something that could have happened in your case?
Kind regards, Vincent
Hi @andregeuze ,
I will be closing this issue at the end of the week, unless I get further information. Without a sample project or further information, there is not much more I can do.
Kind regards, Vincent
Hello there! Thanks for the great library :)
Upon updating to the latest version I am hitting the same exception over and over. After digging through my setup and your Blazor examples, I could not find what I was doing wrong. Only when I downgraded to 4.3.0 everything started working again.
Setup
My configuration is as simple as it can be, and hasn't changed since v3.x;
Usage
The page that crashes, has this constructor;
Error details
This is the error that I'm getting;
Workaround
Downgrade to 4.3.0
Looking forward to your response :)