My app is sending request to APIs from some other parties. Every single parties have different return codes that I need to handle. The result is I need to handle thousands of different return code from those parties.
I am thinking about making a specific class that will hold constant to handle all of them. It will be like:
public static final Map<String, String> RETURN_CODE_MAP = new HashMap<String, String>(){
{
// these mapping will be thousands of line
put("BANK_A_000","SUCCESS");
put("BANK_A_001","FAILED");
put("BANK_A_002","UNKNOWN");
put("BANK_B_SU","SUCCESS");
put("BANK_B_FA","FAILED");
put("BANK_B_UN","UNKNOWN");
put("BANK_C_00077","SUCCESS");
put("BANK_C_00088","FAILED");
put("BANK_C_00099","UNKNOWN");
put("E-COMMERCE_A_000","SUCCESS");
put("E-COMMERCE_A_001","FAILED");
put("E-COMMERCE_A_002","UNKNOWN");
put("E-COMMERCE_B_000SU","SUCCESS");
put("E-COMMERCE_B_000FA","FAILED");
put("E-COMMERCE_B_000UN","UNKNOWN");
put("E-COMMERCE_C_00077","SUCCESS");
put("E-COMMERCE_C_00088","FAILED");
put("E-COMMERCE_C_00099","UNKNOWN");
}
};
The list of the return code will be thousands of them. Are there going to be a performance issue? Can you guys tell me the right way to handle this kind of case? Thank you all