package th.co.ais.ssbsrfc.substate; import java.io.Reader; import java.io.StringReader; import javax.xml.bind.JAXBException; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; 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.AdjustmentResponseIns; import th.co.ais.ssbsrfc.instance.ChargeResponseIns; import th.co.ais.ssbsrfc.instance.EC02Instance; import th.co.ais.ssbsrfc.instance.EQXRawInstance; import th.co.ais.ssbsrfc.message.MessageParser; import th.co.ais.ssbsrfc.utils.EqxStringUtils; public class SubWaitAdjustmentChargeRequestResponse extends WaitSubState { private ChargeResponseIns chargeResponseIns = new ChargeResponseIns(); public void configSubstate(EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { this._state = StateConfig.SSTATE_W_ADJUSTMENT_CHARGEREQUEST; this._eventType = StateConfig.Incoming_Adjustment_ChargeRequest_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); AdjustmentResponseIns ins=null; try { ins = (AdjustmentResponseIns) MessageParser.formsoap(value); } catch (XMLStreamException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); } AppLog.d("MsgLanguageCode:"+ins.getMsgLanguageCode()); chargeResponseIns.setResult("000"); chargeResponseIns.setdesc("SUCCESS"); chargeResponseIns.setChargingID("50928192340800649741"); chargeResponseIns.setPrepaidsubscriberflag("1"); return chargeResponseIns; } public void verifyMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { this.type = Constant.TYPE_SUCCESS; } public void buildMessage(AbstractAF abstractAF, EC02Instance ec02Instance, EquinoxRawData equinoxRawData) { switch (this.type) { case Constant.TYPE_SUCCESS: default: { // this.isStat = false; // ec02Instance.getAFInstance().getListStat().add(new Stat(StateConfig.PROJECT_STAT_NAME + " ABCDEFG STAT")); String message = th.co.ais.ssbsrfc.message.MessageParser.toXml(chargeResponseIns); ec02Instance.getAFInstance().setCurrentState(StateConfig.SSTATE_END); EQXRawInstance eqxRaw = SubMessages.getRawChargeRequestResponse(abstractAF, ec02Instance, ec02Instance.getAFInstance().getOrig(), ec02Instance.getAFInstance().getInvoke(),message); this.equinoxRawDataList.add(this.ec02Builder.getHTTPResponse(eqxRaw)); } } } }