diff --git a/src/th/co/ais/ssbsrfc/config/Constant.java b/src/th/co/ais/ssbsrfc/config/Constant.java index 87183aa..9b894cd 100644 --- a/src/th/co/ais/ssbsrfc/config/Constant.java +++ b/src/th/co/ais/ssbsrfc/config/Constant.java @@ -62,8 +62,11 @@ public class Constant { public static final String ERROR = "Error"; public static final String ENCRYPTKEY = "82BDZsTKxvTJb9Bm"; - - public static final int FLOW_TEST_A = 1; + + public static final int FLOW_TEST_A = 0; + public static final int FLOW_INGW_CMF = 0; + public static final int FLOW_CHARGE_REPORT = 2; + public static final int FLOW_CHARGE_REQUEST = 1; public static final int FLOW_Unexpected_Event_Handling = 19; public static final int SUBSTATE_TYPE_W_REQUEST = 1; @@ -73,6 +76,9 @@ public class Constant { public static String nodeLBSRFP = "LBSRFP"; public static String nodeE01 = "E01"; + public static String nodeOCSNew = "OCS-New"; + public static String nodeOCSOld = "OCS-Old"; + public static String nodeES12 = "ES12"; public static final int[] arrSingleFlow = {/*Constant.FLOW_Loan_Potential_Jobs_Tracking, Constant.FLOW_TEST_A, Constant.FLOW_Loan_Potential_Request_Handling, Constant.FLOW_Loan_UI, Constant.FLOW_Loan_Activation, Constant.FLOW_Loan_Customer_Registration*/}; diff --git a/src/th/co/ais/ssbsrfc/config/StateConfig.java b/src/th/co/ais/ssbsrfc/config/StateConfig.java index 88c165a..9934919 100644 --- a/src/th/co/ais/ssbsrfc/config/StateConfig.java +++ b/src/th/co/ais/ssbsrfc/config/StateConfig.java @@ -10,7 +10,7 @@ import ec02.utils.AppLog; public class StateConfig { //define project name - public static final String PROJECT_NAME = "LBCF"; + public static final String PROJECT_NAME = "INGW-CMF"; public static String PROJECT_STAT_NAME = PROJECT_NAME; public static final boolean isMultiFlow = false; @@ -25,7 +25,6 @@ public class StateConfig { public static final String SSTATE_ABORT = "ABORT"; public static final String SSTATE_BEGIN = "BEGIN"; public static final String SSTATE_END = "END"; - public static final String SSTATE_W_A = "W_A"; public static final String SSTATE_W_CHARGEREQUEST = "W_CHARGEREQUEST"; public static final String SSTATE_W_CHARGEREPORT = "W_CHARGEREPORT"; public static final String SSTATE_W_ADJUSTMENT_CHARGEREQUEST = "W_ADJUSTMENTRESPONSE_CHARGEREQUEST"; @@ -34,7 +33,6 @@ public class StateConfig { public static final String Incoming_Unknown ="Incoming_Unknown"; public static final String Incoming_REJECT ="Incoming_REJECT"; public static final String Incoming_ABORT ="Incoming_ABORT"; - public static final String Incoming_A_Request = "Incoming_A_Request"; public static final String Incoming_ChargeRequest_Request = "Incoming_ChargeRequest_Request"; public static final String Incoming_ChargeReport_Request = "Incoming_ChargeReport_Request"; public static final String Incoming_Adjustment_ChargeRequest_Response = "Incoming_Adjustment_ChargeRequest_Response"; @@ -58,10 +56,10 @@ public class StateConfig { new State(SSTATE_ABORT, Incoming_ABORT, LASE_Abort), new State(SSTATE_END, Incoming_Unknown, LASE_Unknown), - new State(SSTATE_W_CHARGEREQUEST, Incoming_ChargeRequest_Request, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A), - new State(SSTATE_W_CHARGEREPORT, Incoming_ChargeReport_Request, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A), - new State(SSTATE_W_ADJUSTMENT_CHARGEREQUEST, Incoming_Adjustment_ChargeRequest_Response, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A), - new State(SSTATE_W_ADJUSTMENT_CHARGEREPORT, Incoming_Adjustment_ChargeReport_Response, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A), + new State(SSTATE_W_CHARGEREQUEST, Incoming_ChargeRequest_Request, "chargeRequest", "Adjustment", Constant.TYPE_REQUEST, Constant.FLOW_CHARGE_REQUEST), + new State(SSTATE_W_CHARGEREPORT, Incoming_ChargeReport_Request, "chargeReport", "Adjustment", Constant.TYPE_REQUEST, Constant.FLOW_CHARGE_REPORT), + new State(SSTATE_W_ADJUSTMENT_CHARGEREQUEST, Incoming_Adjustment_ChargeRequest_Response, "Adjustment", "chargeRequest", Constant.TYPE_RESPONSE, Constant.FLOW_CHARGE_REQUEST), + new State(SSTATE_W_ADJUSTMENT_CHARGEREPORT, Incoming_Adjustment_ChargeReport_Response, "Adjustment", "chargeReport", Constant.TYPE_RESPONSE, Constant.FLOW_CHARGE_REPORT), // new State(SSTATE_W_A, Incoming_A_Request, "Test A", "Test A", Constant.TYPE_RESPONSE), new State(SSTATE_END, Incoming_Unknown,"Unknown_Command"), }; @@ -135,11 +133,12 @@ public class StateConfig { State state = subStateList[i]; String ssCommand = state.nameReq; String ssEventType = state.eventType; - + //AppLog.e("############# ssEventType " + ssEventType); // if we found matching relation if(eventType.equals(ssEventType)) { command = ssCommand; + AppLog.d("COMMAND:"+command); break; } } diff --git a/src/th/co/ais/ssbsrfc/control/SubStateManager.java b/src/th/co/ais/ssbsrfc/control/SubStateManager.java index fd47420..6c8bcfd 100644 --- a/src/th/co/ais/ssbsrfc/control/SubStateManager.java +++ b/src/th/co/ais/ssbsrfc/control/SubStateManager.java @@ -1,13 +1,12 @@ package th.co.ais.ssbsrfc.control; +import ec02.utils.Log; import th.co.ais.ssbsrfc.config.StateConfig; import th.co.ais.ssbsrfc.interfaces.AbstractAFSubStateManager; -import th.co.ais.ssbsrfc.substate.SubWaitA; import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeReportResponse; import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeRequestResponse; import th.co.ais.ssbsrfc.substate.SubWaitChargeReport; import th.co.ais.ssbsrfc.substate.SubWaitChargeRequest; -import ec02.utils.Log; public class SubStateManager extends AbstractAFSubStateManager { diff --git a/src/th/co/ais/ssbsrfc/control/TestMain.java b/src/th/co/ais/ssbsrfc/control/TestMain.java index 2f33970..8b3b82b 100644 --- a/src/th/co/ais/ssbsrfc/control/TestMain.java +++ b/src/th/co/ais/ssbsrfc/control/TestMain.java @@ -8,6 +8,9 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import java.util.Scanner; import javax.xml.bind.JAXBContext; @@ -19,8 +22,6 @@ import javax.xml.soap.SOAPMessage; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; -import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser; - import th.co.ais.ssbsrfc.instance.AdjustmentRequestRes; import th.co.ais.ssbsrfc.instance.ResultHeader; @@ -48,6 +49,23 @@ public class TestMain { public static void main(String[] args) throws Exception { + + HashMap map = new HashMap(); + + map.put("x", "y"); + boolean c = false; + if(null==map.get("y")){ + c = true; + } + + System.out.println(c); + + Random random = new Random(); + String rand = "000"; + int a = random.nextInt(1000); + rand += a; + rand = rand.substring(rand.length()-3); + System.out.println(rand); Date time = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmssSS"); @@ -100,11 +118,11 @@ public class TestMain { JAXBElement jbe = unmarshaller.unmarshal(xsr, ResultHeader.class); res = jbe.getValue(); - + String ChargeId = ""+random.nextInt(10000); System.out.println("getVersion:"+res.getVersion()); System.out.println("getMsgLanguageCode:"+res.getMsgLanguageCode()); - System.out.println("getAcctKey:"+adj.getAcctKey()); + System.out.println("getAcctKey:"+ChargeId); System.out.println("getBalanceID:"+adj.getAdjustmentInfo().get(0).getBalanceID()); //System.out.println("Version:"+customer.getresultHeader().getVersion()); diff --git a/src/th/co/ais/ssbsrfc/control/mainAF.java b/src/th/co/ais/ssbsrfc/control/mainAF.java index e4ccc51..a3345e9 100644 --- a/src/th/co/ais/ssbsrfc/control/mainAF.java +++ b/src/th/co/ais/ssbsrfc/control/mainAF.java @@ -123,6 +123,7 @@ public class mainAF extends AbstractAF implements IEC02 { // 1.1.7. Set raw event type = event type r.setRawEventType(eventType); ec02Instance.getAFInstance().listTimeoutRemove(r.getInvoke()); + ec02Instance.getAFInstance().setEvent(eventType); AppLog.d("[eventType] : " + eventType); } } diff --git a/src/th/co/ais/ssbsrfc/instance/AFInstance.java b/src/th/co/ais/ssbsrfc/instance/AFInstance.java index 7cb6a68..974a4cd 100644 --- a/src/th/co/ais/ssbsrfc/instance/AFInstance.java +++ b/src/th/co/ais/ssbsrfc/instance/AFInstance.java @@ -46,11 +46,39 @@ public class AFInstance { private String acknowledgeTime = null; private String dialogueId = null; private Map dicRetry = null; - + private String ChargeId = null; + private String event = null; private AdjustmentRequestIns adjustmentRequestIns = null; private AdjustmentResponseIns adjustmentResponseIns = null; private HashMap Dn = null; + private String rand = null; + private String ms = null; + + public String getEvent() { + return event; + } + public void setEvent(String event) { + this.event = event; + } + public String getMs() { + return ms; + } + public void setMs(String ms) { + this.ms = ms; + } + public String getRand() { + return rand; + } + public void setRand(String rand) { + this.rand = rand; + } + public String getChargeId() { + return ChargeId; + } + public void setChargeId(String chargeId) { + ChargeId = chargeId; + } public HashMap getDn() { return Dn; } diff --git a/src/th/co/ais/ssbsrfc/instance/ChargeReportIns.java b/src/th/co/ais/ssbsrfc/instance/ChargeReportIns.java index 32f4ee5..4ba714d 100644 --- a/src/th/co/ais/ssbsrfc/instance/ChargeReportIns.java +++ b/src/th/co/ais/ssbsrfc/instance/ChargeReportIns.java @@ -8,8 +8,9 @@ import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "vcrr") @XmlAccessorType(XmlAccessType.FIELD) public class ChargeReportIns { - + @XmlElement(name = "res") private String Result; + @XmlElement(name = "ppf") private String Prepaidsubscriberflag; public String getResult() { diff --git a/src/th/co/ais/ssbsrfc/instance/ChargeResponseIns.java b/src/th/co/ais/ssbsrfc/instance/ChargeResponseIns.java index 2cf57b4..6a943e0 100644 --- a/src/th/co/ais/ssbsrfc/instance/ChargeResponseIns.java +++ b/src/th/co/ais/ssbsrfc/instance/ChargeResponseIns.java @@ -10,64 +10,37 @@ import javax.xml.bind.annotation.XmlRootElement; public class ChargeResponseIns { @XmlElement(name = "res") - private Element Result; + private String Result; @XmlElement(name = "desc") - private Element desc; + private String desc; @XmlElement(name = "id") - private Element ChargingID; + private String ChargingID; @XmlElement(name = "ppf") - private Element Prepaidsubscriberflag; - + private String Prepaidsubscriberflag; + public String getResult() { - return getElementValue(this.Result); - } - - public void setResult(String Result) { - this.Result = setElementValue(this.Result, Result); - } - - public String getdesc() { - return getElementValue(this.desc); - } - - public void setdesc(String desc) { - this.desc = setElementValue(this.desc, desc); - } - + return Result; + } + public void setResult(String result) { + Result = result; + } + public String getDesc() { + return desc; + } + public void setDesc(String desc) { + this.desc = desc; + } public String getChargingID() { - return getElementValue(this.ChargingID); - } - - public void setChargingID(String ChargingID) { - this.ChargingID = setElementValue(this.ChargingID, ChargingID); - } - + return ChargingID; + } + public void setChargingID(String chargingID) { + ChargingID = chargingID; + } public String getPrepaidsubscriberflag() { - return getElementValue(this.Prepaidsubscriberflag); - } - - public void setPrepaidsubscriberflag(String Prepaidsubscriberflag) { - this.Prepaidsubscriberflag = setElementValue(this.Prepaidsubscriberflag, Prepaidsubscriberflag); - } - - public static String getElementValue(Element element) { - if(element == null) { - return null; - } else { - return element.getValue(); - } - } - - public static Element setElementValue(Element element, String value) { - if(value != null) { - if(element == null) { - element = new Element(); - } - element.setValue(value); - } else { - return null; - } - return element; - } + return Prepaidsubscriberflag; + } + public void setPrepaidsubscriberflag(String prepaidsubscriberflag) { + Prepaidsubscriberflag = prepaidsubscriberflag; + } } diff --git a/src/th/co/ais/ssbsrfc/message/EC02Builder.java b/src/th/co/ais/ssbsrfc/message/EC02Builder.java index 417c341..a375fbd 100644 --- a/src/th/co/ais/ssbsrfc/message/EC02Builder.java +++ b/src/th/co/ais/ssbsrfc/message/EC02Builder.java @@ -283,6 +283,7 @@ public class EC02Builder { // Log Detail Output if (data != null) { String currentState = ""; + currentState = this.ec02Ins.getAFInstance().getCurrentState(); String cmd = (command == null ) ? StateConfig.getCommandFromState(currentState) : command; if (nodeTo == null && currentState != null) { String eventType = StateConfig.getEventTypeFromSubState(currentState); diff --git a/src/th/co/ais/ssbsrfc/substate/SubMessages.java b/src/th/co/ais/ssbsrfc/substate/SubMessages.java index 585c3b0..fba5e51 100644 --- a/src/th/co/ais/ssbsrfc/substate/SubMessages.java +++ b/src/th/co/ais/ssbsrfc/substate/SubMessages.java @@ -2,11 +2,13 @@ package th.co.ais.ssbsrfc.substate; import ec02.af.abstracts.AbstractAF; import ec02.utils.AppLog; +import th.co.ais.ssbsrfc.config.Constant; import th.co.ais.ssbsrfc.config.Invoke; import th.co.ais.ssbsrfc.config.StateConfig; import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.EQXRawInstance; +import th.co.ais.ssbsrfc.instance.ManageTime; import th.co.ais.ssbsrfc.interfaces.EQXMsg; import th.co.ais.ssbsrfc.message.MessageParser; import th.co.ais.ssbsrfc.utils.Global; @@ -17,46 +19,69 @@ public class SubMessages { public static EQXRawInstance getRawAdjustmentRequest(AbstractAF abstractAF, EC02Instance ec02Instancee, String eventType,AdjustmentRequestIns ajr) { - + + String command = "Adjustment"; AdjustmentRequestIns ins = ajr; String message = MessageParser.toSoap(ins); EQXRawInstance eqxRaw = new EQXRawInstance(); - String command = "OSDOld"; - String to = Global.getEC02WarmConfig("Resource-Name-OCSOld"); - String session = "SESSION"; - Invoke iv = new Invoke("OSDOld",session,command,eventType,null); - String invoke = iv.toString(); + String to = Global.getEC02WarmConfig("Resource-Name-OCS-Old"); + AppLog.d("Resource-Name-OCS-Old :"+to); + String session = "SESSION"; + Invoke iv = new Invoke("OCS-Old",session,command,eventType,null); + String invoke = iv.toString(); + eqxRaw.setNodeTo(Constant.nodeOCSOld); eqxRaw.setMessage(message); eqxRaw.setTo(to); + eqxRaw.setDataOutput(message); + AppLog.d("Adjustment-Request-timeout :"+Global.getEC02WarmConfig("Adjustment-Request-timeout")); eqxRaw.setInvoke(invoke); eqxRaw.setCtype(EQXMsg.TEXTXML); - eqxRaw.setUrl(Global.getEC02WarmConfig("Http-OCSOld-URL")); + eqxRaw.setCommand(command); + String timeout = new ManageTime(ec02Instancee).getTimeout(invoke, StateConfig.getTimeout(abstractAF, StateConfig.Incoming_Adjustment_ChargeRequest_Response)); + eqxRaw.setTimeout(timeout); + + eqxRaw.setUrl(Global.getEC02WarmConfig("Http-OCS-Old-URL")); + AppLog.d("Http-OCS-Old-URL :"+eqxRaw.getUrl()); return eqxRaw; } - public static EQXRawInstance getRawAResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag) - { - String message = "Hello"; - String command = "A"; - - EQXRawInstance eqxRaw = new EQXRawInstance(); - eqxRaw.setMessage(message); - eqxRaw.setTo(to); - eqxRaw.setInvoke(invoke); - eqxRaw.setCtype(EQXMsg.TEXTPLAIN); - eqxRaw.setCommand(command); - - return eqxRaw; - } + public static EQXRawInstance getRawAdjustmentReport(AbstractAF abstractAF, EC02Instance ec02Instancee, String eventType,AdjustmentRequestIns ajr) + { + + String command = "Adjustment"; + AdjustmentRequestIns ins = ajr; + String message = MessageParser.toSoap(ins); + EQXRawInstance eqxRaw = new EQXRawInstance(); + String to = Global.getEC02WarmConfig("Resource-Name-OCS-Old"); + AppLog.d("Resource-Name-OCS-Old :"+Global.getEC02WarmConfig("Resource-Name-OCS-Old")); + String session = "SESSION"; + Invoke iv = new Invoke("OCS-Old",session,command,eventType,null); + String invoke = iv.toString(); + AppLog.d("Adjustment-Request-timeout :"+Global.getEC02WarmConfig("Adjustment-Request-timeout")); + String timeout = new ManageTime(ec02Instancee).getTimeout(invoke, StateConfig.getTimeout(abstractAF, StateConfig.Incoming_Adjustment_ChargeReport_Response)); + eqxRaw.setNodeTo(Constant.nodeOCSOld); + eqxRaw.setMessage(message); + eqxRaw.setTo(to); + eqxRaw.setDataOutput(message); + eqxRaw.setInvoke(invoke); + eqxRaw.setCtype(EQXMsg.TEXTXML); + eqxRaw.setCommand(command); + eqxRaw.setTimeout(timeout); + eqxRaw.setUrl(Global.getEC02WarmConfig("Http-OCS-Old-URL")); + AppLog.d("Http-OCS-Old-URL :"+Global.getEC02WarmConfig("Http-OCS-Old-URL")); + return eqxRaw; + } public static EQXRawInstance getRawChargeRequestResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag) { String message = mag; - String command = "A"; + String command = "chargeRequest"; EQXRawInstance eqxRaw = new EQXRawInstance(); eqxRaw.setMessage(message); + eqxRaw.setNodeTo(Constant.nodeOCSNew); eqxRaw.setTo(to); + eqxRaw.setDataOutput(message); eqxRaw.setInvoke(invoke); eqxRaw.setCtype(EQXMsg.TEXTXML); eqxRaw.setCommand(command); @@ -68,17 +93,17 @@ public class SubMessages { public static EQXRawInstance getRawChargeReportResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag) { String message = mag; - String command = "A"; + String command = "chargeReport"; EQXRawInstance eqxRaw = new EQXRawInstance(); eqxRaw.setMessage(message); + eqxRaw.setNodeTo(Constant.nodeOCSNew); eqxRaw.setTo(to); + eqxRaw.setDataOutput(message); eqxRaw.setInvoke(invoke); eqxRaw.setCtype(EQXMsg.TEXTXML); eqxRaw.setCommand(command); return eqxRaw; } - - } diff --git a/src/th/co/ais/ssbsrfc/substate/SubWaitA.java b/src/th/co/ais/ssbsrfc/substate/SubWaitA.java deleted file mode 100644 index 996def7..0000000 --- a/src/th/co/ais/ssbsrfc/substate/SubWaitA.java +++ /dev/null @@ -1,54 +0,0 @@ -package th.co.ais.ssbsrfc.substate; - -import th.co.ais.ssbsrfc.config.Constant; -import th.co.ais.ssbsrfc.config.StateConfig; -import th.co.ais.ssbsrfc.instance.EC02Instance; -import th.co.ais.ssbsrfc.instance.EQXRawInstance; -import th.co.ais.ssbsrfc.utils.EqxStringUtils; -import ec02.af.abstracts.AbstractAF; -import ec02.af.data.EquinoxRawData; -import ec02.utils.AppLog; - - -public class SubWaitA extends WaitSubState { - public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { - this._state = StateConfig.SSTATE_W_A; - this._eventType = StateConfig.Incoming_A_Request; - this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST; - if (equinoxRawData != null) { - ec02Instance.getAFInstance().setOrig(equinoxRawData.getOrig()); - ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke()); - ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke()); - } - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A); - } - - public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { - String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance); - AppLog.d("## PARAMETERS : " + value); - return value; - } - - public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { - AppLog.d("## TEST MSG SUBSTATE A"); - this.type = Constant.TYPE_SUCCESS; - } - public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { - switch (this.type) { - case Constant.TYPE_SUCCESS: - default: - { -// this.isStat = false; -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); - - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); - EQXRawInstance eqxRaw = SubMessages.getRawAResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),"xx"); - this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); - } - } - } -} diff --git a/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeReportResponse.java b/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeReportResponse.java index 941ca43..ebdc33c 100644 --- a/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeReportResponse.java +++ b/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeReportResponse.java @@ -14,8 +14,10 @@ import th.co.ais.ssbsrfc.instance.ChargeReportIns; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.EQXRawInstance; import th.co.ais.ssbsrfc.instance.ResultHeader; +import th.co.ais.ssbsrfc.instance.Stat; import th.co.ais.ssbsrfc.message.MessageParser; import th.co.ais.ssbsrfc.utils.EqxStringUtils; +import th.co.ais.ssbsrfc.utils.Global; public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { @@ -30,7 +32,6 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT; this._eventType = StateConfig.Incoming_Adjustment_ChargeReport_Response; this._stateType = Constant.SUBSTATE_TYPE_W_RESPONSE; - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A); } public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) @@ -52,8 +53,8 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { adjustresponse.setResultHeader(res); adjustresponse.setAdjustmentResult(adj); ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse); - - chargeReportIns.setResult("000"); + this._resultCode = "0"; + chargeReportIns.setResult(this._resultCode); chargeReportIns.setPrepaidsubscriberflag("1"); return chargeReportIns; @@ -61,18 +62,137 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { - this.type = Constant.TYPE_SUCCESS; + this._resultDescription = "SUCCESS"; + if(null==res.getVersion()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(res.getVersion())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==res.getResultCode()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(res.getResultCode())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==res.getResultDesc()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(res.getResultDesc())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAcctKey()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(adj.getAcctKey())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getBalanceType()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getBalanceType())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getOldBalanceAmt()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getOldBalanceAmt())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getNewBalanceAmt()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getNewBalanceAmt())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getCurrencyID()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultDescription = "INCOMPLETE_DATA"; + this._resultCode="322"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getCurrencyID())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } } public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { switch (this.type) { - case Constant.TYPE_SUCCESS: - default: + case Constant.TYPE_INVALID: + { + chargeReportIns.setResult(this._resultCode); + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT")); + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns); + EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); + break; + } + case Constant.TYPE_SUCCESS: + default: { + chargeReportIns.setResult(this._resultCode); + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); // this.isStat = false; -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT")); String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns); ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); diff --git a/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeRequestResponse.java b/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeRequestResponse.java index 2975920..3c36bdc 100644 --- a/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeRequestResponse.java +++ b/src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeRequestResponse.java @@ -17,8 +17,10 @@ import th.co.ais.ssbsrfc.instance.ChargeResponseIns; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.EQXRawInstance; import th.co.ais.ssbsrfc.instance.ResultHeader; +import th.co.ais.ssbsrfc.instance.Stat; import th.co.ais.ssbsrfc.message.MessageParser; import th.co.ais.ssbsrfc.utils.EqxStringUtils; +import th.co.ais.ssbsrfc.utils.Global; public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { @@ -54,15 +56,10 @@ public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { adjustresponse.setResultHeader(res); adjustresponse.setAdjustmentResult(adj); ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse); - - Random random = new Random(); - Date time = new Date(); - String x = time.getTime()+""; - int y = 900000000+random.nextInt(1000); - String MSGID =x+""+y; - chargeResponseIns.setResult("000"); - chargeResponseIns.setdesc("SUCCESS"); - chargeResponseIns.setChargingID(MSGID); + AppLog.d("Random : "+ec02Instance.getAFInstance().getRand()); + this._resultCode="0"; + chargeResponseIns.setResult(this._resultCode); + chargeResponseIns.setChargingID(ec02Instance.getAFInstance().getChargeId()); chargeResponseIns.setPrepaidsubscriberflag("1"); return chargeResponseIns; @@ -72,18 +69,138 @@ public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { { this.type = Constant.TYPE_SUCCESS; + this._resultDescription = "SUCCESS"; + if(null==res.getVersion()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(res.getVersion())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==res.getResultCode()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(res.getResultCode())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==res.getResultDesc()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(res.getResultDesc())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAcctKey()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(adj.getAcctKey())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getBalanceType()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getBalanceType())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getOldBalanceAmt()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getOldBalanceAmt())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getNewBalanceAmt()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getNewBalanceAmt())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } + if(null==adj.getAdjustmentInfo().get(0).getCurrencyID()){ + this.type = Constant.TYPE_INVALID; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + } + if("".equals(adj.getAdjustmentInfo().get(0).getCurrencyID())){ + this.type = Constant.TYPE_INVALID; + this._resultCode="322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:"+"null"); + } } public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { switch (this.type) { - + case Constant.TYPE_INVALID: + case Constant.TYPE_TIMEOUT: + { + chargeResponseIns.setResult(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT")); + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); + EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); + break; + } case Constant.TYPE_SUCCESS: default: { + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); // this.isStat = false; -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT")); String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); diff --git a/src/th/co/ais/ssbsrfc/substate/SubWaitChargeReport.java b/src/th/co/ais/ssbsrfc/substate/SubWaitChargeReport.java index 657dc2c..b5ef095 100644 --- a/src/th/co/ais/ssbsrfc/substate/SubWaitChargeReport.java +++ b/src/th/co/ais/ssbsrfc/substate/SubWaitChargeReport.java @@ -3,11 +3,12 @@ package th.co.ais.ssbsrfc.substate; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Date; import java.util.HashMap; +import java.util.Random; import ec02.af.abstracts.AbstractAF; import ec02.af.data.EquinoxRawData; +import ec02.af.data.GlobalData; import ec02.utils.AppLog; import th.co.ais.ssbsrfc.config.Constant; import th.co.ais.ssbsrfc.config.StateConfig; @@ -16,21 +17,24 @@ import th.co.ais.ssbsrfc.instance.AdjustmentInfo; import th.co.ais.ssbsrfc.instance.AdjustmentObj; import th.co.ais.ssbsrfc.instance.AdjustmentRequest; import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns; +import th.co.ais.ssbsrfc.instance.ChargeReportIns; import th.co.ais.ssbsrfc.instance.CheckRequest; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.EQXRawInstance; import th.co.ais.ssbsrfc.instance.OwnershipInfo; import th.co.ais.ssbsrfc.instance.RequestHeader; +import th.co.ais.ssbsrfc.instance.Stat; import th.co.ais.ssbsrfc.instance.SubAccessCode; import th.co.ais.ssbsrfc.utils.EqxStringUtils; - +import th.co.ais.ssbsrfc.utils.Global; public class SubWaitChargeReport extends WaitSubState { - + AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns(); - - public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { + HashMap map = new HashMap(); + ChargeReportIns chargeResponseIns = new ChargeReportIns(); + + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { this._state = StateConfig.SSTATE_W_CHARGEREPORT; this._eventType = StateConfig.Incoming_ChargeReport_Request; this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST; @@ -39,90 +43,244 @@ public class SubWaitChargeReport extends WaitSubState { ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke()); ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke()); } - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A); + ec02Instance.getAFInstance().setFlow(Constant.FLOW_CHARGE_REPORT); } - public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance); AppLog.d("## PARAMETERS : " + value); - HashMap map = new HashMap(); String page = equinoxRawData.getRawDataAttribute("val"); CheckRequest checkRequest = new CheckRequest(); checkRequest.setDn(page); - String [] dnList = checkRequest.getDn().split("&", -1); + String[] dnList = checkRequest.getDn().split("&", -1); page = dnList[0].substring("ssid=".length()); - int i=0; - while(i 3) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } + if (null == map.get("pwd")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("pwd:" + "null"); + } else if ("".equals(map.get("pwd")) || map.get("pwd").length() > 8) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } + if (null == map.get("ms")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("ms:" + "null"); + } else if ("".equals(map.get("ms")) || map.get("ms").length() > 10) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } + if (null == map.get("id")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("id:" + "null"); + } else if ("".equals(map.get("id")) || map.get("id").length() > 20) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } + if (null == map.get("rtv")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("rtv:" + "null"); + } else if ("".equals(map.get("rtv")) || map.get("rtv").length() > 5) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } + if (null == map.get("dat")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("dat:" + "null"); + } else if ("".equals(map.get("dat")) || map.get("dat").length() > 2048) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } + if (null == map.get("ssid")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("ssid:" + "null"); + } else if ("".equals(map.get("ssid")) || map.get("ssid").length() > 20) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "null"); + } } - public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { switch (this.type) { - case Constant.TYPE_SUCCESS: - default: - { -// this.isStat = false; -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT); - EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,StateConfig.Incoming_Adjustment_ChargeReport_Response,adjustmentRequest); + case Constant.TYPE_INVALID: + case Constant.TYPE_ERROR: { + this.type = Constant.TYPE_ERROR; + chargeResponseIns.setResult(this._resultCode); + chargeResponseIns.setPrepaidsubscriberflag("1"); + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, + ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(), message); + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + break; + } + case Constant.TYPE_SUCCESS: + default: { + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + // this.isStat = false; + ec02Instance.getAFInstance().getListStat() + .add(new Stat(StateConfig.PROJECT_STAT_NAME + "chargeReport STAT")); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT); + EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentReport(abstractAF, ec02Instance, + StateConfig.Incoming_Adjustment_ChargeReport_Response, adjustmentRequest); - this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw)); - } + this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw)); + } } } } diff --git a/src/th/co/ais/ssbsrfc/substate/SubWaitChargeRequest.java b/src/th/co/ais/ssbsrfc/substate/SubWaitChargeRequest.java index a3be33d..d5f06be 100644 --- a/src/th/co/ais/ssbsrfc/substate/SubWaitChargeRequest.java +++ b/src/th/co/ais/ssbsrfc/substate/SubWaitChargeRequest.java @@ -3,8 +3,8 @@ package th.co.ais.ssbsrfc.substate; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.Date; import java.util.HashMap; +import java.util.Random; import ec02.af.abstracts.AbstractAF; import ec02.af.data.EquinoxRawData; @@ -16,21 +16,24 @@ import th.co.ais.ssbsrfc.instance.AdjustmentInfo; import th.co.ais.ssbsrfc.instance.AdjustmentObj; import th.co.ais.ssbsrfc.instance.AdjustmentRequest; import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns; +import th.co.ais.ssbsrfc.instance.ChargeResponseIns; import th.co.ais.ssbsrfc.instance.CheckRequest; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.EQXRawInstance; import th.co.ais.ssbsrfc.instance.OwnershipInfo; import th.co.ais.ssbsrfc.instance.RequestHeader; +import th.co.ais.ssbsrfc.instance.Stat; import th.co.ais.ssbsrfc.instance.SubAccessCode; import th.co.ais.ssbsrfc.utils.EqxStringUtils; - +import th.co.ais.ssbsrfc.utils.Global; public class SubWaitChargeRequest extends WaitSubState { AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns(); - - public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { + HashMap map = new HashMap(); + private ChargeResponseIns chargeResponseIns = new ChargeResponseIns(); + + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { this._state = StateConfig.SSTATE_W_CHARGEREQUEST; this._eventType = StateConfig.Incoming_ChargeRequest_Request; this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST; @@ -39,97 +42,273 @@ public class SubWaitChargeRequest extends WaitSubState { ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke()); ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke()); } - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A); + ec02Instance.getAFInstance().setFlow(Constant.FLOW_CHARGE_REQUEST); } - public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { - Date time = new Date(); + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance); AppLog.d("## PARAMETERS : " + value); - HashMap map = new HashMap(); String page = equinoxRawData.getRawDataAttribute("val"); CheckRequest checkRequest = new CheckRequest(); checkRequest.setDn(page); - String [] dnList = checkRequest.getDn().split("&", -1); + String[] dnList = checkRequest.getDn().split("&", -1); page = dnList[0].substring("ssid=".length()); - int i=0; - while(i 3) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("scp:" + "INVALID"); + } + if (null == map.get("pwd")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("pwd:" + "null"); + } else if ("".equals(map.get("pwd")) || map.get("pwd").length() > 8) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("pwd:" + "INVALID"); + } + if (null == map.get("ms")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("ms:" + "null"); + } else if ("".equals(map.get("ms")) || map.get("ms").length() > 10) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ms:" + "INVALID"); + } + if (null == map.get("fee")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("fee:" + "null"); + } else if ("".equals(map.get("fee")) || map.get("fee").length() > 5) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("fee:" + "INVALID"); + } + if (null == map.get("mod")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("mod:" + "null"); + } else if ("".equals(map.get("mod")) || map.get("mod").length() > 1) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("mod:" + "INVALID"); + } + if (null == map.get("cat")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("cat:" + "null"); + } else if ("".equals(map.get("cat")) || map.get("cat").length() > 1) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("cat:" + "INVALID"); + } + if (null == map.get("dat")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("dat:" + "null"); + } else if ("".equals(map.get("dat")) || map.get("dat").length() > 100) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("dat:" + "INVALID"); + } + if (null == map.get("nid")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("nid:" + "null"); + } else if ("".equals(map.get("nid")) || map.get("nid").length() > 5) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("nid:" + "INVALID"); + } + if (null == map.get("ssid")) { + this.type = Constant.TYPE_MISSING; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER"); + AppLog.d("ssid:" + "null"); + } else if ("".equals(map.get("ssid")) || map.get("ssid").length() > 20) { + this.type = Constant.TYPE_INVALID; + this._resultCode = "322"; + this._resultDescription = "INCOMPLETE_DATA"; + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER"); + AppLog.d("ssid:" + "INVALID"); + } + } - public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) - { + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { switch (this.type) { - case Constant.TYPE_SUCCESS: - default: - { -// this.isStat = false; -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); - String message = th.co.ais.ssbsrfc.message.MessageParser.toSoap(adjustmentRequest); - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST); - EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,StateConfig.Incoming_Adjustment_ChargeRequest_Response,adjustmentRequest); - - this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw)); - } + case Constant.TYPE_INVALID: + case Constant.TYPE_MISSING: { + this.type = Constant.TYPE_ERROR; + chargeResponseIns.setResult(this._resultCode); + chargeResponseIns.setPrepaidsubscriberflag("1"); + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + chargeResponseIns.setChargingID(ec02Instance.getAFInstance().getChargeId()); + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, + ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(), message); + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + break; + } + case Constant.TYPE_SUCCESS: + default: { + ec02Instance.getAFInstance().setResultCode(this._resultCode); + ec02Instance.getAFInstance().setResultDescription(this._resultDescription); + // this.isStat = false; + ec02Instance.getAFInstance().getListStat() + .add(new Stat(StateConfig.PROJECT_STAT_NAME + "chargeRequest STAT")); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST); + EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance, + StateConfig.Incoming_Adjustment_ChargeRequest_Response, adjustmentRequest); + + this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw)); + } } } } diff --git a/src/th/co/ais/ssbsrfc/substate/WaitSubState.java b/src/th/co/ais/ssbsrfc/substate/WaitSubState.java index 8682153..0d0e196 100644 --- a/src/th/co/ais/ssbsrfc/substate/WaitSubState.java +++ b/src/th/co/ais/ssbsrfc/substate/WaitSubState.java @@ -7,7 +7,10 @@ import java.util.List; import th.co.ais.ssbsrfc.config.Constant; import th.co.ais.ssbsrfc.config.Invoke; import th.co.ais.ssbsrfc.config.StateConfig; +import th.co.ais.ssbsrfc.instance.ChargeReportIns; +import th.co.ais.ssbsrfc.instance.ChargeResponseIns; import th.co.ais.ssbsrfc.instance.EC02Instance; +import th.co.ais.ssbsrfc.instance.EQXRawInstance; import th.co.ais.ssbsrfc.instance.ListE01Data; import th.co.ais.ssbsrfc.instance.LogError; import th.co.ais.ssbsrfc.instance.ManageTime; @@ -27,6 +30,7 @@ import ec02.af.abstracts.AbstractAF; import ec02.af.data.EquinoxRawData; import ec02.af.data.GlobalData; import ec02.utils.AppLog; +import sun.applet.AppletPanel; public class WaitSubState implements IAFSubState { @@ -45,6 +49,7 @@ public class WaitSubState implements IAFSubState { protected String _invokeTimeout = null; protected boolean isRetry = false; private boolean isIdle = true; + int flow = 0; @Override @@ -215,6 +220,7 @@ public class WaitSubState implements IAFSubState { // SET LOG Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat); } + this.summaryLog(ec02Instance, equinoxRawData); } AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(END) ####]"); AppLog.d("#### NEXTSUBSTATE: " + ec02Instance.getAFInstance().getCurrentState()); @@ -317,7 +323,7 @@ public class WaitSubState implements IAFSubState { //Detail Log Input String value = EqxStringUtils.getMessage(equinoxRawData, null, false); String invoke = equinoxRawData.getInvoke(); - String eventType = equinoxRawData.getRawEventType(); + String eventType = ec02Instance.getAFInstance().getEvent(); String messageType = equinoxRawData.getType(); this.detailLogInput(ec02Instance, invoke, eventType, messageType, this._objIns, value); @@ -376,44 +382,82 @@ public class WaitSubState implements IAFSubState { public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { } + + protected void error(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) { AppLog.d("SPECIFIC ERROR BY APPLICATION"); - this.type = Constant.TYPE_ERROR; + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){ + this.type = Constant.TYPE_ERROR; + this._resultCode = null; + }else{ + this.type = Constant.TYPE_ERROR; + + } LogError ins = new LogError("1", "Error"); - this._resultCode = "null"; + this._resultCode = "310"; this._resultDescription = "Error"; + ec02Instance.getAFInstance().setResultCode("310"); + ec02Instance.getAFInstance().setResultDescription("SCP_OTHER"); + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins); this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); + flow = ec02Instance.getAFInstance().getFlow(); } protected void reject(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) { AppLog.d("REJECTED BY PLATFORM"); - this.type = Constant.TYPE_REJECT; + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){ + this.type = Constant.TYPE_REJECT; + this._resultCode = null; + }else{ + + this.type = Constant.TYPE_ERROR; + } LogError ins = new LogError("2", "Reject"); - this._resultCode = "null"; + this._resultCode = "307"; this._resultDescription = "Reject"; + ec02Instance.getAFInstance().setResultCode("307"); + ec02Instance.getAFInstance().setResultDescription("SCP_NOT_CONNECT"); + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins); this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); } protected void abort(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) { AppLog.d("RETURN ABORTED BY PLATFORM"); - this.type = Constant.TYPE_ABORT; - this._resultCode = "null"; + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){ + this.type = Constant.TYPE_ABORT; + this._resultCode = null; + }else{ + this.type = Constant.TYPE_ERROR; + } + this._resultCode = "310"; + LogError ins = new LogError("3", "Abort"); this._resultDescription = "Abort"; + ec02Instance.getAFInstance().setResultCode("310"); + ec02Instance.getAFInstance().setResultDescription("SCP_OTHER"); + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins); this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); } protected void timeout(AbstractAF abstractAF, EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) { AppLog.d("RETURN TIMEOUT BY PLATFORM"); - this.type = Constant.TYPE_TIMEOUT; - this._resultCode = "null"; + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){ + this.type = Constant.TYPE_TIMEOUT; + }else{ + this.type = Constant.TYPE_ERROR; + } + this._resultCode = "329"; LogError ins = new LogError("4", "Timeout"); this._resultDescription = "Timeout"; + ec02Instance.getAFInstance().setResultCode("329"); + ec02Instance.getAFInstance().setResultDescription("SCP_TIMEOUT"); + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins); this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); + } private void detailLogInput(EC02Instance ec02Instance,String invoke, String eventType, String messageType, Object ins) @@ -481,9 +525,10 @@ public class WaitSubState implements IAFSubState { input.setType(TYPE.RES); } } + if(this.type!=Constant.TYPE_SUCCESS){ input.setJsonData(MessageParser.toJsonObject(ins)); + } input.setRawData(Global.getDetailLogRawData(rawData)); - if(responseTime != null) { input.setRespTime(Long.parseLong(responseTime)); } @@ -496,15 +541,54 @@ public class WaitSubState implements IAFSubState { } } - private void buildResponeMsg(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, Object ins, GlobalData e01) - { - this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins); - // set error code - ec02Instance.getAFInstance().setResultCode(this._resultCode); - ec02Instance.getAFInstance().setResultDescription(this._resultDescription); -// String subState = StateConfig.getSubStateFromEventType(eventType); -// LogError insError = (LogError)ins; - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + public void buildResponeMsg(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, Object ins, GlobalData e01) + { + AppLog.d("########buildResponeMsg########"); + AppLog.d("########flow########:"+flow); + flow = ec02Instance.getAFInstance().getFlow(); + switch (flow) { + + case Constant.FLOW_CHARGE_REQUEST: + { + ChargeResponseIns chargeResponseIns = new ChargeResponseIns(); + switch (this.type) { + case Constant.TYPE_ERROR: + case Constant.TYPE_REJECT: + case Constant.TYPE_ABORT: + case Constant.TYPE_TIMEOUT: + { + chargeResponseIns.setResult(this._resultCode); + chargeResponseIns.setPrepaidsubscriberflag("1"); + chargeResponseIns.setChargingID(ec02Instance.getAFInstance().getChargeId()); + this._resultCode = null; + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + break; + } + } + break; + } + case Constant.FLOW_CHARGE_REPORT: + ChargeReportIns chargeReportIns = new ChargeReportIns(); + switch (this.type) { + case Constant.TYPE_ERROR: + case Constant.TYPE_REJECT: + case Constant.TYPE_ABORT: + case Constant.TYPE_TIMEOUT: + { + chargeReportIns.setResult(this._resultCode); + chargeReportIns.setPrepaidsubscriberflag("1"); + this._resultCode = null; + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns); + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); + break; + } + } + } } private void summaryLog(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) @@ -526,7 +610,7 @@ public class WaitSubState implements IAFSubState { } String node = Global.getNodeFromEventType(this._eventType); if (Log.debug) { - AppLog.d("## SUMMARY:" + this.type + node + command + this._resultCode + this._resultDescription); + //AppLog.d("## SUMMARY:" + this.type + node + command + this._resultCode + this._resultDescription); } if(this._resultDescription.equals(EQXMsg.EMPTY)) { diff --git a/src/th/co/ais/ssbsrfc/substate/ssss.java b/src/th/co/ais/ssbsrfc/substate/ssss.java deleted file mode 100644 index a897df0..0000000 --- a/src/th/co/ais/ssbsrfc/substate/ssss.java +++ /dev/null @@ -1,5 +0,0 @@ -package th.co.ais.ssbsrfc.substate; - -public class ssss { - -} diff --git a/src/th/co/ais/ssbsrfc/utils/Global.java b/src/th/co/ais/ssbsrfc/utils/Global.java index 1106d36..2eb96fd 100644 --- a/src/th/co/ais/ssbsrfc/utils/Global.java +++ b/src/th/co/ais/ssbsrfc/utils/Global.java @@ -35,8 +35,8 @@ public class Global private static String outputTimeStamp = null; public static String inputTimeStamp = null; - public static String detailNameLog = null; - public static String summaryNameLog = null; + public static String detailNameLog = "DETAIL"; + public static String summaryNameLog = "SUMMARY"; public static boolean isUDR = false; public static boolean isDetail = true; public static boolean isDetailRawData = true; @@ -45,7 +45,7 @@ public class Global public static boolean isDetailScenario = true; public static boolean isDetailCurrentState = true; public static boolean isDetailNextState = true; - public static boolean isSummary = false; + public static boolean isSummary = true; public static boolean isStat = true; public static boolean isErrorLog = false; public static int detailLog = 0; @@ -81,7 +81,10 @@ public class Global public static void setNode() { - mapNode.put(StateConfig.Incoming_A_Request, Constant.nodeE01); + mapNode.put(StateConfig.Incoming_ChargeRequest_Request, Constant.nodeOCSNew); + mapNode.put(StateConfig.Incoming_ChargeReport_Request, Constant.nodeOCSNew); + mapNode.put(StateConfig.Incoming_Adjustment_ChargeReport_Response, Constant.nodeOCSOld); + mapNode.put(StateConfig.Incoming_Adjustment_ChargeRequest_Response, Constant.nodeOCSOld); } public static String getFlowName(int flow) { @@ -94,7 +97,8 @@ public class Global public static void setFlow() { //flow #1 - mapFlow.put(Constant.FLOW_TEST_A, "TEST A"); + mapFlow.put(Constant.FLOW_CHARGE_REQUEST, "CHARGE_REQUEST"); + mapFlow.put(Constant.FLOW_CHARGE_REPORT, "CHARGE_REPORT"); } public static void setOpenRawData(boolean isOpenRawData) { diff --git a/src/th/co/ais/ssbsrfc/utils/Log.java b/src/th/co/ais/ssbsrfc/utils/Log.java index 73bcd80..e43ac09 100644 --- a/src/th/co/ais/ssbsrfc/utils/Log.java +++ b/src/th/co/ais/ssbsrfc/utils/Log.java @@ -4,6 +4,12 @@ import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import ais.mmt.sand.comlog.DetailsLogPrototype; +import ais.mmt.sand.comlog.SummaryLogPrototype; +import ais.mmt.sand.comlog.exception.CommonLogException; +import ec02.af.abstracts.AbstractAF; +import ec02.af.data.EquinoxRawData; +import ec02.utils.AppLog; import th.co.ais.ssbsrfc.config.Constant; import th.co.ais.ssbsrfc.config.Invoke; import th.co.ais.ssbsrfc.config.State; @@ -11,17 +17,10 @@ import th.co.ais.ssbsrfc.config.StateConfig; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.Stat; import th.co.ais.ssbsrfc.interfaces.EQXMsg; -import th.co.ais.ssbsrfc.message.MessageParser; -import ais.mmt.sand.comlog.DetailsLogPrototype; -import ais.mmt.sand.comlog.SummaryLogPrototype; -import ais.mmt.sand.comlog.exception.CommonLogException; -import ec02.af.abstracts.AbstractAF; -import ec02.af.data.EquinoxRawData; -import ec02.utils.AppLog; public class Log { - public static boolean debug = false; + public static boolean debug = true; public static void results(EC02Instance ec02Instance, String currentSubState, List equinoxRawDataList, int type, boolean isStat) { int idx = StateConfig.getSubStateIndex(currentSubState); @@ -103,7 +102,7 @@ public class Log { } catch (Exception e) { if (Log.debug) { - AppLog.d("## ERROR STAT:" + e.getMessage()); + //AppLog.d("## ERROR STAT:" + e.getMessage()); } } @@ -136,11 +135,11 @@ public class Log { AppLog.d("## CST_(" + flow + ":LISTSTAT): " + name); } } else { - name = nameLog; + /*name = nameLog; abstractAF.getUtils().incrementStats(name); if (Log.debug) { AppLog.d("## CST_(" + flow + ":LISTSTAT): " + name); - } + }*/ } } } @@ -154,7 +153,6 @@ public class Log { public static void summaryLog(EC02Instance ec02Instance, AbstractAF abstractAF) { - Log.dev("" + Global.isWriteSummary); if (Global.isSummary && (ec02Instance.getAFInstance().getCurrentState().equals(StateConfig.SSTATE_END) || Global.isWriteSummary)) { int flow = ec02Instance.getAFInstance().getFlow(); @@ -162,7 +160,7 @@ public class Log { String session = abstractAF.getEquinoxProperties().getSession(); String commandName = EQXMsg.EMPTY; String initialInvoke = ec02Instance.getAFInstance().getInitialInvoke(); - String identity = Log.getIdentity(ec02Instance, abstractAF); + String identity = ec02Instance.getAFInstance().getMs(); String resultCode = ec02Instance.getAFInstance().getResultCode(); String resultDescription = ec02Instance.getAFInstance().getResultDescription(); long responseTimestamp = System.currentTimeMillis(); @@ -204,7 +202,7 @@ public class Log { String identity = ""; int flow = ec02Instance.getAFInstance().getFlow(); switch (flow) { - case Constant.FLOW_TEST_A: + case Constant.FLOW_INGW_CMF: break; } @@ -286,8 +284,8 @@ public class Log { Log.dev(" arrOutput count:" + arrOutput.size()); } - String identity = session; - switch (flow) { + String identity = ec02Instance.getAFInstance().getMs(); + /*switch (flow) { case Constant.FLOW_TEST_A: identity = "MIS"; if(session.matches("66\\d{9}")) { @@ -297,7 +295,7 @@ public class Log { default: identity = session; break; - } + }*/ String message = ""; DetailsLogPrototype detLog = ec02Instance.getAFInstance().getDetaillog(); @@ -307,7 +305,6 @@ public class Log { detLog.setInputTimestamp(lInputTimeStamp); detLog.addScenario(scenario, initialInvoke, currentState + "." + ec02Instance.getAFInstance().getPreviousState(), nextState + "." + ec02Instance.getAFInstance().getCurrentState()); detLog.setOutputTimestamp(lOutputTimeStamp); - detLog.setEnableData(Global.isDetailData); detLog.setEnableRawData(Global.isDetailRawData); detLog.setEnableScenario(Global.isDetailScenario); @@ -335,7 +332,7 @@ public class Log { public static void dev(String message) { if (debug) { - AppLog.d("#dev# :" + message); + //AppLog.d("#dev# :" + message); } } } -- libgit2 0.21.2