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

Ability to override base url #441

Open
1 task
bartlomiejgawel opened this issue Jan 8, 2025 · 0 comments
Open
1 task

Ability to override base url #441

bartlomiejgawel opened this issue Jan 8, 2025 · 0 comments

Comments

@bartlomiejgawel
Copy link

bartlomiejgawel commented Jan 8, 2025

Environment

  • Checkout SDK version: 4.2.2

Description

I would like to write integration tests using a mocked Checkout API (for example using WireMock.Net).

To do that, I would like to override the base URL.

Unfortunately, I am not able to do that. If you take a look on the existing implementation, it only allows:

configuration.EnvironmentSubdomain != null
    ? configuration.EnvironmentSubdomain.ApiUri
    : configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri

Neither of these two options allows us to set our own base address.

Proposed Solution

It would be nice to have an option in CheckoutSdkBuilder to do something like that:

var client = CheckoutSdk
    .Builder()
    .BaseUrl("https://localhost:1234") // always override the base URL
    .Build();

or:

var client = CheckoutSdk
    .Builder()
    .Environment(Environment.Custom)
    .BaseUrl("https://localhost:1234") // override only when Environment == Custom
    .Build();

or:

var client = CheckoutSdk
    .Builder()
    .HttpClientFactory(...) // use the base url from the http client if present
    .Build();
  • I may be able to implement this feature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant