www in docker support
This commit is contained in:
parent
539a848e95
commit
c227fce036
2145 changed files with 399596 additions and 58 deletions
|
|
@ -0,0 +1,721 @@
|
|||
package it.acxent.bank.sella;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.UnknownServiceException;
|
||||
|
||||
public class GestPayCrypt {
|
||||
private String ShopLogin = "";
|
||||
|
||||
private String Currency = "";
|
||||
|
||||
private String Amount = "";
|
||||
|
||||
private String ShopTransactionID = "";
|
||||
|
||||
private String BuyerName = "";
|
||||
|
||||
private String BuyerEmail = "";
|
||||
|
||||
private String Language = "";
|
||||
|
||||
private String CustomInfo = "";
|
||||
|
||||
private String AuthorizationCode = "";
|
||||
|
||||
private String ErrorCode = "";
|
||||
|
||||
private String ErrorDescription = "";
|
||||
|
||||
private String BankTransactionID = "";
|
||||
|
||||
private String AlertCode = "";
|
||||
|
||||
private String AlertDescription = "";
|
||||
|
||||
private String EncryptedString = "";
|
||||
|
||||
private String ToBeEncript = "";
|
||||
|
||||
private String Decripted = "";
|
||||
|
||||
private String TransactionResult = "";
|
||||
|
||||
private String ProtocolAuthServer = "";
|
||||
|
||||
private String DomainName = "";
|
||||
|
||||
private String separator = "";
|
||||
|
||||
private String errDescription = "";
|
||||
|
||||
private String errNumber = "";
|
||||
|
||||
private String Version = "";
|
||||
|
||||
private String Min = "";
|
||||
|
||||
private String CVV = "";
|
||||
|
||||
private String country = "";
|
||||
|
||||
private String vbvrisp = "";
|
||||
|
||||
private String vbv = "";
|
||||
|
||||
private String trans;
|
||||
|
||||
public GestPayCrypt() {
|
||||
this.ShopLogin = "";
|
||||
this.Currency = "";
|
||||
this.Amount = "";
|
||||
this.ShopTransactionID = "";
|
||||
this.BuyerName = "";
|
||||
this.BuyerEmail = "";
|
||||
this.Language = "";
|
||||
this.CustomInfo = "";
|
||||
this.AuthorizationCode = "";
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
this.BankTransactionID = "";
|
||||
this.AlertCode = "";
|
||||
this.AlertDescription = "";
|
||||
this.EncryptedString = "";
|
||||
this.ToBeEncript = "";
|
||||
this.Decripted = "";
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.DomainName = "";
|
||||
this.separator = "*P1*";
|
||||
this.errDescription = "";
|
||||
this.errNumber = "0";
|
||||
this.Version = "3.0";
|
||||
this.Min = "";
|
||||
this.CVV = "";
|
||||
this.country = "";
|
||||
this.vbvrisp = "";
|
||||
this.vbv = "";
|
||||
this.trans = "";
|
||||
}
|
||||
|
||||
public void setShopLogin(String xstr) {
|
||||
this.ShopLogin = xstr;
|
||||
}
|
||||
|
||||
public void setCurrency(String xstr) {
|
||||
this.Currency = xstr;
|
||||
}
|
||||
|
||||
public void setAmount(String xstr) {
|
||||
this.Amount = xstr;
|
||||
}
|
||||
|
||||
public void setShopTransactionID(String xstr) {
|
||||
this.ShopTransactionID = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setMIN(String xstr) {
|
||||
this.Min = xstr;
|
||||
}
|
||||
|
||||
public void setCVV(String xstr) {
|
||||
this.CVV = xstr;
|
||||
}
|
||||
|
||||
public void setBuyerName(String xstr) {
|
||||
this.BuyerName = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setBuyerEmail(String xstr) {
|
||||
this.BuyerEmail = xstr.trim();
|
||||
}
|
||||
|
||||
public void setLanguage(String xstr) {
|
||||
this.Language = xstr.trim();
|
||||
}
|
||||
|
||||
public void setCustomInfo(String xstr) {
|
||||
this.CustomInfo = URLEncoder.encode(xstr.trim());
|
||||
}
|
||||
|
||||
public void setEncryptedString(String xstr) {
|
||||
this.EncryptedString = xstr;
|
||||
}
|
||||
|
||||
public void setProtocolServer(String xstr) {
|
||||
this.ProtocolAuthServer = xstr;
|
||||
}
|
||||
|
||||
public void setDomainName(String xstr) {
|
||||
this.DomainName = xstr;
|
||||
}
|
||||
|
||||
public String getShopLogin() {
|
||||
return this.ShopLogin;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return this.Currency;
|
||||
}
|
||||
|
||||
public String getAmount() {
|
||||
return this.Amount;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return this.country;
|
||||
}
|
||||
|
||||
public String getVBV() {
|
||||
return this.vbv;
|
||||
}
|
||||
|
||||
public String getVBVrisp() {
|
||||
return this.vbvrisp;
|
||||
}
|
||||
|
||||
public String getShopTransactionID() {
|
||||
String app = "";
|
||||
try {
|
||||
app = URLDecode(this.ShopTransactionID);
|
||||
} catch (Exception e) {}
|
||||
return app;
|
||||
}
|
||||
|
||||
public String getBuyerName() {
|
||||
String appBuyername = "";
|
||||
try {
|
||||
appBuyername = URLDecode(this.BuyerName);
|
||||
} catch (Exception ex) {
|
||||
appBuyername = "errore";
|
||||
}
|
||||
return appBuyername;
|
||||
}
|
||||
|
||||
public String getBuyerEmail() {
|
||||
return this.BuyerEmail;
|
||||
}
|
||||
|
||||
public String getCustomInfo() {
|
||||
String appCustom = "";
|
||||
try {
|
||||
appCustom = URLDecode(this.CustomInfo);
|
||||
} catch (Exception e) {}
|
||||
return appCustom;
|
||||
}
|
||||
|
||||
public String getAuthorizationCode() {
|
||||
return this.AuthorizationCode;
|
||||
}
|
||||
|
||||
public String getErrorCode() {
|
||||
return this.ErrorCode;
|
||||
}
|
||||
|
||||
public String getErrorDescription() {
|
||||
return this.ErrorDescription;
|
||||
}
|
||||
|
||||
public String getBankTransactionID() {
|
||||
return this.BankTransactionID;
|
||||
}
|
||||
|
||||
public String getTransactionResult() {
|
||||
return this.TransactionResult;
|
||||
}
|
||||
|
||||
public String getAlertCode() {
|
||||
return this.AlertCode;
|
||||
}
|
||||
|
||||
public String getAlertDescription() {
|
||||
return this.AlertDescription;
|
||||
}
|
||||
|
||||
public String getEncryptedString() {
|
||||
return this.EncryptedString;
|
||||
}
|
||||
|
||||
public String getProtocolServer() {
|
||||
return this.ProtocolAuthServer;
|
||||
}
|
||||
|
||||
public String getDomainName() {
|
||||
return this.DomainName;
|
||||
}
|
||||
|
||||
public boolean Encrypt() {
|
||||
String sErr = "";
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (controlValues(this.ProtocolAuthServer))
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.trans = this.ShopLogin.substring(0, 6);
|
||||
this.trans = this.trans.toLowerCase();
|
||||
if (controlValues(this.DomainName))
|
||||
if (this.trans.equals("gespay")) {
|
||||
this.DomainName = "testecomm.sella.it/CryptHTTP";
|
||||
} else {
|
||||
this.DomainName = "ecomms2s.sella.it/CryptHTTP";
|
||||
}
|
||||
if (this.Currency.length() <= 0) {
|
||||
this.ErrorCode = "552";
|
||||
this.ErrorDescription = "Currency not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.Amount.length() <= 0) {
|
||||
this.ErrorCode = "553";
|
||||
this.ErrorDescription = "Amount not valid";
|
||||
return false;
|
||||
}
|
||||
if (this.ShopTransactionID.length() <= 0) {
|
||||
this.ErrorCode = "551";
|
||||
this.ErrorDescription = "Shop Transaction ID not valid";
|
||||
return false;
|
||||
}
|
||||
this.ToBeEncript = "";
|
||||
if (this.CVV.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CVV=" + this.separator;
|
||||
if (this.Min.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_MIN=" + this.separator;
|
||||
if (this.Currency.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_UICCODE=" + this.separator;
|
||||
if (this.Amount.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_AMOUNT=" + this.separator;
|
||||
if (this.ShopTransactionID.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_SHOPTRANSACTIONID=" + this.separator;
|
||||
if (this.BuyerName.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHNAME=" + this.separator;
|
||||
if (this.BuyerEmail.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHEMAIL=" + this.separator;
|
||||
if (this.Language.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_IDLANGUAGE=" + this.separator;
|
||||
if (this.CustomInfo.length() > 0)
|
||||
this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + this.separator;
|
||||
String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Encrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" +
|
||||
this.ToBeEncript.substring(4, this.ToBeEncript.length());
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#cryptstring#");
|
||||
nEnd = line.lastIndexOf("#/cryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false))
|
||||
this.EncryptedString = line.substring(nStart + 13, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "ServiceException occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean Decrypt() {
|
||||
this.ErrorCode = "0";
|
||||
this.ErrorDescription = "";
|
||||
String strdaelim = "";
|
||||
if (this.ShopLogin.length() <= 0) {
|
||||
this.ErrorCode = "546";
|
||||
this.ErrorDescription = "IDshop not valid";
|
||||
return false;
|
||||
}
|
||||
if (controlValues(this.ProtocolAuthServer))
|
||||
this.ProtocolAuthServer = "http://";
|
||||
this.trans = this.ShopLogin.substring(0, 6);
|
||||
this.trans = this.trans.toLowerCase();
|
||||
if (controlValues(this.DomainName))
|
||||
if (this.trans.equals("gespay")) {
|
||||
this.DomainName = "testecomm.sella.it/CryptHTTP";
|
||||
} else {
|
||||
this.DomainName = "ecomms2s.sella.it/CryptHTTP";
|
||||
}
|
||||
if (this.EncryptedString.length() <= 0) {
|
||||
this.ErrorCode = "1009";
|
||||
this.ErrorDescription = "String to Decrypt not valid";
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Decrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.EncryptedString;
|
||||
URL url = new URL(urlString);
|
||||
URLConnection connection = url.openConnection();
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
String line = "";
|
||||
while (line != null) {
|
||||
line = in.readLine();
|
||||
if (line != null) {
|
||||
nStart = line.indexOf("#decryptstring#");
|
||||
nEnd = line.lastIndexOf("#/decryptstring#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false))
|
||||
this.Decripted = line.substring(nStart + 15, nEnd);
|
||||
nStart = line.indexOf("#error#");
|
||||
nEnd = line.lastIndexOf("#/error#");
|
||||
if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) {
|
||||
String sErr = line.substring(nStart + 7, nEnd);
|
||||
int intsep = sErr.indexOf("-");
|
||||
this.ErrorCode = sErr.substring(0, intsep);
|
||||
this.ErrorDescription = sErr.substring(intsep + 1, sErr.length());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
if (this.Decripted.trim() == "") {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Void String";
|
||||
return false;
|
||||
}
|
||||
if (!Parsing(this.Decripted))
|
||||
return false;
|
||||
return true;
|
||||
} catch (MalformedURLException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL";
|
||||
return false;
|
||||
} catch (UnknownServiceException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Service Exception occurred.";
|
||||
return false;
|
||||
} catch (IOException ex) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Bad URL Request";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean Parsing(String StringToBeParsed) {
|
||||
int nStart = 0;
|
||||
int nEnd = 0;
|
||||
this.ErrorCode = "";
|
||||
this.ErrorDescription = "";
|
||||
try {
|
||||
nStart = StringToBeParsed.indexOf("PAY1_UICCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Currency = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AMOUNT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Amount = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHNAME");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_COUNTRY");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.country = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBVRISP");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_VBV");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.vbv = StringToBeParsed.substring(nStart + 9, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.Language = StringToBeParsed.substring(nStart + 16, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT");
|
||||
if (nStart != -1) {
|
||||
nEnd = StringToBeParsed.indexOf(this.separator, nStart);
|
||||
if (nEnd == -1) {
|
||||
nEnd = StringToBeParsed.length();
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
if (nStart >= 4) {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart - 4);
|
||||
} else {
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
} else {
|
||||
this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd);
|
||||
StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart);
|
||||
}
|
||||
}
|
||||
this.CustomInfo = StringToBeParsed.trim();
|
||||
} catch (Exception e) {
|
||||
this.ErrorCode = "9999";
|
||||
this.ErrorDescription = "Error parsing String";
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public String URLDecode(String str) throws Exception {
|
||||
if (str == null)
|
||||
return null;
|
||||
char[] res = new char[str.length()];
|
||||
int didx = 0;
|
||||
for (int sidx = 0; sidx < str.length(); sidx++) {
|
||||
char ch = str.charAt(sidx);
|
||||
if (ch == '+') {
|
||||
res[didx++] = ' ';
|
||||
} else if (ch == '%') {
|
||||
try {
|
||||
res[didx++] =
|
||||
(char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16);
|
||||
sidx += 2;
|
||||
} catch (NumberFormatException e) {
|
||||
didx--;
|
||||
res[didx++] = ch;
|
||||
}
|
||||
} else {
|
||||
res[didx++] = ch;
|
||||
}
|
||||
}
|
||||
return String.valueOf(res, 0, didx);
|
||||
}
|
||||
|
||||
protected boolean controlValues(String str) {
|
||||
return (str == null || str.length() == 0);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue