Skip to content

Commit

Permalink
Add subdomains for merchants in previuous (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko authored Mar 15, 2024
1 parent a0bb0ae commit c2ec98a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/CheckoutSdk/Previous/AbstractCheckoutApmApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ public abstract class AbstractCheckoutApmApi
protected AbstractCheckoutApmApi(CheckoutConfiguration configuration)
{
var apiClient = new ApiClient(configuration.HttpClientFactory,
configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri);
configuration.EnvironmentSubdomain != null
? configuration.EnvironmentSubdomain.ApiUri
: configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri);
_idealClient = new IdealClient(apiClient, configuration);
_klarnaClient = new KlarnaClient(apiClient, configuration);
_sepaClient = new SepaClient(apiClient, configuration);
Expand Down
4 changes: 3 additions & 1 deletion src/CheckoutSdk/Previous/CheckoutApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public class CheckoutApi : AbstractCheckoutApmApi, ICheckoutApi
public CheckoutApi(CheckoutConfiguration configuration) : base(configuration)
{
var apiClient = new ApiClient(configuration.HttpClientFactory,
configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri);
configuration.EnvironmentSubdomain != null
? configuration.EnvironmentSubdomain.ApiUri
: configuration.Environment.GetAttribute<EnvironmentAttribute>().ApiUri);
_tokensClient = new TokensClient(apiClient, configuration);
_customersClient = new CustomersClient(apiClient, configuration);
_sourcesClient = new SourcesClient(apiClient, configuration);
Expand Down
4 changes: 2 additions & 2 deletions test/CheckoutSdkTest/CheckoutDefaultSdkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void ShouldInstantiateClientWithCustomHttpClientFactory()
}

[Fact]
private void ShouldCreateStaticKeysWithSubdomainCheckoutSdks()
private async void ShouldCreateStaticKeysWithSubdomainCheckoutSdks()
{
var checkoutApi1 = CheckoutSdk
.Builder()
Expand All @@ -104,7 +104,7 @@ private void ShouldCreateStaticKeysWithSubdomainCheckoutSdks()
.Build();

checkoutApi1.ShouldNotBeNull();

var checkoutApi2 = CheckoutSdk
.Builder()
.StaticKeys()
Expand Down
3 changes: 3 additions & 0 deletions test/CheckoutSdkTest/SandboxTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ protected SandboxTestFixture(PlatformType platformType)
.PublicKey(System.Environment.GetEnvironmentVariable("CHECKOUT_PREVIOUS_PUBLIC_KEY"))
.SecretKey(System.Environment.GetEnvironmentVariable("CHECKOUT_PREVIOUS_SECRET_KEY"))
.Environment(Environment.Sandbox)
//.EnvironmentSubdomain(System.Environment.GetEnvironmentVariable("CHECKOUT_MERCHANT_SUBDOMAIN"))
.LogProvider(logFactory)
.HttpClientFactory(new DefaultHttpClientFactory())
.Build();
Expand All @@ -42,6 +43,7 @@ protected SandboxTestFixture(PlatformType platformType)
.PublicKey(System.Environment.GetEnvironmentVariable("CHECKOUT_DEFAULT_PUBLIC_KEY"))
.SecretKey(System.Environment.GetEnvironmentVariable("CHECKOUT_DEFAULT_SECRET_KEY"))
.Environment(Environment.Sandbox)
//.EnvironmentSubdomain(System.Environment.GetEnvironmentVariable("CHECKOUT_MERCHANT_SUBDOMAIN"))
.LogProvider(logFactory)
.Build();
break;
Expand All @@ -57,6 +59,7 @@ protected SandboxTestFixture(PlatformType platformType)
OAuthScope.TransfersView, OAuthScope.BalancesView, OAuthScope.VaultCardMetadata,
OAuthScope.FinancialActions)
.Environment(Environment.Sandbox)
//.EnvironmentSubdomain(System.Environment.GetEnvironmentVariable("CHECKOUT_MERCHANT_SUBDOMAIN"))
.LogProvider(logFactory)
.Build();
break;
Expand Down

0 comments on commit c2ec98a

Please sign in to comment.