Commit d8d76c02 authored by spawar's avatar spawar

Added changes for check payment gateway response status.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@103484 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 907a5a3c
......@@ -113,7 +113,7 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//ReceiptAdvConfLocal receiptAdvConfLocal = null;
//Changes by Dadaso pawar on [24/02/15] (Confirmed dispatch) [End]
//Changed By Samadhan on 15/07/2015 D15CKAT015
String ptcnPalletNo = "",tokenInfo = "";
String ptcnPalletNo = "",tokenInfo = "",paymentGatewayStatus="";
//Added by Santosh on 01-04-2016 for Exchange rate [Start]
String finCurrCode = "", exchRate = "", finEntity1 = "";
FinCommon finCommon = new FinCommon();
......@@ -416,10 +416,17 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
{
modName = "W_SAGEPAY";
//segPayStatus = authoriseSagePay(ptcn, conn);
//Changed By Samadhan on 27/09/2016 for status checking start
//Changed by manish to check token_info is present or not on 09/03/16 [start]
//if(tokenInfo == null || tokenInfo.trim().length() == 0 ||( tokenInfo != null && tokenInfo.indexOf("OK") < -1) )
if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && tokenInfo.indexOf("OK") == -1) )
{
//if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && tokenInfo.indexOf("OK") == -1) )
if(tokenInfo != null && checkNull(tokenInfo).trim().length() > 0)
{
paymentGatewayStatus = checkNull(genericUtility.getColumnValue("STATUS", genericUtility.parseString(tokenInfo)));
}
if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && !paymentGatewayStatus.equalsIgnoreCase("OK")) )
{
//Changed By Samadhan on 27/09/2016 for status checking end
long startTime5 = System.currentTimeMillis();
System.out.println("START TIME ON SEGPAY AUTHORIZATION CONFIRM IN SECONDS:::["+startTime5/1000+"]");
......@@ -431,17 +438,27 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
segPayStatus = segPayStatus == null ? "" : segPayStatus.trim();
System.out.println("segPayStatus@@------->>["+segPayStatus+"]");
//Changed By Samadhan on 27/09/2016 for status checking start.
tokenInfo = getSagePayTokenInfo(segPayStatus);
paymentGatewayStatus = "";
paymentGatewayStatus = checkNull(genericUtility.getColumnValue("STATUS", genericUtility.parseString(tokenInfo)));
// Changed by Sneha on 12-09-2016, to check the failed status for segpay [Start]
//if(segPayStatus.indexOf("INVALID") > 0)
if(segPayStatus.indexOf("INVALID") > 0 || segPayStatus.indexOf("Declined") > 0)
//if(segPayStatus.indexOf("INVALID") > 0 || segPayStatus.indexOf("Declined") > 0)
// Changed by Sneha on 12-09-2016, to check the failed status for segpay [End]
if(paymentGatewayStatus.equalsIgnoreCase("INVALID") || segPayStatus.equalsIgnoreCase("Declined"))
//Changed By Samadhan on 27/09/2016 for status checking end.
{
isError = true;
System.out.println("Sage Payment not successfully done....................");
throw new Exception("Invalid Sage Payment.....["+segPayStatus+"]");
}
else if(segPayStatus.indexOf("OK") > 0)
//Changed By Samadhan on 27/09/2016 for status checking
//else if(segPayStatus.indexOf("OK") > 0)
else if(paymentGatewayStatus.equalsIgnoreCase("OK"))
{
isReceiptGen = true ;
......@@ -464,9 +481,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
//String specReason = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", despId, currCode); //Commented by Dadaso pawar on 20/08/15
// tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
//Changed by Samadhan on 27/09/2016 for status checking.
// Changed by Manish on 15-04-2016 to getting token info [Start]
tokenInfo = getSagePayTokenInfo(segPayStatus);
//tokenInfo = getSagePayTokenInfo(segPayStatus);
// Changed by Manish on 15-04-2016 to getting token info, [end]
updateDespatch(despId,tokenInfo, tranIdRcp, null);
......@@ -494,11 +511,13 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
String vps = "";
//Changed By Samadhan on 27/09/2016 for status checking start
// Changed by Sneha on 16-03-2016, checking value from isReceiptGeneration [Start]
//if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("OK") > 0)
if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("OK") > 0 && receiptCount <= 0)
// Changed by Sneha on 16-03-2016, calling isReceiptGeneration method [End]
//if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("OK") > 0 && receiptCount <= 0)
// Changed by Sneha on 16-03-2016, calling isReceiptGeneration method [End]
if(tokenInfo != null && tokenInfo.length() > 0 && paymentGatewayStatus.equalsIgnoreCase("OK") && receiptCount <= 0)
//Changed By Samadhan on 27/09/2016 for status checking end
{
System.out.println("inside if block when token info is correct for sagepay");
isReceiptGen = true ;
......@@ -544,20 +563,35 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
try
{
//payPalStatus = authorizePayPal(ptcn, conn);
//Changed By Samadhan on 27/09/2016 for status checking start
//Changed by manish to check token_info is present or not on 09/03/16 [start]
//if(tokenInfo == null || tokenInfo.trim().length() == 0)
if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && tokenInfo.indexOf("Success") == -1) )
//if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && tokenInfo.indexOf("Success") == -1) )
if(tokenInfo != null && checkNull(tokenInfo).trim().length() > 0)
{
paymentGatewayStatus = checkNull(genericUtility.getColumnValue("ACK", genericUtility.parseString(tokenInfo)));
}
if(tokenInfo == null || tokenInfo.trim().length() == 0 || ( tokenInfo != null && !paymentGatewayStatus.equalsIgnoreCase("Success")))
{
//Changed By Samadhan on 27/09/2016 for status checking end
payPalStatus = authorizePayPal(ptcn, conn);
payPalStatus = payPalStatus == null ? "" : payPalStatus.trim();
System.out.println("payPalStatus@@------->>["+payPalStatus+"]");
if(payPalStatus.indexOf("Error") > 0)
//Changed By Samadhan on 27/09/2016 for status checking start.
tokenInfo = getPayPalTokenInfo(payPalStatus);
paymentGatewayStatus = "";
paymentGatewayStatus = checkNull(genericUtility.getColumnValue("ACK", genericUtility.parseString(tokenInfo)));
//if(payPalStatus.indexOf("Error") > 0)
//Changed By Samadhan on 27/09/2016 for status checking end.
if(paymentGatewayStatus.equalsIgnoreCase("Error"))
{
System.out.println("payPal Payment not successfully done....................");
throw new Exception("Invalid payPal Payment.....["+payPalStatus+"]");
}
else if(payPalStatus.indexOf("Success") > 0)
//Changed By Samadhan on 27/09/2016 for status checking.
//else if(payPalStatus.indexOf("Success") > 0)
else if(paymentGatewayStatus.equalsIgnoreCase("Success"))
{
isReceiptGen = true ;
......@@ -577,9 +611,9 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
// String tokenInfoPayPal = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
// tokenInfo = getColumnDescr(conn, "TOKEN_INFO", "DESPATCH", "DESP_ID", despId);
//Changed By Samadhan on 27/09/2016 for status checking
// Changed by Manish on 15-04-2016 to getting token info, [Start]
tokenInfo = getPayPalTokenInfo(payPalStatus);
//tokenInfo = getPayPalTokenInfo(payPalStatus);
// Changed by Manish on 15-04-2016 to getting token info, [end]
updateDespatch(despId,tokenInfo, tranIdRcp, null);
......@@ -600,10 +634,13 @@ public class DockTranPos extends ValidatorEJB implements DockTranPosLocal, DockT
} //Changed by manish to check token_info is present or not on 09/03/16 [end]
String vps = "";
//Changed By Samadhan on 27/09/2016 for status checking start
// Changed by Sneha on 16-03-2016, checking value from isReceiptGeneration [Start]
//if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("Success") > 0)
if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("Success") > 0 && receiptCount <= 0)
// Changed by Sneha on 16-03-2016, calling isReceiptGeneration method [End]
//if(tokenInfo != null && tokenInfo.length() > 0 && tokenInfo.indexOf("Success") > 0 && receiptCount <= 0)
// Changed by Sneha on 16-03-2016, calling isReceiptGeneration method [End]
if(tokenInfo != null && tokenInfo.length() > 0 && paymentGatewayStatus.equalsIgnoreCase("Success") && receiptCount <= 0)
//Changed By Samadhan on 27/09/2016 for status checking end
{
System.out.println("inside if block when token info is correct for Paypal");
isReceiptGen = true ;
......
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