HOWTO set currency ACTIVE or INACTIVE and to set default currency


Important tables in database AtomiaBilling for setting currency ACTIVE or INACTIVE:

  1. currency

  2. account_details

  3. reseller_configuration

  4. reseller_currencies



SET UP AVAILABLE CURRENCIES:

  1. In table currency, field “active” needs to be set at “1” for currency to be available

    1. 1 represents active currency

    2. 0 represent inactive currency

  2. Set up field “active” to 1 for all currencies that you wanna be available.


Changing default currencies for EXISTING RESELLERS and CLIENTS

  1. Set up in table “currency” field “active” to 1 for currencies that you want to be available

  2. In table resseler_currencies field fk_currency_id needs to be updated to desired currency

  3. In table resseler_configuration field fk_default_currency_id needs to be updated to desired currency

  4. In table account_details field fk_default_currency_id needs to be updated to desired currency


Relationships between tables:

  1. resseler_currencies =>currency

    1. fk_currency_id => id

  2. resseler_configuration =>resseler_currencies

    1. Resseler_configuration_id => fk_resseler_configuration_id

  3. account_details =>resseler_configuration

    1. Fk_resseler_configuration_id => resseler_configuration_id

  4. account_details =>currency

    1. Fk_default_currency_id => id


 relationships.jpg


EXAMPLE QUERY FOR SQL MANAGEMENT STUDIO:


WARNING: Make sure to use transactions when performing database commands.


  1. Update desired currencies to 'active'

UPDATE AtomiaBilling..currency SET active = 1 where code in ('EUR', 'USD')

( For list of all available currencies and their current status: SELECT name, code, active FROM AtomiaBilling..currency )


  1. Enable currency for each reseller where it is needed

INSERT INTO AtomiaBilling..reseller_currencies

SELECT r.id, c.id FROM AtomiaAccount..account a  

INNER JOIN AtomiaBilling..account_details d ON d.account_id = a.id

INNER JOIN AtomiaBilling..reseller_configuration r on r.id = d.fk_reseller_configuration_id

INNER JOIN AtomiaBilling..currency c on 1=1

WHERE c.code IN ('EUR', 'USD')

AND a.name IN ('100000', '100497', '100617')


  1. Define products' prices for each new currency


Do not forget to replace example values from the guide with actual currency codes and resellers' numbers.






For more information you can always contact Atomia’s friendly support team.