www in docker support

This commit is contained in:
MaddoScientisto 2026-04-22 18:41:37 +02:00
commit c227fce036
2145 changed files with 399596 additions and 58 deletions

View file

@ -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);
}
}

View file

@ -0,0 +1,676 @@
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 GestPayCrypt20 {
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 = "2.0";
private String Min = "";
private String CVV = "";
private String country = "";
private String vbvrisp = "";
private String vbv = "";
public GestPayCrypt20() {
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 = "ecomm.sella.it/CryptHTTP";
this.separator = "*P1*";
this.errDescription = "";
this.errNumber = "0";
this.Min = "";
this.CVV = "";
this.country = "";
this.vbvrisp = "";
this.vbv = "";
}
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 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 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 (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 (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);
}
}

View file

@ -0,0 +1,195 @@
package it.acxent.bank.sella;
import it.acxent.bank._BankAdapter;
import it.acxent.common.Parm;
import it.acxent.common.StatusMsg;
import it.acxent.db.ApplParmFull;
import it.acxent.db.DBAdapter;
public class SellaReq extends _BankAdapter {
public static final String LANG_CODE_IT = "1";
public static final String LANG_CODE_EN = "2";
public static final String LANG_CODE_ES = "3";
public static final String LANG_CODE_FR = "4";
public static final String LANG_CODE_DE = "5";
public static final String DIV_CODE_LIRA = "18";
public static final String DIV_CODE_EURO = "242";
public static final String P_COD_ESER_SELLA = "COD_ESER_SELLA";
public static final String P_SELLA_FULL = "SELLA_FULL";
public static final String DIV_CODE_STERLINE = "2";
public static final String DIV_CODE_YEN = "71";
public static final String DIV_CODE_DOLLARL_HK = "103";
public static final String DIV_CODE_REAL = "234";
private String myshoplogin;
private String mycurrency;
private String myamount;
private String myshoptransactionID;
private String mybuyername;
private String mybuyeremail;
private String mylanguage;
private String lang;
private String mycustominfo;
public static final String P_PAYMENT_OK_PAGE = "SELLA_OK";
public static final String P_PAYMENT_ERROR_PAGE = "SELLA_KO";
public static final String DIV_CODE_DOLLARI = "1";
public String getMyamount() {
return (this.myamount == null) ? "" : this.myamount;
}
public void setMyamount(String myamount) {
this.myamount = myamount;
}
public String getMybuyeremail() {
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
}
public void setMybuyeremail(String mybuyeremail) {
this.mybuyeremail = mybuyeremail;
}
public String getMybuyername() {
return (this.mybuyername == null) ? "" : this.mybuyername;
}
public void setMybuyername(String mybuyername) {
this.mybuyername = mybuyername;
}
public String getMycurrency() {
return (this.mycurrency == null) ? "" : this.mycurrency;
}
public void setMycurrency(String mycurrency) {
this.mycurrency = mycurrency;
}
public String getMycustominfo() {
return (this.mycustominfo == null) ? "" : this.mycustominfo;
}
public void setMycustominfo(String mycustominfo) {
this.mycustominfo = mycustominfo;
}
public String getMylanguage() {
if (this.mylanguage == null || this.mylanguage.isEmpty())
this.mylanguage = getMylanguageCode();
return this.mylanguage;
}
private String getMylanguageCode() {
if (getLang().toLowerCase().equals("it"))
return "1";
if (getLang().toLowerCase().equals("en"))
return "2";
if (getLang().toLowerCase().equals("es"))
return "3";
if (getLang().toLowerCase().equals("fr"))
return "4";
if (getLang().toLowerCase().equals("de"))
return "5";
return "2";
}
public String getMyshoplogin() {
return (this.myshoplogin == null) ? "" : this.myshoplogin;
}
public void setMyshoplogin(String myshoplogin) {
this.myshoplogin = myshoplogin;
}
public String getMyshoptransactionID() {
return (this.myshoptransactionID == null) ? "" : this.myshoptransactionID;
}
public void setMyshoptransactionID(String myshoptransactionID) {
this.myshoptransactionID = myshoptransactionID;
}
public void setMylanguage(String mylanguage) {
this.mylanguage = mylanguage;
}
public String getLang() {
return (this.lang == null) ? "" : this.lang;
}
public void setLang(String lang) {
this.lang = lang;
}
public static void initApplicationParms(ApplParmFull ap) {
boolean debug = false;
if (ap != null) {
DBAdapter.logDebug(debug, "SELLA chechout initParms: start");
String l_tipoParm = "SELLA";
StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm);
Parm bean = new Parm(ap);
bean.findByCodice("COD_ESER_SELLA");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("COD_ESER_SELLA");
bean.setDescrizione("COD_ESER_SELLA");
bean.setFlgTipo(0L);
bean.setNota("CODICE ESERCENTE BANCA SELLA");
bean.save();
bean.findByCodice("SELLA_FULL");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("SELLA_FULL");
bean.setDescrizione("SELLA_FULL");
bean.setFlgTipo(5L);
bean.setNota("SPECIFICA SE IL CONTRATTO CON SELLA E' DI TIPO FULL");
bean.save();
bean.findByCodice("SELLA_KO");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("SELLA_KO");
bean.setDescrizione("SELLA_KO");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("payRes.jsp");
bean.setNota("SELLA_KO");
bean.save();
bean.findByCodice("SELLA_OK");
bean.setFlgAdmin(0L);
bean.setTipoParm(l_tipoParm);
bean.setCodice("SELLA_OK");
bean.setDescrizione("SELLA_OK");
bean.setFlgTipo(0L);
if (bean.getTesto().equals(""))
bean.setTesto("payRes.jsp");
bean.setNota("SELLA_OK");
bean.save();
DBAdapter.logDebug(debug, "SELLA chechout initParms: stop");
StatusMsg.deleteMsgByTag(ap, "INIT");
}
}
}

View file

@ -0,0 +1,185 @@
package it.acxent.bank.sella;
import it.acxent.bank._BankAdapter;
public class SellaResp extends _BankAdapter {
private String myshoplogin;
private int mycurrency;
private float myamount;
private String myshoptrxID;
private String mybuyername;
private String mybuyeremail;
private String mytrxresult;
private String myauthcode;
private String myerrorcode;
private String myerrordescription;
private String myerrorbanktrxid;
private long id_ordine;
private String myalertcode;
private String myalertdescription;
private String mycustominfo;
public SellaResp() {}
public SellaResp(GestPayCrypt bean) {
fillResponse(bean);
}
public String getMyalertcode() {
return (this.myalertcode == null) ? "" : this.myalertcode;
}
public void fillResponse(GestPayCrypt bean) {
setMyshoplogin(bean.getShopLogin().trim());
if (!bean.getCurrency().isEmpty())
setMycurrency(Integer.parseInt(bean.getCurrency()));
if (!bean.getAmount().isEmpty())
setMyamount(Float.parseFloat(bean.getAmount()));
setMyshoptrxID(bean.getShopTransactionID().trim());
setMybuyername(bean.getBuyerName().trim());
setMybuyeremail(bean.getBuyerEmail().trim());
setMytrxresult(bean.getTransactionResult().trim());
setMyauthcode(bean.getAuthorizationCode());
setMyerrorcode(bean.getErrorCode());
setMyerrordescription(bean.getErrorDescription().trim());
setMyerrorbanktrxid(bean.getBankTransactionID().trim());
setMyalertcode(bean.getAlertCode().trim());
setMyalertdescription(bean.getAlertDescription().trim());
setMycustominfo(bean.getCustomInfo().trim());
if (!bean.getShopTransactionID().isEmpty())
setId_ordine(Long.parseLong(bean.getShopTransactionID()));
}
public void setMyalertcode(String myalertcode) {
this.myalertcode = myalertcode;
}
public String getMyalertdescription() {
return (this.myalertdescription == null) ? "" :
this.myalertdescription;
}
public void setMyalertdescription(String myalertdescription) {
this.myalertdescription = myalertdescription;
}
public float getMyamount() {
return this.myamount;
}
public void setMyamount(float myamount) {
this.myamount = myamount;
}
public String getMyauthcode() {
return (this.myauthcode == null) ? "" : this.myauthcode;
}
public void setMyauthcode(String myauthcode) {
this.myauthcode = myauthcode;
}
public String getMybuyeremail() {
return (this.mybuyeremail == null) ? "" : this.mybuyeremail;
}
public void setMybuyeremail(String mybuyeremail) {
this.mybuyeremail = mybuyeremail;
}
public String getMybuyername() {
return (this.mybuyername == null) ? "" : this.mybuyername;
}
public void setMybuyername(String mybuyername) {
this.mybuyername = mybuyername;
}
public int getMycurrency() {
return this.mycurrency;
}
public void setMycurrency(int mycurrency) {
this.mycurrency = mycurrency;
}
public String getMycustominfo() {
return (this.mycustominfo == null) ? "" : this.mycustominfo;
}
public void setMycustominfo(String mycustominfo) {
this.mycustominfo = mycustominfo;
}
public String getMyerrorbanktrxid() {
return (this.myerrorbanktrxid == null) ? "" :
this.myerrorbanktrxid;
}
public void setMyerrorbanktrxid(String myerrorbanktrxid) {
this.myerrorbanktrxid = myerrorbanktrxid;
}
public String getMyerrorcode() {
return (this.myerrorcode == null) ? "" : this.myerrorcode;
}
public void setMyerrorcode(String myerrorcode) {
this.myerrorcode = myerrorcode;
}
public String getMyerrordescription() {
return (this.myerrordescription == null) ? "" :
this.myerrordescription;
}
public void setMyerrordescription(String myerrordescription) {
this.myerrordescription = myerrordescription;
}
public String getMyshoplogin() {
return (this.myshoplogin == null) ? "" : this.myshoplogin;
}
public void setMyshoplogin(String myshoplogin) {
this.myshoplogin = myshoplogin;
}
public String getMyshoptrxID() {
return (this.myshoptrxID == null) ? "" : this.myshoptrxID;
}
public void setMyshoptrxID(String myshoptrxID) {
this.myshoptrxID = myshoptrxID;
}
public String getMytrxresult() {
return (this.mytrxresult == null) ? "" : this.mytrxresult;
}
public void setMytrxresult(String mytrxresult) {
this.mytrxresult = mytrxresult;
}
public long getId_ordine() {
return this.id_ordine;
}
public void setId_ordine(long id_ordine) {
this.id_ordine = id_ordine;
}
}