Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Novalnet-Technic committed Nov 10, 2021
0 parents commit c71e3a7
Show file tree
Hide file tree
Showing 83 changed files with 9,689 additions and 0 deletions.
856 changes: 856 additions & 0 deletions extras/novalnet_callback.php

Large diffs are not rendered by default.

Binary file added images/icons/novalnet/novalnet_PayPal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_cashpayment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_cc_amex.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_cc_maestro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_cc_master.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_cc_visa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_eps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_giropay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_ideal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_instantbank.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_invoice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_postfinance.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_prepayment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_przelewy24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icons/novalnet/novalnet_sepa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
935 changes: 935 additions & 0 deletions includes/classes/class.novalnetutil.php

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions includes/ext/novalnet/css/novalnet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

#novalnet_instalment_table_invoice table, td, th {
border: 1px solid #907e7e !important;
text-align: left;
padding: 10px;
}

#novalnet_instalment_table_invoice th, #novalnet_instalment_table_sepa th {
background-color:#a2a2a2;
}

.autocomplete-items {
background: #fff;
border: 1px solid #66afe9;
position: absolute;
width: 86%;
z-index: 99;
}
20 changes: 20 additions & 0 deletions includes/ext/novalnet/install/install.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

CREATE TABLE IF NOT EXISTS novalnet_transaction_detail (
id int(11) AUTO_INCREMENT COMMENT 'Auto Increment ID',
tid bigint(20) unsigned COMMENT 'Novalnet Transaction Reference ID',
order_no int(11) COMMENT 'Order number from shop',
payment_id int(11) unsigned COMMENT 'Payment ID',
payment_type varchar(50) COMMENT 'Executed Payment type of this order',
amount int(11) unsigned COMMENT 'Transaction amount',
callback_amount int(11) unsigned COMMENT 'Callback amount',
gateway_status int(11) unsigned COMMENT 'Novalnet transaction status',
instalment_details text COMMENT 'Stored instalment details',
`date` datetime COMMENT 'Transaction Date for reference',
`language` varchar(10) COMMENT 'Shop language',
PRIMARY KEY (id),
KEY tid (tid),
KEY payment_type (payment_type),
KEY order_no (order_no)
) COMMENT='Novalnet Transaction History';

ALTER TABLE orders_status_history MODIFY comments text;
116 changes: 116 additions & 0 deletions includes/ext/novalnet/js/novalnet_admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Novalnet API script
* By Novalnet (https://www.novalnet.de)
* Copyright (c) Novalnet
*/

if (window.addEventListener) {
window.addEventListener("load", novalnet_admin);
} else if (window.attachEvent) {
window.attachEvent("load", novalnet_admin);
}

function novalnet_admin() {

jQuery('input[type="text"]').on('keyup',function(e){
let selected_name = jQuery(this).attr('name');
if( ! selected_name.match( /CUSTOMER_INFO/g ) && ! selected_name.match( /STYLE/g )) {
if ( this.value != '' && isNaN( this.value ) ) {
this.value = 0;
}
}
});
//capture authorize
jQuery('#set_limit_title, #set_limit_desc').hide();
jQuery('[name*="_ONHOLD_LIMIT]"]').hide();
jQuery('[name*="_ONHOLD]"]').click(function () {
if (jQuery('[name*="_ONHOLD]"]').prop('checked') == true) {
jQuery('#set_limit_title, #set_limit_desc').hide();
jQuery('[name*="_ONHOLD_LIMIT]"]').hide().val('');
}
if (jQuery('[name*="_ONHOLD]"]').prop('checked') == false) {
jQuery('#set_limit_title, #set_limit_desc').show();
jQuery('[name*="_ONHOLD_LIMIT]"]').show();
}

});
if (jQuery('[name*="_ONHOLD]"]').prop('checked') == false) {
jQuery('#set_limit_title, #set_limit_desc').show();
jQuery('[name*="_ONHOLD_LIMIT]"]').show();
}

jQuery('button[id=saveButton]').on('click', function(event){
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_DUE_DATE]"]').attr('id', 'sepa_due_date');
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_DUE_DATE]"]').attr('id', 'guarantee_sepa_due_date');
performAdminValidations(event);
});
function performAdminValidations(event) {

if (jQuery('#sepa_due_date').val() != undefined && jQuery.trim(jQuery('#sepa_due_date').val()) != '') {
if (isNaN(jQuery('#sepa_due_date').val()) || jQuery('#sepa_due_date').val() < 2 || jQuery('#sepa_due_date').val() > 14) {
event.preventDefault();
alert(jQuery('#sepa_due_date_error').val());
}
} else if(jQuery('#guarantee_sepa_due_date').val() != undefined && jQuery.trim(jQuery('#guarantee_sepa_due_date').val()) != '') {
if ( isNaN(jQuery('#guarantee_sepa_due_date').val()) || jQuery('#guarantee_sepa_due_date').val() < 2 || jQuery('#guarantee_sepa_due_date').val() > 14) {
event.preventDefault();
alert(jQuery('#sepa_due_date_error').val());
}
}
}

}


/**
* Creates Installment Select Fields
* @param config_name string
* @param id string
*/
function create_installment_fields( config_name, id ) {

let config_period_name = "configuration["+ config_name + "_PERIOD]";
let config_cycle_name = "configuration["+ config_name + "_CYCLE]";
let period_id = id + '_period';
let cycle_id = id + '_cycle';

jQuery('input[name="' + config_period_name + '"]').attr('id', period_id );
jQuery('input[name="' + config_cycle_name + '"]').attr('id', cycle_id );
console.log( 'input[name="' + config_cycle_name + '"]' );

var selected_period = jQuery('#'+ period_id).val();
var selected_instalment_cycles = jQuery('#'+ cycle_id).val() || '';
jQuery('#'+ period_id ).replaceWith('<select class="form-control" id="'+ period_id + '" name= "'+config_period_name+'"></select>');
var lang = jQuery('#nn_lang').val();
var instalment_periods = {'1M':'per month', '2M':'per 2 months', '3M':'per 3 months', '4M':'per 4 months', '6M':'per 6 months'};
if (lang == 'de')
instalment_periods = {'1M':'pro Monate', '2M':'pro 2 Monate', '3M':'pro 3 Monate', '4M':'pro 4 Monate', '6M':'pro 6 Monate'};

jQuery.each(instalment_periods, function( index, value ) {
jQuery('#'+period_id).append(jQuery('<option>', {
value: jQuery.trim(index),
text: jQuery.trim(value)
}));
});
if(selected_period != '') {
jQuery('#'+period_id).val(selected_period);
}
jQuery('#'+ cycle_id ).replaceWith('<select multiple class="form-control" id="'+cycle_id+'" name= "'+config_cycle_name+'[]"></select>');

var cycle_text = ( lang == 'en') ? ' cycles' : ' raten' ;

var selected_cycle_array = selected_instalment_cycles.replace(/ /g,'').split(",");
for( var cycle = 2; cycle < 25; cycle++ )
{
if( cycle != 21 && ( cycle % 3 == 0 || ( cycle % 2== 0 && cycle < 11 ) ) ) {
var attr = {
value: cycle,
text: cycle + cycle_text
};
if( jQuery.inArray( cycle.toString(), selected_cycle_array ) !== -1 ) {
attr.selected = 'selected';
}
jQuery('#'+cycle_id).append(jQuery('<option>', attr ));
}
}
}
127 changes: 127 additions & 0 deletions includes/ext/novalnet/js/novalnet_api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* Novalnet API script
* @author Novalnet AG <[email protected]>
* @copyright Novalnet
* @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
*/
if (window.addEventListener) { // For all major browsers, except IE 8 and earlier
window.addEventListener("load", novalnet_api_load)
} else if (window.attachEvent) { // For IE 8 and earlier versions
window.attachEvent("onload", novalnet_api_load);
}

function novalnet_api_load()
{
var regex = /^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-\.]+)+([;]([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9\-]+\.)+([a-zA-Z0-9\-\.]+))*$/;
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO]"]').attr('id', 'novalnet_mail_to');
jQuery('form[name="modules"').on('submit',function(e){
let novalnet_mail_to = jQuery.trim( jQuery('#novalnet_mail_to').val() );
if( novalnet_mail_to != '' && ! novalnet_mail_to.match( regex ) ) {
alert(jQuery('#email_validation_error').val());
e.preventDefault();
}
});

jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_PUBLIC_KEY]"]').attr('id', 'novalnet_public_key');
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_VENDOR_ID]"]').attr('id', 'novalnet_vendor_id');
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_AUTH_CODE]"]').attr('id', 'novalnet_auth_code');
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_PRODUCT_ID]"]').attr('id', 'novalnet_product');
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_TARIFF_ID]"]').attr('id', 'novalnet_tariff_id');
jQuery('input[name="configuration[MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY]"]').attr('id', 'novalnet_access_key');
jQuery('#novalnet_vendor_id,#novalnet_auth_code,#novalnet_product,#novalnet_access_key').attr("readonly", true);
if ( jQuery('#novalnet_public_key').val() != '' ) {
get_merchant_details();
}
jQuery('#novalnet_public_key').change(function () {
get_merchant_details();
});
jQuery('#novalnet_public_key').closest('form').submit(function (event) {
var form = this;
if (jQuery('#novalnet_public_key').val() == '') {
event.preventDefault();
alert(jQuery('#merchant_credentials_error').val());
}
if (jQuery('#novalnet_ajax_complete').attr('value') == '0') {
event.preventDefault();
jQuery(document).ajaxComplete(function () {
jQuery(form).submit();
});
}
});
}

function null_basic_params()
{
jQuery('#novalnet_vendor_id, #novalnet_auth_code, #novalnet_product, #novalnet_access_key, #novalnet_public_key').val('');
jQuery('#novalnet_tariff_id').find('option').remove();
jQuery('#novalnet_ajax_complete').attr('value', 1);
jQuery('#novalnet_tariff_id').replaceWith('<input id="novalnet_tariff_id" name="configuration[MODULE_PAYMENT_NOVALNET_TARIFF_ID]" type="text" id="novalnet_tariff_id">');
}

function get_merchant_details()
{
var public_key = jQuery('#novalnet_public_key').val();
var language = jQuery('#nn_language').val();
if (jQuery.trim(public_key) == '') {
null_basic_params();
return false;
}
var data_to_send = {
"hash": public_key,
'lang': language
}
var filePath = '../novalnet_autoconfig.php';

jQuery('#novalnet_ajax_complete').attr('value', 0);

data_to_send = jQuery.param(data_to_send);

if ('XDomainRequest' in window && window.XDomainRequest !== null) {
var xdr = new XDomainRequest();
xdr.open('POST', filePath);
xdr.onload = function () {
process_result(data_to_send);
};
xdr.send(data_to_send);
} else {
var xmlhttp = (window.XMLHttpRequest) ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
process_result(xmlhttp.responseText);
}
}
xmlhttp.open("POST", filePath, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(data_to_send);
}
return true;
}

function process_result(hash_string)
{
var result = JSON.parse(hash_string);
var saved_tariff_id = jQuery('#novalnet_tariff_id').val();
jQuery('#novalnet_tariff_id').replaceWith('<select id="novalnet_tariff_id" name= "configuration[MODULE_PAYMENT_NOVALNET_TARIFF_ID]" ></select>');
var tariff = result.tariff;
if (tariff != undefined) {
jQuery('#novalnet_vendor_id').val(result.vendor_id);
jQuery('#novalnet_auth_code').val(result.auth_code);
jQuery('#novalnet_product').val(result.product_id);
jQuery('#novalnet_access_key').val(result.access_key);
jQuery('#novalnet_ajax_complete').attr('value', 1);
jQuery.each(tariff, function ( index, value ) {
var tariff_val = value.type + '-' + index;
jQuery('#novalnet_tariff_id').append(jQuery('<option>', {
value: jQuery.trim(tariff_val),
text: jQuery.trim(value.name)
}));
if (saved_tariff_id != undefined && saved_tariff_id == tariff_val) {
jQuery('#novalnet_tariff_id').val(tariff_val);
}
});

} else {
null_basic_params();
alert(result.status_desc);
}
}
Loading

0 comments on commit c71e3a7

Please sign in to comment.