Use plug-ins
Describes how to use plug-ins in Optimizely Configured Commerce.
Currency conversion
Converting price values from one currency to another can be done by implementing the ICurrencyConverter. The method implemented by this interface is the GetRate() method. The GetRate() method takes the currency from and currency to parameters and returns the decimal value for that conversion.
Currency conversion is executed using a post-processor currency refresh. The Currency converter is configured in the application setting called CurrencyConverter which uses the dependency name as the value.
There are two currency converters that are packaged with Optimizely Configured Commerce:
- TheMoneyConvert
- WebserviceX
IGeocoder
The geocode plug-in evaluates a location or address and resolves it to a location object containing Latitude, Longitude, City, StateAbbreviation, CountryAbbreviation, and PostalCode. The method implemented by the IGeocoderProvider is the Geocode() method.
There are two geolocation services packaged with Configured Commerce:
- FreeGeoip
Payment Gateway
Orders submitted from Configured Commerce will be processed by a payment gateway. The IPaymentGateway interface that is implemented by payment gateways in the Configured Commerce platform contain the following methods:
- SubmitTransaction()
- GetStoredPaymentProfile()
- StorePaymentProfile()
- RemoveStoredPaymentProfile()
There are four payment gateway providers packaged with Configured Commerce:
- Authorize.NET
- Cenpos
- CyberSource
- PayflowPro
The application setting called PaymentGateway is set to the dependency name of the provider class. When the PaymentGateway is set to Dummy the test credit card numbers can be used when testing submitting orders.
Product search
Configured Commerce product search can use Solr or Lucene. Both search providers derive from the ProductSearchProviderBase class. To set the search provider the application setting ProductSearchProvider is set to the name of the dependency value on the class of the provider.
There are two currency converters that are packaged with Configured Commerce:
- Azure Lucene
- Lucene
- Solr
To learn more about the complexities of Search, review the Rank search results article.
Rating services
Processing shipping is an important aspect to any commerce site and Configured Commerce is packaged with two rating services. The IRatingService interface is implemented by these rating service providers. The method implemented by this interface is the RateShipment() method and uses the parameters ship from address, customer order, packages, and carrier. The object returned by RateShipment is a list of shipping cost objects.
The ship rating service are used in the GetCartHandler and CartHelper class files. There are two rating services that are packaged with Configured Commerce:
- FedEx
- UPS
Tax calculation
Calculating the tax on orders is handled by the services in the platform that implement the ITaxCalculator interface. The ITaxCalculator interface implements the CalculateTax and PostTax methods.
The tax calculator is configured in the management console using the dependency name as the value of the TaxCalculator application settings. The default value is Standard.
There are unique application settings for each tax calculator however the following are shared application settings:
- TaxCalculator_PostTaxes (Boolean)
- TaxCalculator_StorePickupShipCode (String)
- TaxCalculator_StorePickupStateAbberviation (String)
- TaxCalculator_StorePickupZipCode (String)
- TaxCalculator_TaxCode1ForPercent (String)
Tax calculation is executed on the checkout page.
The following are tax calculation services integrated with Configured Commerce:
- Avalara
- CyberSource
- Sx
If a custom tax calculator (implements ITaxCalculator) is being used, after tax is calculated the customerOrder.TaxCalculated property must be set to true. If this property is set to false, then the storefront will display the tax as "TBD" on the Cart page and Review and Checkout page. The tax calculated will still be applied to the order, but the display on the storefront will be incorrect.
Translation service
Multilanguage is a capability in Configured Commerce with some basic integration configuration. Google is the recommended translation provider however custom translation services can be built using the ITranslationService interface. The ITranslationService interface uses on overloaded method that translates text.
The following translation services are integrated with Configured Commerce:
- Microsoft
Updated 9 months ago