Copied!

CurrencyServiceInterface

CurrencyServiceInterface.php : 18

The currency service is used to manage currencies in the context of storefront.

Tags
See
CurrencyServiceInterface

Methods

publicgetAvailableCurrencies()

CurrencyServiceInterface.php : 30

Returns list of the currencies assigned to the storefront.

public getAvailableCurrencies() : iterable<string|int, CurrencyInterface>

Return values

iterable<string|int, CurrencyInterface>

publicgetCurrencyByCode()

CurrencyServiceInterface.php : 23
public getCurrencyByCode(string $code) : CurrencyInterface

Parameters

Name Type Default value Description
$code string - -

Return values

CurrencyInterface

Tags
Throws
NotFoundException

publicgetDefaultCurrency()

CurrencyServiceInterface.php : 37

Get the default currency according to user preferences.

public getDefaultCurrency() : CurrencyInterface|null

Default currency is used when no currency is set in the session.

Return values

CurrencyInterface|null

publicgetSessionCurrency()

CurrencyServiceInterface.php : 54

Get the currency used in the current user session (or null if not set).

public getSessionCurrency() : CurrencyInterface|null

Currency stored in the session is usually manually selected by user and has higher priority than the "default" currency.

Return values

CurrencyInterface|null

Tags
Throws
NotFoundException

publicisAcceptable()

CurrencyServiceInterface.php : 66

Checks if the currency can be used in the current storefront.

public isAcceptable(CurrencyInterface $currency) : bool

Parameters

Name Type Default value Description
$currency CurrencyInterface - -

Return values

bool

publicsetDefaultCurrency()

CurrencyServiceInterface.php : 45

Sets the default currency for the current user.

public setDefaultCurrency(CurrencyInterface|null $currency) : void

Parameters

Name Type Default value Description
$currency CurrencyInterface|null - -
Tags
Throws
InvalidArgumentException

If the $userPreferenceSetStruct is invalid

Throws
UnauthorizedException

If the current user is not allowed to set user preference

publicsetSessionCurrency()

CurrencyServiceInterface.php : 61

Sets the currency to be used for a current user session.

public setSessionCurrency(CurrencyInterface|null $currency) : void

Currency stored in the session is usually manually selected by user and has higher priority than the "default" currency.

Parameters

Name Type Default value Description
$currency CurrencyInterface|null - -