Skip to content

Commit

Permalink
Merge pull request #3 from dsulochana/dev
Browse files Browse the repository at this point in the history
Bug fix around MTN EP discovery
  • Loading branch information
dsulochana authored Nov 5, 2020
2 parents abdac6c + 37f4157 commit c14d354
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public class SendSMSHandler extends AbstractHandler{
public SendSMSHandler(SMSExecutor executor) throws InstantiationException, IllegalAccessException, ClassNotFoundException, ValidatorException{
super();
this.executor = executor;
occi = new OriginatingCountryCalculatorIDD();
occi = new OriginatingCountryCalculatorIDD(true);
responseHandler = new ResponseHandler();
smsMessagingService = new SMSMessagingService();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ public class OriginatingCountryCalculatorIDD extends OriginatingCountryCalculato
public static String oparatorOnHeaderRegEx = null;
public static String oparatorOnHeaderMCC = null;

private boolean ignoreMSISDNFormatValidation;

public OriginatingCountryCalculatorIDD () {

}

public OriginatingCountryCalculatorIDD (boolean ignoreMSISDNFormatValidation) {
this.ignoreMSISDNFormatValidation = ignoreMSISDNFormatValidation;
}

/*
* (non-Javadoc)
Expand Down Expand Up @@ -249,35 +258,43 @@ public OperatorEndpoint getOperatorEndpoint(
//MSISDN could be in ARC/PCR format
//if (phoneUtil.resourceInMsisdnFormat(searchDTO.getMSISDN())) {

MSISDN numberProto = null;
int countryCode = 0;
//Check MSIDN in typical format
try {
numberProto = phoneUtil.parse(searchDTO.getMSISDN());
if (numberProto != null) {
if (!ignoreMSISDNFormatValidation) {
MSISDN numberProto = null;
int countryCode = 0;
//Check MSIDN in typical format
try {
numberProto = phoneUtil.parse(searchDTO.getMSISDN());
if (numberProto != null) {
/**
* obtain the country code form the phone number object
*/
countryCode = numberProto.getCountryCode();
}

/**
* obtain the country code form the phone number object
* if the country code within the header look up context , the
* operator taken from the header object
*/
if (countryLookUpOnHeader.contains(String.valueOf(countryCode))) {
operator = operatorCode;
}
/**
* build the MSISDN
*/
countryCode = numberProto.getCountryCode();
}

/**
* if the country code within the header look up context , the
* operator taken from the header object
*/
if (countryLookUpOnHeader.contains(String.valueOf(countryCode))) {
operator = operatorCode;
}
/**
* build the MSISDN
*/

if (numberProto != null) {
if (numberProto != null) {

msisdn.append("+").append(numberProto.getCountryCode())
.append(numberProto.getNationalNumber());
msisdn.append("+").append(numberProto.getCountryCode())
.append(numberProto.getNationalNumber());
}
} catch (InvalidMSISDNException e) {
//number in either ARC/PCR format. number already validated from oneapi validation
//operator fetched from header
if (operatorCode != null) {
operator = operatorCode;
}
}
} catch (InvalidMSISDNException e) {
} else {
//number in either ARC/PCR format. number already validated from oneapi validation
//operator fetched from header
if (operatorCode != null) {
Expand Down

0 comments on commit c14d354

Please sign in to comment.