Commit 6fdc2901d0325b6983b46e0a79a24a29024d0cfd

Authored by Suraputt Suntimitr
1 parent 6b44ac9f
Exists in INGW_CMF

INGW-CMF

src/th/co/ais/ssbsrfc/config/Constant.java
@@ -62,8 +62,11 @@ public class Constant { @@ -62,8 +62,11 @@ public class Constant {
62 public static final String ERROR = "Error"; 62 public static final String ERROR = "Error";
63 63
64 public static final String ENCRYPTKEY = "82BDZsTKxvTJb9Bm"; 64 public static final String ENCRYPTKEY = "82BDZsTKxvTJb9Bm";
65 -  
66 - public static final int FLOW_TEST_A = 1; 65 +
  66 + public static final int FLOW_TEST_A = 0;
  67 + public static final int FLOW_INGW_CMF = 0;
  68 + public static final int FLOW_CHARGE_REPORT = 2;
  69 + public static final int FLOW_CHARGE_REQUEST = 1;
67 public static final int FLOW_Unexpected_Event_Handling = 19; 70 public static final int FLOW_Unexpected_Event_Handling = 19;
68 71
69 public static final int SUBSTATE_TYPE_W_REQUEST = 1; 72 public static final int SUBSTATE_TYPE_W_REQUEST = 1;
@@ -73,6 +76,9 @@ public class Constant { @@ -73,6 +76,9 @@ public class Constant {
73 76
74 public static String nodeLBSRFP = "LBSRFP"; 77 public static String nodeLBSRFP = "LBSRFP";
75 public static String nodeE01 = "E01"; 78 public static String nodeE01 = "E01";
  79 + public static String nodeOCSNew = "OCS-New";
  80 + public static String nodeOCSOld = "OCS-Old";
  81 +
76 public static String nodeES12 = "ES12"; 82 public static String nodeES12 = "ES12";
77 83
78 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*/}; 84 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*/};
src/th/co/ais/ssbsrfc/config/StateConfig.java
@@ -10,7 +10,7 @@ import ec02.utils.AppLog; @@ -10,7 +10,7 @@ import ec02.utils.AppLog;
10 public class StateConfig { 10 public class StateConfig {
11 11
12 //define project name 12 //define project name
13 - public static final String PROJECT_NAME = "LBCF"; 13 + public static final String PROJECT_NAME = "INGW-CMF";
14 public static String PROJECT_STAT_NAME = PROJECT_NAME; 14 public static String PROJECT_STAT_NAME = PROJECT_NAME;
15 public static final boolean isMultiFlow = false; 15 public static final boolean isMultiFlow = false;
16 16
@@ -25,7 +25,6 @@ public class StateConfig { @@ -25,7 +25,6 @@ public class StateConfig {
25 public static final String SSTATE_ABORT = "ABORT"; 25 public static final String SSTATE_ABORT = "ABORT";
26 public static final String SSTATE_BEGIN = "BEGIN"; 26 public static final String SSTATE_BEGIN = "BEGIN";
27 public static final String SSTATE_END = "END"; 27 public static final String SSTATE_END = "END";
28 - public static final String SSTATE_W_A = "W_A";  
29 public static final String SSTATE_W_CHARGEREQUEST = "W_CHARGEREQUEST"; 28 public static final String SSTATE_W_CHARGEREQUEST = "W_CHARGEREQUEST";
30 public static final String SSTATE_W_CHARGEREPORT = "W_CHARGEREPORT"; 29 public static final String SSTATE_W_CHARGEREPORT = "W_CHARGEREPORT";
31 public static final String SSTATE_W_ADJUSTMENT_CHARGEREQUEST = "W_ADJUSTMENTRESPONSE_CHARGEREQUEST"; 30 public static final String SSTATE_W_ADJUSTMENT_CHARGEREQUEST = "W_ADJUSTMENTRESPONSE_CHARGEREQUEST";
@@ -34,7 +33,6 @@ public class StateConfig { @@ -34,7 +33,6 @@ public class StateConfig {
34 public static final String Incoming_Unknown ="Incoming_Unknown"; 33 public static final String Incoming_Unknown ="Incoming_Unknown";
35 public static final String Incoming_REJECT ="Incoming_REJECT"; 34 public static final String Incoming_REJECT ="Incoming_REJECT";
36 public static final String Incoming_ABORT ="Incoming_ABORT"; 35 public static final String Incoming_ABORT ="Incoming_ABORT";
37 - public static final String Incoming_A_Request = "Incoming_A_Request";  
38 public static final String Incoming_ChargeRequest_Request = "Incoming_ChargeRequest_Request"; 36 public static final String Incoming_ChargeRequest_Request = "Incoming_ChargeRequest_Request";
39 public static final String Incoming_ChargeReport_Request = "Incoming_ChargeReport_Request"; 37 public static final String Incoming_ChargeReport_Request = "Incoming_ChargeReport_Request";
40 public static final String Incoming_Adjustment_ChargeRequest_Response = "Incoming_Adjustment_ChargeRequest_Response"; 38 public static final String Incoming_Adjustment_ChargeRequest_Response = "Incoming_Adjustment_ChargeRequest_Response";
@@ -58,10 +56,10 @@ public class StateConfig { @@ -58,10 +56,10 @@ public class StateConfig {
58 new State(SSTATE_ABORT, Incoming_ABORT, LASE_Abort), 56 new State(SSTATE_ABORT, Incoming_ABORT, LASE_Abort),
59 new State(SSTATE_END, Incoming_Unknown, LASE_Unknown), 57 new State(SSTATE_END, Incoming_Unknown, LASE_Unknown),
60 58
61 - new State(SSTATE_W_CHARGEREQUEST, Incoming_ChargeRequest_Request, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),  
62 - new State(SSTATE_W_CHARGEREPORT, Incoming_ChargeReport_Request, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),  
63 - new State(SSTATE_W_ADJUSTMENT_CHARGEREQUEST, Incoming_Adjustment_ChargeRequest_Response, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A),  
64 - new State(SSTATE_W_ADJUSTMENT_CHARGEREPORT, Incoming_Adjustment_ChargeReport_Response, "Test A", "Test A", Constant.TYPE_REQUEST, Constant.FLOW_TEST_A), 59 + new State(SSTATE_W_CHARGEREQUEST, Incoming_ChargeRequest_Request, "chargeRequest", "Adjustment", Constant.TYPE_REQUEST, Constant.FLOW_CHARGE_REQUEST),
  60 + new State(SSTATE_W_CHARGEREPORT, Incoming_ChargeReport_Request, "chargeReport", "Adjustment", Constant.TYPE_REQUEST, Constant.FLOW_CHARGE_REPORT),
  61 + new State(SSTATE_W_ADJUSTMENT_CHARGEREQUEST, Incoming_Adjustment_ChargeRequest_Response, "Adjustment", "chargeRequest", Constant.TYPE_RESPONSE, Constant.FLOW_CHARGE_REQUEST),
  62 + new State(SSTATE_W_ADJUSTMENT_CHARGEREPORT, Incoming_Adjustment_ChargeReport_Response, "Adjustment", "chargeReport", Constant.TYPE_RESPONSE, Constant.FLOW_CHARGE_REPORT),
65 // new State(SSTATE_W_A, Incoming_A_Request, "Test A", "Test A", Constant.TYPE_RESPONSE), 63 // new State(SSTATE_W_A, Incoming_A_Request, "Test A", "Test A", Constant.TYPE_RESPONSE),
66 new State(SSTATE_END, Incoming_Unknown,"Unknown_Command"), 64 new State(SSTATE_END, Incoming_Unknown,"Unknown_Command"),
67 }; 65 };
@@ -135,11 +133,12 @@ public class StateConfig { @@ -135,11 +133,12 @@ public class StateConfig {
135 State state = subStateList[i]; 133 State state = subStateList[i];
136 String ssCommand = state.nameReq; 134 String ssCommand = state.nameReq;
137 String ssEventType = state.eventType; 135 String ssEventType = state.eventType;
138 - 136 + //AppLog.e("############# ssEventType " + ssEventType);
139 // if we found matching relation 137 // if we found matching relation
140 if(eventType.equals(ssEventType)) 138 if(eventType.equals(ssEventType))
141 { 139 {
142 command = ssCommand; 140 command = ssCommand;
  141 + AppLog.d("COMMAND:"+command);
143 break; 142 break;
144 } 143 }
145 } 144 }
src/th/co/ais/ssbsrfc/control/SubStateManager.java
1 package th.co.ais.ssbsrfc.control; 1 package th.co.ais.ssbsrfc.control;
2 2
  3 +import ec02.utils.Log;
3 import th.co.ais.ssbsrfc.config.StateConfig; 4 import th.co.ais.ssbsrfc.config.StateConfig;
4 import th.co.ais.ssbsrfc.interfaces.AbstractAFSubStateManager; 5 import th.co.ais.ssbsrfc.interfaces.AbstractAFSubStateManager;
5 -import th.co.ais.ssbsrfc.substate.SubWaitA;  
6 import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeReportResponse; 6 import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeReportResponse;
7 import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeRequestResponse; 7 import th.co.ais.ssbsrfc.substate.SubWaitAdjustmentChargeRequestResponse;
8 import th.co.ais.ssbsrfc.substate.SubWaitChargeReport; 8 import th.co.ais.ssbsrfc.substate.SubWaitChargeReport;
9 import th.co.ais.ssbsrfc.substate.SubWaitChargeRequest; 9 import th.co.ais.ssbsrfc.substate.SubWaitChargeRequest;
10 -import ec02.utils.Log;  
11 10
12 public class SubStateManager extends AbstractAFSubStateManager { 11 public class SubStateManager extends AbstractAFSubStateManager {
13 12
src/th/co/ais/ssbsrfc/control/TestMain.java
@@ -8,6 +8,9 @@ import java.text.DateFormat; @@ -8,6 +8,9 @@ import java.text.DateFormat;
8 import java.text.SimpleDateFormat; 8 import java.text.SimpleDateFormat;
9 import java.util.Calendar; 9 import java.util.Calendar;
10 import java.util.Date; 10 import java.util.Date;
  11 +import java.util.HashMap;
  12 +import java.util.Map;
  13 +import java.util.Random;
11 import java.util.Scanner; 14 import java.util.Scanner;
12 15
13 import javax.xml.bind.JAXBContext; 16 import javax.xml.bind.JAXBContext;
@@ -19,8 +22,6 @@ import javax.xml.soap.SOAPMessage; @@ -19,8 +22,6 @@ import javax.xml.soap.SOAPMessage;
19 import javax.xml.stream.XMLInputFactory; 22 import javax.xml.stream.XMLInputFactory;
20 import javax.xml.stream.XMLStreamReader; 23 import javax.xml.stream.XMLStreamReader;
21 24
22 -import com.sun.org.apache.xalan.internal.xsltc.compiler.Parser;  
23 -  
24 import th.co.ais.ssbsrfc.instance.AdjustmentRequestRes; 25 import th.co.ais.ssbsrfc.instance.AdjustmentRequestRes;
25 import th.co.ais.ssbsrfc.instance.ResultHeader; 26 import th.co.ais.ssbsrfc.instance.ResultHeader;
26 27
@@ -48,6 +49,23 @@ public class TestMain { @@ -48,6 +49,23 @@ public class TestMain {
48 49
49 public static void main(String[] args) throws Exception { 50 public static void main(String[] args) throws Exception {
50 51
  52 +
  53 + HashMap<String , String> map = new HashMap<String, String>();
  54 +
  55 + map.put("x", "y");
  56 + boolean c = false;
  57 + if(null==map.get("y")){
  58 + c = true;
  59 + }
  60 +
  61 + System.out.println(c);
  62 +
  63 + Random random = new Random();
  64 + String rand = "000";
  65 + int a = random.nextInt(1000);
  66 + rand += a;
  67 + rand = rand.substring(rand.length()-3);
  68 + System.out.println(rand);
51 69
52 Date time = new Date(); 70 Date time = new Date();
53 SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmssSS"); 71 SimpleDateFormat sdf = new SimpleDateFormat("MMddHHmmssSS");
@@ -100,11 +118,11 @@ public class TestMain { @@ -100,11 +118,11 @@ public class TestMain {
100 JAXBElement<ResultHeader> jbe = unmarshaller.unmarshal(xsr, ResultHeader.class); 118 JAXBElement<ResultHeader> jbe = unmarshaller.unmarshal(xsr, ResultHeader.class);
101 119
102 res = jbe.getValue(); 120 res = jbe.getValue();
103 - 121 + String ChargeId = ""+random.nextInt(10000);
104 System.out.println("getVersion:"+res.getVersion()); 122 System.out.println("getVersion:"+res.getVersion());
105 System.out.println("getMsgLanguageCode:"+res.getMsgLanguageCode()); 123 System.out.println("getMsgLanguageCode:"+res.getMsgLanguageCode());
106 124
107 - System.out.println("getAcctKey:"+adj.getAcctKey()); 125 + System.out.println("getAcctKey:"+ChargeId);
108 System.out.println("getBalanceID:"+adj.getAdjustmentInfo().get(0).getBalanceID()); 126 System.out.println("getBalanceID:"+adj.getAdjustmentInfo().get(0).getBalanceID());
109 127
110 //System.out.println("Version:"+customer.getresultHeader().getVersion()); 128 //System.out.println("Version:"+customer.getresultHeader().getVersion());
src/th/co/ais/ssbsrfc/control/mainAF.java
@@ -123,6 +123,7 @@ public class mainAF extends AbstractAF implements IEC02 { @@ -123,6 +123,7 @@ public class mainAF extends AbstractAF implements IEC02 {
123 // 1.1.7. Set raw event type = event type 123 // 1.1.7. Set raw event type = event type
124 r.setRawEventType(eventType); 124 r.setRawEventType(eventType);
125 ec02Instance.getAFInstance().listTimeoutRemove(r.getInvoke()); 125 ec02Instance.getAFInstance().listTimeoutRemove(r.getInvoke());
  126 + ec02Instance.getAFInstance().setEvent(eventType);
126 AppLog.d("[eventType] : " + eventType); 127 AppLog.d("[eventType] : " + eventType);
127 } 128 }
128 } 129 }
src/th/co/ais/ssbsrfc/instance/AFInstance.java
@@ -46,11 +46,39 @@ public class AFInstance { @@ -46,11 +46,39 @@ public class AFInstance {
46 private String acknowledgeTime = null; 46 private String acknowledgeTime = null;
47 private String dialogueId = null; 47 private String dialogueId = null;
48 private Map<String, RetryIns> dicRetry = null; 48 private Map<String, RetryIns> dicRetry = null;
49 - 49 + private String ChargeId = null;
  50 + private String event = null;
50 private AdjustmentRequestIns adjustmentRequestIns = null; 51 private AdjustmentRequestIns adjustmentRequestIns = null;
51 private AdjustmentResponseIns adjustmentResponseIns = null; 52 private AdjustmentResponseIns adjustmentResponseIns = null;
52 private HashMap<String, String> Dn = null; 53 private HashMap<String, String> Dn = null;
  54 + private String rand = null;
  55 + private String ms = null;
  56 +
53 57
  58 + public String getEvent() {
  59 + return event;
  60 + }
  61 + public void setEvent(String event) {
  62 + this.event = event;
  63 + }
  64 + public String getMs() {
  65 + return ms;
  66 + }
  67 + public void setMs(String ms) {
  68 + this.ms = ms;
  69 + }
  70 + public String getRand() {
  71 + return rand;
  72 + }
  73 + public void setRand(String rand) {
  74 + this.rand = rand;
  75 + }
  76 + public String getChargeId() {
  77 + return ChargeId;
  78 + }
  79 + public void setChargeId(String chargeId) {
  80 + ChargeId = chargeId;
  81 + }
54 public HashMap<String, String> getDn() { 82 public HashMap<String, String> getDn() {
55 return Dn; 83 return Dn;
56 } 84 }
src/th/co/ais/ssbsrfc/instance/ChargeReportIns.java
@@ -8,8 +8,9 @@ import javax.xml.bind.annotation.XmlRootElement; @@ -8,8 +8,9 @@ import javax.xml.bind.annotation.XmlRootElement;
8 @XmlRootElement(name = "vcrr") 8 @XmlRootElement(name = "vcrr")
9 @XmlAccessorType(XmlAccessType.FIELD) 9 @XmlAccessorType(XmlAccessType.FIELD)
10 public class ChargeReportIns { 10 public class ChargeReportIns {
11 - 11 + @XmlElement(name = "res")
12 private String Result; 12 private String Result;
  13 + @XmlElement(name = "ppf")
13 private String Prepaidsubscriberflag; 14 private String Prepaidsubscriberflag;
14 15
15 public String getResult() { 16 public String getResult() {
src/th/co/ais/ssbsrfc/instance/ChargeResponseIns.java
@@ -10,64 +10,37 @@ import javax.xml.bind.annotation.XmlRootElement; @@ -10,64 +10,37 @@ import javax.xml.bind.annotation.XmlRootElement;
10 public class ChargeResponseIns { 10 public class ChargeResponseIns {
11 11
12 @XmlElement(name = "res") 12 @XmlElement(name = "res")
13 - private Element Result; 13 + private String Result;
14 @XmlElement(name = "desc") 14 @XmlElement(name = "desc")
15 - private Element desc; 15 + private String desc;
16 @XmlElement(name = "id") 16 @XmlElement(name = "id")
17 - private Element ChargingID; 17 + private String ChargingID;
18 @XmlElement(name = "ppf") 18 @XmlElement(name = "ppf")
19 - private Element Prepaidsubscriberflag;  
20 - 19 + private String Prepaidsubscriberflag;
  20 +
21 public String getResult() { 21 public String getResult() {
22 - return getElementValue(this.Result);  
23 - }  
24 -  
25 - public void setResult(String Result) {  
26 - this.Result = setElementValue(this.Result, Result);  
27 - }  
28 -  
29 - public String getdesc() {  
30 - return getElementValue(this.desc);  
31 - }  
32 -  
33 - public void setdesc(String desc) {  
34 - this.desc = setElementValue(this.desc, desc);  
35 - }  
36 - 22 + return Result;
  23 + }
  24 + public void setResult(String result) {
  25 + Result = result;
  26 + }
  27 + public String getDesc() {
  28 + return desc;
  29 + }
  30 + public void setDesc(String desc) {
  31 + this.desc = desc;
  32 + }
37 public String getChargingID() { 33 public String getChargingID() {
38 - return getElementValue(this.ChargingID);  
39 - }  
40 -  
41 - public void setChargingID(String ChargingID) {  
42 - this.ChargingID = setElementValue(this.ChargingID, ChargingID);  
43 - }  
44 - 34 + return ChargingID;
  35 + }
  36 + public void setChargingID(String chargingID) {
  37 + ChargingID = chargingID;
  38 + }
45 public String getPrepaidsubscriberflag() { 39 public String getPrepaidsubscriberflag() {
46 - return getElementValue(this.Prepaidsubscriberflag);  
47 - }  
48 -  
49 - public void setPrepaidsubscriberflag(String Prepaidsubscriberflag) {  
50 - this.Prepaidsubscriberflag = setElementValue(this.Prepaidsubscriberflag, Prepaidsubscriberflag);  
51 - }  
52 -  
53 - public static String getElementValue(Element element) {  
54 - if(element == null) {  
55 - return null;  
56 - } else {  
57 - return element.getValue();  
58 - }  
59 - }  
60 -  
61 - public static Element setElementValue(Element element, String value) {  
62 - if(value != null) {  
63 - if(element == null) {  
64 - element = new Element();  
65 - }  
66 - element.setValue(value);  
67 - } else {  
68 - return null;  
69 - }  
70 - return element;  
71 - } 40 + return Prepaidsubscriberflag;
  41 + }
  42 + public void setPrepaidsubscriberflag(String prepaidsubscriberflag) {
  43 + Prepaidsubscriberflag = prepaidsubscriberflag;
  44 + }
72 45
73 } 46 }
src/th/co/ais/ssbsrfc/message/EC02Builder.java
@@ -283,6 +283,7 @@ public class EC02Builder { @@ -283,6 +283,7 @@ public class EC02Builder {
283 // Log Detail Output 283 // Log Detail Output
284 if (data != null) { 284 if (data != null) {
285 String currentState = ""; 285 String currentState = "";
  286 + currentState = this.ec02Ins.getAFInstance().getCurrentState();
286 String cmd = (command == null ) ? StateConfig.getCommandFromState(currentState) : command; 287 String cmd = (command == null ) ? StateConfig.getCommandFromState(currentState) : command;
287 if (nodeTo == null && currentState != null) { 288 if (nodeTo == null && currentState != null) {
288 String eventType = StateConfig.getEventTypeFromSubState(currentState); 289 String eventType = StateConfig.getEventTypeFromSubState(currentState);
src/th/co/ais/ssbsrfc/substate/SubMessages.java
@@ -2,11 +2,13 @@ package th.co.ais.ssbsrfc.substate; @@ -2,11 +2,13 @@ package th.co.ais.ssbsrfc.substate;
2 2
3 import ec02.af.abstracts.AbstractAF; 3 import ec02.af.abstracts.AbstractAF;
4 import ec02.utils.AppLog; 4 import ec02.utils.AppLog;
  5 +import th.co.ais.ssbsrfc.config.Constant;
5 import th.co.ais.ssbsrfc.config.Invoke; 6 import th.co.ais.ssbsrfc.config.Invoke;
6 import th.co.ais.ssbsrfc.config.StateConfig; 7 import th.co.ais.ssbsrfc.config.StateConfig;
7 import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns; 8 import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns;
8 import th.co.ais.ssbsrfc.instance.EC02Instance; 9 import th.co.ais.ssbsrfc.instance.EC02Instance;
9 import th.co.ais.ssbsrfc.instance.EQXRawInstance; 10 import th.co.ais.ssbsrfc.instance.EQXRawInstance;
  11 +import th.co.ais.ssbsrfc.instance.ManageTime;
10 import th.co.ais.ssbsrfc.interfaces.EQXMsg; 12 import th.co.ais.ssbsrfc.interfaces.EQXMsg;
11 import th.co.ais.ssbsrfc.message.MessageParser; 13 import th.co.ais.ssbsrfc.message.MessageParser;
12 import th.co.ais.ssbsrfc.utils.Global; 14 import th.co.ais.ssbsrfc.utils.Global;
@@ -17,46 +19,69 @@ public class SubMessages { @@ -17,46 +19,69 @@ public class SubMessages {
17 19
18 public static EQXRawInstance getRawAdjustmentRequest(AbstractAF abstractAF, EC02Instance ec02Instancee, String eventType,AdjustmentRequestIns ajr) 20 public static EQXRawInstance getRawAdjustmentRequest(AbstractAF abstractAF, EC02Instance ec02Instancee, String eventType,AdjustmentRequestIns ajr)
19 { 21 {
20 - 22 +
  23 + String command = "Adjustment";
21 AdjustmentRequestIns ins = ajr; 24 AdjustmentRequestIns ins = ajr;
22 String message = MessageParser.toSoap(ins); 25 String message = MessageParser.toSoap(ins);
23 EQXRawInstance eqxRaw = new EQXRawInstance(); 26 EQXRawInstance eqxRaw = new EQXRawInstance();
24 - String command = "OSDOld";  
25 - String to = Global.getEC02WarmConfig("Resource-Name-OCSOld");  
26 - String session = "SESSION";  
27 - Invoke iv = new Invoke("OSDOld",session,command,eventType,null);  
28 - String invoke = iv.toString(); 27 + String to = Global.getEC02WarmConfig("Resource-Name-OCS-Old");
  28 + AppLog.d("Resource-Name-OCS-Old :"+to);
  29 + String session = "SESSION";
  30 + Invoke iv = new Invoke("OCS-Old",session,command,eventType,null);
  31 + String invoke = iv.toString();
  32 + eqxRaw.setNodeTo(Constant.nodeOCSOld);
29 eqxRaw.setMessage(message); 33 eqxRaw.setMessage(message);
30 eqxRaw.setTo(to); 34 eqxRaw.setTo(to);
  35 + eqxRaw.setDataOutput(message);
  36 + AppLog.d("Adjustment-Request-timeout :"+Global.getEC02WarmConfig("Adjustment-Request-timeout"));
31 eqxRaw.setInvoke(invoke); 37 eqxRaw.setInvoke(invoke);
32 eqxRaw.setCtype(EQXMsg.TEXTXML); 38 eqxRaw.setCtype(EQXMsg.TEXTXML);
33 - eqxRaw.setUrl(Global.getEC02WarmConfig("Http-OCSOld-URL")); 39 + eqxRaw.setCommand(command);
  40 + String timeout = new ManageTime(ec02Instancee).getTimeout(invoke, StateConfig.getTimeout(abstractAF, StateConfig.Incoming_Adjustment_ChargeRequest_Response));
  41 + eqxRaw.setTimeout(timeout);
  42 +
  43 + eqxRaw.setUrl(Global.getEC02WarmConfig("Http-OCS-Old-URL"));
  44 + AppLog.d("Http-OCS-Old-URL :"+eqxRaw.getUrl());
34 return eqxRaw; 45 return eqxRaw;
35 } 46 }
36 47
37 - public static EQXRawInstance getRawAResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag)  
38 - {  
39 - String message = "Hello";  
40 - String command = "A";  
41 -  
42 - EQXRawInstance eqxRaw = new EQXRawInstance();  
43 - eqxRaw.setMessage(message);  
44 - eqxRaw.setTo(to);  
45 - eqxRaw.setInvoke(invoke);  
46 - eqxRaw.setCtype(EQXMsg.TEXTPLAIN);  
47 - eqxRaw.setCommand(command);  
48 -  
49 - return eqxRaw;  
50 - } 48 + public static EQXRawInstance getRawAdjustmentReport(AbstractAF abstractAF, EC02Instance ec02Instancee, String eventType,AdjustmentRequestIns ajr)
  49 + {
  50 +
  51 + String command = "Adjustment";
  52 + AdjustmentRequestIns ins = ajr;
  53 + String message = MessageParser.toSoap(ins);
  54 + EQXRawInstance eqxRaw = new EQXRawInstance();
  55 + String to = Global.getEC02WarmConfig("Resource-Name-OCS-Old");
  56 + AppLog.d("Resource-Name-OCS-Old :"+Global.getEC02WarmConfig("Resource-Name-OCS-Old"));
  57 + String session = "SESSION";
  58 + Invoke iv = new Invoke("OCS-Old",session,command,eventType,null);
  59 + String invoke = iv.toString();
  60 + AppLog.d("Adjustment-Request-timeout :"+Global.getEC02WarmConfig("Adjustment-Request-timeout"));
  61 + String timeout = new ManageTime(ec02Instancee).getTimeout(invoke, StateConfig.getTimeout(abstractAF, StateConfig.Incoming_Adjustment_ChargeReport_Response));
  62 + eqxRaw.setNodeTo(Constant.nodeOCSOld);
  63 + eqxRaw.setMessage(message);
  64 + eqxRaw.setTo(to);
  65 + eqxRaw.setDataOutput(message);
  66 + eqxRaw.setInvoke(invoke);
  67 + eqxRaw.setCtype(EQXMsg.TEXTXML);
  68 + eqxRaw.setCommand(command);
  69 + eqxRaw.setTimeout(timeout);
  70 + eqxRaw.setUrl(Global.getEC02WarmConfig("Http-OCS-Old-URL"));
  71 + AppLog.d("Http-OCS-Old-URL :"+Global.getEC02WarmConfig("Http-OCS-Old-URL"));
  72 + return eqxRaw;
  73 + }
51 74
52 public static EQXRawInstance getRawChargeRequestResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag) 75 public static EQXRawInstance getRawChargeRequestResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag)
53 { 76 {
54 String message = mag; 77 String message = mag;
55 - String command = "A"; 78 + String command = "chargeRequest";
56 79
57 EQXRawInstance eqxRaw = new EQXRawInstance(); 80 EQXRawInstance eqxRaw = new EQXRawInstance();
58 eqxRaw.setMessage(message); 81 eqxRaw.setMessage(message);
  82 + eqxRaw.setNodeTo(Constant.nodeOCSNew);
59 eqxRaw.setTo(to); 83 eqxRaw.setTo(to);
  84 + eqxRaw.setDataOutput(message);
60 eqxRaw.setInvoke(invoke); 85 eqxRaw.setInvoke(invoke);
61 eqxRaw.setCtype(EQXMsg.TEXTXML); 86 eqxRaw.setCtype(EQXMsg.TEXTXML);
62 eqxRaw.setCommand(command); 87 eqxRaw.setCommand(command);
@@ -68,17 +93,17 @@ public class SubMessages { @@ -68,17 +93,17 @@ public class SubMessages {
68 public static EQXRawInstance getRawChargeReportResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag) 93 public static EQXRawInstance getRawChargeReportResponse(AbstractAF abstractAF, EC02Instance ec02Instancee, String to, String invoke,String mag)
69 { 94 {
70 String message = mag; 95 String message = mag;
71 - String command = "A"; 96 + String command = "chargeReport";
72 97
73 EQXRawInstance eqxRaw = new EQXRawInstance(); 98 EQXRawInstance eqxRaw = new EQXRawInstance();
74 eqxRaw.setMessage(message); 99 eqxRaw.setMessage(message);
  100 + eqxRaw.setNodeTo(Constant.nodeOCSNew);
75 eqxRaw.setTo(to); 101 eqxRaw.setTo(to);
  102 + eqxRaw.setDataOutput(message);
76 eqxRaw.setInvoke(invoke); 103 eqxRaw.setInvoke(invoke);
77 eqxRaw.setCtype(EQXMsg.TEXTXML); 104 eqxRaw.setCtype(EQXMsg.TEXTXML);
78 eqxRaw.setCommand(command); 105 eqxRaw.setCommand(command);
79 106
80 return eqxRaw; 107 return eqxRaw;
81 } 108 }
82 -  
83 -  
84 } 109 }
src/th/co/ais/ssbsrfc/substate/SubWaitA.java
@@ -1,54 +0,0 @@ @@ -1,54 +0,0 @@
1 -package th.co.ais.ssbsrfc.substate;  
2 -  
3 -import th.co.ais.ssbsrfc.config.Constant;  
4 -import th.co.ais.ssbsrfc.config.StateConfig;  
5 -import th.co.ais.ssbsrfc.instance.EC02Instance;  
6 -import th.co.ais.ssbsrfc.instance.EQXRawInstance;  
7 -import th.co.ais.ssbsrfc.utils.EqxStringUtils;  
8 -import ec02.af.abstracts.AbstractAF;  
9 -import ec02.af.data.EquinoxRawData;  
10 -import ec02.utils.AppLog;  
11 -  
12 -  
13 -public class SubWaitA extends WaitSubState {  
14 - public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
15 - {  
16 - this._state = StateConfig.SSTATE_W_A;  
17 - this._eventType = StateConfig.Incoming_A_Request;  
18 - this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST;  
19 - if (equinoxRawData != null) {  
20 - ec02Instance.getAFInstance().setOrig(equinoxRawData.getOrig());  
21 - ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke());  
22 - ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());  
23 - }  
24 - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A);  
25 - }  
26 -  
27 - public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
28 - {  
29 - String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);  
30 - AppLog.d("## PARAMETERS : " + value);  
31 - return value;  
32 - }  
33 -  
34 - public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
35 - {  
36 - AppLog.d("## TEST MSG SUBSTATE A");  
37 - this.type = Constant.TYPE_SUCCESS;  
38 - }  
39 - public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
40 - {  
41 - switch (this.type) {  
42 - case Constant.TYPE_SUCCESS:  
43 - default:  
44 - {  
45 -// this.isStat = false;  
46 -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));  
47 -  
48 - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);  
49 - EQXRawInstance eqxRaw = SubMessages.getRawAResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),"xx");  
50 - this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));  
51 - }  
52 - }  
53 - }  
54 -}  
src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeReportResponse.java
@@ -14,8 +14,10 @@ import th.co.ais.ssbsrfc.instance.ChargeReportIns; @@ -14,8 +14,10 @@ import th.co.ais.ssbsrfc.instance.ChargeReportIns;
14 import th.co.ais.ssbsrfc.instance.EC02Instance; 14 import th.co.ais.ssbsrfc.instance.EC02Instance;
15 import th.co.ais.ssbsrfc.instance.EQXRawInstance; 15 import th.co.ais.ssbsrfc.instance.EQXRawInstance;
16 import th.co.ais.ssbsrfc.instance.ResultHeader; 16 import th.co.ais.ssbsrfc.instance.ResultHeader;
  17 +import th.co.ais.ssbsrfc.instance.Stat;
17 import th.co.ais.ssbsrfc.message.MessageParser; 18 import th.co.ais.ssbsrfc.message.MessageParser;
18 import th.co.ais.ssbsrfc.utils.EqxStringUtils; 19 import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  20 +import th.co.ais.ssbsrfc.utils.Global;
19 21
20 22
21 public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { 23 public class SubWaitAdjustmentChargeReportResponse extends WaitSubState {
@@ -30,7 +32,6 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { @@ -30,7 +32,6 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState {
30 this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT; 32 this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT;
31 this._eventType = StateConfig.Incoming_Adjustment_ChargeReport_Response; 33 this._eventType = StateConfig.Incoming_Adjustment_ChargeReport_Response;
32 this._stateType = Constant.SUBSTATE_TYPE_W_RESPONSE; 34 this._stateType = Constant.SUBSTATE_TYPE_W_RESPONSE;
33 - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A);  
34 } 35 }
35 36
36 public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) 37 public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
@@ -52,8 +53,8 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { @@ -52,8 +53,8 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState {
52 adjustresponse.setResultHeader(res); 53 adjustresponse.setResultHeader(res);
53 adjustresponse.setAdjustmentResult(adj); 54 adjustresponse.setAdjustmentResult(adj);
54 ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse); 55 ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse);
55 -  
56 - chargeReportIns.setResult("000"); 56 + this._resultCode = "0";
  57 + chargeReportIns.setResult(this._resultCode);
57 chargeReportIns.setPrepaidsubscriberflag("1"); 58 chargeReportIns.setPrepaidsubscriberflag("1");
58 59
59 return chargeReportIns; 60 return chargeReportIns;
@@ -61,18 +62,137 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState { @@ -61,18 +62,137 @@ public class SubWaitAdjustmentChargeReportResponse extends WaitSubState {
61 62
62 public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) 63 public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
63 { 64 {
64 -  
65 this.type = Constant.TYPE_SUCCESS; 65 this.type = Constant.TYPE_SUCCESS;
  66 + this._resultDescription = "SUCCESS";
  67 + if(null==res.getVersion()){
  68 + this.type = Constant.TYPE_INVALID;
  69 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  70 + this._resultDescription = "INCOMPLETE_DATA";
  71 + this._resultCode="322";
  72 + }
  73 + if("".equals(res.getVersion())){
  74 + this.type = Constant.TYPE_INVALID;
  75 + this._resultCode="322";
  76 + this._resultDescription = "INCOMPLETE_DATA";
  77 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  78 + AppLog.d("ssid:"+"null");
  79 + }
  80 + if(null==res.getResultCode()){
  81 + this.type = Constant.TYPE_INVALID;
  82 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  83 + this._resultDescription = "INCOMPLETE_DATA";
  84 + this._resultCode="322";
  85 + }
  86 + if("".equals(res.getResultCode())){
  87 + this.type = Constant.TYPE_INVALID;
  88 + this._resultCode="322";
  89 + this._resultDescription = "INCOMPLETE_DATA";
  90 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  91 + AppLog.d("ssid:"+"null");
  92 + }
  93 + if(null==res.getResultDesc()){
  94 + this.type = Constant.TYPE_INVALID;
  95 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  96 + this._resultDescription = "INCOMPLETE_DATA";
  97 + this._resultCode="322";
  98 + }
  99 + if("".equals(res.getResultDesc())){
  100 + this.type = Constant.TYPE_INVALID;
  101 + this._resultCode="322";
  102 + this._resultDescription = "INCOMPLETE_DATA";
  103 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  104 + AppLog.d("ssid:"+"null");
  105 + }
  106 + if(null==adj.getAcctKey()){
  107 + this.type = Constant.TYPE_INVALID;
  108 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  109 + this._resultDescription = "INCOMPLETE_DATA";
  110 + this._resultCode="322";
  111 + }
  112 + if("".equals(adj.getAcctKey())){
  113 + this.type = Constant.TYPE_INVALID;
  114 + this._resultCode="322";
  115 + this._resultDescription = "INCOMPLETE_DATA";
  116 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  117 + AppLog.d("ssid:"+"null");
  118 + }
  119 + if(null==adj.getAdjustmentInfo().get(0).getBalanceType()){
  120 + this.type = Constant.TYPE_INVALID;
  121 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  122 + this._resultDescription = "INCOMPLETE_DATA";
  123 + this._resultCode="322";
  124 + }
  125 + if("".equals(adj.getAdjustmentInfo().get(0).getBalanceType())){
  126 + this.type = Constant.TYPE_INVALID;
  127 + this._resultCode="322";
  128 + this._resultDescription = "INCOMPLETE_DATA";
  129 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  130 + AppLog.d("ssid:"+"null");
  131 + }
  132 + if(null==adj.getAdjustmentInfo().get(0).getOldBalanceAmt()){
  133 + this.type = Constant.TYPE_INVALID;
  134 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  135 + this._resultDescription = "INCOMPLETE_DATA";
  136 + this._resultCode="322";
  137 + }
  138 + if("".equals(adj.getAdjustmentInfo().get(0).getOldBalanceAmt())){
  139 + this.type = Constant.TYPE_INVALID;
  140 + this._resultCode="322";
  141 + this._resultDescription = "INCOMPLETE_DATA";
  142 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  143 + AppLog.d("ssid:"+"null");
  144 + }
  145 + if(null==adj.getAdjustmentInfo().get(0).getNewBalanceAmt()){
  146 + this.type = Constant.TYPE_INVALID;
  147 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  148 + this._resultDescription = "INCOMPLETE_DATA";
  149 + this._resultCode="322";
  150 + }
  151 + if("".equals(adj.getAdjustmentInfo().get(0).getNewBalanceAmt())){
  152 + this.type = Constant.TYPE_INVALID;
  153 + this._resultCode="322";
  154 + this._resultDescription = "INCOMPLETE_DATA";
  155 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  156 + AppLog.d("ssid:"+"null");
  157 + }
  158 + if(null==adj.getAdjustmentInfo().get(0).getCurrencyID()){
  159 + this.type = Constant.TYPE_INVALID;
  160 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  161 + this._resultDescription = "INCOMPLETE_DATA";
  162 + this._resultCode="322";
  163 + }
  164 + if("".equals(adj.getAdjustmentInfo().get(0).getCurrencyID())){
  165 + this.type = Constant.TYPE_INVALID;
  166 + this._resultCode="322";
  167 + this._resultDescription = "INCOMPLETE_DATA";
  168 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  169 + AppLog.d("ssid:"+"null");
  170 + }
66 } 171 }
67 172
68 public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) 173 public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
69 { 174 {
70 switch (this.type) { 175 switch (this.type) {
71 - case Constant.TYPE_SUCCESS:  
72 - default: 176 + case Constant.TYPE_INVALID:
  177 + {
  178 + chargeReportIns.setResult(this._resultCode);
  179 + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT"));
  180 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns);
  181 + EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
  182 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  183 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  184 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  185 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  186 + break;
  187 + }
  188 + case Constant.TYPE_SUCCESS:
  189 + default:
73 { 190 {
  191 + chargeReportIns.setResult(this._resultCode);
  192 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  193 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
74 // this.isStat = false; 194 // this.isStat = false;
75 -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); 195 + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT"));
76 String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns); 196 String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns);
77 ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); 197 ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
78 EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); 198 EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
src/th/co/ais/ssbsrfc/substate/SubWaitAdjustmentChargeRequestResponse.java
@@ -17,8 +17,10 @@ import th.co.ais.ssbsrfc.instance.ChargeResponseIns; @@ -17,8 +17,10 @@ import th.co.ais.ssbsrfc.instance.ChargeResponseIns;
17 import th.co.ais.ssbsrfc.instance.EC02Instance; 17 import th.co.ais.ssbsrfc.instance.EC02Instance;
18 import th.co.ais.ssbsrfc.instance.EQXRawInstance; 18 import th.co.ais.ssbsrfc.instance.EQXRawInstance;
19 import th.co.ais.ssbsrfc.instance.ResultHeader; 19 import th.co.ais.ssbsrfc.instance.ResultHeader;
  20 +import th.co.ais.ssbsrfc.instance.Stat;
20 import th.co.ais.ssbsrfc.message.MessageParser; 21 import th.co.ais.ssbsrfc.message.MessageParser;
21 import th.co.ais.ssbsrfc.utils.EqxStringUtils; 22 import th.co.ais.ssbsrfc.utils.EqxStringUtils;
  23 +import th.co.ais.ssbsrfc.utils.Global;
22 24
23 25
24 public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { 26 public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState {
@@ -54,15 +56,10 @@ public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { @@ -54,15 +56,10 @@ public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState {
54 adjustresponse.setResultHeader(res); 56 adjustresponse.setResultHeader(res);
55 adjustresponse.setAdjustmentResult(adj); 57 adjustresponse.setAdjustmentResult(adj);
56 ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse); 58 ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse);
57 -  
58 - Random random = new Random();  
59 - Date time = new Date();  
60 - String x = time.getTime()+"";  
61 - int y = 900000000+random.nextInt(1000);  
62 - String MSGID =x+""+y;  
63 - chargeResponseIns.setResult("000");  
64 - chargeResponseIns.setdesc("SUCCESS");  
65 - chargeResponseIns.setChargingID(MSGID); 59 + AppLog.d("Random : "+ec02Instance.getAFInstance().getRand());
  60 + this._resultCode="0";
  61 + chargeResponseIns.setResult(this._resultCode);
  62 + chargeResponseIns.setChargingID(ec02Instance.getAFInstance().getChargeId());
66 chargeResponseIns.setPrepaidsubscriberflag("1"); 63 chargeResponseIns.setPrepaidsubscriberflag("1");
67 64
68 return chargeResponseIns; 65 return chargeResponseIns;
@@ -72,18 +69,138 @@ public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { @@ -72,18 +69,138 @@ public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState {
72 { 69 {
73 70
74 this.type = Constant.TYPE_SUCCESS; 71 this.type = Constant.TYPE_SUCCESS;
  72 + this._resultDescription = "SUCCESS";
  73 + if(null==res.getVersion()){
  74 + this.type = Constant.TYPE_INVALID;
  75 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  76 + this._resultCode="322";
  77 + this._resultDescription = "INCOMPLETE_DATA";
  78 + }
  79 + if("".equals(res.getVersion())){
  80 + this.type = Constant.TYPE_INVALID;
  81 + this._resultCode="322";
  82 + this._resultDescription = "INCOMPLETE_DATA";
  83 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  84 + AppLog.d("ssid:"+"null");
  85 + }
  86 + if(null==res.getResultCode()){
  87 + this.type = Constant.TYPE_INVALID;
  88 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  89 + this._resultCode="322";
  90 + this._resultDescription = "INCOMPLETE_DATA";
  91 + }
  92 + if("".equals(res.getResultCode())){
  93 + this.type = Constant.TYPE_INVALID;
  94 + this._resultCode="322";
  95 + this._resultDescription = "INCOMPLETE_DATA";
  96 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  97 + AppLog.d("ssid:"+"null");
  98 + }
  99 + if(null==res.getResultDesc()){
  100 + this.type = Constant.TYPE_INVALID;
  101 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  102 + this._resultCode="322";
  103 + this._resultDescription = "INCOMPLETE_DATA";
  104 + }
  105 + if("".equals(res.getResultDesc())){
  106 + this.type = Constant.TYPE_INVALID;
  107 + this._resultCode="322";
  108 + this._resultDescription = "INCOMPLETE_DATA";
  109 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  110 + AppLog.d("ssid:"+"null");
  111 + }
  112 + if(null==adj.getAcctKey()){
  113 + this.type = Constant.TYPE_INVALID;
  114 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  115 + this._resultCode="322";
  116 + this._resultDescription = "INCOMPLETE_DATA";
  117 + }
  118 + if("".equals(adj.getAcctKey())){
  119 + this.type = Constant.TYPE_INVALID;
  120 + this._resultCode="322";
  121 + this._resultDescription = "INCOMPLETE_DATA";
  122 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  123 + AppLog.d("ssid:"+"null");
  124 + }
  125 + if(null==adj.getAdjustmentInfo().get(0).getBalanceType()){
  126 + this.type = Constant.TYPE_INVALID;
  127 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  128 + this._resultCode="322";
  129 + this._resultDescription = "INCOMPLETE_DATA";
  130 + }
  131 + if("".equals(adj.getAdjustmentInfo().get(0).getBalanceType())){
  132 + this.type = Constant.TYPE_INVALID;
  133 + this._resultCode="322";
  134 + this._resultDescription = "INCOMPLETE_DATA";
  135 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  136 + AppLog.d("ssid:"+"null");
  137 + }
  138 + if(null==adj.getAdjustmentInfo().get(0).getOldBalanceAmt()){
  139 + this.type = Constant.TYPE_INVALID;
  140 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  141 + this._resultCode="322";
  142 + this._resultDescription = "INCOMPLETE_DATA";
  143 + }
  144 + if("".equals(adj.getAdjustmentInfo().get(0).getOldBalanceAmt())){
  145 + this.type = Constant.TYPE_INVALID;
  146 + this._resultCode="322";
  147 + this._resultDescription = "INCOMPLETE_DATA";
  148 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  149 + AppLog.d("ssid:"+"null");
  150 + }
  151 + if(null==adj.getAdjustmentInfo().get(0).getNewBalanceAmt()){
  152 + this.type = Constant.TYPE_INVALID;
  153 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  154 + this._resultCode="322";
  155 + this._resultDescription = "INCOMPLETE_DATA";
  156 + }
  157 + if("".equals(adj.getAdjustmentInfo().get(0).getNewBalanceAmt())){
  158 + this.type = Constant.TYPE_INVALID;
  159 + this._resultCode="322";
  160 + this._resultDescription = "INCOMPLETE_DATA";
  161 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  162 + AppLog.d("ssid:"+"null");
  163 + }
  164 + if(null==adj.getAdjustmentInfo().get(0).getCurrencyID()){
  165 + this.type = Constant.TYPE_INVALID;
  166 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  167 + this._resultCode="322";
  168 + this._resultDescription = "INCOMPLETE_DATA";
  169 + }
  170 + if("".equals(adj.getAdjustmentInfo().get(0).getCurrencyID())){
  171 + this.type = Constant.TYPE_INVALID;
  172 + this._resultCode="322";
  173 + this._resultDescription = "INCOMPLETE_DATA";
  174 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  175 + AppLog.d("ssid:"+"null");
  176 + }
75 } 177 }
76 178
77 public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) 179 public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
78 { 180 {
79 181
80 switch (this.type) { 182 switch (this.type) {
81 - 183 + case Constant.TYPE_INVALID:
  184 + case Constant.TYPE_TIMEOUT:
  185 + {
  186 + chargeResponseIns.setResult(this._resultCode);
  187 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  188 + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT"));
  189 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns);
  190 + EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
  191 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  192 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  193 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  194 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  195 + break;
  196 + }
82 case Constant.TYPE_SUCCESS: 197 case Constant.TYPE_SUCCESS:
83 default: 198 default:
84 { 199 {
  200 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  201 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
85 // this.isStat = false; 202 // this.isStat = false;
86 -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); 203 + ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT"));
87 String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); 204 String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns);
88 ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); 205 ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
89 EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); 206 EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
src/th/co/ais/ssbsrfc/substate/SubWaitChargeReport.java
@@ -3,11 +3,12 @@ package th.co.ais.ssbsrfc.substate; @@ -3,11 +3,12 @@ package th.co.ais.ssbsrfc.substate;
3 import java.text.DateFormat; 3 import java.text.DateFormat;
4 import java.text.SimpleDateFormat; 4 import java.text.SimpleDateFormat;
5 import java.util.Calendar; 5 import java.util.Calendar;
6 -import java.util.Date;  
7 import java.util.HashMap; 6 import java.util.HashMap;
  7 +import java.util.Random;
8 8
9 import ec02.af.abstracts.AbstractAF; 9 import ec02.af.abstracts.AbstractAF;
10 import ec02.af.data.EquinoxRawData; 10 import ec02.af.data.EquinoxRawData;
  11 +import ec02.af.data.GlobalData;
11 import ec02.utils.AppLog; 12 import ec02.utils.AppLog;
12 import th.co.ais.ssbsrfc.config.Constant; 13 import th.co.ais.ssbsrfc.config.Constant;
13 import th.co.ais.ssbsrfc.config.StateConfig; 14 import th.co.ais.ssbsrfc.config.StateConfig;
@@ -16,21 +17,24 @@ import th.co.ais.ssbsrfc.instance.AdjustmentInfo; @@ -16,21 +17,24 @@ import th.co.ais.ssbsrfc.instance.AdjustmentInfo;
16 import th.co.ais.ssbsrfc.instance.AdjustmentObj; 17 import th.co.ais.ssbsrfc.instance.AdjustmentObj;
17 import th.co.ais.ssbsrfc.instance.AdjustmentRequest; 18 import th.co.ais.ssbsrfc.instance.AdjustmentRequest;
18 import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns; 19 import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns;
  20 +import th.co.ais.ssbsrfc.instance.ChargeReportIns;
19 import th.co.ais.ssbsrfc.instance.CheckRequest; 21 import th.co.ais.ssbsrfc.instance.CheckRequest;
20 import th.co.ais.ssbsrfc.instance.EC02Instance; 22 import th.co.ais.ssbsrfc.instance.EC02Instance;
21 import th.co.ais.ssbsrfc.instance.EQXRawInstance; 23 import th.co.ais.ssbsrfc.instance.EQXRawInstance;
22 import th.co.ais.ssbsrfc.instance.OwnershipInfo; 24 import th.co.ais.ssbsrfc.instance.OwnershipInfo;
23 import th.co.ais.ssbsrfc.instance.RequestHeader; 25 import th.co.ais.ssbsrfc.instance.RequestHeader;
  26 +import th.co.ais.ssbsrfc.instance.Stat;
24 import th.co.ais.ssbsrfc.instance.SubAccessCode; 27 import th.co.ais.ssbsrfc.instance.SubAccessCode;
25 import th.co.ais.ssbsrfc.utils.EqxStringUtils; 28 import th.co.ais.ssbsrfc.utils.EqxStringUtils;
26 - 29 +import th.co.ais.ssbsrfc.utils.Global;
27 30
28 public class SubWaitChargeReport extends WaitSubState { 31 public class SubWaitChargeReport extends WaitSubState {
29 - 32 +
30 AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns(); 33 AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns();
31 -  
32 - public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
33 - { 34 + HashMap<String, String> map = new HashMap<String, String>();
  35 + ChargeReportIns chargeResponseIns = new ChargeReportIns();
  36 +
  37 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
34 this._state = StateConfig.SSTATE_W_CHARGEREPORT; 38 this._state = StateConfig.SSTATE_W_CHARGEREPORT;
35 this._eventType = StateConfig.Incoming_ChargeReport_Request; 39 this._eventType = StateConfig.Incoming_ChargeReport_Request;
36 this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST; 40 this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST;
@@ -39,90 +43,244 @@ public class SubWaitChargeReport extends WaitSubState { @@ -39,90 +43,244 @@ public class SubWaitChargeReport extends WaitSubState {
39 ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke()); 43 ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke());
40 ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke()); 44 ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());
41 } 45 }
42 - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A); 46 + ec02Instance.getAFInstance().setFlow(Constant.FLOW_CHARGE_REPORT);
43 } 47 }
44 48
45 - public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
46 - { 49 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
47 String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance); 50 String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
48 AppLog.d("## PARAMETERS : " + value); 51 AppLog.d("## PARAMETERS : " + value);
49 - HashMap<String , String> map = new HashMap<String, String>();  
50 String page = equinoxRawData.getRawDataAttribute("val"); 52 String page = equinoxRawData.getRawDataAttribute("val");
51 CheckRequest checkRequest = new CheckRequest(); 53 CheckRequest checkRequest = new CheckRequest();
52 checkRequest.setDn(page); 54 checkRequest.setDn(page);
53 - String [] dnList = checkRequest.getDn().split("&", -1); 55 + String[] dnList = checkRequest.getDn().split("&", -1);
54 page = dnList[0].substring("ssid=".length()); 56 page = dnList[0].substring("ssid=".length());
55 - int i=0;  
56 - while(i<dnList.length){  
57 -  
58 - map.put(dnList[i].substring(0, dnList[i].indexOf("=")), dnList[i].substring(dnList[i].indexOf("=")+1)); 57 + int i = 0;
  58 + while (i < dnList.length) {
  59 + map.put(dnList[i].substring(0, dnList[i].indexOf("=")), dnList[i].substring(dnList[i].indexOf("=") + 1));
59 i++; 60 i++;
60 } 61 }
61 -  
62 - DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSS"); 62 +
  63 + DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
63 Calendar cal = Calendar.getInstance(); 64 Calendar cal = Calendar.getInstance();
64 - cal.add(Calendar.YEAR, -543);  
65 - 65 + Random random = new Random();
  66 + String rand = "000";
  67 + int x = random.nextInt(1000);
  68 + rand += x;
  69 + rand = rand.substring(rand.length() - 3);
  70 + ec02Instance.getAFInstance().setRand(rand);
  71 + String ChargeId = dateFormat.format(cal.getTime()) + rand;
  72 + ec02Instance.getAFInstance().setChargeId(ChargeId);
66 ec02Instance.getAFInstance().setDn(map); 73 ec02Instance.getAFInstance().setDn(map);
67 - 74 +
  75 + AppLog.d("########Random : " + rand);
  76 + AppLog.d("########MessageSeq : " + ChargeId);
  77 +
68 this.type = Constant.TYPE_SUCCESS; 78 this.type = Constant.TYPE_SUCCESS;
69 79
70 RequestHeader requestHeader = new RequestHeader(); 80 RequestHeader requestHeader = new RequestHeader();
71 - requestHeader.setVersion(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("Version").get(0));  
72 - requestHeader.setBusinessCode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BusinessCode_Refund").get(0));  
73 - requestHeader.setMessageSeq(dateFormat.format(cal.getTime())); 81 + requestHeader.setVersion(
  82 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AdjustmentRequestVersion").get(0));
  83 + AppLog.d("AdjustmentRequestVersion :" + Global.getEC02WarmConfig("AdjustmentRequestVersion"));
  84 + requestHeader.setBusinessCode(
  85 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BusinessCode_Refund").get(0));
  86 + AppLog.d("BusinessCode_Refund :" + Global.getEC02WarmConfig("BusinessCode_Refund"));
  87 + requestHeader.setMessageSeq(ChargeId);
74 OwnershipInfo ownershipInfo = new OwnershipInfo(); 88 OwnershipInfo ownershipInfo = new OwnershipInfo();
75 - ownershipInfo.setBEID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID").get(0));  
76 - ownershipInfo.setBRID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID").get(0)); 89 + if (null == ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID")) {
  90 + ownershipInfo.setBEID("101");
  91 + AppLog.d("BEID :" + Global.getEC02WarmConfig("BEID"));
  92 + } else {
  93 + ownershipInfo.setBEID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID").get(0));
  94 + AppLog.d("BEID :" + Global.getEC02WarmConfig("BEID"));
  95 + }
  96 + ownershipInfo.setBRID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BRID").get(0));
  97 + AppLog.d("BRID :" + Global.getEC02WarmConfig("BRID"));
77 requestHeader.setOwnershipInfo(ownershipInfo); 98 requestHeader.setOwnershipInfo(ownershipInfo);
78 AccessSecurity accessSecurity = new AccessSecurity(); 99 AccessSecurity accessSecurity = new AccessSecurity();
79 - accessSecurity.setLoginSystemCode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("LoginSystemCode").get(0)); 100 + accessSecurity.setLoginSystemCode(
  101 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("LoginSystemCode").get(0));
  102 + AppLog.d("LoginSystemCode :" + Global.getEC02WarmConfig("LoginSystemCode"));
80 accessSecurity.setPassword(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("Password").get(0)); 103 accessSecurity.setPassword(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("Password").get(0));
  104 + AppLog.d("Password :" + Global.getEC02WarmConfig("Password"));
81 requestHeader.setAccessSecurity(accessSecurity); 105 requestHeader.setAccessSecurity(accessSecurity);
82 - requestHeader.setAccessMode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AccessMode").get(0));  
83 - 106 + if (null == ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AccessMode")) {
  107 + requestHeader.setAccessMode("3");
  108 + AppLog.d("AccessMode :" + Global.getEC02WarmConfig("AccessMode"));
  109 + } else {
  110 + requestHeader
  111 + .setAccessMode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AccessMode").get(0));
  112 + AppLog.d("AccessMode :" + Global.getEC02WarmConfig("AccessMode"));
  113 + }
84 AdjustmentRequest adjustmentrequest = new AdjustmentRequest(); 114 AdjustmentRequest adjustmentrequest = new AdjustmentRequest();
85 adjustmentrequest.setAdjustmentSerialNo(map.get("ssid")); 115 adjustmentrequest.setAdjustmentSerialNo(map.get("ssid"));
86 AdjustmentObj adjustmentObj = new AdjustmentObj(); 116 AdjustmentObj adjustmentObj = new AdjustmentObj();
87 - SubAccessCode subAccessCode = new SubAccessCode(); 117 + SubAccessCode subAccessCode = new SubAccessCode();
88 subAccessCode.setPrimaryIdentity(map.get("ms")); 118 subAccessCode.setPrimaryIdentity(map.get("ms"));
89 adjustmentObj.setSubAccessCode(subAccessCode); 119 adjustmentObj.setSubAccessCode(subAccessCode);
90 adjustmentrequest.setAdjustmentObj(adjustmentObj); 120 adjustmentrequest.setAdjustmentObj(adjustmentObj);
91 adjustmentrequest.setOpType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("OpType").get(0)); 121 adjustmentrequest.setOpType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("OpType").get(0));
  122 + AppLog.d("OpType :" + Global.getEC02WarmConfig("OpType"));
92 AdjustmentInfo adjustmentInfo = new AdjustmentInfo(); 123 AdjustmentInfo adjustmentInfo = new AdjustmentInfo();
93 - adjustmentInfo.setBalanceType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BalanceType").get(0));  
94 - adjustmentInfo.setAdjustmentType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AdjustmentType_Refund").get(0)); 124 + adjustmentInfo
  125 + .setBalanceType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BalanceType").get(0));
  126 + AppLog.d("BalanceType :" + Global.getEC02WarmConfig("BalanceType"));
  127 + adjustmentInfo.setAdjustmentType(
  128 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AdjustmentType_Refund").get(0));
  129 + AppLog.d("AdjustmentType_Refund :" + Global.getEC02WarmConfig("AdjustmentType_Refund"));
95 adjustmentInfo.setAdjustmentAmt(map.get("rtv")); 130 adjustmentInfo.setAdjustmentAmt(map.get("rtv"));
96 - adjustmentInfo.setCurrencyID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("CurrencyID").get(0)); 131 + adjustmentInfo
  132 + .setCurrencyID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("CurrencyID").get(0));
  133 + AppLog.d("CurrencyID :" + Global.getEC02WarmConfig("CurrencyID"));
97 adjustmentrequest.setAdjustmentInfo(adjustmentInfo); 134 adjustmentrequest.setAdjustmentInfo(adjustmentInfo);
98 - 135 +
99 adjustmentRequest.setRequestHeader(requestHeader); 136 adjustmentRequest.setRequestHeader(requestHeader);
100 adjustmentRequest.setAdjustmentRequest(adjustmentrequest); 137 adjustmentRequest.setAdjustmentRequest(adjustmentrequest);
101 - 138 +
102 ec02Instance.getAFInstance().setAdjustmentRequestIns(adjustmentRequest); 139 ec02Instance.getAFInstance().setAdjustmentRequestIns(adjustmentRequest);
103 - 140 + ec02Instance.getAFInstance().setMs(map.get("ms"));
104 return value; 141 return value;
105 } 142 }
106 143
107 - public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
108 - {  
109 - AppLog.d("## TEST MSG SUBSTATE A");  
110 - this.type = Constant.TYPE_SUCCESS; 144 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
  145 + if (null == map.get("page")) {
  146 + this.type = Constant.TYPE_MISSING;
  147 + this._resultCode = "322";
  148 + this._resultDescription = "INCOMPLETE_DATA";
  149 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  150 + AppLog.d("page:" + "null");
  151 + } else if (map.get("page").equals("chargeReport")) {
  152 + this.type = Constant.TYPE_SUCCESS;
  153 + this._resultCode = "000";
  154 + this._resultDescription = "SUCCESS";
  155 + } else {
  156 + this.type = Constant.TYPE_INVALID;
  157 + this._resultCode = "322";
  158 + this._resultDescription = "INCOMPLETE_DATA";
  159 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  160 + AppLog.d("page:" + map.get("page"));
  161 + }
  162 + if (null == map.get("scp")) {
  163 + this.type = Constant.TYPE_MISSING;
  164 + this._resultCode = "322";
  165 + this._resultDescription = "INCOMPLETE_DATA";
  166 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  167 + AppLog.d("scp:" + "null");
  168 + } else if ("".equals(map.get("scp")) || map.get("scp").length() > 3) {
  169 + this.type = Constant.TYPE_INVALID;
  170 + this._resultCode = "322";
  171 + this._resultDescription = "INCOMPLETE_DATA";
  172 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  173 + AppLog.d("ssid:" + "null");
  174 + }
  175 + if (null == map.get("pwd")) {
  176 + this.type = Constant.TYPE_MISSING;
  177 + this._resultCode = "322";
  178 + this._resultDescription = "INCOMPLETE_DATA";
  179 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  180 + AppLog.d("pwd:" + "null");
  181 + } else if ("".equals(map.get("pwd")) || map.get("pwd").length() > 8) {
  182 + this.type = Constant.TYPE_INVALID;
  183 + this._resultCode = "322";
  184 + this._resultDescription = "INCOMPLETE_DATA";
  185 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  186 + AppLog.d("ssid:" + "null");
  187 + }
  188 + if (null == map.get("ms")) {
  189 + this.type = Constant.TYPE_MISSING;
  190 + this._resultCode = "322";
  191 + this._resultDescription = "INCOMPLETE_DATA";
  192 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  193 + AppLog.d("ms:" + "null");
  194 + } else if ("".equals(map.get("ms")) || map.get("ms").length() > 10) {
  195 + this.type = Constant.TYPE_INVALID;
  196 + this._resultCode = "322";
  197 + this._resultDescription = "INCOMPLETE_DATA";
  198 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  199 + AppLog.d("ssid:" + "null");
  200 + }
  201 + if (null == map.get("id")) {
  202 + this.type = Constant.TYPE_MISSING;
  203 + this._resultCode = "322";
  204 + this._resultDescription = "INCOMPLETE_DATA";
  205 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  206 + AppLog.d("id:" + "null");
  207 + } else if ("".equals(map.get("id")) || map.get("id").length() > 20) {
  208 + this.type = Constant.TYPE_INVALID;
  209 + this._resultCode = "322";
  210 + this._resultDescription = "INCOMPLETE_DATA";
  211 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  212 + AppLog.d("ssid:" + "null");
  213 + }
  214 + if (null == map.get("rtv")) {
  215 + this.type = Constant.TYPE_MISSING;
  216 + this._resultCode = "322";
  217 + this._resultDescription = "INCOMPLETE_DATA";
  218 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  219 + AppLog.d("rtv:" + "null");
  220 + } else if ("".equals(map.get("rtv")) || map.get("rtv").length() > 5) {
  221 + this.type = Constant.TYPE_INVALID;
  222 + this._resultCode = "322";
  223 + this._resultDescription = "INCOMPLETE_DATA";
  224 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  225 + AppLog.d("ssid:" + "null");
  226 + }
  227 + if (null == map.get("dat")) {
  228 + this.type = Constant.TYPE_MISSING;
  229 + this._resultCode = "322";
  230 + this._resultDescription = "INCOMPLETE_DATA";
  231 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  232 + AppLog.d("dat:" + "null");
  233 + } else if ("".equals(map.get("dat")) || map.get("dat").length() > 2048) {
  234 + this.type = Constant.TYPE_INVALID;
  235 + this._resultCode = "322";
  236 + this._resultDescription = "INCOMPLETE_DATA";
  237 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  238 + AppLog.d("ssid:" + "null");
  239 + }
  240 + if (null == map.get("ssid")) {
  241 + this.type = Constant.TYPE_MISSING;
  242 + this._resultCode = "322";
  243 + this._resultDescription = "INCOMPLETE_DATA";
  244 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  245 + AppLog.d("ssid:" + "null");
  246 + } else if ("".equals(map.get("ssid")) || map.get("ssid").length() > 20) {
  247 + this.type = Constant.TYPE_INVALID;
  248 + this._resultCode = "322";
  249 + this._resultDescription = "INCOMPLETE_DATA";
  250 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  251 + AppLog.d("ssid:" + "null");
  252 + }
111 } 253 }
112 254
113 - public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
114 - { 255 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
115 switch (this.type) { 256 switch (this.type) {
116 - case Constant.TYPE_SUCCESS:  
117 - default:  
118 - {  
119 -// this.isStat = false;  
120 -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));  
121 - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT);  
122 - EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,StateConfig.Incoming_Adjustment_ChargeReport_Response,adjustmentRequest); 257 + case Constant.TYPE_INVALID:
  258 + case Constant.TYPE_ERROR: {
  259 + this.type = Constant.TYPE_ERROR;
  260 + chargeResponseIns.setResult(this._resultCode);
  261 + chargeResponseIns.setPrepaidsubscriberflag("1");
  262 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  263 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  264 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns);
  265 + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance,
  266 + ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(), message);
  267 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  268 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  269 + break;
  270 + }
  271 + case Constant.TYPE_SUCCESS:
  272 + default: {
  273 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  274 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  275 + // this.isStat = false;
  276 + ec02Instance.getAFInstance().getListStat()
  277 + .add(new Stat(StateConfig.PROJECT_STAT_NAME + "chargeReport STAT"));
  278 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT);
  279 + EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentReport(abstractAF, ec02Instance,
  280 + StateConfig.Incoming_Adjustment_ChargeReport_Response, adjustmentRequest);
123 281
124 - this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw));  
125 - } 282 + this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw));
  283 + }
126 } 284 }
127 } 285 }
128 } 286 }
src/th/co/ais/ssbsrfc/substate/SubWaitChargeRequest.java
@@ -3,8 +3,8 @@ package th.co.ais.ssbsrfc.substate; @@ -3,8 +3,8 @@ package th.co.ais.ssbsrfc.substate;
3 import java.text.DateFormat; 3 import java.text.DateFormat;
4 import java.text.SimpleDateFormat; 4 import java.text.SimpleDateFormat;
5 import java.util.Calendar; 5 import java.util.Calendar;
6 -import java.util.Date;  
7 import java.util.HashMap; 6 import java.util.HashMap;
  7 +import java.util.Random;
8 8
9 import ec02.af.abstracts.AbstractAF; 9 import ec02.af.abstracts.AbstractAF;
10 import ec02.af.data.EquinoxRawData; 10 import ec02.af.data.EquinoxRawData;
@@ -16,21 +16,24 @@ import th.co.ais.ssbsrfc.instance.AdjustmentInfo; @@ -16,21 +16,24 @@ import th.co.ais.ssbsrfc.instance.AdjustmentInfo;
16 import th.co.ais.ssbsrfc.instance.AdjustmentObj; 16 import th.co.ais.ssbsrfc.instance.AdjustmentObj;
17 import th.co.ais.ssbsrfc.instance.AdjustmentRequest; 17 import th.co.ais.ssbsrfc.instance.AdjustmentRequest;
18 import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns; 18 import th.co.ais.ssbsrfc.instance.AdjustmentRequestIns;
  19 +import th.co.ais.ssbsrfc.instance.ChargeResponseIns;
19 import th.co.ais.ssbsrfc.instance.CheckRequest; 20 import th.co.ais.ssbsrfc.instance.CheckRequest;
20 import th.co.ais.ssbsrfc.instance.EC02Instance; 21 import th.co.ais.ssbsrfc.instance.EC02Instance;
21 import th.co.ais.ssbsrfc.instance.EQXRawInstance; 22 import th.co.ais.ssbsrfc.instance.EQXRawInstance;
22 import th.co.ais.ssbsrfc.instance.OwnershipInfo; 23 import th.co.ais.ssbsrfc.instance.OwnershipInfo;
23 import th.co.ais.ssbsrfc.instance.RequestHeader; 24 import th.co.ais.ssbsrfc.instance.RequestHeader;
  25 +import th.co.ais.ssbsrfc.instance.Stat;
24 import th.co.ais.ssbsrfc.instance.SubAccessCode; 26 import th.co.ais.ssbsrfc.instance.SubAccessCode;
25 import th.co.ais.ssbsrfc.utils.EqxStringUtils; 27 import th.co.ais.ssbsrfc.utils.EqxStringUtils;
26 - 28 +import th.co.ais.ssbsrfc.utils.Global;
27 29
28 public class SubWaitChargeRequest extends WaitSubState { 30 public class SubWaitChargeRequest extends WaitSubState {
29 31
30 AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns(); 32 AdjustmentRequestIns adjustmentRequest = new AdjustmentRequestIns();
31 -  
32 - public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
33 - { 33 + HashMap<String, String> map = new HashMap<String, String>();
  34 + private ChargeResponseIns chargeResponseIns = new ChargeResponseIns();
  35 +
  36 + public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
34 this._state = StateConfig.SSTATE_W_CHARGEREQUEST; 37 this._state = StateConfig.SSTATE_W_CHARGEREQUEST;
35 this._eventType = StateConfig.Incoming_ChargeRequest_Request; 38 this._eventType = StateConfig.Incoming_ChargeRequest_Request;
36 this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST; 39 this._stateType = Constant.SUBSTATE_TYPE_W_REQUEST;
@@ -39,97 +42,273 @@ public class SubWaitChargeRequest extends WaitSubState { @@ -39,97 +42,273 @@ public class SubWaitChargeRequest extends WaitSubState {
39 ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke()); 42 ec02Instance.getAFInstance().setInvoke(equinoxRawData.getInvoke());
40 ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke()); 43 ec02Instance.getAFInstance().setInitialInvoke(equinoxRawData.getInvoke());
41 } 44 }
42 - ec02Instance.getAFInstance().setFlow(Constant.FLOW_TEST_A); 45 + ec02Instance.getAFInstance().setFlow(Constant.FLOW_CHARGE_REQUEST);
43 } 46 }
44 47
45 - public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
46 - {  
47 - Date time = new Date(); 48 + public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
48 String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance); 49 String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
49 AppLog.d("## PARAMETERS : " + value); 50 AppLog.d("## PARAMETERS : " + value);
50 - HashMap<String , String> map = new HashMap<String, String>();  
51 String page = equinoxRawData.getRawDataAttribute("val"); 51 String page = equinoxRawData.getRawDataAttribute("val");
52 CheckRequest checkRequest = new CheckRequest(); 52 CheckRequest checkRequest = new CheckRequest();
53 checkRequest.setDn(page); 53 checkRequest.setDn(page);
54 - String [] dnList = checkRequest.getDn().split("&", -1); 54 + String[] dnList = checkRequest.getDn().split("&", -1);
55 page = dnList[0].substring("ssid=".length()); 55 page = dnList[0].substring("ssid=".length());
56 - int i=0;  
57 - while(i<dnList.length){  
58 -  
59 - map.put(dnList[i].substring(0, dnList[i].indexOf("=")), dnList[i].substring(dnList[i].indexOf("=")+1)); 56 + int i = 0;
  57 + while (i < dnList.length) {
  58 +
  59 + map.put(dnList[i].substring(0, dnList[i].indexOf("=")), dnList[i].substring(dnList[i].indexOf("=") + 1));
60 i++; 60 i++;
61 } 61 }
62 -  
63 - DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSS"); 62 +
  63 + DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
64 Calendar cal = Calendar.getInstance(); 64 Calendar cal = Calendar.getInstance();
65 - cal.add(Calendar.YEAR, -543);  
66 - 65 + Random random = new Random();
  66 + String rand = "000";
  67 + int x = random.nextInt(1000);
  68 + rand += x;
  69 + rand = rand.substring(rand.length() - 3);
  70 + ec02Instance.getAFInstance().setRand(rand);
  71 + String ChargeId = dateFormat.format(cal.getTime()) + rand;
  72 + ec02Instance.getAFInstance().setChargeId(ChargeId);
67 ec02Instance.getAFInstance().setDn(map); 73 ec02Instance.getAFInstance().setDn(map);
68 -  
69 this.type = Constant.TYPE_SUCCESS; 74 this.type = Constant.TYPE_SUCCESS;
70 75
  76 + AppLog.d("########Random : " + rand);
  77 + AppLog.d("########MessageSeq : " + ChargeId);
  78 +
71 RequestHeader requestHeader = new RequestHeader(); 79 RequestHeader requestHeader = new RequestHeader();
72 - requestHeader.setVersion(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("Version").get(0));  
73 - requestHeader.setBusinessCode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BusinessCode_Deduct").get(0));  
74 - requestHeader.setMessageSeq(dateFormat.format(cal.getTime())); 80 +
  81 + requestHeader.setVersion(
  82 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AdjustmentRequestVersion").get(0));
  83 + AppLog.d("AdjustmentRequestVersion :" + Global.getEC02WarmConfig("AdjustmentRequestVersion"));
  84 + requestHeader.setBusinessCode(
  85 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BusinessCode_Deduct").get(0));
  86 + AppLog.d("BusinessCode_Deduct :" + Global.getEC02WarmConfig("BusinessCode_Deduct"));
  87 + requestHeader.setMessageSeq(ChargeId);
75 OwnershipInfo ownershipInfo = new OwnershipInfo(); 88 OwnershipInfo ownershipInfo = new OwnershipInfo();
76 - ownershipInfo.setBEID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID").get(0));  
77 - ownershipInfo.setBRID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID").get(0)); 89 + if (null == ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID")) {
  90 + ownershipInfo.setBEID("101");
  91 + AppLog.d("BEID :" + Global.getEC02WarmConfig("BEID"));
  92 + } else {
  93 + ownershipInfo.setBEID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BEID").get(0));
  94 + AppLog.d("BEID :" + Global.getEC02WarmConfig("BEID"));
  95 + }
  96 + ownershipInfo.setBRID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BRID").get(0));
  97 + AppLog.d("BRID :" + Global.getEC02WarmConfig("BRID"));
78 requestHeader.setOwnershipInfo(ownershipInfo); 98 requestHeader.setOwnershipInfo(ownershipInfo);
79 AccessSecurity accessSecurity = new AccessSecurity(); 99 AccessSecurity accessSecurity = new AccessSecurity();
80 - accessSecurity.setLoginSystemCode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("LoginSystemCode").get(0)); 100 + accessSecurity.setLoginSystemCode(
  101 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("LoginSystemCode").get(0));
  102 + AppLog.d("LoginSystemCode :" + Global.getEC02WarmConfig("LoginSystemCode"));
81 accessSecurity.setPassword(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("Password").get(0)); 103 accessSecurity.setPassword(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("Password").get(0));
  104 + AppLog.d("Password :" + Global.getEC02WarmConfig("Password"));
82 requestHeader.setAccessSecurity(accessSecurity); 105 requestHeader.setAccessSecurity(accessSecurity);
83 - requestHeader.setAccessMode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AccessMode").get(0));  
84 - 106 + if (null == ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AccessMode")) {
  107 + requestHeader.setAccessMode("3");
  108 + AppLog.d("AccessMode :" + Global.getEC02WarmConfig("AccessMode"));
  109 + } else {
  110 + requestHeader
  111 + .setAccessMode(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AccessMode").get(0));
  112 + AppLog.d("AccessMode :" + Global.getEC02WarmConfig("AccessMode"));
  113 + }
  114 +
85 AdjustmentRequest adjustmentrequest = new AdjustmentRequest(); 115 AdjustmentRequest adjustmentrequest = new AdjustmentRequest();
86 adjustmentrequest.setAdjustmentSerialNo(map.get("ssid")); 116 adjustmentrequest.setAdjustmentSerialNo(map.get("ssid"));
87 AdjustmentObj adjustmentObj = new AdjustmentObj(); 117 AdjustmentObj adjustmentObj = new AdjustmentObj();
88 - SubAccessCode subAccessCode = new SubAccessCode(); 118 + SubAccessCode subAccessCode = new SubAccessCode();
89 subAccessCode.setPrimaryIdentity(map.get("ms")); 119 subAccessCode.setPrimaryIdentity(map.get("ms"));
90 adjustmentObj.setSubAccessCode(subAccessCode); 120 adjustmentObj.setSubAccessCode(subAccessCode);
91 adjustmentrequest.setAdjustmentObj(adjustmentObj); 121 adjustmentrequest.setAdjustmentObj(adjustmentObj);
92 adjustmentrequest.setOpType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("OpType").get(0)); 122 adjustmentrequest.setOpType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("OpType").get(0));
  123 + AppLog.d("OpType :" + Global.getEC02WarmConfig("OpType"));
93 AdjustmentInfo adjustmentInfo = new AdjustmentInfo(); 124 AdjustmentInfo adjustmentInfo = new AdjustmentInfo();
94 - adjustmentInfo.setBalanceType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BalanceType").get(0));  
95 - adjustmentInfo.setAdjustmentType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AdjustmentType_Deduct").get(0)); 125 + adjustmentInfo
  126 + .setBalanceType(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("BalanceType").get(0));
  127 + AppLog.d("BalanceType :" + Global.getEC02WarmConfig("BalanceType"));
  128 + adjustmentInfo.setAdjustmentType(
  129 + ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("AdjustmentType_Deduct").get(0));
  130 + AppLog.d("AdjustmentType_Deduct :" + Global.getEC02WarmConfig("AdjustmentType_Deduct"));
96 adjustmentInfo.setAdjustmentAmt(map.get("fee")); 131 adjustmentInfo.setAdjustmentAmt(map.get("fee"));
97 - adjustmentInfo.setCurrencyID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("CurrencyID").get(0)); 132 + adjustmentInfo
  133 + .setCurrencyID(ec02Instance.getAbstractAF().getUtils().getHmWarmConfig().get("CurrencyID").get(0));
  134 + AppLog.d("CurrencyID :" + Global.getEC02WarmConfig("CurrencyID"));
98 adjustmentrequest.setAdjustmentInfo(adjustmentInfo); 135 adjustmentrequest.setAdjustmentInfo(adjustmentInfo);
99 - 136 +
100 adjustmentRequest.setRequestHeader(requestHeader); 137 adjustmentRequest.setRequestHeader(requestHeader);
101 adjustmentRequest.setAdjustmentRequest(adjustmentrequest); 138 adjustmentRequest.setAdjustmentRequest(adjustmentrequest);
102 - 139 + AppLog.d("SSID:" + map.get("ssid"));
103 ec02Instance.getAFInstance().setAdjustmentRequestIns(adjustmentRequest); 140 ec02Instance.getAFInstance().setAdjustmentRequestIns(adjustmentRequest);
104 - 141 + ec02Instance.getAFInstance().setMs(map.get("ms"));
105 return value; 142 return value;
106 -  
107 -  
108 -  
109 } 143 }
110 144
111 - public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
112 - {  
113 -  
114 -  
115 -  
116 - 145 + public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
  146 + this._resultCode = "000";
  147 + this._resultDescription = "SUCCESS";
  148 + this.type = Constant.TYPE_SUCCESS;
  149 + if (null == map.get("page")) {
  150 + this.type = Constant.TYPE_MISSING;
  151 + this._resultCode = "322";
  152 + this._resultDescription = "INCOMPLETE_DATA";
  153 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  154 + AppLog.d("page:" + "null");
  155 + } else if (!map.get("page").equals("chargeRequest")) {
  156 + this.type = Constant.TYPE_INVALID;
  157 + this._resultCode = "322";
  158 + this._resultDescription = "INCOMPLETE_DATA";
  159 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  160 + AppLog.d("page:" + map.get("page"));
  161 + }
  162 + if (null == map.get("scp")) {
  163 + this.type = Constant.TYPE_MISSING;
  164 + this._resultCode = "322";
  165 + this._resultDescription = "INCOMPLETE_DATA";
  166 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  167 + AppLog.d("scp:" + "null");
  168 + } else if ("".equals(map.get("scp")) || map.get("scp").length() > 3) {
  169 + this.type = Constant.TYPE_INVALID;
  170 + this._resultCode = "322";
  171 + this._resultDescription = "INCOMPLETE_DATA";
  172 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  173 + AppLog.d("scp:" + "INVALID");
  174 + }
  175 + if (null == map.get("pwd")) {
  176 + this.type = Constant.TYPE_MISSING;
  177 + this._resultCode = "322";
  178 + this._resultDescription = "INCOMPLETE_DATA";
  179 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  180 + AppLog.d("pwd:" + "null");
  181 + } else if ("".equals(map.get("pwd")) || map.get("pwd").length() > 8) {
  182 + this.type = Constant.TYPE_INVALID;
  183 + this._resultCode = "322";
  184 + this._resultDescription = "INCOMPLETE_DATA";
  185 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  186 + AppLog.d("pwd:" + "INVALID");
  187 + }
  188 + if (null == map.get("ms")) {
  189 + this.type = Constant.TYPE_MISSING;
  190 + this._resultCode = "322";
  191 + this._resultDescription = "INCOMPLETE_DATA";
  192 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  193 + AppLog.d("ms:" + "null");
  194 + } else if ("".equals(map.get("ms")) || map.get("ms").length() > 10) {
  195 + this.type = Constant.TYPE_INVALID;
  196 + this._resultCode = "322";
  197 + this._resultDescription = "INCOMPLETE_DATA";
  198 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  199 + AppLog.d("ms:" + "INVALID");
  200 + }
  201 + if (null == map.get("fee")) {
  202 + this.type = Constant.TYPE_MISSING;
  203 + this._resultCode = "322";
  204 + this._resultDescription = "INCOMPLETE_DATA";
  205 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  206 + AppLog.d("fee:" + "null");
  207 + } else if ("".equals(map.get("fee")) || map.get("fee").length() > 5) {
  208 + this.type = Constant.TYPE_INVALID;
  209 + this._resultCode = "322";
  210 + this._resultDescription = "INCOMPLETE_DATA";
  211 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  212 + AppLog.d("fee:" + "INVALID");
  213 + }
  214 + if (null == map.get("mod")) {
  215 + this.type = Constant.TYPE_MISSING;
  216 + this._resultCode = "322";
  217 + this._resultDescription = "INCOMPLETE_DATA";
  218 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  219 + AppLog.d("mod:" + "null");
  220 + } else if ("".equals(map.get("mod")) || map.get("mod").length() > 1) {
  221 + this.type = Constant.TYPE_INVALID;
  222 + this._resultCode = "322";
  223 + this._resultDescription = "INCOMPLETE_DATA";
  224 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  225 + AppLog.d("mod:" + "INVALID");
  226 + }
  227 + if (null == map.get("cat")) {
  228 + this.type = Constant.TYPE_MISSING;
  229 + this._resultCode = "322";
  230 + this._resultDescription = "INCOMPLETE_DATA";
  231 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  232 + AppLog.d("cat:" + "null");
  233 + } else if ("".equals(map.get("cat")) || map.get("cat").length() > 1) {
  234 + this.type = Constant.TYPE_INVALID;
  235 + this._resultCode = "322";
  236 + this._resultDescription = "INCOMPLETE_DATA";
  237 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  238 + AppLog.d("cat:" + "INVALID");
  239 + }
  240 + if (null == map.get("dat")) {
  241 + this.type = Constant.TYPE_MISSING;
  242 + this._resultCode = "322";
  243 + this._resultDescription = "INCOMPLETE_DATA";
  244 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  245 + AppLog.d("dat:" + "null");
  246 + } else if ("".equals(map.get("dat")) || map.get("dat").length() > 100) {
  247 + this.type = Constant.TYPE_INVALID;
  248 + this._resultCode = "322";
  249 + this._resultDescription = "INCOMPLETE_DATA";
  250 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  251 + AppLog.d("dat:" + "INVALID");
  252 + }
  253 + if (null == map.get("nid")) {
  254 + this.type = Constant.TYPE_MISSING;
  255 + this._resultCode = "322";
  256 + this._resultDescription = "INCOMPLETE_DATA";
  257 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  258 + AppLog.d("nid:" + "null");
  259 + } else if ("".equals(map.get("nid")) || map.get("nid").length() > 5) {
  260 + this.type = Constant.TYPE_INVALID;
  261 + this._resultCode = "322";
  262 + this._resultDescription = "INCOMPLETE_DATA";
  263 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  264 + AppLog.d("nid:" + "INVALID");
  265 + }
  266 + if (null == map.get("ssid")) {
  267 + this.type = Constant.TYPE_MISSING;
  268 + this._resultCode = "322";
  269 + this._resultDescription = "INCOMPLETE_DATA";
  270 + AppLog.d("## VERIFY(PARAMETER) :MISSING PARAMETER");
  271 + AppLog.d("ssid:" + "null");
  272 + } else if ("".equals(map.get("ssid")) || map.get("ssid").length() > 20) {
  273 + this.type = Constant.TYPE_INVALID;
  274 + this._resultCode = "322";
  275 + this._resultDescription = "INCOMPLETE_DATA";
  276 + AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
  277 + AppLog.d("ssid:" + "INVALID");
  278 + }
  279 +
117 } 280 }
118 281
119 - public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)  
120 - { 282 + public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) {
121 switch (this.type) { 283 switch (this.type) {
122 - case Constant.TYPE_SUCCESS:  
123 - default:  
124 - {  
125 -// this.isStat = false;  
126 -// ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT"));  
127 - String message = th.co.ais.ssbsrfc.message.MessageParser.toSoap(adjustmentRequest);  
128 - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST);  
129 - EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,StateConfig.Incoming_Adjustment_ChargeRequest_Response,adjustmentRequest);  
130 -  
131 - this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw));  
132 - } 284 + case Constant.TYPE_INVALID:
  285 + case Constant.TYPE_MISSING: {
  286 + this.type = Constant.TYPE_ERROR;
  287 + chargeResponseIns.setResult(this._resultCode);
  288 + chargeResponseIns.setPrepaidsubscriberflag("1");
  289 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  290 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  291 + chargeResponseIns.setChargingID(ec02Instance.getAFInstance().getChargeId());
  292 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns);
  293 + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance,
  294 + ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(), message);
  295 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  296 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  297 + break;
  298 + }
  299 + case Constant.TYPE_SUCCESS:
  300 + default: {
  301 + ec02Instance.getAFInstance().setResultCode(this._resultCode);
  302 + ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
  303 + // this.isStat = false;
  304 + ec02Instance.getAFInstance().getListStat()
  305 + .add(new Stat(StateConfig.PROJECT_STAT_NAME + "chargeRequest STAT"));
  306 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST);
  307 + EQXRawInstance eqxRaw = SubMessages.getRawAdjustmentRequest(abstractAF, ec02Instance,
  308 + StateConfig.Incoming_Adjustment_ChargeRequest_Response, adjustmentRequest);
  309 +
  310 + this.equinoxRawDataList.add(this.ec02Builder.getRequest(eqxRaw));
  311 + }
133 } 312 }
134 } 313 }
135 } 314 }
src/th/co/ais/ssbsrfc/substate/WaitSubState.java
@@ -7,7 +7,10 @@ import java.util.List; @@ -7,7 +7,10 @@ import java.util.List;
7 import th.co.ais.ssbsrfc.config.Constant; 7 import th.co.ais.ssbsrfc.config.Constant;
8 import th.co.ais.ssbsrfc.config.Invoke; 8 import th.co.ais.ssbsrfc.config.Invoke;
9 import th.co.ais.ssbsrfc.config.StateConfig; 9 import th.co.ais.ssbsrfc.config.StateConfig;
  10 +import th.co.ais.ssbsrfc.instance.ChargeReportIns;
  11 +import th.co.ais.ssbsrfc.instance.ChargeResponseIns;
10 import th.co.ais.ssbsrfc.instance.EC02Instance; 12 import th.co.ais.ssbsrfc.instance.EC02Instance;
  13 +import th.co.ais.ssbsrfc.instance.EQXRawInstance;
11 import th.co.ais.ssbsrfc.instance.ListE01Data; 14 import th.co.ais.ssbsrfc.instance.ListE01Data;
12 import th.co.ais.ssbsrfc.instance.LogError; 15 import th.co.ais.ssbsrfc.instance.LogError;
13 import th.co.ais.ssbsrfc.instance.ManageTime; 16 import th.co.ais.ssbsrfc.instance.ManageTime;
@@ -27,6 +30,7 @@ import ec02.af.abstracts.AbstractAF; @@ -27,6 +30,7 @@ import ec02.af.abstracts.AbstractAF;
27 import ec02.af.data.EquinoxRawData; 30 import ec02.af.data.EquinoxRawData;
28 import ec02.af.data.GlobalData; 31 import ec02.af.data.GlobalData;
29 import ec02.utils.AppLog; 32 import ec02.utils.AppLog;
  33 +import sun.applet.AppletPanel;
30 34
31 public class WaitSubState implements IAFSubState { 35 public class WaitSubState implements IAFSubState {
32 36
@@ -45,6 +49,7 @@ public class WaitSubState implements IAFSubState { @@ -45,6 +49,7 @@ public class WaitSubState implements IAFSubState {
45 protected String _invokeTimeout = null; 49 protected String _invokeTimeout = null;
46 protected boolean isRetry = false; 50 protected boolean isRetry = false;
47 private boolean isIdle = true; 51 private boolean isIdle = true;
  52 + int flow = 0;
48 53
49 54
50 @Override 55 @Override
@@ -215,6 +220,7 @@ public class WaitSubState implements IAFSubState { @@ -215,6 +220,7 @@ public class WaitSubState implements IAFSubState {
215 // SET LOG 220 // SET LOG
216 Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat); 221 Log.results(ec02Instance, _state, this.equinoxRawDataList, this.type, this.isStat);
217 } 222 }
  223 + this.summaryLog(ec02Instance, equinoxRawData);
218 } 224 }
219 AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(END) ####]"); 225 AppLog.d("[#### CURRENTSUBSTATE: " + _state + "(END) ####]");
220 AppLog.d("#### NEXTSUBSTATE: " + ec02Instance.getAFInstance().getCurrentState()); 226 AppLog.d("#### NEXTSUBSTATE: " + ec02Instance.getAFInstance().getCurrentState());
@@ -317,7 +323,7 @@ public class WaitSubState implements IAFSubState { @@ -317,7 +323,7 @@ public class WaitSubState implements IAFSubState {
317 //Detail Log Input 323 //Detail Log Input
318 String value = EqxStringUtils.getMessage(equinoxRawData, null, false); 324 String value = EqxStringUtils.getMessage(equinoxRawData, null, false);
319 String invoke = equinoxRawData.getInvoke(); 325 String invoke = equinoxRawData.getInvoke();
320 - String eventType = equinoxRawData.getRawEventType(); 326 + String eventType = ec02Instance.getAFInstance().getEvent();
321 String messageType = equinoxRawData.getType(); 327 String messageType = equinoxRawData.getType();
322 this.detailLogInput(ec02Instance, invoke, eventType, messageType, this._objIns, value); 328 this.detailLogInput(ec02Instance, invoke, eventType, messageType, this._objIns, value);
323 329
@@ -376,44 +382,82 @@ public class WaitSubState implements IAFSubState { @@ -376,44 +382,82 @@ public class WaitSubState implements IAFSubState {
376 public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) 382 public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
377 { } 383 { }
378 384
  385 +
  386 +
379 protected void error(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) 387 protected void error(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
380 { 388 {
381 AppLog.d("SPECIFIC ERROR BY APPLICATION"); 389 AppLog.d("SPECIFIC ERROR BY APPLICATION");
382 - this.type = Constant.TYPE_ERROR; 390 + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){
  391 + this.type = Constant.TYPE_ERROR;
  392 + this._resultCode = null;
  393 + }else{
  394 + this.type = Constant.TYPE_ERROR;
  395 +
  396 + }
383 LogError ins = new LogError("1", "Error"); 397 LogError ins = new LogError("1", "Error");
384 - this._resultCode = "null"; 398 + this._resultCode = "310";
385 this._resultDescription = "Error"; 399 this._resultDescription = "Error";
  400 + ec02Instance.getAFInstance().setResultCode("310");
  401 + ec02Instance.getAFInstance().setResultDescription("SCP_OTHER");
  402 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins);
386 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); 403 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
  404 + flow = ec02Instance.getAFInstance().getFlow();
387 } 405 }
388 406
389 protected void reject(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) 407 protected void reject(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
390 { 408 {
391 AppLog.d("REJECTED BY PLATFORM"); 409 AppLog.d("REJECTED BY PLATFORM");
392 - this.type = Constant.TYPE_REJECT; 410 + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){
  411 + this.type = Constant.TYPE_REJECT;
  412 + this._resultCode = null;
  413 + }else{
  414 +
  415 + this.type = Constant.TYPE_ERROR;
  416 + }
393 LogError ins = new LogError("2", "Reject"); 417 LogError ins = new LogError("2", "Reject");
394 - this._resultCode = "null"; 418 + this._resultCode = "307";
395 this._resultDescription = "Reject"; 419 this._resultDescription = "Reject";
  420 + ec02Instance.getAFInstance().setResultCode("307");
  421 + ec02Instance.getAFInstance().setResultDescription("SCP_NOT_CONNECT");
  422 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins);
396 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); 423 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
397 } 424 }
398 425
399 protected void abort(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) 426 protected void abort(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
400 { 427 {
401 AppLog.d("RETURN ABORTED BY PLATFORM"); 428 AppLog.d("RETURN ABORTED BY PLATFORM");
402 - this.type = Constant.TYPE_ABORT;  
403 - this._resultCode = "null"; 429 + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){
  430 + this.type = Constant.TYPE_ABORT;
  431 + this._resultCode = null;
  432 + }else{
  433 + this.type = Constant.TYPE_ERROR;
  434 + }
  435 + this._resultCode = "310";
  436 +
404 LogError ins = new LogError("3", "Abort"); 437 LogError ins = new LogError("3", "Abort");
405 this._resultDescription = "Abort"; 438 this._resultDescription = "Abort";
  439 + ec02Instance.getAFInstance().setResultCode("310");
  440 + ec02Instance.getAFInstance().setResultDescription("SCP_OTHER");
  441 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins);
406 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); 442 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
407 } 443 }
408 444
409 protected void timeout(AbstractAF abstractAF, EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01) 445 protected void timeout(AbstractAF abstractAF, EC02Instance ec02Instance, String invoke, String eventType, String messageType, GlobalData e01)
410 { 446 {
411 AppLog.d("RETURN TIMEOUT BY PLATFORM"); 447 AppLog.d("RETURN TIMEOUT BY PLATFORM");
412 - this.type = Constant.TYPE_TIMEOUT;  
413 - this._resultCode = "null"; 448 + if(this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT||this._state == StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST){
  449 + this.type = Constant.TYPE_TIMEOUT;
  450 + }else{
  451 + this.type = Constant.TYPE_ERROR;
  452 + }
  453 + this._resultCode = "329";
414 LogError ins = new LogError("4", "Timeout"); 454 LogError ins = new LogError("4", "Timeout");
415 this._resultDescription = "Timeout"; 455 this._resultDescription = "Timeout";
  456 + ec02Instance.getAFInstance().setResultCode("329");
  457 + ec02Instance.getAFInstance().setResultDescription("SCP_TIMEOUT");
  458 + this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins);
416 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01); 459 this.buildResponeMsg(abstractAF, ec02Instance, invoke, eventType, messageType, ins, e01);
  460 +
417 } 461 }
418 462
419 private void detailLogInput(EC02Instance ec02Instance,String invoke, String eventType, String messageType, Object ins) 463 private void detailLogInput(EC02Instance ec02Instance,String invoke, String eventType, String messageType, Object ins)
@@ -481,9 +525,10 @@ public class WaitSubState implements IAFSubState { @@ -481,9 +525,10 @@ public class WaitSubState implements IAFSubState {
481 input.setType(TYPE.RES); 525 input.setType(TYPE.RES);
482 } 526 }
483 } 527 }
  528 + if(this.type!=Constant.TYPE_SUCCESS){
484 input.setJsonData(MessageParser.toJsonObject(ins)); 529 input.setJsonData(MessageParser.toJsonObject(ins));
  530 + }
485 input.setRawData(Global.getDetailLogRawData(rawData)); 531 input.setRawData(Global.getDetailLogRawData(rawData));
486 -  
487 if(responseTime != null) { 532 if(responseTime != null) {
488 input.setRespTime(Long.parseLong(responseTime)); 533 input.setRespTime(Long.parseLong(responseTime));
489 } 534 }
@@ -496,15 +541,54 @@ public class WaitSubState implements IAFSubState { @@ -496,15 +541,54 @@ public class WaitSubState implements IAFSubState {
496 } 541 }
497 } 542 }
498 543
499 - private void buildResponeMsg(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, Object ins, GlobalData e01)  
500 - {  
501 - this.detailLogInput(ec02Instance, invoke, eventType, messageType, ins);  
502 - // set error code  
503 - ec02Instance.getAFInstance().setResultCode(this._resultCode);  
504 - ec02Instance.getAFInstance().setResultDescription(this._resultDescription);  
505 -// String subState = StateConfig.getSubStateFromEventType(eventType);  
506 -// LogError insError = (LogError)ins;  
507 - ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); 544 + public void buildResponeMsg(AbstractAF abstractAF,EC02Instance ec02Instance, String invoke, String eventType, String messageType, Object ins, GlobalData e01)
  545 + {
  546 + AppLog.d("########buildResponeMsg########");
  547 + AppLog.d("########flow########:"+flow);
  548 + flow = ec02Instance.getAFInstance().getFlow();
  549 + switch (flow) {
  550 +
  551 + case Constant.FLOW_CHARGE_REQUEST:
  552 + {
  553 + ChargeResponseIns chargeResponseIns = new ChargeResponseIns();
  554 + switch (this.type) {
  555 + case Constant.TYPE_ERROR:
  556 + case Constant.TYPE_REJECT:
  557 + case Constant.TYPE_ABORT:
  558 + case Constant.TYPE_TIMEOUT:
  559 + {
  560 + chargeResponseIns.setResult(this._resultCode);
  561 + chargeResponseIns.setPrepaidsubscriberflag("1");
  562 + chargeResponseIns.setChargingID(ec02Instance.getAFInstance().getChargeId());
  563 + this._resultCode = null;
  564 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns);
  565 + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
  566 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  567 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  568 + break;
  569 + }
  570 + }
  571 + break;
  572 + }
  573 + case Constant.FLOW_CHARGE_REPORT:
  574 + ChargeReportIns chargeReportIns = new ChargeReportIns();
  575 + switch (this.type) {
  576 + case Constant.TYPE_ERROR:
  577 + case Constant.TYPE_REJECT:
  578 + case Constant.TYPE_ABORT:
  579 + case Constant.TYPE_TIMEOUT:
  580 + {
  581 + chargeReportIns.setResult(this._resultCode);
  582 + chargeReportIns.setPrepaidsubscriberflag("1");
  583 + this._resultCode = null;
  584 + String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns);
  585 + EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
  586 + this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
  587 + ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
  588 + break;
  589 + }
  590 + }
  591 + }
508 } 592 }
509 593
510 private void summaryLog(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) 594 private void summaryLog(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
@@ -526,7 +610,7 @@ public class WaitSubState implements IAFSubState { @@ -526,7 +610,7 @@ public class WaitSubState implements IAFSubState {
526 } 610 }
527 String node = Global.getNodeFromEventType(this._eventType); 611 String node = Global.getNodeFromEventType(this._eventType);
528 if (Log.debug) { 612 if (Log.debug) {
529 - AppLog.d("## SUMMARY:" + this.type + node + command + this._resultCode + this._resultDescription); 613 + //AppLog.d("## SUMMARY:" + this.type + node + command + this._resultCode + this._resultDescription);
530 } 614 }
531 615
532 if(this._resultDescription.equals(EQXMsg.EMPTY)) { 616 if(this._resultDescription.equals(EQXMsg.EMPTY)) {
src/th/co/ais/ssbsrfc/substate/ssss.java
@@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
1 -package th.co.ais.ssbsrfc.substate;  
2 -  
3 -public class ssss {  
4 -  
5 -}  
src/th/co/ais/ssbsrfc/utils/Global.java
@@ -35,8 +35,8 @@ public class Global @@ -35,8 +35,8 @@ public class Global
35 private static String outputTimeStamp = null; 35 private static String outputTimeStamp = null;
36 36
37 public static String inputTimeStamp = null; 37 public static String inputTimeStamp = null;
38 - public static String detailNameLog = null;  
39 - public static String summaryNameLog = null; 38 + public static String detailNameLog = "DETAIL";
  39 + public static String summaryNameLog = "SUMMARY";
40 public static boolean isUDR = false; 40 public static boolean isUDR = false;
41 public static boolean isDetail = true; 41 public static boolean isDetail = true;
42 public static boolean isDetailRawData = true; 42 public static boolean isDetailRawData = true;
@@ -45,7 +45,7 @@ public class Global @@ -45,7 +45,7 @@ public class Global
45 public static boolean isDetailScenario = true; 45 public static boolean isDetailScenario = true;
46 public static boolean isDetailCurrentState = true; 46 public static boolean isDetailCurrentState = true;
47 public static boolean isDetailNextState = true; 47 public static boolean isDetailNextState = true;
48 - public static boolean isSummary = false; 48 + public static boolean isSummary = true;
49 public static boolean isStat = true; 49 public static boolean isStat = true;
50 public static boolean isErrorLog = false; 50 public static boolean isErrorLog = false;
51 public static int detailLog = 0; 51 public static int detailLog = 0;
@@ -81,7 +81,10 @@ public class Global @@ -81,7 +81,10 @@ public class Global
81 81
82 public static void setNode() 82 public static void setNode()
83 { 83 {
84 - mapNode.put(StateConfig.Incoming_A_Request, Constant.nodeE01); 84 + mapNode.put(StateConfig.Incoming_ChargeRequest_Request, Constant.nodeOCSNew);
  85 + mapNode.put(StateConfig.Incoming_ChargeReport_Request, Constant.nodeOCSNew);
  86 + mapNode.put(StateConfig.Incoming_Adjustment_ChargeReport_Response, Constant.nodeOCSOld);
  87 + mapNode.put(StateConfig.Incoming_Adjustment_ChargeRequest_Response, Constant.nodeOCSOld);
85 } 88 }
86 89
87 public static String getFlowName(int flow) { 90 public static String getFlowName(int flow) {
@@ -94,7 +97,8 @@ public class Global @@ -94,7 +97,8 @@ public class Global
94 97
95 public static void setFlow() { 98 public static void setFlow() {
96 //flow #1 99 //flow #1
97 - mapFlow.put(Constant.FLOW_TEST_A, "TEST A"); 100 + mapFlow.put(Constant.FLOW_CHARGE_REQUEST, "CHARGE_REQUEST");
  101 + mapFlow.put(Constant.FLOW_CHARGE_REPORT, "CHARGE_REPORT");
98 } 102 }
99 103
100 public static void setOpenRawData(boolean isOpenRawData) { 104 public static void setOpenRawData(boolean isOpenRawData) {
src/th/co/ais/ssbsrfc/utils/Log.java
@@ -4,6 +4,12 @@ import java.util.ArrayList; @@ -4,6 +4,12 @@ import java.util.ArrayList;
4 import java.util.Calendar; 4 import java.util.Calendar;
5 import java.util.List; 5 import java.util.List;
6 6
  7 +import ais.mmt.sand.comlog.DetailsLogPrototype;
  8 +import ais.mmt.sand.comlog.SummaryLogPrototype;
  9 +import ais.mmt.sand.comlog.exception.CommonLogException;
  10 +import ec02.af.abstracts.AbstractAF;
  11 +import ec02.af.data.EquinoxRawData;
  12 +import ec02.utils.AppLog;
7 import th.co.ais.ssbsrfc.config.Constant; 13 import th.co.ais.ssbsrfc.config.Constant;
8 import th.co.ais.ssbsrfc.config.Invoke; 14 import th.co.ais.ssbsrfc.config.Invoke;
9 import th.co.ais.ssbsrfc.config.State; 15 import th.co.ais.ssbsrfc.config.State;
@@ -11,17 +17,10 @@ import th.co.ais.ssbsrfc.config.StateConfig; @@ -11,17 +17,10 @@ import th.co.ais.ssbsrfc.config.StateConfig;
11 import th.co.ais.ssbsrfc.instance.EC02Instance; 17 import th.co.ais.ssbsrfc.instance.EC02Instance;
12 import th.co.ais.ssbsrfc.instance.Stat; 18 import th.co.ais.ssbsrfc.instance.Stat;
13 import th.co.ais.ssbsrfc.interfaces.EQXMsg; 19 import th.co.ais.ssbsrfc.interfaces.EQXMsg;
14 -import th.co.ais.ssbsrfc.message.MessageParser;  
15 -import ais.mmt.sand.comlog.DetailsLogPrototype;  
16 -import ais.mmt.sand.comlog.SummaryLogPrototype;  
17 -import ais.mmt.sand.comlog.exception.CommonLogException;  
18 -import ec02.af.abstracts.AbstractAF;  
19 -import ec02.af.data.EquinoxRawData;  
20 -import ec02.utils.AppLog;  
21 20
22 public class Log { 21 public class Log {
23 22
24 - public static boolean debug = false; 23 + public static boolean debug = true;
25 24
26 public static void results(EC02Instance ec02Instance, String currentSubState, List<EquinoxRawData> equinoxRawDataList, int type, boolean isStat) { 25 public static void results(EC02Instance ec02Instance, String currentSubState, List<EquinoxRawData> equinoxRawDataList, int type, boolean isStat) {
27 int idx = StateConfig.getSubStateIndex(currentSubState); 26 int idx = StateConfig.getSubStateIndex(currentSubState);
@@ -103,7 +102,7 @@ public class Log { @@ -103,7 +102,7 @@ public class Log {
103 } 102 }
104 catch (Exception e) { 103 catch (Exception e) {
105 if (Log.debug) { 104 if (Log.debug) {
106 - AppLog.d("## ERROR STAT:" + e.getMessage()); 105 + //AppLog.d("## ERROR STAT:" + e.getMessage());
107 } 106 }
108 } 107 }
109 108
@@ -136,11 +135,11 @@ public class Log { @@ -136,11 +135,11 @@ public class Log {
136 AppLog.d("## CST_(" + flow + ":LISTSTAT): " + name); 135 AppLog.d("## CST_(" + flow + ":LISTSTAT): " + name);
137 } 136 }
138 } else { 137 } else {
139 - name = nameLog; 138 + /*name = nameLog;
140 abstractAF.getUtils().incrementStats(name); 139 abstractAF.getUtils().incrementStats(name);
141 if (Log.debug) { 140 if (Log.debug) {
142 AppLog.d("## CST_(" + flow + ":LISTSTAT): " + name); 141 AppLog.d("## CST_(" + flow + ":LISTSTAT): " + name);
143 - } 142 + }*/
144 } 143 }
145 } 144 }
146 } 145 }
@@ -154,7 +153,6 @@ public class Log { @@ -154,7 +153,6 @@ public class Log {
154 153
155 public static void summaryLog(EC02Instance ec02Instance, AbstractAF abstractAF) 154 public static void summaryLog(EC02Instance ec02Instance, AbstractAF abstractAF)
156 { 155 {
157 - Log.dev("" + Global.isWriteSummary);  
158 if (Global.isSummary && (ec02Instance.getAFInstance().getCurrentState().equals(StateConfig.SSTATE_END) || Global.isWriteSummary)) 156 if (Global.isSummary && (ec02Instance.getAFInstance().getCurrentState().equals(StateConfig.SSTATE_END) || Global.isWriteSummary))
159 { 157 {
160 int flow = ec02Instance.getAFInstance().getFlow(); 158 int flow = ec02Instance.getAFInstance().getFlow();
@@ -162,7 +160,7 @@ public class Log { @@ -162,7 +160,7 @@ public class Log {
162 String session = abstractAF.getEquinoxProperties().getSession(); 160 String session = abstractAF.getEquinoxProperties().getSession();
163 String commandName = EQXMsg.EMPTY; 161 String commandName = EQXMsg.EMPTY;
164 String initialInvoke = ec02Instance.getAFInstance().getInitialInvoke(); 162 String initialInvoke = ec02Instance.getAFInstance().getInitialInvoke();
165 - String identity = Log.getIdentity(ec02Instance, abstractAF); 163 + String identity = ec02Instance.getAFInstance().getMs();
166 String resultCode = ec02Instance.getAFInstance().getResultCode(); 164 String resultCode = ec02Instance.getAFInstance().getResultCode();
167 String resultDescription = ec02Instance.getAFInstance().getResultDescription(); 165 String resultDescription = ec02Instance.getAFInstance().getResultDescription();
168 long responseTimestamp = System.currentTimeMillis(); 166 long responseTimestamp = System.currentTimeMillis();
@@ -204,7 +202,7 @@ public class Log { @@ -204,7 +202,7 @@ public class Log {
204 String identity = ""; 202 String identity = "";
205 int flow = ec02Instance.getAFInstance().getFlow(); 203 int flow = ec02Instance.getAFInstance().getFlow();
206 switch (flow) { 204 switch (flow) {
207 - case Constant.FLOW_TEST_A: 205 + case Constant.FLOW_INGW_CMF:
208 break; 206 break;
209 } 207 }
210 208
@@ -286,8 +284,8 @@ public class Log { @@ -286,8 +284,8 @@ public class Log {
286 Log.dev(" arrOutput count:" + arrOutput.size()); 284 Log.dev(" arrOutput count:" + arrOutput.size());
287 } 285 }
288 286
289 - String identity = session;  
290 - switch (flow) { 287 + String identity = ec02Instance.getAFInstance().getMs();
  288 + /*switch (flow) {
291 case Constant.FLOW_TEST_A: 289 case Constant.FLOW_TEST_A:
292 identity = "MIS"; 290 identity = "MIS";
293 if(session.matches("66\\d{9}")) { 291 if(session.matches("66\\d{9}")) {
@@ -297,7 +295,7 @@ public class Log { @@ -297,7 +295,7 @@ public class Log {
297 default: 295 default:
298 identity = session; 296 identity = session;
299 break; 297 break;
300 - } 298 + }*/
301 299
302 String message = ""; 300 String message = "";
303 DetailsLogPrototype detLog = ec02Instance.getAFInstance().getDetaillog(); 301 DetailsLogPrototype detLog = ec02Instance.getAFInstance().getDetaillog();
@@ -307,7 +305,6 @@ public class Log { @@ -307,7 +305,6 @@ public class Log {
307 detLog.setInputTimestamp(lInputTimeStamp); 305 detLog.setInputTimestamp(lInputTimeStamp);
308 detLog.addScenario(scenario, initialInvoke, currentState + "." + ec02Instance.getAFInstance().getPreviousState(), nextState + "." + ec02Instance.getAFInstance().getCurrentState()); 306 detLog.addScenario(scenario, initialInvoke, currentState + "." + ec02Instance.getAFInstance().getPreviousState(), nextState + "." + ec02Instance.getAFInstance().getCurrentState());
309 detLog.setOutputTimestamp(lOutputTimeStamp); 307 detLog.setOutputTimestamp(lOutputTimeStamp);
310 -  
311 detLog.setEnableData(Global.isDetailData); 308 detLog.setEnableData(Global.isDetailData);
312 detLog.setEnableRawData(Global.isDetailRawData); 309 detLog.setEnableRawData(Global.isDetailRawData);
313 detLog.setEnableScenario(Global.isDetailScenario); 310 detLog.setEnableScenario(Global.isDetailScenario);
@@ -335,7 +332,7 @@ public class Log { @@ -335,7 +332,7 @@ public class Log {
335 332
336 public static void dev(String message) { 333 public static void dev(String message) {
337 if (debug) { 334 if (debug) {
338 - AppLog.d("#dev# :" + message); 335 + //AppLog.d("#dev# :" + message);
339 } 336 }
340 } 337 }
341 } 338 }