Skip to content

Commit

Permalink
Merge pull request jpos#101 from vsalaman/isocurr
Browse files Browse the repository at this point in the history
ISOCurrency now uses currencies from jvm
  • Loading branch information
ar committed Feb 24, 2016
2 parents e9cf808 + fcda2b6 commit 83616bb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 226 deletions.
26 changes: 24 additions & 2 deletions jpos/src/main/java/org/jpos/iso/ISOCurrency.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.*;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
import java.util.Set;

/**
* ISO Currency Conversion package
Expand All @@ -43,10 +48,27 @@ private ISOCurrency()

static
{
addBundle(ISOCurrency.class.getName());
addJavaCurrencies();
loadPropertiesFromClasspath("META-INF/org/jpos/config/ISOCurrency.properties");
}

private static void addJavaCurrencies()
{
Set<java.util.Currency> currencies = java.util.Currency.getAvailableCurrencies();
for (java.util.Currency sc : currencies)
{
try
{
addCurrency(sc.getCurrencyCode().toUpperCase(),
ISOUtil.zeropad(Integer.toString(sc.getNumericCode()), 3),
sc.getDefaultFractionDigits());
}
catch (ISOException ignored)
{
}
}
}

@SuppressWarnings({"EmptyCatchBlock"})
public static void loadPropertiesFromClasspath(String base)
{
Expand Down
224 changes: 0 additions & 224 deletions jpos/src/main/resources/org/jpos/iso/ISOCurrency.properties

This file was deleted.

0 comments on commit 83616bb

Please sign in to comment.