Commit 71dfc042 authored by steurwadkar's avatar steurwadkar

F17ABAS001 GST source code commit for new token

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@171393 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 31979a05
......@@ -80,10 +80,12 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
private String clientSecret = "";
private String fileDownloadDir = "";
private String saveFilePath = "";
private String gspTokenTimeStampFormat = "";
AESEncryption aesEncryption = null;
PubKeyEncryption pubKeyEncryption = null;
GSPSignature gspSignature;
PrivateKey aspPrivateKey = null;
SimpleDateFormat gspTokenTimeFormatter = null;
GSTCommonUtil gstCommonUtil = new GSTCommonUtil();
E12GenericUtility e12GenericUtility = new E12GenericUtility();
......@@ -114,6 +116,8 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
clientId = finCommon.getFinparams("999999", "GST_CLIENT_ID", conn);
clientSecret = finCommon.getFinparams("999999", "GST_CLIENT_SECRET", conn);
fileDownloadDir = finCommon.getFinparams("999999", "GST_DOWNLOAD_DIR", conn);
gspTokenTimeStampFormat = finCommon.getFinparams("999999", "GSP_TKN_TIMSTMP_FRMT", conn);
gspTokenTimeFormatter = new SimpleDateFormat(gspTokenTimeStampFormat);
aesEncryption = new AESEncryption();
pubKeyEncryption = new PubKeyEncryption(pubKeyInpStream);
ipAddress = sc.next();
......@@ -354,7 +358,6 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
String otp = "", transactionId = "", authToken = "", sek = "", retXML = "", errorXML = "", errMsg = "", returnType = "", action = "";
String gspAuthString = "", gspAuthSignature = "";
long timeStamp = new Timestamp().getDateTime();
byte[] authSEK = null;
String loginCode = "", chgTerm = "", callStatus = "", responseId = "", responseJsonStr= "", recType = "";
String signDataXML = "", summaryDataJsonStr = "";
......@@ -449,7 +452,10 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
transactionId = UUID.randomUUID().toString().replaceAll("-", "");
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo + ":" + "AUTHTOKEN";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
otp = checkNull(e12GenericUtility.getColumnValue("otp", dom1));
......@@ -1183,7 +1189,6 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
String userName = "", stateCode = "", gspAuthString = "", gspAuthSignature = "", gstinNo = "", periodCode = "", siteCode = "", recType = "", recordType = "";
String responseId = "", responseJsonStr = "", callStatus = "";
String transactionId = UUID.randomUUID().toString().replaceAll("-", "");
long timeStamp = new Timestamp().getDateTime();
if("NULLFOUND".equalsIgnoreCase(clientId) || "NULLFOUND".equalsIgnoreCase(clientSecret))
{
......@@ -1580,7 +1585,10 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
if(!isDataError)
{
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo + ":" + "OTPREQUEST";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
JSONObject otpRequest = new JSONObject();
......@@ -1837,11 +1845,14 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
if(byPassSectionList != null && !byPassSectionList.contains(action))
{
long timeStamp = new Timestamp().getDateTime();
//long timeStamp = new Timestamp().getDateTime();
System.out.println("calling for ["+action+"]");
String transactionId = UUID.randomUUID().toString().replaceAll("-", "");
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo + ":" + action;
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest getDataReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR1_URL))
......@@ -2031,11 +2042,14 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
{
if(byPassSectionList != null && !byPassSectionList.contains(action))
{
long timeStamp = new Timestamp().getDateTime();
//long timeStamp = new Timestamp().getDateTime();
System.out.println("calling for ["+action+"]");
String transactionId = UUID.randomUUID().toString().replaceAll("-", "");
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstinNo + ":" + action;
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest getDataReq = Unirest.get(String.format("%s%s", BASE_API_URL,GSTR2_URL))
......@@ -2225,8 +2239,11 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSUM";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest getGstr1SumryReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR1_URL))
......@@ -2343,8 +2360,11 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSUM";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest getGstr2SumryReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR2_URL))
......@@ -2461,8 +2481,11 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSUM";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest getGstr3bSumryReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR3B_URL))
......@@ -3058,8 +3081,11 @@ public class GSTDataSubmitWizEJB extends ValidatorEJB implements GSTDataSubmitWi
}
transactionId = UUID.randomUUID().toString().replaceAll("-", "");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "FILEDET";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest fileDetailsReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR_RETSTAT_URL))
......
......@@ -15,6 +15,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Calendar;
......@@ -127,12 +128,14 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
private String fileDownloadDir = "";
private String saveFilePath = "";
private String gstDateFormat = "";
private String gspTokenTimeStampFormat = "";
AESEncryption aesEncryption = null;
PubKeyEncryption pubKeyEncryption = null;
Connection conn = null;
GSPSignature gspSignature;
PrivateKey aspPrivateKey = null;
SimpleDateFormat gspTokenTimeFormatter = null;
E12GenericUtility e12GenericUtility = new E12GenericUtility();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
......@@ -163,6 +166,8 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
clientId = finCommon.getFinparams("999999", "GST_CLIENT_ID", conn);
clientSecret = finCommon.getFinparams("999999", "GST_CLIENT_SECRET", conn);
fileDownloadDir = finCommon.getFinparams("999999", "GST_DOWNLOAD_DIR", conn);
gspTokenTimeStampFormat = finCommon.getFinparams("999999", "GSP_TKN_TIMSTMP_FRMT", conn);
gspTokenTimeFormatter = new SimpleDateFormat(gspTokenTimeStampFormat);
aesEncryption = new AESEncryption();
pubKeyEncryption = new PubKeyEncryption(pubKeyInpStream);
ipAddress = sc.next();
......@@ -425,8 +430,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
authTokenReqObj.put("app_key", appKeyEncryptedAndCoded);
authTokenReqObj.put("otp", encryptedOTP);
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "AUTHTOKEN";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest authTokenReq = Unirest.post(String.format("%s%s", BASE_API_URL, AUTH_TOKEN_URL))
......@@ -2658,8 +2666,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
reqBody.put("data", encryptedPayload);
reqBody.put("hmac", new String(Base64.getEncoder().encode(resBuf)));
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSUBMIT";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest gstrSubmitReq = Unirest.post(String.format("%s%s", BASE_API_URL, RETURN_URL))
......@@ -2792,8 +2803,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETFILE";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
byte[] jsonBase64 = Base64.getEncoder().encode(summaryData.toString().getBytes());
......@@ -2930,8 +2944,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
transactionId = UUID.randomUUID().toString().replaceAll("-", "");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSAVE";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
byte[] jsonBase64 = Base64.getEncoder().encode(jsonPayload.getBytes());
......@@ -3462,8 +3479,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
if(byPassSectionList != null && !byPassSectionList.contains(action))
{
System.out.println("calling for ["+action+"]");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + action;
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest getGstr2InvoicesReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR2A_URL))
......@@ -4367,8 +4387,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
transactionId = UUID.randomUUID().toString().replaceAll("-", "");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "GENERATE";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest generateGSTR3Req = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR3_URL))
......@@ -4519,8 +4542,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
}
transactionId = UUID.randomUUID().toString().replaceAll("-", "");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "FILEDET";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest fileDetailsReq = Unirest.get(String.format("%s%s", BASE_API_URL, GSTR_RETSTAT_URL))
......@@ -5589,8 +5615,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
reqBody.put("data", encryptedPayload);
reqBody.put("hmac", new String(Base64.getEncoder().encode(resBuf)));
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSUBMIT";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
HttpRequest gstr3bSubmitReq = Unirest.post(String.format("%s%s", BASE_API_URL, GSTR3B_URL))
......@@ -5702,8 +5731,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
loginCode = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "loginCode");
chgTerm = e12GenericUtility.getValueFromXTRA_PARAMS(xtraParams, "chgTerm");
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETFILE";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
byte[] jsonBase64 = Base64.getEncoder().encode(summaryData.toString().getBytes());
......@@ -7272,8 +7304,11 @@ public class GSTDataSubmitWizPos extends ValidatorEJB implements GSTDataSubmitWi
gstr1HeaderObj.put("data", encryptedPayload);
gstr1HeaderObj.put("hmac", new String(Base64.getEncoder().encode(resBuf)));
long timeStamp = new Timestamp().getDateTime();
gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
//Changed by Santosh on 03/10/2017 as per new GSP token format
//long timeStamp = new Timestamp().getDateTime();
//gspAuthString = clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin;
String timeStamp = gspTokenTimeFormatter.format(new Date());
gspAuthString = "v2.0::"+clientId + ":" + transactionId + ":" + timeStamp + ":" + gstin + ":" + "RETSAVE";
gspAuthSignature = gspSignature.sign(gspAuthString, aspPrivateKey);
Date startTime = new Date();
......
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