SubWaitAdjustmentChargeReportResponse.java
7.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
package th.co.ais.ssbsrfc.substate;
import javax.xml.bind.JAXBException;
import javax.xml.stream.XMLStreamException;
import ec02.af.abstracts.AbstractAF;
import ec02.af.data.EquinoxRawData;
import ec02.utils.AppLog;
import th.co.ais.ssbsrfc.config.Constant;
import th.co.ais.ssbsrfc.config.StateConfig;
import th.co.ais.ssbsrfc.instance.AdjustmentRequestRes;
import th.co.ais.ssbsrfc.instance.AdjustmentResponseIns;
import th.co.ais.ssbsrfc.instance.ChargeReportIns;
import th.co.ais.ssbsrfc.instance.EC02Instance;
import th.co.ais.ssbsrfc.instance.EQXRawInstance;
import th.co.ais.ssbsrfc.instance.ResultHeader;
import th.co.ais.ssbsrfc.instance.Stat;
import th.co.ais.ssbsrfc.message.MessageParser;
import th.co.ais.ssbsrfc.utils.EqxStringUtils;
import th.co.ais.ssbsrfc.utils.Global;
public class SubWaitAdjustmentChargeReportResponse extends WaitSubState {
private ResultHeader res = new ResultHeader();
private AdjustmentRequestRes adj = new AdjustmentRequestRes();
private AdjustmentResponseIns adjustresponse = new AdjustmentResponseIns();
private ChargeReportIns chargeReportIns = new ChargeReportIns();
public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
{
this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREPORT;
this._eventType = StateConfig.Incoming_Adjustment_ChargeReport_Response;
this._stateType = Constant.SUBSTATE_TYPE_W_RESPONSE;
}
public Object getMessage(EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
{
String value = EqxStringUtils.getMessage(equinoxRawData, ec02Instance);
AppLog.d("## PARAMETERS : " + value);
try {
res = (ResultHeader) MessageParser.formsoapResultHeader(value);
adj = (AdjustmentRequestRes) MessageParser.formsoapAdjust(value);
} catch (XMLStreamException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
adjustresponse.setResultHeader(res);
adjustresponse.setAdjustmentResult(adj);
ec02Instance.getAFInstance().setAdjustmentResponseIns(adjustresponse);
this._resultCode = "000";
chargeReportIns.setResult(this._resultCode);
chargeReportIns.setPrepaidsubscriberflag("1");
return chargeReportIns;
}
public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
{
this.type = Constant.TYPE_SUCCESS;
this._resultDescription = "SUCCESS";
if(null==res.getVersion()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(res.getVersion())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==res.getResultCode()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(res.getResultCode())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==res.getResultDesc()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(res.getResultDesc())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==adj.getAcctKey()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(adj.getAcctKey())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==adj.getAdjustmentInfo().get(0).getBalanceType()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(adj.getAdjustmentInfo().get(0).getBalanceType())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==adj.getAdjustmentInfo().get(0).getOldBalanceAmt()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(adj.getAdjustmentInfo().get(0).getOldBalanceAmt())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==adj.getAdjustmentInfo().get(0).getNewBalanceAmt()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(adj.getAdjustmentInfo().get(0).getNewBalanceAmt())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
if(null==adj.getAdjustmentInfo().get(0).getCurrencyID()){
this.type = Constant.TYPE_INVALID;
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
this._resultDescription = "INCOMPLETE_DATA";
this._resultCode="322";
}
if("".equals(adj.getAdjustmentInfo().get(0).getCurrencyID())){
this.type = Constant.TYPE_INVALID;
this._resultCode="322";
this._resultDescription = "INCOMPLETE_DATA";
AppLog.d("## VERIFY(PARAMETER) :INVALID PARAMETER");
AppLog.d("ssid:"+"null");
}
}
public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData)
{
switch (this.type) {
case Constant.TYPE_INVALID:
{
chargeReportIns.setResult(this._resultCode);
ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT"));
String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns);
EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
ec02Instance.getAFInstance().setResultCode(this._resultCode);
ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
break;
}
case Constant.TYPE_SUCCESS:
default:
{
chargeReportIns.setResult(this._resultCode);
ec02Instance.getAFInstance().setResultCode(this._resultCode);
ec02Instance.getAFInstance().setResultDescription(this._resultDescription);
// this.isStat = false;
ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + "Adjustment STAT"));
String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeReportIns);
ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END);
EQXRawInstance eqxRaw = SubMessages.getRawChargeReportResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message);
this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw));
}
}
}
}