|
@@ -1,5 +1,6 @@
|
|
|
package com.psi.gabontel.mobileapp.thirdparty.helper;
|
|
package com.psi.gabontel.mobileapp.thirdparty.helper;
|
|
|
|
|
|
|
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import javax.ejb.Remote;
|
|
import javax.ejb.Remote;
|
|
@@ -33,27 +34,40 @@ public class MobileAppThirdPartyHelper implements AppManagerFunction {
|
|
|
String method = syntax.get("method");
|
|
String method = syntax.get("method");
|
|
|
String password = syntax.get("password");
|
|
String password = syntax.get("password");
|
|
|
String respmessage = key + ":" + method + ":";
|
|
String respmessage = key + ":" + method + ":";
|
|
|
|
|
+ String response = StringUtil.base64Encode(new JsonResponse(99,"System is busy").toString().getBytes());
|
|
|
McomSubscriber originator = null;
|
|
McomSubscriber originator = null;
|
|
|
|
|
+ boolean isfinal = false;
|
|
|
|
|
+ String finalmessage = "System Busy.";
|
|
|
|
|
+ if(!StringUtil.isNullOrEmpty(password)) {
|
|
|
|
|
+ isfinal = true;
|
|
|
|
|
+ }
|
|
|
Message msg = Messanger.getMessage(MessageId.SYSTEM_BUSY, msisdn, "<refid>", refid);
|
|
Message msg = Messanger.getMessage(MessageId.SYSTEM_BUSY, msisdn, "<refid>", refid);
|
|
|
try {
|
|
try {
|
|
|
- originator = McomSubscriber.getMcomSubscriber(msisdn);
|
|
|
|
|
- if(!StringUtil.isNullOrEmpty(password)) {
|
|
|
|
|
|
|
+ if(isfinal) {
|
|
|
|
|
+ originator = McomSubscriber.getMcomSubscriber(msisdn);
|
|
|
msg = TransactionHelper.validateOriginator(originator, password);
|
|
msg = TransactionHelper.validateOriginator(originator, password);
|
|
|
if (msg != null) {
|
|
if (msg != null) {
|
|
|
- return new Message(99,0,respmessage + new JsonResponse(99,msg.getMessage()).toString());
|
|
|
|
|
|
|
+ log.error("Error: Refid:"+refid+"|invalid originator!");
|
|
|
|
|
+ return new Message(99,0,msg.getMessage().toString());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if(InitializerBean.containsKey(method)) {
|
|
if(InitializerBean.containsKey(method)) {
|
|
|
- String[] paramarr = syntax.get("mparam").split("\\|");
|
|
|
|
|
- return new Message(0,0,respmessage + new JsonResponse(0,InitializerBean.callUssd(method, paramarr)).toString());
|
|
|
|
|
- }else {
|
|
|
|
|
- return new Message(99,0,respmessage + new JsonResponse(99,"System is busy").toString());
|
|
|
|
|
|
|
+ String[] paramarr = syntax.get("mparam").split("\\|");
|
|
|
|
|
+ String appmanresponse = InitializerBean.callUssd(method, paramarr).toString();
|
|
|
|
|
+ response = StringUtil.base64Encode(new JsonResponse(0,appmanresponse).toString().getBytes());
|
|
|
|
|
+ finalmessage = respmessage + response;
|
|
|
|
|
+ if(isfinal) {
|
|
|
|
|
+ finalmessage = appmanresponse;
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Message(0,0,finalmessage);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ log.error("Error: Refid:"+refid+"|method not found!");
|
|
|
}catch(Exception e) {
|
|
}catch(Exception e) {
|
|
|
log.error("Error: Refid:"+refid+"|" ,e);
|
|
log.error("Error: Refid:"+refid+"|" ,e);
|
|
|
}
|
|
}
|
|
|
- return new Message(99,0,respmessage + new JsonResponse(99,"System is busy").toString());
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(!isfinal) {
|
|
|
|
|
+ finalmessage = respmessage + response;
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Message(99,0,finalmessage);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|