Commit 5e060c4d authored by steurwadkar's avatar steurwadkar

F17ABAS001 source code commit


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@106134 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 2dca37c7
......@@ -11,7 +11,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
......@@ -21,9 +20,6 @@ import java.util.UUID;
import javax.annotation.PostConstruct;
import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.macs.HMac;
import org.bouncycastle.crypto.params.KeyParameter;
import org.json.JSONObject;
import org.json.XML;
import org.w3c.dom.Document;
......@@ -464,7 +460,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
valueXmlString.append("<Detail2 domID='1'>");
valueXmlString.append("<auth_token><![CDATA["+ authToken +"]]></auth_token>");
valueXmlString.append("<auth_sek><![CDATA["+ authSEK +"]]></auth_sek>");
valueXmlString.append("<auth_sek><![CDATA["+ sek +"]]></auth_sek>");
valueXmlString.append("</Detail2>" );
valueXmlString.append("<Detail2 domID='2'>");
valueXmlString.append(retXML);
......@@ -674,20 +670,6 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
rs.close();
rs = null;
}
/*sql = "SELECT COUNT(1) AS CNT FROM GST_DATA_HDR WHERE REC_TYPE = '1' AND SUBMIT_STATUS = 'P' AND PRD_CODE = ? AND SITE_CODE = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, periodCode);
pstmt.setString(2, loginSiteCode);
rs = pstmt.executeQuery();
if(rs.next())
{
if(rs.getInt("CNT") > 0)
{
errList.add( "VTRECSAPEN" );
errFields.add("returns_type");
}
}*/
}
}
break;
......@@ -878,7 +860,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
System.out.println("GSTDataSubmitWizEJB.handleRequest()["+e.getMessage()+"]");
e.printStackTrace();
throw new ITMException(e);
retResponseXML = "<root><message><![CDATA[Message : Error occured!]]></message></root>";
}
finally
{
......@@ -916,7 +898,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpResponse<JsonNode> getDataResp = Unirest.get(String.format("%s%s", GSP_API_URL,GSTR1_URL_V2))//TODO need to change URL to v0.3
HttpResponse<JsonNode> getDataResp = Unirest.get(String.format("%s%s", GSP_API_URL,GSTR1_URL_V3))
.queryString("action", action)
.queryString("gstin", gstinNo)
.queryString("ret_period", periodCode)
......@@ -1049,7 +1031,7 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpResponse<JsonNode> getGstr1SumryResp = Unirest.get(String.format("%s%s", GSP_API_URL, GSTR1_URL_V2))//TODO need to change with version 0.3
HttpResponse<JsonNode> getGstr1SumryResp = Unirest.get(String.format("%s%s", GSP_API_URL, GSTR1_URL_V3))
.queryString("action","RETSUM")
.queryString("gstin", gstin)
.queryString("ret_period", periodCode)
......
......@@ -273,29 +273,46 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
}
detail2NList = allXMLDom.getElementsByTagName("Detail2");
System.out.println("returnsType["+returnsType+"] action ["+action+"]");
for(int i=0; i<detail2NList.getLength(); i++)
if("SUBMIT".equalsIgnoreCase(action))
{
Node eachDetail2Node = detail2NList.item(i);
System.out.println("560101.domId["+eachDetail2Node.getAttributes().getNamedItem("domID")+"]");
detail2ChildNList = eachDetail2Node.getChildNodes();
detail2NList = allXMLDom.getElementsByTagName("Detail2");
detail2ChildNList = detail2NList.item(0).getChildNodes();
for(int j=0; j<detail1ChildNList.getLength();j++)
for(int i=0; i<detail2ChildNList.getLength();i++)
{
Node eachDetail2Element = detail2ChildNList.item(j);
Node eachDetail2Element = detail2ChildNList.item(i);
nodeName = eachDetail2Element.getNodeName();
if(!"#text".equalsIgnoreCase(nodeName) && !"attribute".equals(nodeName))
{
if("auth_token".equalsIgnoreCase(nodeName))
{
authToken = eachDetail2Element.getTextContent();
}
else if("auth_sek".equalsIgnoreCase(nodeName))
{
sek = eachDetail2Element.getTextContent();
}
}
}
System.out.println("returnsType["+returnsType+"] action ["+action+"]");
System.out.println("authToken["+authToken+"] sek["+sek+"]");
}
appKeyInBytes = aesEncryption.decodeBase64StringTOByte(appKey);
appKeyEncryptedAndCoded = pubKeyEncryption.encrypt(appKeyInBytes);
if(authToken.trim().length() > 0 && sek.trim().length() > 0)
{
System.out.println("authToken and authSEK from detail2");
authSEK = aesEncryption.decrypt(sek, appKeyInBytes);
System.out.println("AuthSEK = "+ aesEncryption.encodeBase64String(authSEK));
}
else
{
String encryptedOTP = aesEncryption.encryptEK(otp.getBytes(), appKeyInBytes);
JSONObject authTokenReq = new JSONObject();
......@@ -333,28 +350,6 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
authSEK = aesEncryption.decrypt(sek, appKeyInBytes);
System.out.println("AuthSEK = "+ aesEncryption.encodeBase64String(authSEK));
if("GSTR1".equalsIgnoreCase(returnsType))
{
if("SAVE".equalsIgnoreCase(action))
{
retString = saveGstr1(authToken, siteCode, stateCode, userName, gstin, periodCode, grossTurnover, authSEK, conn);
}
else if ("RETSUM".equalsIgnoreCase(action) || "FILE".equalsIgnoreCase(action))
{
retString = getGstr1Summary(authToken, stateCode, userName, gstin, periodCode, authSEK, action, conn);
}
else if ("SUBMIT".equalsIgnoreCase(action))
{
retString = submitGstr1(authToken, stateCode, userName, gstin, periodCode, authSEK, conn);
}
}
else if("GSTR2".equalsIgnoreCase(returnsType))
{
if("GETINV".equalsIgnoreCase(action))
{
retString = getGstr2Invoices(authToken, stateCode, userName, gstin, periodCode, siteCode, authSEK, conn);
}
}
}
else
{
......@@ -378,6 +373,30 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
retString = getError(errMsg, "GSTAPIERR", conn);
}
}
if("GSTR1".equalsIgnoreCase(returnsType))
{
if("SAVE".equalsIgnoreCase(action))
{
retString = saveGstr1(authToken, siteCode, stateCode, userName, gstin, periodCode, grossTurnover, authSEK, conn);
}
else if ("RETSUM".equalsIgnoreCase(action) || "FILE".equalsIgnoreCase(action))
{
retString = getGstr1Summary(authToken, stateCode, userName, gstin, periodCode, authSEK, action, conn);
}
else if ("SUBMIT".equalsIgnoreCase(action))
{
retString = submitGstr1(authToken, stateCode, userName, gstin, periodCode, authSEK, conn);
}
}
else if("GSTR2".equalsIgnoreCase(returnsType))
{
if("GETINV".equalsIgnoreCase(action))
{
retString = getGstr2Invoices(authToken, stateCode, userName, gstin, periodCode, siteCode, authSEK, conn);
}
}
}
catch(Exception e)
{
System.out.println("GSTDataSubmitWizPos.postSave()["+e.getMessage()+"]");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment