##### Child pages
• [in-commerce] Currency converter code reorganization
Go to start of banner

# [in-commerce] Currency converter code reorganization

All currency converter classes are located in same file, not in separate files as they should. Base currency converter class is named "kCurrencyRates" (starting with "k"), but it is not part of In-Portal distribution, and belongs to In-Commerce module, so "k" should be removed.

Also this class is registered not in unit config, but in kApplication class directly. At the end all classes from file "\in-commerce\units\currencies\currency_rates.php" should be moved to "\in-commerce\units\helpers" folder and named properly, because they are actually helpers.

MINC-39 - Getting issue details... STATUS

1. Yes, I agree with Alex.

However do we really want to create 3 separate files for each CurrencyRates
class which only has 2 methods in each?

What if we properly rename and move kCurrencyRates as proposed into helpers
and create a separate file for all kBankLVCurrencyRates, kECBCurrencyRates,
kFRNYCurrencyRates which extend kCurrencyRates?

What's you take on this?

DA.

2. In case if we don't move each class declaration to separate file, then we
will violate our own coding standards, but because of they are really small,
then we could keep them together as you proposed.

3. Yes, they are super-small so I think we can do a single file in this
case.

The question remains where do we put them? They will be kind of
extensions of that Currency Helper once refactored.

What you think?

DA.

4. Did you miss my original post, where I've mentioned place, where those
classes should be moved. In that case it will be
"in-commerce/units/helper/currency_rate_helper.php".

5. Ok so you recommend we leave all classes in a single file. I thought to
break it on two files - Base Currency Converter class and separate file for
Extension classes...

I am okay with a single file - it was just a thought.

DA.

6. Here is a task for this:

572: Refactor Currency Converter Class

MINC-39 - Getting issue details... STATUS

DA.

7. Hi guys,

I'd ask a question: how many e-commerce projects had more than 1
currency enabled?

I don't know how much theses 175 currencies weight in DB, but if it
could fasten order process, I'd recommend a function to remove
unecessary currencies.

Phil.

8. Hi Phil,

Not to disappoint you, but I know many In-Commerce projects that have
many.