ExtensionInfo Class

Contains static methods to expose extension-related context information.

Namespace

CommerceExtension

Example

1public with sharing class TaxServiceExtensionResolverSample extends commercestoretax.TaxService implements CommerceExtension.ResolutionStrategy {
2    public CommerceExtension.Resolution resolve() {
3        // The Sample Extension Provider registered with developer name as
4        // 'tax_extension_provider_for_us' will be selected for execution for en_US locale
5        if(CommerceExtension.ExtensionInfo.getLocaleString() == 'en_US') {
6            return new CommerceExtension.Resolution('tax_extension_provider_for_us');
7        }
8        // The Sample Extension Provider registered with developer name as
9        // 'tax_extension_provider_for_canada' will be selected for execution for en_CA locale
10        if(CommerceExtension.ExtensionInfo.getLocaleString() == 'en_CA') {
11            return new CommerceExtension.Resolution('tax_extension_provider_for_canada');
12        }
13        // The default Salesforce Internal Tax Api will return an empty response for German locale
14        if(CommerceExtension.ExtensionInfo.getLocaleString() == 'de') {
15            return new CommerceExtension.Resolution(CommerceExtension.ResolutionStates.OFF);
16        }
17        // The default Salesforce Internal Tax Api will be selected for execution for
18        // all other locales than US, Canada and Germany
19        return new CommerceExtension.Resolution();
20    }
21}

ExtensionInfo Methods

The following are methods for ExtensionInfo.

getClientApiVersion()

Returns the version number of the Client API for the extension context.

Signature

public static Double getClientApiVersion()

Return Value

Type: Double

Version number of the Client API for the extension context.

getCustomParameterField(fieldName)

Returns a custom parameter field value, if available, for the extension context.

Signature

public static String getCustomParameterField(String fieldName)

Parameters

  • fieldName:

    Type: String

    Custom parameter field name.

Return Value

Type: String

Custom parameter field value for the extension context.

getLocaleString()

Returns the locale for the extension context.

Signature

public static String getLocaleString()

Return Value

Type: String

Locale for the extension context.

isCustomParametersAvailable()

Indicates whether custom parameters are available for the extension context.

Signature

public static Boolean isCustomParametersAvailable()

Return Value

Type: Boolean

Value indicating if custom parameters are available in the extension context (true) or not (false).