Allow to get prices in non-EUR currencies from reichelt

This commit is contained in:
Jan Böhmer 2025-02-20 16:37:13 +01:00
parent d05c0579a2
commit c51e0eb68f
2 changed files with 7 additions and 2 deletions

4
.env
View file

@ -223,12 +223,14 @@ PROVIDER_OEMSECRETS_SORT_CRITERIA=C
# We dont require an API key for Reichelt, just set this to 1 to enable Reichelt support
PROVIDER_REICHELT_ENABLED=0
# The country to get prices for (only EUR supported for now)
# The country to get prices for
PROVIDER_REICHELT_COUNTRY=DE
# The language to get results in (en, de, fr, nl, pl, it, es)
PROVIDER_REICHELT_LANGUAGE=en
# Include VAT in prices (set to 1 to include VAT, 0 to exclude VAT)
PROVIDER_REICHELT_INCLUDE_VAT=1
# The currency to get prices in (only for countries with countries other than EUR)
PROVIDER_REICHELT_CURRENCY=EUR
##################################################################################
# EDA integration related settings

View file

@ -48,7 +48,9 @@ class ReicheltProvider implements InfoProviderInterface
#[Autowire(env: "PROVIDER_REICHELT_COUNTRY")]
private readonly string $country = "DE",
#[Autowire(env: "PROVIDER_REICHELT_INCLUDE_VAT")]
private bool $includeVAT = false
private readonly bool $includeVAT = false,
#[Autowire(env: "PROVIDER_REICHELT_CURRENCY")]
private readonly string $currency = "EUR",
)
{
}
@ -134,6 +136,7 @@ class ReicheltProvider implements InfoProviderInterface
$response = $this->client->request('GET', $productPage, [
'query' => [
'CCTYPE' => $this->includeVAT ? 'private' : 'business',
'currency' => $this->currency,
],
]);
$html = $response->getContent();