com.konakart.blif
Interface TaxMgrIf

All Known Implementing Classes:
TaxMgr

public interface TaxMgrIf

TaxMgrIf Interface which an implementation of this manager must adhere to.


Method Summary
 java.math.BigDecimal addStoreTax(java.math.BigDecimal cost, int taxClassId)
          This is a utility method to directly get the final cost.
 java.math.BigDecimal addStoreTax(java.math.BigDecimal cost, int taxClassId, int quantity)
          This is a utility method to directly get the final cost.
 java.math.BigDecimal addTax(java.math.BigDecimal cost, int countryId, int zoneId, int taxClassId)
          This is a utility method to directly get the final cost.
 java.math.BigDecimal addTax(java.math.BigDecimal cost, int countryId, int zoneId, int taxClassId, int quantity)
          This is a utility method to directly get the final cost.
 Country[] getAllCountries()
          Returns an array of all defined countries
 Country getCountryPerId(int countryId)
          Returns the country object for the country id, or Null if the country doesn't exist in the DB.
 Country getCountryPerName(java.lang.String countryName)
          Returns the country object for the country name, or Null if the country doesn't exist in the DB.
 GeoZone[] getGeoZonesPerZone(ZoneIf zone)
          Find the GeoZones that exist for a particular zone
 java.math.BigDecimal getStoreTax(java.math.BigDecimal cost, int taxClassId)
          This is a utility method to directly return the tax that needs to be applied for a defined item cost and a quantity of 1.
 java.math.BigDecimal getStoreTax(java.math.BigDecimal cost, int taxClassId, int quantity)
          This is a utility method to directly return the total tax that needs to be applied for a defined item cost and quantity.
 java.math.BigDecimal getStoreTaxRate(int taxClassId)
          Returns the tax rate for the store for a taxClassId.
 java.math.BigDecimal getTax(java.math.BigDecimal cost, int countryId, int zoneId, int taxClassId)
          This is a utility method to directly return the tax that needs to be applied for a defined item cost and a quantity of 1.
 java.math.BigDecimal getTax(java.math.BigDecimal cost, int countryId, int zoneId, int taxClassId, int quantity)
          This is a utility method to directly return the total tax that needs to be applied for a defined item cost and quantity.
 int getTaxQuantityRule()
          Returns the rule used to calculate tax for products with multiple quantities.
 java.math.BigDecimal getTaxRate(int countryId, int zoneId, int taxClassId)
          The tax rate can be calculated based on the country id, the zone id and the tax class id.
 TaxRate[] getTaxRateObjects(int countryId, int zoneId, int taxClassId)
          The tax rate can be calculated based on the country id, the zone id and the tax class id.
 int getTaxScale()
          Returns the precision use for calculating tax that matches the ADMIN_CURRENCY_DECIMAL_PLACES configuration variable.
 Zone getZonePerCountryAndCode(int countryId, java.lang.String zoneDesc)
          The zone name and zone code is compared with the zoneDesc parameter in order to determine whether a zone exists in the DB matching zoneDesc for the country defined by countryId.
 Zone getZonePerId(int zoneId)
          Get a zone for a zoneId
 Zone[] getZonesPerCountry(int countryId)
          Get all zones for a country.
 void refreshConfigs()
          Get the config variables needed to setup the tax mgr
 Zone[] searchForZones(ZoneSearchIf search)
          Search for zones using various search criteria
 

Method Detail

refreshConfigs

void refreshConfigs()
                    throws java.lang.Exception
Get the config variables needed to setup the tax mgr

Throws:
java.lang.Exception

getZonePerCountryAndCode

Zone getZonePerCountryAndCode(int countryId,
                              java.lang.String zoneDesc)
                              throws org.apache.torque.TorqueException,
                                     com.workingdogs.village.DataSetException,
                                     KKException
The zone name and zone code is compared with the zoneDesc parameter in order to determine whether a zone exists in the DB matching zoneDesc for the country defined by countryId. An example of this would be to compare the state of an address with FL or Florida.

Parameters:
countryId -
zoneDesc -
Returns:
the zoneif it exists, otherwise null
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getZonesPerCountry

Zone[] getZonesPerCountry(int countryId)
                          throws org.apache.torque.TorqueException,
                                 com.workingdogs.village.DataSetException,
                                 KKException
Get all zones for a country.

Parameters:
countryId -
Returns:
the zoneif it exists, otherwise null
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

searchForZones

Zone[] searchForZones(ZoneSearchIf search)
                      throws org.apache.torque.TorqueException,
                             com.workingdogs.village.DataSetException,
                             KKException
Search for zones using various search criteria

Parameters:
search -
Returns:
Returns an array of Zone objects
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getZonePerId

Zone getZonePerId(int zoneId)
                  throws org.apache.torque.TorqueException,
                         com.workingdogs.village.DataSetException,
                         KKException
Get a zone for a zoneId

Parameters:
zoneId -
Returns:
the zone if it exists, otherwise null
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getStoreTaxRate

java.math.BigDecimal getStoreTaxRate(int taxClassId)
                                     throws com.workingdogs.village.DataSetException,
                                            org.apache.torque.TorqueException,
                                            KKException
Returns the tax rate for the store for a taxClassId.

Parameters:
taxClassId -
Returns:
Returns The tax rate for the taxClassId and the store
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getTaxRate

java.math.BigDecimal getTaxRate(int countryId,
                                int zoneId,
                                int taxClassId)
                                throws com.workingdogs.village.DataSetException,
                                       org.apache.torque.TorqueException,
                                       KKException
The tax rate can be calculated based on the country id, the zone id and the tax class id. There may be more than one tax rate. If this is the case the rates have to be applied starting from the first rate and then compounded. If there are multiple rates with the same priority, then these are added together and can be applied in a single calculation. If there are multiple rates with different priorities, then they are compounded. temp = (1+t1/100)*(1+t2/100)*(1+t3/100) etc. Compound rate = (temp-1)*100; i.e. for rates of 7% and 10% the return is 17.7%

Parameters:
countryId -
zoneId -
taxClassId -
Returns:
Returns the tax rates for the country, zone and tax class
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getTaxRateObjects

TaxRate[] getTaxRateObjects(int countryId,
                            int zoneId,
                            int taxClassId)
                            throws com.workingdogs.village.DataSetException,
                                   org.apache.torque.TorqueException,
                                   KKException
The tax rate can be calculated based on the country id, the zone id and the tax class id. There may be more than one tax rate.

Parameters:
countryId -
zoneId -
taxClassId -
Returns:
Returns the tax rate objects for the country, zone and tax class
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getTax

java.math.BigDecimal getTax(java.math.BigDecimal cost,
                            int countryId,
                            int zoneId,
                            int taxClassId)
                            throws KKException,
                                   org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException
This is a utility method to directly return the tax that needs to be applied for a defined item cost and a quantity of 1.

Parameters:
cost -
countryId -
zoneId -
taxClassId -
Returns:
Returns the tax that needs to be applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getTax

java.math.BigDecimal getTax(java.math.BigDecimal cost,
                            int countryId,
                            int zoneId,
                            int taxClassId,
                            int quantity)
                            throws KKException,
                                   org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException
This is a utility method to directly return the total tax that needs to be applied for a defined item cost and quantity. When the quantity is greater than one, the tax amount may be calculated differently depending on the algorithm used. i.e. Could calculate tax on a single product before multiplying by the quantity or tax on the total.

Parameters:
cost -
countryId -
zoneId -
taxClassId -
quantity -
Returns:
Returns the tax that needs to be applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getStoreTax

java.math.BigDecimal getStoreTax(java.math.BigDecimal cost,
                                 int taxClassId)
                                 throws KKException,
                                        org.apache.torque.TorqueException,
                                        com.workingdogs.village.DataSetException
This is a utility method to directly return the tax that needs to be applied for a defined item cost and a quantity of 1.

Parameters:
cost -
taxClassId -
Returns:
Returns the tax that needs to be applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getStoreTax

java.math.BigDecimal getStoreTax(java.math.BigDecimal cost,
                                 int taxClassId,
                                 int quantity)
                                 throws KKException,
                                        org.apache.torque.TorqueException,
                                        com.workingdogs.village.DataSetException
This is a utility method to directly return the total tax that needs to be applied for a defined item cost and quantity. When the quantity is greater than one, the tax amount may be calculated differently depending on the algorithm used. i.e. Could calculate tax on a single product before multiplying by the quantity or tax on the total.

Parameters:
cost -
taxClassId -
quantity -
Returns:
Returns the tax that needs to be applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addTax

java.math.BigDecimal addTax(java.math.BigDecimal cost,
                            int countryId,
                            int zoneId,
                            int taxClassId)
                            throws KKException,
                                   org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException
This is a utility method to directly get the final cost. The tax is added to the value of the cost parameter.

Parameters:
cost -
countryId -
zoneId -
taxClassId -
Returns:
Returns the cost after tax has been applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addTax

java.math.BigDecimal addTax(java.math.BigDecimal cost,
                            int countryId,
                            int zoneId,
                            int taxClassId,
                            int quantity)
                            throws KKException,
                                   org.apache.torque.TorqueException,
                                   com.workingdogs.village.DataSetException
This is a utility method to directly get the final cost. The tax is added to the value of the cost parameter. The cost parameter defines the total cost (item cost x quantity) before tax. When the quantity is greater than one, the tax amount may be calculated differently depending on the algorithm used. i.e. Could calculate tax on a single product before multiplying by the quantity or tax on the total.

Parameters:
cost -
countryId -
zoneId -
taxClassId -
quantity -
Returns:
Returns the cost after tax has been applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addStoreTax

java.math.BigDecimal addStoreTax(java.math.BigDecimal cost,
                                 int taxClassId)
                                 throws KKException,
                                        org.apache.torque.TorqueException,
                                        com.workingdogs.village.DataSetException
This is a utility method to directly get the final cost. The tax is added to the value of the cost parameter.

Parameters:
cost -
taxClassId -
Returns:
Returns the cost after tax has been applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

addStoreTax

java.math.BigDecimal addStoreTax(java.math.BigDecimal cost,
                                 int taxClassId,
                                 int quantity)
                                 throws KKException,
                                        org.apache.torque.TorqueException,
                                        com.workingdogs.village.DataSetException
This is a utility method to directly get the final cost. The tax is added to the value of the cost parameter. The cost parameter defines the total cost (item cost x quantity) before tax. When the quantity is greater than one, the tax amount may be calculated differently depending on the algorithm used. i.e. Could calculate tax on a single product before multiplying by the quantity or tax on the total.

Parameters:
cost -
taxClassId -
quantity -
Returns:
Returns the cost after tax has been applied
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getGeoZonesPerZone

GeoZone[] getGeoZonesPerZone(ZoneIf zone)
                             throws org.apache.torque.TorqueException,
                                    com.workingdogs.village.DataSetException,
                                    KKException
Find the GeoZones that exist for a particular zone

Parameters:
zone -
Returns:
An array of GeoZones or null if non exist
Throws:
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException
KKException

getAllCountries

Country[] getAllCountries()
                          throws com.workingdogs.village.DataSetException,
                                 org.apache.torque.TorqueException,
                                 KKException
Returns an array of all defined countries

Returns:
Returns an array of countries
Throws:
com.workingdogs.village.DataSetException
org.apache.torque.TorqueException
KKException

getCountryPerName

Country getCountryPerName(java.lang.String countryName)
                          throws KKException,
                                 org.apache.torque.TorqueException,
                                 com.workingdogs.village.DataSetException
Returns the country object for the country name, or Null if the country doesn't exist in the DB. If there is more than one country with the same name, we return the first one that we find.

Parameters:
countryName -
Returns:
Returns a country object
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getCountryPerId

Country getCountryPerId(int countryId)
                        throws KKException,
                               org.apache.torque.TorqueException,
                               com.workingdogs.village.DataSetException
Returns the country object for the country id, or Null if the country doesn't exist in the DB.

Parameters:
countryId -
Returns:
Returns a country object
Throws:
KKException
org.apache.torque.TorqueException
com.workingdogs.village.DataSetException

getTaxQuantityRule

int getTaxQuantityRule()
                       throws KKException
Returns the rule used to calculate tax for products with multiple quantities. The supported rules are:
    • TaxUtils.TAX_PER_ITEM : The tax is calculated for a single item, to the number of decimal places defined by scale. Then this value is multiplied by the quantity.
      TaxUtils.TAX_ON_TOTAL : The tax is calculated for the total amount (single item cost x quantity).
  • Returns:
    the taxQuantityRule
    Throws:
    KKException

    getTaxScale

    int getTaxScale()
                    throws KKException
    Returns the precision use for calculating tax that matches the ADMIN_CURRENCY_DECIMAL_PLACES configuration variable.

    Returns:
    the taxScale
    Throws:
    KKException


    Copyright © 2011 DS Data Systems UK Ltd.