How to configure the currencies to be used in your Atomia platform.
Overview
Atomia supports many currencies, and the ones that are active by default are:
- USD
- ARS
- PLN
- SEK
If you are going to use a currency that is not in this list, you need to mark it as Active in the database.
Setting up available currencies
- The following tables need to be edited in the AtomiaBilling database to set a currency as Active or Inactive:
- currency
- account_details
- reseller_configuration
- reseller_currencies
- In table currency, field active needs to be set at “1” for currency to be available
- 1 represents active currency.
- 0 represent inactive currency.
- Set up field active to 1 for all currencies that you want to be available.
Changing default currencies for existing resellers and clients
- Set the field active to 1 in table currency for all currencies you want to be available.
- In the table reseller_currencies the field fk_currency_id needs to be updated to the desired currency.
- In the table reseller_configuration the field fk_default_currency_id needs to be updated to the desired currency.
- In the table account_details the field fk_default_currency_id needs to be updated to the desired currency.
Relationships between tables
- reseller_currencies => currency
- fk_currency_id => id
- reseller_configuration => reseller_currencies
- Reseller_configuration_id => fk_reseller_configuration_id
- account_details => reseller_configuration
- Fk_reseller_configuration_id => reseller_configuration_id
- account_details => currency
- Fk_default_currency_id => id
Example query for SQL management studio
- 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 )
- 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’)
- Define products’ prices for each new currency.