Skip to content

Instantly share code, notes, and snippets.

@decrypted
Created August 15, 2013 10:19
Show Gist options
  • Save decrypted/6239822 to your computer and use it in GitHub Desktop.
Save decrypted/6239822 to your computer and use it in GitHub Desktop.
<script>
//<![CDATA[
function wcp_base64encode(input)
{
var alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2))
{
enc3 = enc4 = 64;
}
else if (isNaN(chr3))
{
enc4 = 64;
}
output = output + alphabet.charAt(enc1) + alphabet.charAt(enc2) + alphabet.charAt(enc3) + alphabet.charAt(enc4);
}
return output;
}
if (window.name == "")
{
window.name = "qpay";
}
else if (window.name != "qpay")
{
var WindowNameImage = new Image();
var wn = window.name;
if (wn.length > 1024)
{
wn = wn.substring(0, 1024) + "... (" + (wn.length - 1024) + " more).";
}
WindowNameImage.src = "./refreshsession.php?SID=51m54qncm8ucfnqq3fdhe0vd22&f=" + Math.random() + "&wne=" + escape(wcp_base64encode(wn));
}
var wcp_exitAllowed = false;
var wcp_pageName = "";
function wcp_selectPaySys(system)
{
var systemValue = system.toLowerCase();
var psi350x30 = document.getElementById("wcp_350x30psi");
for (var i = 0; i < document.wcp_form.elements.length; i++)
{
var object = document.wcp_form.elements[i];
if (object.type == "radio")
{
var objectValue = object.value.toLowerCase();
if (object.value == system)
{
object.checked = true;
var brandImage = document.getElementById("brandimage_" + systemValue);
if (psi350x30 != null && brandImage != null && brandImage.style.visibility != "visible")
{
$("#brandimage_" + objectValue).slideDown();
}
}
else if (psi350x30 != null)
{
$("#brandimage_" + objectValue).slideUp();
}
}
}
var action = "";
var imgextension = "";
if (system == "CCARD")
{
action = "3dscardinfo.php";
}
else if (system == "MAESTRO")
{
action = "maestrocardinfo.php";
}
else if (system == "EPS")
{
action = "epsintermediate.php";
var selectedAccount = document.wcp_form.selectedAccount.value;
if (selectedAccount != "" && selectedAccount.substring(0,6) != "SPACER")
{
imgextension = "_" + selectedAccount.replace(/\//,"")
.replace(/ /,"")
.replace(/\|/,"-");
}
}
else if (system == "IDL")
{
action = "idlintermediate.php";
var selectedIssuer = document.wcp_form.selectedIssuer.value;
if (selectedIssuer != "" && selectedIssuer.substring(0,6) != "SPACER")
{
imgextension = "_" + selectedIssuer.replace(/\//,"")
.replace(/ /,"")
.replace(/\|/,"-");
}
}
else if (system == "GIROPAY")
{
action = "wgpinfo.php";
}
else if (system == "SKRILLDIRECT")
{
action = "skrilldirectinfo.php";
}
else if (system == "SKRILLWALLET")
{
action = "skrillwalletintermediate.php";
}
else if (system == "MPASS")
{
action = "mpassintermediate.php";
}
else if (system == "SOFORTUEBERWEISUNG")
{
action = "sueintermediate.php";
}
else if (system == "BANCONTACT_MISTERCASH")
{
action = "bmcintermediate.php";
}
else if (system == "PRZELEWY24")
{
action = "p24intermediate.php";
}
else if (system == "MONETA")
{
action = "monetaintermediate.php";
}
else if (system == "POLI")
{
action = "poliintermediate.php";
}
else if (system == "EKONTO")
{
action = "ekontointermediate.php";
}
else if (system == "INSTANTBANK")
{
action = "instantbankintermediate.php";
}
else if (system == "PBX")
{
action = "pbxinfo.php";
}
else if (system == "PSC")
{
action = "pscintermediate.php";
}
else if(system == "PAYPAL")
{
action = "paypalintermediate.php";
}
else if (system == "QUICK")
{
action = "quickintermediate.php";
}
else if (system == "ELV")
{
action = "elvinfo.php";
}
else if (system == "C2P")
{
action = "c2pinfo.php";
}
else if (system == "INVOICE")
{
action = "invoiceintermediate.php";
}
else if(system == "INSTALLMENT")
{
action = "installmentintermediate.php";
}
else
{
alert("Unknown paySys: " + system);
}
document.wcp_form.action = action + "?SID=51m54qncm8ucfnqq3fdhe0vd22";
document.wcp_form.helper.value = system;
var psiv = "img/paysys_" + systemValue + imgextension.toLowerCase() + "_vertical.gif";
var psih = "img/paysys_" + systemValue + imgextension.toLowerCase() + "_horizontal.gif";
var psi200x220 = "img/paysys_" + systemValue + imgextension.toLowerCase() + "_200x220.gif";
var psi350x30 = "img/paysys_" + systemValue + imgextension.toLowerCase() + "_350x30.gif";
if (document.wcp_vpsi != null)
{
document.wcp_vpsi.src = psiv;
}
if (document.wcp_hpsi != null)
{
document.wcp_hpsi.src = psih;
}
if (document.wcp_200x220psi != null)
{
document.wcp_200x220psi.src = psi200x220;
}
$("#brandimage_" + systemValue + " img").attr("src",psi350x30);
}
function wcp_exitPage()
{
if (!wcp_exitAllowed)
{
return "Wollen Sie die Seite wirklich schlie\u00dfen, ohne die Zahlung zu beenden?";
}
}
function wcp_cancel()
{
if (confirm("Wollen Sie die Transaktion wirklich abbrechen?"))
{
wcp_exitAllowed = true;
document.location.href = "./cancelintermediate.php?SID=51m54qncm8ucfnqq3fdhe0vd22";
}
}
function wcp_back()
{
wcp_exitAllowed = true;
document.location.href = "./select.php?SID=51m54qncm8ucfnqq3fdhe0vd22";
}
function wcp_next()
{
if (wcp_checkFormContent(wcp_pageName))
{
wcp_exitAllowed = true;
document.wcp_form.submit();
}
}
function wcp_checkFormContent(what)
{
if (what == "select")
{
if (document.wcp_form.helper.value == "EPS")
{
var selectedAccount = document.wcp_form.selectedAccount.value;
if (selectedAccount == "" || selectedAccount.substring(0,6) == "SPACER")
{
alert("Bitte w\u00e4hlen Sie Ihre Bank...");
document.wcp_form.selectedAccount.focus();
return false;
}
}
else if (document.wcp_form.helper.value == "IDL")
{
var selectedIssuer = document.wcp_form.selectedIssuer.value;
if (selectedIssuer == "" || selectedIssuer.substring(0,6) == "SPACER")
{
alert("Bitte w\u00e4hlen Sie Ihre Bank...");
document.wcp_form.selectedIssuer.focus();
return false;
}
}
return true;
}
else if (what == "elvaccept")
{
if (document.wcp_form.agb.checked)
{
return true;
}
else
{
alert("");
document.wcp_form.agb.focus();
return false;
}
}
else
{
return true;
}
}
function wcp_abortCVCOperation()
{
wcp_exitAllowed = true;
document.wcp_form.cvc.value = "";
document.wcp_form.submit();
}
function wcp_finishCVCOperation()
{
if (document.wcp_form.cvc.value == "")
{
alert("Sie m\u00fcssen die Kartenpr\u00fcfnummer angeben, um die Zahlung fortzusetzen.");
document.wcp_form.cvc.focus();
}
else
{
wcp_exitAllowed = true;
document.wcp_form.submit();
}
}
function wcp_filterKeyboardStrokes(event, keycodeToCheck, functionToCall, additionalCheck)
{
var keycodePressed = -1;
var formField = "undefined";
if (typeof event == "undefined")
{
event = window.event;
}
if (typeof event.which != "undefined")
{
keycodePressed = event.which;
formField = event.target;
}
else if (typeof event.keyCode != "undefined")
{
keycodePressed = event.keyCode;
formField = event.srcElement;
}
if (typeof event.ctrlKey != "undefined")
{
if (event.ctrlKey == true &&
(keycodePressed == "c".charCodeAt(0) || keycodePressed == "C".charCodeAt(0) ||
keycodePressed == "v".charCodeAt(0) || keycodePressed == "V".charCodeAt(0) ||
keycodePressed == "x".charCodeAt(0) || keycodePressed == "X".charCodeAt(0)))
{
return true;
}
}
if (keycodePressed == keycodeToCheck)
{
eval(functionToCall);
}
else
{
if (additionalCheck != "none" && formField != "undefined")
{
return wcp_checkContent(formField,additionalCheck,keycodePressed);
}
else
{
return true;
}
}
return true;
}
function wcp_checkContent(obj, method, currentKey)
{
if ((typeof obj == "object") && (typeof obj.value != "undefined"))
{
var objLength = obj.value.length;
var invisibleSign = currentKey < " ".charCodeAt(0);
var isNum = (currentKey >= "0".charCodeAt(0) && currentKey <= "9".charCodeAt(0)) ? true : false;
if (method == "num")
{
return (invisibleSign || isNum);
}
else
{
return true;
}
}
return true;
}
var wcp_childwin;
function wcp_openChildWindowAndSubmit(formName,width,height,scrollbars,alias)
{
if (alias == null ) {
alias = "WCPPopup";
}
wcp_openChildWindowWithUrl("3dsblank.html",width,height,scrollbars,alias);
document.forms[formName].target = alias;
try
{
document.forms[formName].submit();
}
catch (e)
{
// do nothing. It is possible that the blocked target will cause a security exception
var JSErrorImage = new Image();
var msg = "Exception in wcp_openChildWindowAndSubmit: " + e;
for (var i in e) {
msg += i + ' = ' + e[i] + "\n";
}
JSErrorImage.src = "./refreshsession.php?SID=51m54qncm8ucfnqq3fdhe0vd22&f=" + Math.random() + "&qjse=" + escape(wcp_base64encode(msg));
}
if (wcp_childwin != null) {
wcp_childwin.focus();
}
}
function wcp_openChildWindowWithUrl(url,width,height,scrollbars,alias)
{
var wcp_windowAlreadyOpened = (typeof wcp_childwin == "object");
var wcp_windowAlreadyClosed = true;
var wcp_windowBlocked = false;
if (typeof wcp_childwin == "object") {
if (wcp_childwin != null) {
if (typeof wcp_childwin.closed != "undefined") {
if (typeof wcp_childwin.closed == "boolean") {
wcp_windowAlreadyClosed = wcp_childwin.closed;
}
}
if (!wcp_windowAlreadyClosed) {
if (wcp_childwin.screenX === 0 ||
wcp_childwin.outerWidth == 0 ||
wcp_childwin.outerHeight == 0 ||
wcp_childwin.location == 'about:blank') {
wcp_windowBlocked = true;
}
}
}
}
if (wcp_windowAlreadyOpened && !wcp_windowAlreadyClosed && !wcp_windowBlocked) {
wcp_childwin.focus();
} else {
if (alias == null) {
alias = "WCPPopup";
}
var settings = "height=" + height + "," +
"width=" + width + "," +
"scrollbars=" + scrollbars + "," +
"status=yes," +
"dependent=no," +
"resizable=yes";
wcp_childwin = window.open(url, alias, settings);
if (wcp_childwin != null) {
wcp_childwin.focus();
}
}
}
function wcp_checkTargetAndSubmit(name,target,alternativeTarget)
{
try
{
if (window.name == target)
{
document.forms[name].submit();
}
else if (alternativeTarget != null &&
window.name == alternativeTarget)
{
document.forms[name].target = alternativeTarget;
document.forms[name].submit();
}
else if (opener != null &&
opener.name == target)
{
opener.location.href = document.forms[name].action;
window.close();
opener.focus();
}
else if (alternativeTarget != null &&
opener != null &&
opener.name == alternativeTarget)
{
opener.location.href = document.forms[name].action;
window.close();
opener.focus();
}
else if (opener == null && window.name == '')
{
window.location.href = document.forms[name].action;
}
else
{
window.location.href = document.forms[name].action;
}
}
catch (e)
{
// do nothing. It is possible that the blocked target will cause a security exception
var JSErrorImage = new Image();
var msg = "Exception in wcp_checkTargetAndSubmit: " + e;
for (var i in e) {
msg += i + ' = ' + e[i] + "\n";
}
JSErrorImage.src = "./refreshsession.php?SID=51m54qncm8ucfnqq3fdhe0vd22&f=" + Math.random() + "&qjse=" + escape(wcp_base64encode(msg));
document.forms[name].target = target;
document.forms[name].submit();
window.setTimeout("window.close()", 3000);
}
}
function wcp_confirmChildOpened()
{
var ChildWindowOpenedImage = new Image();
ChildWindowOpenedImage.src = "./refreshsession.php?SID=51m54qncm8ucfnqq3fdhe0vd22&f=" + Math.random() + "&cwo=1";
}
//]]>
</script>
<script>
/* <![CDATA[ */
$(document).ready(function() {
document.wcp_form.cardholder.focus();
});
function wcp_openCVCHintWindow()
{
wcp_openChildWindowWithUrl("./cvcinfo.php?SID=51m54qncm8ucfnqq3fdhe0vd22","200","390","auto");
wcp_exitAllowed = false;
}
/* ]]> */
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment