").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,e||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var dd=a.document.documentElement;function ed(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&n.inArray("auto",[f,i])>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d={top:0,left:0},e=this[0],f=e&&e.ownerDocument;if(f)return b=f.documentElement,n.contains(b,e)?(typeof e.getBoundingClientRect!==L&&(d=e.getBoundingClientRect()),c=ed(f),{top:d.top+(c.pageYOffset||b.scrollTop)-(b.clientTop||0),left:d.left+(c.pageXOffset||b.scrollLeft)-(b.clientLeft||0)}):d},position:function(){if(this[0]){var a,b,c={top:0,left:0},d=this[0];return"fixed"===n.css(d,"position")?b=d.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(c=a.offset()),c.top+=n.css(a[0],"borderTopWidth",!0),c.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-c.top-n.css(d,"marginTop",!0),left:b.left-c.left-n.css(d,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||dd;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||dd})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,b){var c=/Y/.test(b);n.fn[a]=function(d){return W(this,function(a,d,e){var f=ed(a);return void 0===e?f?b in f?f[b]:f.document.documentElement[d]:a[d]:void(f?f.scrollTo(c?n(f).scrollLeft():e,c?e:n(f).scrollTop()):a[d]=e)},a,d,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=Mb(l.pixelPosition,function(a,c){return c?(c=Kb(a,b),Ib.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return W(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var fd=a.jQuery,gd=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=gd),b&&a.jQuery===n&&(a.jQuery=fd),n},typeof b===L&&(a.jQuery=a.$=n),n});
diff --git a/ext/novalnet/js/novalnet.js b/ext/novalnet/js/novalnet.js
new file mode 100644
index 0000000..22084d0
--- /dev/null
+++ b/ext/novalnet/js/novalnet.js
@@ -0,0 +1,262 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for common utility functionality
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet.js
+ */
+if (window.addEventListener) {
+ window.addEventListener("load", novalnet_load);
+} else if (window.attachEvent) {
+ window.attachEvent("onload", novalnet_load);
+}
+
+function novalnet_load() {
+ var urlVars = getUrlVars();
+ if (urlVars.module && urlVars.action && urlVars.action == 'edit') {
+ var module = urlVars.module.toUpperCase();
+ var module_code = urlVars.module;
+ // To validate applepay and googlepay button height
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_'+ module +'_BUTTON_HEIGHT]"]').on('keydown',function(e) {
+ if (e.keyCode == 8 || e.keyCode == 46 || e.keyCode == 16 || e.keyCode == 20){
+ return true;
+ }
+ if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105)) {
+ var num = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_'+ module +'_BUTTON_HEIGHT]"]').val();
+ if (num == '' && parseInt(String.fromCharCode(e.which)) >=3 && parseInt(String.fromCharCode(e.which)) <= 6) {
+ return true;
+ } else if (num >=3 && num <=6) {
+ if (num == 6 && ((e.keyCode >= 48 && e.keyCode <= 52) || (e.keyCode >= 96 && e.keyCode <= 99))) {
+ return true;
+ } else if ((num >=3 && num < 6) && ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105))) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+ return false;
+ });
+ // To validate applepay button corner radius
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS]"]').on('keydown',function(e) {
+ var radius = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS]"]').val();
+ if (e.keyCode == 8 || e.keyCode == 46 || e.keyCode == 16 || e.keyCode == 20) {
+ return true;
+ }
+ if (radius == '') {
+ if ((e.keyCode >= 49 && e.keyCode <= 57) || (e.keyCode >= 97 && e.keyCode <= 105)) {
+ return true;
+ } else {
+ return false;
+ }
+
+ } else if (radius == 1) {
+ if(e.keyCode == 48 || e.keyCode == 96) {
+ return true
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ });
+ var button_display = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_'+ module +'_BUTTON_DISPLAY]"]');
+ if ((getUrlVars()["module"] == 'novalnet_applepay') || (getUrlVars()["module"] == 'novalnet_googlepay')) {
+ // Replace GooglePay button type field into select fields.
+ var googlepay_button_type = {
+ 'plain' :'Plain',
+ 'buy' : 'Buy',
+ 'donate' : 'Donate',
+ 'book' : 'Book',
+ 'checkout' : 'Checkout',
+ 'order' : 'Order',
+ 'subscribe' : 'Subscribe',
+ 'pay' : 'Pay',
+ };
+ var button_type = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE]"]');
+ var selected_type = button_type.val();
+ jQuery(button_type).replaceWith('
');
+ appendOptions(googlepay_button_type, selected_type, 'googlepay_button_type');
+
+ // Replace ApplePay button type field into select fields.
+ var applepay_button_type = {
+ 'plain' :'Default',
+ 'buy' : 'Buy',
+ 'donate' : 'Donate',
+ 'book' : 'Book',
+ 'check-out' : 'Check out',
+ 'order' : 'Order',
+ 'subscribe' : 'Subscribe',
+ 'pay' : 'Pay',
+ 'contribute' : 'Contribute',
+ 'tip' : 'Tip',
+ 'rent' : 'Rent',
+ 'reload' : 'Reload',
+ 'support' : 'Support',
+ };
+ var button_type = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE]"]');
+ var selected_type = button_type.val();
+ jQuery(button_type).replaceWith('
');
+ appendOptions(applepay_button_type, selected_type, 'applepay_button_type');
+
+ // Replace ApplePay button theme field into select fields.
+ var applepay_button_theme = {
+ 'black' : 'Dark',
+ 'white' : 'Light',
+ 'white-outline' : 'Light-Outline',
+ };
+ var button_theme = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME]"]');
+ var selected_theme = button_theme.val();
+ jQuery(button_theme).replaceWith('
');
+ appendOptions(applepay_button_theme, selected_theme, 'applepay_button_theme');
+ // To give multiselect option in applepay and googlepay button display
+ jQuery(button_display).replaceWith('
shopping cart page product page checkout page ');
+ var button_display_page = jQuery('#nn_button_display_page').val();
+ var selectedValues = button_display_page.split("|");
+ jQuery(document).ready(function() {
+ jQuery("#nn_pages").select2( {
+ closeOnSelect : false,
+ placeholder : "Button display pages",
+ allowHtml: true,
+ allowClear: true,
+ tags: true
+ });
+ jQuery('#nn_pages').val(selectedValues).trigger('change');
+ });
+ }
+
+ $('input[name="configuration[configuration/MODULE_PAYMENT_'+ module +'_ENDCUSTOMER_INFO]"]').keyup(function() {
+ this.value = this.value.replace(/<(.|\n)*?>/g,'');
+ });
+ $('input[name="configuration[configuration/MODULE_PAYMENT_'+ module +'_VISIBILITY_BY_AMOUNT]"]').keyup(function() {
+ this.value = this.value.replace(/[^0-9]/g,'');
+ });
+ $('input[name="configuration[configuration/MODULE_PAYMENT_'+ module +'_MANUAL_CHECK_LIMIT]"]').keyup(function() {
+ this.value = this.value.replace(/[^0-9]/g,'');
+ });
+ checkDueDates();
+ if ($('#' + module_code + '_auth').val() == 'false') {
+ $('input[name="configuration[configuration/MODULE_PAYMENT_' + module + '_MANUAL_CHECK_LIMIT]').hide();
+ }
+
+ // Replace payment action field into select fields for CC and SEPA payments
+ if ((getUrlVars()["module"] == 'novalnet_cc') || (getUrlVars()["module"] == 'novalnet_sepa')){
+ var payment_action = '';
+ if (jQuery('#lang_code').val() == 'EN') {
+ payment_action = {
+ '' : '--Select--',
+ 'authorize' : 'Authorize',
+ 'capture' : 'Capture',
+ 'zero_amount' : 'Authorize with zero amount',
+ };
+ } else if (jQuery('#lang_code').val() == 'DE') {
+ payment_action = {
+ '' : '--Wählen Sie --',
+ 'authorize' : 'autorisieren',
+ 'capture' : 'einziehen',
+ 'zero_amount' : 'Mit Nullbetrag autorisieren',
+ };
+ }
+ var action = jQuery('input[name="configuration[configuration/MODULE_PAYMENT_' + module + '_AUTHENTICATE]"]');
+ var selected_action = action.val();
+ jQuery(action).replaceWith('
');
+ appendOptions(payment_action, selected_action, 'payment_action');
+
+ var limitElem = $('input[name="configuration[configuration/MODULE_PAYMENT_' + module + '_MANUAL_CHECK_LIMIT]"');
+ limitElem.hide();
+ $('#payment_action').click(function() {
+ if($('#payment_action').find(":selected").val() == 'authorize') {
+ limitElem.show();
+ } else {
+ limitElem.hide();
+ }
+ });
+ } else {
+ $('input:checkbox[name="configuration[configuration/MODULE_PAYMENT_' + module + '_AUTHENTICATE]"]').parent().click(function() {
+ var switcher = $('input:checkbox[name="configuration[configuration/MODULE_PAYMENT_' + module + '_AUTHENTICATE]"]').parent();
+ var limitElem = $('input[name="configuration[configuration/MODULE_PAYMENT_' + module + '_MANUAL_CHECK_LIMIT]"');
+ if(switcher[0].classList.contains('checked')) {
+ limitElem.show()
+ } else {
+ limitElem.hide();
+ }
+ });
+ }
+
+
+ // Allow minim value greater than 1998
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_VISIBILITY_BY_AMOUNT]"]').blur(function() {
+ if ($(this).val() < 1998) {
+ $(this).val('');
+ }
+ });
+ // Hide switch in instalment and guarantee payments
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA]']").parent().find("div").hide();
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA]']").parents("div").first().hide();
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE]']").parent().find("div").hide();
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE]']").parents("div").first().hide();
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ]']").parent().find("div").hide();
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ]']").parents("div").first().hide();
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ]').parent().find("div").hide();
+ $("input[name='configuration[configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ]']").parents("div").first().hide();
+ }
+}
+
+function checkDueDates() {
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE]"]').blur(function() {
+ if ($(this).val() < 7) {
+ $(this).val('');
+ }
+ });
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE]"]').blur(function() {
+ if (($(this).val() < 7) || ($(this).val() > 28)) {
+ $(this).val('');
+ }
+ });
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_DUE_DATE]"]').blur(function() {
+ if (($(this).val() < 2) || ($(this).val() > 14)) {
+ $(this).val('');
+ }
+ });
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE]"]').blur(function() {
+ if (($(this).val() < 2) || ($(this).val() > 14)) {
+ $(this).val('');
+ }
+ });
+ $('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE]"]').blur(function() {
+ if (($(this).val() < 2) || ($(this).val() > 14)) {
+ $(this).val('');
+ }
+ });
+}
+function appendOptions(optionData , selectedValue ,elemID) {
+ if($('#'+elemID+' > option').length == 0) {
+ jQuery.each(optionData, function(value,text) {
+ jQuery('#' + elemID).append(jQuery('
', {
+ value: jQuery.trim(value),
+ text: jQuery.trim(text)
+ }));
+ if (selectedValue != undefined && selectedValue == value) {
+ jQuery('#' + elemID).val(value);
+ }
+ });
+ }
+}
+
+function validateDateFormat(e) {
+ if (!NovalnetUtility.validateDateFormat(e.value)) {
+ alert($('#nn_invoice_birthdate_error').val());
+ }
+}
+function getUrlVars() {
+ var vars = {};
+ var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
+ vars[key] = value;
+ });
+ return vars;
+}
diff --git a/ext/novalnet/js/novalnet_cc.js b/ext/novalnet/js/novalnet_cc.js
new file mode 100644
index 0000000..8689fcd
--- /dev/null
+++ b/ext/novalnet/js/novalnet_cc.js
@@ -0,0 +1,155 @@
+/**
+ * Novalnet payment module
+ *
+ * This script loads the form and gets the server's pan hash
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_cc.js
+ */
+window.onload = function() {
+ novalnet_cc = {
+ /** Initiate Credit card Iframe process */
+ init : function() {
+ novalnet_cc.load_iframe();
+ $('.cc_token').click(function(){
+ var data_to_send = {'action': 'delete_token', 'id': this.id};
+ $.ajax({
+ type : 'POST',
+ url : 'novalnet_token_delete.php',
+ data : data_to_send,
+ success: function(data){
+ location.reload();
+ }
+ });
+ });
+
+ jQuery('input[name="payment"]').click(function(){
+ if(jQuery(this).val() == 'novalnet_cc') {
+ NovalnetUtility.setCreditCardFormHeight();
+ }
+ });
+
+ jQuery('#novalnet_cc_new').click(function() {
+ jQuery('#novalnet_iframe').show();
+ jQuery('#cc_save_card').show();
+ if(jQuery(this).attr('data-reload') == '1'){
+ novalnet_cc.load_iframe();
+ jQuery(this).attr('data-reload', '0')
+ }
+ });
+
+ jQuery('.novalnet_cc_saved_acc').click(function(){
+ jQuery('#novalnet_iframe').hide();
+ jQuery('#cc_save_card').hide();
+ });
+ },
+ load_iframe : function(){
+ var nn_css_label = jQuery('#nn_css_label').val();
+ var nn_css_input = jQuery('#nn_css_input').val();
+ var nn_css_text = jQuery('#nn_css_text').val();
+ var nn_cc_form_details = jQuery('#nn_cc_iframe_data').val();
+ var nn_cc_details = JSON.parse(nn_cc_form_details);
+ var clientKey = (nn_cc_details.client_key !== undefined) ? nn_cc_details.client_key : '';
+ var iframe = document.getElementById('novalnet_iframe').contentWindow;
+ NovalnetUtility.setClientKey(clientKey);
+ var configurationObject = {
+ callback: {
+ on_success: function (data) {
+ jQuery('#nn_pan_hash').val(data['hash']);
+ jQuery('#nn_uniqueid').val(data['unique_id']);
+ jQuery('#do_redirect').val(data['do_redirect']);
+ $("#checkout_payment").submit();
+ return true;
+ },
+ on_error: function (data) {
+ if (data['error_message'] !== undefined) {
+ alert(data['error_message']);
+ return false;
+ }
+ },
+ },
+ iframe: {
+ id: "novalnet_iframe",
+ inline: (nn_cc_details.inline_form !== undefined) ? nn_cc_details.inline_form : '0',
+ style: {
+ container: (nn_css_text !== undefined) ? nn_css_text : '',
+ input:(nn_css_input !== undefined) ? nn_css_input : '' ,
+ label: (nn_css_label !== undefined) ? nn_css_label : '' ,
+ },
+ text: {
+ lang: (nn_cc_details.lang !== undefined) ? nn_cc_details.lang : '',
+ error: (nn_cc_details.iframe_error !== undefined) ? nn_cc_details.iframe_error : '',
+ card_holder: {
+ label: (nn_cc_details.iframe_holder_label !== undefined) ? nn_cc_details.iframe_holder_label : '',
+ place_holder: (nn_cc_details.iframe_holder_input !== undefined) ? nn_cc_details.iframe_holder_input : '',
+ error: (nn_cc_details.iframe_holder_error !== undefined) ? nn_cc_details.iframe_holder_error : '',
+ },
+ card_number: {
+ label: (nn_cc_details.iframe_number_label !== undefined) ? nn_cc_details.iframe_number_label : '',
+ place_holder: (nn_cc_details.iframe_number_input !== undefined) ? nn_cc_details.iframe_number_input : '',
+ error: (nn_cc_details.iframe_number_error !== undefined) ? nn_cc_details.iframe_number_error : '',
+ },
+ expiry_date: {
+ label: (nn_cc_details.iframe_expire_label !== undefined) ? nn_cc_details.iframe_expire_label : '',
+ error: (nn_cc_details.iframe_expire_error !== undefined) ? nn_cc_details.iframe_expire_error : '',
+ },
+ cvc: {
+ label: (nn_cc_details.iframe_cvc_label !== undefined) ? nn_cc_details.iframe_cvc_label : '',
+ place_holder: (nn_cc_details.iframe_cvc_input !== undefined) ? nn_cc_details.iframe_cvc_input : '',
+ error: (nn_cc_details.iframe_cvc_error !== undefined) ? nn_cc_details.iframe_cvc_error : '',
+ }
+ }
+ },
+ customer: {
+ first_name: (nn_cc_details.first_name !== undefined) ? nn_cc_details.first_name : '',
+ last_name: (nn_cc_details.last_name !== undefined) ? nn_cc_details.last_name : nn_cc_details.first_name,
+ email: (nn_cc_details.email_address !== undefined) ? nn_cc_details.email_address : '',
+ billing: {
+ street: (nn_cc_details.street_address !== undefined) ? nn_cc_details.street_address : '',
+ city: (nn_cc_details.city !== undefined) ? nn_cc_details.city : '',
+ zip: (nn_cc_details.postcode !== undefined) ? nn_cc_details.postcode : '',
+ country_code: (nn_cc_details.country !== undefined) ? nn_cc_details.country : ''
+ },
+ shipping: {
+ "same_as_billing": 1,
+ first_name: (nn_cc_details.first_name !== undefined) ? nn_cc_details.first_name : '',
+ last_name: (nn_cc_details.last_name !== undefined) ? nn_cc_details.last_name : nn_cc_details.first_name,
+ email: (nn_cc_details.email_address !== undefined) ? nn_cc_details.email_address : '',
+ street: (nn_cc_details.street_address !== undefined) ? nn_cc_details.street_address : '',
+ city: (nn_cc_details.city !== undefined) ? nn_cc_details.city : '',
+ zip: (nn_cc_details.postcode !== undefined) ? nn_cc_details.postcode : '',
+ country_code: (nn_cc_details.country !== undefined) ? nn_cc_details.country : ''
+ },
+ },
+ transaction: {
+ amount: (nn_cc_details.amount !== undefined) ? nn_cc_details.amount : '',
+ currency: (nn_cc_details.currency !== undefined) ? nn_cc_details.currency : '',
+ test_mode: (nn_cc_details.test_mode !== undefined) ? nn_cc_details.test_mode : '0',
+ enforce_3d: (nn_cc_details.enforce_3d !== undefined) ? nn_cc_details.enforce_3d : '0',
+ },
+ custom: {
+ lang: (nn_cc_details.lang !== undefined) ? nn_cc_details.lang : 'DE'
+ }
+ }
+ NovalnetUtility.createCreditCardForm(configurationObject);
+ },
+ };
+ jQuery(document).ready(function(){
+ novalnet_cc.init();
+ });
+};
+
+document.getElementById('checkout_payment').onsubmit = function(event) {
+ if((document.getElementsByName("payment").length > 1 && document.querySelector('input[name="payment"]:checked').value =="novalnet_cc")
+ || (document.querySelector('input[name="payment"]').value =="novalnet_cc")) {
+ if (jQuery('#novalnet_iframe').is(":visible") && jQuery('#nn_pan_hash').val() != undefined && jQuery('#nn_pan_hash').val() == '') {
+ event.preventDefault();
+ event.stopImmediatePropagation();
+ NovalnetUtility.getPanHash();
+ }
+ }
+};
diff --git a/ext/novalnet/js/novalnet_config.js b/ext/novalnet/js/novalnet_config.js
new file mode 100644
index 0000000..ae2d9e4
--- /dev/null
+++ b/ext/novalnet/js/novalnet_config.js
@@ -0,0 +1,136 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for auto configuration of merchant credentials
+ * and webhook URL configuration
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_config.js
+ */
+
+if (window.addEventListener) {
+ window.addEventListener("load", novalnet_api_load); // For IE browser
+} else if (window.attachEvent) {
+ window.attachEvent("onload", novalnet_api_load);
+}
+
+/**
+ * To get the backend field configuration values
+ */
+function novalnet_api_load() {
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE]"]').attr('id', 'novalnet_signature');
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_TARIFF_ID]"]').attr('id', 'novalnet_tariff_id');
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_CLIENT_KEY]"]').attr('id', 'novalnet_client_key');
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY]"]').attr('id', 'novalnet_access_key');
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_PROJECT_ID]"]').attr('id','novalnet_product_id');
+ jQuery('input[name="configuration[configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_URL]"]').attr('id','novalnet_webhook_url');
+
+ jQuery('#novalnet_signature, #novalnet_access_key').change(function () {
+ if (jQuery('#novalnet_signature').val() != '' && jQuery('#novalnet_access_key').val() != '') {
+ get_merchant_details();
+ return true;
+ } else if (jQuery('#novalnet_signature').val() == '' && jQuery('#novalnet_access_key').val() == '') {
+ clear_basic_params();
+ }
+ }).change();
+ jQuery('#webhook_url_button').on('click', function() {
+ var webhook_url = jQuery.trim(jQuery('#novalnet_webhook_url').val());
+ var regex = /(http|https):\/\/(\w+:{0,1}\w*)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%!\-\/]))?/;
+ if (webhook_url != '' && regex.test(webhook_url)) {
+ confirm('Are you sure you want to configure the Webhook URL in Novalnet Admin Portal?');
+ configure_webhook();
+ return true;
+ } else if (!regex.test( webhook_url) || webhook_url === '' || webhook_url === undefined){
+ alert('Enter the valid webhook URL');
+ return false;
+ }
+ });
+}
+
+/** Get merchant data */
+function get_merchant_details() {
+ var signature = jQuery.trim(jQuery('#novalnet_signature').val());
+ var access_key = jQuery.trim(jQuery('#novalnet_access_key').val());
+ var language = jQuery('#nn_language').val();
+ var data_to_send = {'action': 'merchant', 'signature': signature, 'access_key': access_key, 'lang': language};
+ do_ajax_call(data_to_send, 'merchant');
+ return true;
+}
+
+/** Configure webhook URL in Novalnet system */
+function configure_webhook() {
+ var signature = jQuery.trim(jQuery('#novalnet_signature').val());
+ var access_key = jQuery.trim(jQuery('#novalnet_access_key').val());
+ var webhook_url = jQuery.trim(jQuery('#novalnet_webhook_url').val());
+ var language = jQuery('#nn_language').val();
+ if (signature == '' || access_key == '') {
+ alert("Please enter signature and access key");
+ clear_basic_params();
+ return false;
+ }
+ var data_to_send = {'action': 'webhook', 'signature': signature, 'access_key': access_key, 'webhook_url': webhook_url, 'lang': language};
+ do_ajax_call(data_to_send, 'webhook');
+ return true;
+}
+
+/** Handle the response */
+function process_result(result) {
+ var saved_tariff_id = jQuery('#novalnet_tariff_id').val();
+ jQuery('#novalnet_tariff_id').replaceWith(' ');
+ var tariff = result.merchant.tariff;
+ $("#novalnet_client_key").val(result.merchant.client_key);
+ $("#novalnet_product_id").val(result.merchant.project);
+ if (tariff != undefined) {
+ jQuery.each(tariff, function( index, value ) {
+ var tariff_val = index;
+ jQuery('#novalnet_tariff_id').append(jQuery(' ', {
+ 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 {
+ clear_basic_params();
+ alert(result.status_desc);
+ }
+}
+
+/** Clear basic params */
+function clear_basic_params() {
+ jQuery('#novalnet_access_key').val('');
+ jQuery('#novalnet_client_key').val('');
+ jQuery('#novalnet_product_id').val('');
+ jQuery('#novalnet_tariff_id').find('option' ).remove();
+ jQuery('#novalnet_tariff_id').append(jQuery( ' ', {
+ value: '',
+ text : '',
+ }));
+}
+
+/** AJAX call processing */
+function do_ajax_call (data_to_send, action) {
+ jQuery.ajax({
+ type : 'POST',
+ url : '../novalnet_auto_config.php',
+ data : data_to_send,
+ success: function(data) {
+ var response = JSON.parse(data);
+ if (action == 'merchant') {
+ process_result(response);
+ } else if (action == 'webhook') {
+ if (response.result.status_code == 100) {
+ alert('Notification / Webhook URL is configured successfully in Novalnet Admin Portal');
+ }
+ else {
+ alert('Webhook URL configured failed. Check the webhook endpoint');
+ }
+ }
+ },
+ });
+}
diff --git a/ext/novalnet/js/novalnet_extension.js b/ext/novalnet/js/novalnet_extension.js
new file mode 100644
index 0000000..46a67a2
--- /dev/null
+++ b/ext/novalnet/js/novalnet_extension.js
@@ -0,0 +1,90 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for post process functionality
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_extension.js
+ */
+
+document.addEventListener("DOMContentLoaded", function(){
+ var elements = document.getElementsByClassName("refundBtns");
+
+ var myFunction = function() {
+ var cycle = this.getAttribute("data-instalment");
+
+
+
+ var refund_id = document.getElementById('instalment_refund_'+cycle);
+ if (refund_id.style.display == "none") {
+ refund_id.style.display = "block";
+ } else {
+ refund_id.style.display = "none";
+ }
+ };
+
+ for (var i = 0; i < elements.length; i++) {
+ elements[i].addEventListener('click', myFunction, false);
+ }
+});
+function void_capture_status() {
+ if (document.getElementById('trans_status').value == '') {
+ document.getElementById('nn_void_capture_error').innerHTML=document.getElementsByName("nn_select_status")[0].value;
+ return false;
+ }
+ display_status = document.getElementById("trans_status").value == 'CONFIRM' ? document.getElementsByName("nn_capture_update")[0].value : document.getElementsByName("nn_void_update")[0].value;
+ if (!confirm(display_status)) {
+ return false;
+ }
+ return true;
+}
+
+function remove_void_capture_error_message() {
+ document.getElementById('nn_void_capture_error').innerHTML='';
+}
+
+function refund_amount_validation() {
+ if (document.getElementById('refund_tid') != null) {
+ var refund_ref = document.getElementById('refund_tid').value;
+ refund_ref = refund_ref.trim();
+ var re = /[\/\\#,+!^()$~%.":*?<>{}]/g;
+ if (re.test(refund_ref)) {
+ document.getElementById('nn_refund_error').innerHTML=document.getElementsByName("nn_valid_account")[0].value;
+ return false;
+ }
+ }
+ else {
+ var amount = document.getElementById('refund_trans_amount').value;
+ if (amount.trim() == '' || amount == 0 || isNaN(amount)) {
+ document.getElementById('nn_refund_error').innerHTML= document.getElementsByName("nn_amount_error")[0].value;
+ return false;
+ }
+ }
+ if (!confirm(document.getElementsByName("nn_refund_amount_confirm")[0].value)) {
+ return false;
+ }
+}
+
+function handle_refund(cycle) {
+ var refund_id = document.getElementById('instalment_refund_'+cycle);
+ if (refund_id.style.display == "none") {
+ refund_id.style.display = "block";
+ } else {
+ refund_id.style.display = "none";
+ }
+}
+
+function zero_amount_validation() {
+ var bookamount = document.getElementById('book_amount').value;
+ if (bookamount.trim() == '' || bookamount == 0 || isNaN(bookamount) ) {
+ document.getElementById('nn_zero_amount_error').innerHTML=document.getElementsByName("nn_amount_error")[0].value;
+ return false;
+ }
+ if (!confirm(document.getElementsByName("nn_zero_amount_book_confirm")[0].value)) {
+ return false;
+ }
+}
diff --git a/ext/novalnet/js/novalnet_instalment_invoice.js b/ext/novalnet/js/novalnet_instalment_invoice.js
new file mode 100644
index 0000000..dc0fba9
--- /dev/null
+++ b/ext/novalnet/js/novalnet_instalment_invoice.js
@@ -0,0 +1,83 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for Instalment Invoice plan tables
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_instalment_invoice.js
+ */
+
+if (window.addEventListener) {
+ window.addEventListener("load", instalment_table_invoice);
+ window.addEventListener("change", instalment_table_invoice);
+} else if (window.attachEvent) {
+ window.attachEvent("onload", instalment_table_invoice);
+ window.attachEvent("change", instalment_table_invoice);
+}
+
+//Show instalment invoice plan details
+function instalment_table_invoice() {
+ var novalnet_order_cycle_period = $("#novalnet_global_recurring_period_cycles option:selected").val();
+ var order_amount = $("#order_amount").val();
+ var total_amount = 0, instalment_due = 0, last_instalment_due = 0;
+ var nn_dob_placeholder = $('#novalnet_instalment_invoicebirthdate').val();
+ $('#novalnet_instalment_invoicebirthdate').attr("placeholder", nn_dob_placeholder);
+ total_amount = ( parseFloat( order_amount ) ).toFixed( 2 );
+ for (var i=1;i<=novalnet_order_cycle_period;i++) {
+ if (novalnet_order_cycle_period != i) {
+ split_amount = ( parseFloat( total_amount/novalnet_order_cycle_period ) ).toFixed( 2 );
+ instalment_due = parseFloat( instalment_due ) + parseFloat( split_amount );
+ } else {
+ last_instalment_due = ( parseFloat ( total_amount - instalment_due ) ).toFixed( 2 );
+ }
+ }
+
+ var number_text = '';
+ var currency = $('#nn_installmnet_currency').val();
+ var final_due = novalnet_order_cycle_period-1;
+ if (novalnet_order_cycle_period == '0') {
+ $("#novalnet_instalment_table_invoice thead tr").remove();
+ } else {
+ $("#novalnet_instalment_table_invoice thead tr").remove();
+ $("#novalnet_instalment_table_invoice thead" ).append("" + $('#nn_cycles_frontend').val() + " " + $('#nn_amount_frontend').val() + " ");
+ }
+ $("#novalnet_instalment_table_invoice").show();
+ $("#novalnet_instalment_table_invoice tbody tr").remove();
+ for (var j=0;j" + number_text + " "+ split_amount + " " + currency + " ");
+ } else {
+ $("#novalnet_instalment_table_invoice tbody").append("" + number_text + " "+ last_instalment_due + " " + currency + " ");
+ }
+ }
+}
+function validateDateFormat(e) {
+ if (!NovalnetUtility.validateDateFormat(e.value)) {
+ alert($('#nn_instalmentinvoice_birthdate_error').val());
+ }
+}
diff --git a/ext/novalnet/js/novalnet_instalment_sepa.js b/ext/novalnet/js/novalnet_instalment_sepa.js
new file mode 100644
index 0000000..f1fb932
--- /dev/null
+++ b/ext/novalnet/js/novalnet_instalment_sepa.js
@@ -0,0 +1,151 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for Instalment SEPA plan tables
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_instalment_sepa.js
+ */
+
+if (window.addEventListener) {
+ window.addEventListener("load", instalment_table_sepa);
+ window.addEventListener("change", instalment_table_sepa);
+} else if (window.attachEvent) {
+ window.attachEvent("onload", instalment_table_sepa);
+ window.attachEvent("change", instalment_table_sepa);
+}
+
+//Show instalment SEPA plan details
+function instalment_table_sepa() {
+ var novalnet_order_cycle_period = $("#novalnet_global_recurring_period_cycles_sepa option:selected").val();
+ var order_amount = $("#order_amount").val();
+ var total_amount = 0, instalment_due = 0, last_instalment_due = 0;
+ var nn_dob_placeholder = jQuery('#nn_dob_placeholder').val();
+ jQuery('#novalnet_instalment_sepa_dob').attr("placeholder", nn_dob_placeholder);
+ total_amount = (parseFloat(order_amount)).toFixed(2);
+ for (var i=1;i<=novalnet_order_cycle_period;i++) {
+ if (novalnet_order_cycle_period != i) {
+ split_amount = (parseFloat(total_amount/novalnet_order_cycle_period)).toFixed(2);
+ instalment_due = parseFloat(instalment_due) + parseFloat(split_amount);
+ } else {
+ last_instalment_due = (parseFloat (total_amount - instalment_due)).toFixed(2);
+ }
+ }
+
+ var number_text = '';
+ var currency = $('#nn_installmnet_currency').val();
+ var final_due = novalnet_order_cycle_period-1;
+ if (novalnet_order_cycle_period == '0') {
+ $("#novalnet_instalment_table_sepa thead tr").remove();
+ } else {
+ $("#novalnet_instalment_table_sepa thead tr").remove();
+ $("#novalnet_instalment_table_sepa thead").append( "" + jQuery('#nn_cycles_frontend').val() + " " + jQuery('#nn_amount_frontend').val() + " ");
+ }
+ $("#novalnet_instalment_table_sepa").show();
+ $("#novalnet_instalment_table_sepa tbody tr").remove();
+ for (var j=0;j" + number_text + " " + split_amount + " " + currency + " ");
+ } else {
+ $("#novalnet_instalment_table_sepa tbody").append("" + number_text + " " + last_instalment_due + " " + currency + " ");
+ }
+ }
+}
+
+if (window.addEventListener) {
+ window.addEventListener('load', novalnet_instalment_sepa_load);
+} else if (window.attachEvent) {
+ window.attachEvent('onload', novalnet_instalment_sepa_load);
+}
+
+function novalnet_instalment_sepa_load() {
+ var value = jQuery("input[name='payment']").val().toUpperCase();
+ jQuery('form').each(function () {
+ if (jQuery(this).attr('id') == 'checkout_payment') {
+ formid = 'checkout_payment';
+ }
+ });
+
+ jQuery('#'+formid).submit(
+ function (event) {
+ var selected_payment = (jQuery("input[name='payment']").attr('type') == 'hidden') ? jQuery("input[name='payment']").val() : jQuery("input[name='payment']:checked").val();
+ if (selected_payment == 'novalnet_instalment_sepa') {
+ if (jQuery('#novalnet_instalment_sepa_iban') !== undefined) {
+ var iban = NovalnetUtility.formatAlphaNumeric(jQuery('#novalnet_instalment_sepa_iban').val());
+ if (iban === '') {
+ return false;
+ }
+ }
+ }
+ });
+
+ jQuery('#novalnet_instalment_sepa_iban_field').keyup(function (event) {
+ jQuery(this).val(jQuery(this).val().toUpperCase());
+ if (jQuery('#novalnet_instalment_sepa_iban_field') !== undefined) {
+ var iban = NovalnetUtility.formatIban(jQuery('#novalnet_instalment_sepa_iban').val());
+ if (iban == '') {
+ return false;
+ }
+ }
+ });
+ jQuery("#novalnet_instalment_sepabirthdate").keydown(function() {
+ NovalnetUtility.isNumericBirthdate( this, event )
+ });
+ jQuery('#novalnet_instalment_sepa_new').click(function() {
+ jQuery('#instalment_sepa_save_card').show();
+ jQuery('#instalment_iban').show();
+ jQuery('#novalnet_instalment_sepa_iban_field').show();
+ jQuery('#novalnet_instalment_sepa_iban_field').parents().eq(1).show();
+ jQuery('#novalnet_instalment_sepa_onclick').parents().eq(1).show();
+ });
+ jQuery('.novalnet_instalment_sepa_saved_acc').click(function() {
+ jQuery('#novalnet_instalment_sepa_iban_field').hide();
+ jQuery('#novalnet_instalment_sepa_iban').parents().eq(1).hide();
+ jQuery('#novalnet_instalment_sepa_onclick').parents().eq(1).hide();
+ jQuery('#instalment_iban').hide();
+ });
+ $('.instalment_token').click(function(){
+ var data_to_send = {'action': 'delete_token', 'id': this.id};
+ $.ajax({
+ type : 'POST',
+ url : 'novalnet_token_delete.php',
+ data : data_to_send,
+ success: function(data){
+ location.reload();
+ }
+ });
+ });
+}
+
+function validateDateFormat(e) {
+ if (!NovalnetUtility.validateDateFormat(e.value)) {
+ alert(jQuery('#nn_instalmentsepa_birthdate_error').val());
+ }
+}
+
+
diff --git a/ext/novalnet/js/novalnet_sepa.js b/ext/novalnet/js/novalnet_sepa.js
new file mode 100644
index 0000000..49b3a29
--- /dev/null
+++ b/ext/novalnet/js/novalnet_sepa.js
@@ -0,0 +1,107 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for SEPA process
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_sepa.js
+ */
+
+if (window.addEventListener) {
+ window.addEventListener("load", novalnet_sepa_load);
+} else if (window.attachEvent) {
+ window.attachEvent("onload", novalnet_sepa_load);
+}
+
+function novalnet_sepa_load() {
+ var selected_payment = ($("input[name='payment']").attr('type') == 'hidden') ? $("input[name='payment']").val() : $("input[name='payment']:checked").val();
+ $('form').each(function () {
+ if ($(this).attr('id') == 'checkout_payment') {
+ formid = 'checkout_payment';
+ }
+ });
+ $(document).ready(function() {
+ $(".mandate_confirm").hide();
+ $(".about_mandate").click(function() {
+ $(this).next().toggle();
+ });
+ });
+ handle_oneclick_process();
+ $('#'+formid).submit(function (event) {
+ if (selected_payment == 'novalnet_sepa') {
+ if (undefined !== $( '#novalnet_sepa_iban') ) {
+ var iban = NovalnetUtility.formatAlphaNumeric($('#novalnet_sepa_iban').val());
+ if (iban === '' ) {
+ return false;
+ }
+ }
+ }
+ });
+
+ $('#novalnet_sepa_iban_field').keyup(function (event) {
+ $(this).val($(this).val().toUpperCase());
+ });
+
+ if ($.inArray( selected_payment, ['novalnet_guarantee_sepa', 'novalnet_sepa' ]) != -1) {
+ if ($('#'+ selected_payment +'birthdate') !== undefined && $('#'+ selected_payment +'birthdate').val() !== undefined) {
+ if ($('#'+ selected_payment +'birthdate').val() === '' || !NovalnetUtility.validateDateFormat($('#'+ selected_payment +'birthdate').val())) {
+ return false;
+ }
+ }
+ }
+}
+
+function handle_oneclick_process () {
+ $('#novalnet_sepa_new').click(function() {
+ var selected_payment = ($("input[name='payment']").attr('type') == 'hidden') ? $("input[name='payment']").val() : $("input[name='payment']:checked").val();
+ $('#sepa_save_card').show();
+ $('#novalnet_sepa_iban').show();
+ if (selected_payment == 'novalnet_guarantee_sepa') {
+ $('#iban').show();
+ $('#novalnet_sepa_iban_field').show();
+ $('#novalnet_sepa_iban_field').parents().eq(1).show();
+ $('#novalnet_sepa_onclick').parents().eq(1).show();
+ } else {
+ $('#iban').show();
+ $('#novalnet_sepa_iban_field').show();
+ $('#novalnet_sepa_iban_field').parents().eq(1).show();
+ $('#novalnet_sepa_onclick').parents().eq(1).show();
+ }
+ });
+ $('.novalnet_sepa_saved_acc').click(function() {
+ var selected_payment = ($("input[name='payment']").attr('type') == 'hidden') ? $("input[name='payment']").val() : $("input[name='payment']:checked").val();
+ $('#sepa_save_card').hide();
+ $('#novalnet_sepa_iban').hide();
+ if (selected_payment == 'novalnet_guarantee_sepa') {
+ $('#novalnet_sepa_iban_field').parents().eq(1).hide();
+ $('#novalnet_sepa_onclick').parents().eq(1).hide();
+ } else {
+ $('#novalnet_sepa_iban_field').parents().eq(1).hide();
+ $('#novalnet_sepa_onclick').parents().eq(1).hide();
+ }
+ });
+ if (($('#novalnet_sepa_new') == true) || ($('#sepa_save_card') == true)) {
+ $('#novalnet_guarantee_sepabirthdate').show();
+ }
+ $('.token').click(function(){
+ var data_to_send = {'action': 'delete_token', 'id': this.id};
+ $.ajax({
+ type : 'POST',
+ url : 'novalnet_token_delete.php',
+ data : data_to_send,
+ success: function(data){
+ location.reload();
+ }
+ });
+ });
+}
+
+function validateDateFormat(e) {
+ if (!NovalnetUtility.validateDateFormat(e.value)) {
+ alert($('#nn_sepa_birthdate_error').val());
+ }
+}
diff --git a/ext/novalnet/js/novalnet_wallet.js b/ext/novalnet/js/novalnet_wallet.js
new file mode 100644
index 0000000..be4a066
--- /dev/null
+++ b/ext/novalnet/js/novalnet_wallet.js
@@ -0,0 +1,458 @@
+/**
+ * Novalnet payment module
+ *
+ * This script is used for wallet payments
+ *
+ * @author Novalnet AG
+ * @copyright Copyright (c) Novalnet
+ * @license https://www.novalnet.de/payment-plugins/kostenlos/lizenz
+ * @link https://www.novalnet.de
+ *
+ * Script: novalnet_wallet.js
+ */
+
+if (window.addEventListener) {
+ window.addEventListener("load", show_hide);
+}
+
+// Show or hide continue button based on enabling payment method in checkout page
+function show_hide() {
+ jQuery('#checkout_payment').on('click', function() {
+ if((jQuery('input[name="payment"]:checked').val() == "novalnet_applepay") || (jQuery('input[name="payment"]:checked').val() == "novalnet_googlepay")) {
+ jQuery('.continue_button').hide();
+ } else {
+ jQuery('.continue_button').show();
+ }
+ });
+}
+
+// Display Apple pay, Google pay button and payment process on the product page
+function novalnet_wallet_product_page() {
+ if (jQuery('#novalnet_googlepay_enable').val() == 1) {
+ displayWalletButtons('novalnet_googlepay');
+ }
+ if (jQuery('#novalnet_applepay_enable').val() == 1) {
+ displayWalletButtons('novalnet_applepay');
+ }
+}
+
+// Display Apple pay, Google pay button and payment process on the cart page
+function novalnet_wallet_cart_page() {
+ if (jQuery('#novalnet_googlepay_enable').val() == 1) {
+ displayWalletButtons('novalnet_googlepay');
+ }
+ if (jQuery('#novalnet_applepay_enable').val() == 1) {
+ displayWalletButtons('novalnet_applepay');
+ }
+}
+
+// Display Apple pay, Google pay button and payment process on the checkout page
+function novalnet_checkout_page(wallet) {
+ displayWalletButtons(wallet);
+}
+
+function displayWalletButtons(payment_code) {
+ var wallet_form_details = jQuery('#'+payment_code+'_data').val();
+ wallet_form_details = JSON.parse(wallet_form_details);
+ var walletProductDiv = jQuery('#'+payment_code+'_wallet_div'),
+ walletProductContainer = jQuery('#'+payment_code+'_wallet_button'),
+ payment_name = (payment_code == 'novalnet_googlepay') ? 'googlepay' : 'applepay';
+ var instance = payment_code+'Instance';
+ instance = NovalnetPayment().createPaymentObject();
+ instance.setPaymentIntent(self.walletPaymentRequest(payment_code, payment_name, wallet_form_details));
+ instance.isPaymentMethodAvailable(function(canShowWalletBtn) {
+ if (canShowWalletBtn) {
+ walletProductContainer.empty();
+ instance.addPaymentButton('#'+payment_code+'_wallet_button');
+ if (wallet_form_details.current_page == 'product_info') {
+ jQuery('#'+payment_code+'_wallet_button').find("apple-pay-button").css({'width': '425px', 'margin-left' : '3%'});
+ } else if (wallet_form_details.current_page == 'shopping_cart') {
+ jQuery('#'+payment_code+'_wallet_button').find("apple-pay-button").css({'width': '415px', 'margin-left' : '0.5%'});
+ }
+ walletProductDiv.css('display', 'block');
+
+ } else {
+ walletProductDiv.css('display' , 'none');
+ if(jQuery('#novalnet_applepay_checkoutdiv') && jQuery('.novalnet_applepay').length >0) {
+ jQuery('.novalnet_applepay').hide();
+ }
+ }
+ });
+}
+
+/**
+ * ApplePay and GooglePay process function
+ */
+function walletPaymentRequest(payment_code, payment_name, nn_wallet_details) {
+ payment_name = payment_name.toUpperCase();
+ var button_dimensions = {
+ width: "auto",
+ cornerRadius: (payment_name == 'APPLEPAY' ? nn_wallet_details.applepay_button_radius : ''),
+ height: parseInt(((payment_name == 'GOOGLEPAY') ? (nn_wallet_details.googlepay_button_height) : (nn_wallet_details.applepay_button_height)))
+ };
+ var nn_button = {
+ dimensions: button_dimensions,
+ locale: (nn_wallet_details.lang !== undefined) ? nn_wallet_details.lang : '',
+ type: (payment_name == 'GOOGLEPAY' ? nn_wallet_details.googlepay_button_type : nn_wallet_details.applepay_button_type),
+ boxSizing: (payment_name == 'GOOGLEPAY' ? 'fill' : 'border-box'),
+ };
+
+ var shipping = ["postalAddress", "phone", "email"];
+ if (nn_wallet_details.show_shipping_option == 0 && nn_wallet_details.payment_method == 'APPLEPAY') {
+ var shipping = ["email"];
+ }
+ var configurationObject = {
+ clientKey: nn_wallet_details.client_key,
+ paymentIntent: {
+ transaction: {
+ amount: (nn_wallet_details.total_amount !== undefined) ? nn_wallet_details.total_amount : '',
+ currency: (nn_wallet_details.currency !== undefined) ? nn_wallet_details.currency : '',
+ paymentMethod: payment_name,
+ enforce3d: (nn_wallet_details.enforce_3d !== undefined) ? nn_wallet_details.enforce_3d : '',
+ environment: (nn_wallet_details.environment !== undefined) ? nn_wallet_details.environment : '',
+ setPendingPayment: (nn_wallet_details.product_type !== undefined) ? (nn_wallet_details.product_type == '2' ? true : false) : '',
+ },
+ merchant: {
+ countryCode: (nn_wallet_details.country_code !== undefined) ? nn_wallet_details.country_code : '',
+ partnerId: (payment_name == 'GOOGLEPAY') ? ((nn_wallet_details.partner_id !== undefined) ? nn_wallet_details.partner_id : '') : '',
+ paymentDataPresent: false
+ },
+ custom: {
+ lang: (nn_wallet_details.lang !== undefined) ? nn_wallet_details.lang : '',
+ },
+ order: {
+ paymentDataPresent: false,
+ merchantName: (nn_wallet_details.seller_name !== undefined) ? nn_wallet_details.seller_name : '',
+ lineItems: JSON.parse(jQuery('#nn_article_details').val()),
+ billing: {
+ requiredFields: (nn_wallet_details.current_page != 'checkout_payment') ? ["postalAddress", "phone", "email"] : ["postalAddress"],
+ },
+ shipping: {
+ requiredFields: (nn_wallet_details.current_page != 'checkout_payment') ? shipping : ["postalAddress", "phone", "email"],
+ methodsUpdatedLater: (nn_wallet_details.current_page != 'checkout_payment') ? true : false,
+ }
+ },
+ button: nn_button,
+ callbacks: {
+ onProcessCompletion: function (responseData, bookingResult) {
+ // Only on success, we proceed further with the booking
+ if (responseData.result.status == 'SUCCESS') {
+ if(nn_wallet_details.current_page == 'checkout_payment') {
+ bookingResult({status: 'SUCCESS', statusText: ''});
+ if(payment_name == 'GOOGLEPAY') {
+ document.getElementById('nn_google_wallet').value = responseData.transaction.token;
+ document.getElementById('nn_wallet_doredirect').value = responseData.transaction.doRedirect;
+ } else {
+ document.getElementById('nn_wallet').value = responseData.transaction.token;
+ }
+ var submitEl = jQuery("div.continue_button :submit");
+ jQuery(submitEl).click();
+ } else {
+ var response = {response : responseData};
+ var data_to_send = {
+ 'variable_name': response,
+ 'payment_name' : (payment_name == 'GOOGLEPAY') ? 'novalnet_googlepay' : 'novalnet_applepay',
+ 'payment_page' : (nn_wallet_details.current_page !== undefined) ? nn_wallet_details.current_page : '',
+ };
+ jQuery.ajax({
+ type : 'POST',
+ url : 'novalnet_wallet_payment_process.php',
+ data : data_to_send,
+ success: function (order_response) {
+ response = JSON.parse(order_response);
+ if (response.isRedirect == 1 && response.redirect_url) {
+ window.location.replace(response.redirect_url);
+ }
+ if(response.return_url) {
+ window.location.replace(response.return_url);
+ }
+ bookingResult({status: "SUCCESS", statusText: ''});
+ },
+ error: function(xhr){
+ bookingResult({status: "ERROR", statusText: xhr.result.statusText});
+ }
+ });
+ }
+ }
+ },
+ onShippingContactChange: function (shippingContact, updatedData) {
+ var payload = {address : shippingContact};
+ var data_to_send = {
+ action: 'novalnet_shipping_address_update', // your action name
+ shippingInfo: JSON.stringify(payload),
+ };
+ if (((payment_name == 'GOOGLEPAY') && jQuery('#novalnet_googlepay_wallet_button')) || ((payment_name == 'APPLEPAY') && jQuery('#novalnet_applepay_wallet_button'))) {
+ data_to_send['products_qty'] = jQuery("input[name='products_qty']").val();
+ data_to_send['products_id'] = jQuery("input[name='products_id']").val();
+ data_to_send['product_amount'] = jQuery('#nn_product').val();
+ }
+ var modifiers=[];
+ $( "[name*='modifiers[property]']" ).each(function(){
+ var modifierVal = $(this).val();
+ if (modifierVal && modifierVal != 0 && !modifiers.includes(modifierVal)) {
+ modifiers.push(modifierVal);
+ }
+ });
+ data_to_send['variant_info'] = modifiers;
+ new Promise(function(resolve, reject) {
+ jQuery.ajax({
+ type: 'POST',
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ data: data_to_send,
+ success: function (response) {
+ resolve(response);
+ }
+ });
+ }).then(function(response) {
+ var result = JSON.parse(response);
+ var updatedInfo = {};
+ if ( result.shipping_address.length == 0 ) {
+ updatedInfo.methodsNotFound = "There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.";
+ } else if( result.shipping_address != undefined && result.shipping_address.length ) {
+ updatedInfo.amount = result.amount;
+ updatedInfo.lineItems = result.article_details;
+ updatedInfo.methods = result.shipping_address;
+ updatedInfo.defaultIdentifier = result.shipping_address[0].identifier;
+ }
+ updatedData(updatedInfo);
+ });
+ },
+ onShippingMethodChange: function (choosenShippingMethod, updatedData) {
+ var payload = {shippingMethod : choosenShippingMethod};
+ var data_to_send = {
+ 'action': 'novalnet_shipping_method_update', // your action name
+ 'shippingInfo': JSON.stringify(payload), // your action name
+ };
+ $.ajax({
+ type: 'POST',
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ data: data_to_send,
+ success: function (response) {
+ var result = JSON.parse(response);
+ var updatedInfo = {
+ amount: result.amount,
+ lineItems: result.article_details,
+ };
+ updatedData(updatedInfo);
+ }
+ });
+ },
+ onPaymentButtonClicked: function(clickResult) {
+ if( nn_wallet_details.current_page == 'product_info' ) {
+ if((jQuery('button[name="btn-add-to-cart"]').prop('disabled')) || (jQuery('input[name="btn-add-to-cart"]').prop('disabled'))) {
+ clickResult({status: "FAILURE"});
+ alert('Please select some product options before adding this product to your cart.');
+ } else if (nn_wallet_details.product_type == 2) {
+ var data = {
+ 'action': 'add_virtual_product_in_cart', // your action name
+ 'products_id': jQuery("input[name='products_id']").val(),
+ 'products_qty': jQuery("input[name='products_qty']").val(),
+ };
+ var modifiers=[];
+ $( "[name*='modifiers[attribute]']" ).each(function(){
+ if($(this).prop('checked')==true) {
+ var modifierVal = $(this).val();
+ if (modifierVal && modifierVal != 0 && !modifiers.includes(modifierVal)) {
+ modifiers.push(modifierVal);
+ }
+
+ }
+ });
+ data['attribute_info'] = modifiers;
+ $.ajax({
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ type: 'POST',
+ data: data,
+ success: function (response) {
+ var result = JSON.parse(response);
+ if(result.amount != '' && typeof result.amount !== undefined){
+ var product_data = JSON.parse($('#'+payment_code+'_data').val());
+ product_data.total_amount = parseInt(result.amount);
+ product_data.orig_amount = parseInt(result.amount);
+ $('#'+payment_code+'_data').val(JSON.stringify(product_data));
+ }
+ if (result.article_details != '') {
+ $('#nn_article_details').val(JSON.stringify(result.article_details));
+ }
+ }
+ });
+ clickResult({status: "SUCCESS"});
+ } else {
+
+ clickResult({status: "SUCCESS"});
+ }
+ } else {
+ var data = {'action' : 'updated_amount'};
+ $.ajax({
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ type: 'POST',
+ data: data,
+ success: function (response) {
+ var result = JSON.parse(response);
+ if(result.amount != '' && typeof result.amount !== undefined){
+ var product_data = JSON.parse($('#'+payment_code+'_data').val());
+ product_data.total_amount = parseInt(result.amount);
+ product_data.orig_amount = parseInt(result.amount);
+ $('#'+payment_code+'_data').val(JSON.stringify(product_data));
+ }
+ }
+ });
+ clickResult({status: "SUCCESS"});
+ }
+ }
+ }
+ }
+ };
+
+ if(!nn_wallet_details.show_shipping_option && nn_wallet_details.payment_method == 'GOOGLEPAY'){
+ delete configurationObject.paymentIntent.order.shipping;
+ }
+ if(nn_wallet_details.current_page == 'checkout_payment'){
+ delete configurationObject.paymentIntent.order.billing;
+ delete configurationObject.paymentIntent.order.shipping;
+ }
+ if (payment_name == 'APPLEPAY') {
+ delete configurationObject.paymentIntent.merchant.partnerId;
+ delete configurationObject.paymentIntent.transaction.enforce3d;
+ }
+ if (nn_wallet_details.current_page == 'product_info' && nn_wallet_details.show_shipping_option == 0) {
+ var product_amount = JSON.parse($('#'+payment_code+'_data').val());
+ configurationObject.paymentIntent.transaction.amount = product_amount.total_amount;
+
+ var order_details = JSON.parse($('#nn_article_details').val());
+ configurationObject.paymentIntent.order.lineItems = order_details;
+ }
+ if (nn_wallet_details.current_page == 'shopping_cart' && nn_wallet_details.show_shipping_option == 0) {
+ var product_amount = JSON.parse($('#'+payment_code+'_data').val());
+ configurationObject.paymentIntent.transaction.amount = product_amount.total_amount;
+ }
+ return configurationObject;
+}
+
+jQuery( document ).ready(function() {
+jQuery( document ).ajaxComplete(function(event,xhr,settings) {
+ let pattern = /novalnet_wallet_shipping_data_update_process/i;
+ let ajax_url = settings.url.match(pattern);
+
+ var payment_data = '';
+ if (jQuery('#novalnet_googlepay_enable').val() == 1) {
+ payment_data = $('#novalnet_googlepay_data').val();
+ }
+ if (jQuery('#novalnet_applepay_enable').val() == 1) {
+ payment_data = $('#novalnet_applepay_data').val();
+ }
+
+ var parsed_data = JSON.parse(payment_data);
+ var current_page = parsed_data.current_page;
+
+ if(current_page && current_page == 'shopping_cart') {
+ novalnet_wallet_cart_page();
+ }
+
+ if(jQuery('#novalnet_googlepay_wallet_div').length > 0 && jQuery('#novalnet_googlepay_wallet_div').is(":visible") == true && ajax_url != 'novalnet_wallet_shipping_data_update_process') {
+ var data = {
+ 'action': 'get_variant_product_amount', // your action name
+ 'products_id': jQuery("input[name='products_id']").val(),
+ 'products_qty': jQuery("input[name='products_qty']").val(),
+ };
+ var modifiers=[];
+ $( "[name*='modifiers[property]']" ).each(function(){
+ var modifierVal = $(this).val();
+ if (modifierVal && modifierVal != 0 && !modifiers.includes(modifierVal)) {
+ modifiers.push(modifierVal);
+ }
+ });
+ data['variant_info'] = modifiers;
+ if(modifiers.length > 0) {
+ $.ajax({
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ type: 'POST',
+ data: data,
+ success: function (response) {
+ var result = JSON.parse(response);
+ if(result.amount != '' && typeof result.amount !== undefined){
+ var product_data = JSON.parse($('#novalnet_googlepay_data').val());
+ product_data.total_amount = parseInt(result.amount) + parseInt(product_data.orig_amount);
+ $('#novalnet_googlepay_data').val(JSON.stringify(product_data));
+ }
+ }
+ });
+ }
+ else {
+ var data = {'action' : 'updated_amount'};
+ data['get_article_details'] = 1;
+ $.ajax({
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ type: 'POST',
+ data: data,
+ success: function (response) {
+ var result = JSON.parse(response);
+ if(result.amount != '' && typeof result.amount !== undefined){
+ var product_data = JSON.parse($('#novalnet_googlepay_data').val());
+ product_data.total_amount = parseInt(result.amount);
+ product_data.orig_amount = parseInt(result.amount);
+ $('#novalnet_googlepay_data').val(JSON.stringify(product_data));
+ }
+ if (result.article_details != '') {
+ var articleDetails = JSON.parse($('#nn_article_details').val());
+ $('#nn_article_details').val(JSON.stringify(result.article_details));
+ }
+ }
+ });
+ }
+ return;
+ } else if (jQuery('#novalnet_applepay_wallet_div').length > 0 && jQuery('#novalnet_applepay_wallet_div').is(":visible") == true && ajax_url != 'novalnet_wallet_shipping_data_update_process') {
+ var data = {
+ 'action': 'get_variant_product_amount', // your action name
+ 'products_id': jQuery("input[name='products_id']").val(),
+ 'products_qty' : jQuery("input[name='products_qty']").val(),
+ };
+ var modifiers=[];
+ $( "[name*='modifiers[property]']" ).each(function(){
+ var modifierVal = $(this).val();
+ if (modifierVal && modifierVal != 0 && !modifiers.includes(modifierVal)) {
+ modifiers.push(modifierVal);
+ }
+ });
+ data['variant_info'] = modifiers;
+ if(modifiers.length > 0) {
+ $.ajax({
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ type: 'POST',
+ data: data,
+ success: function (response) {
+ var result = JSON.parse(response);
+ if(result.amount != '' && typeof result.amount !== undefined){
+ var product_data = JSON.parse($('#novalnet_applepay_data').val());
+ product_data.total_amount = parseInt(result.amount) + parseInt(product_data.orig_amount);
+ $('#novalnet_applepay_data').val(JSON.stringify(product_data));
+ }
+ }
+ });
+ }
+ else {
+ var data = {'action' : 'updated_amount'};
+ data['get_article_details'] = 1;
+ $.ajax({
+ url : 'novalnet_wallet_shipping_data_update_process.php',
+ type: 'POST',
+ data: data,
+ success: function (response) {
+ var result = JSON.parse(response);
+ if(result.amount != '' && typeof result.amount !== undefined){
+ var product_data = JSON.parse($('#novalnet_applepay_data').val());
+ product_data.total_amount = parseInt(result.amount);
+ product_data.orig_amount = parseInt(result.amount);
+ $('#novalnet_applepay_data').val(JSON.stringify(product_data));
+ }
+ if (result.article_details != '') {
+ var articleDetails = JSON.parse($('#nn_article_details').val());
+ $('#nn_article_details').val(JSON.stringify(result.article_details));
+ }
+ }
+ });
+ }
+ return;
+ }
+});
+});
diff --git a/ext/novalnet/sql/db.sql b/ext/novalnet/sql/db.sql
new file mode 100644
index 0000000..ca00538
--- /dev/null
+++ b/ext/novalnet/sql/db.sql
@@ -0,0 +1,85 @@
+CREATE TABLE IF NOT EXISTS novalnet_callback_history (
+ id int(10) unsigned AUTO_INCREMENT COMMENT 'Auto increment',
+ callback_datetime datetime COMMENT 'Callback execution date and time',
+ payment_type varchar(40) COMMENT 'Callback payment type',
+ original_tid bigint(20) unsigned COMMENT 'Original transaction id',
+ callback_tid bigint(20) unsigned COMMENT 'Callback reference transaction id',
+ order_amount int(10) unsigned COMMENT 'Order amount in minimum unit of currency',
+ callback_amount int(10) unsigned COMMENT 'Callback amount in minimum unit of currency',
+ order_no int(10) unsigned COMMENT 'Order no from shop',
+ PRIMARY KEY (id),
+ KEY order_no (order_no),
+ KEY original_tid (original_tid)
+) COMMENT='Novalnet callback history';
+CREATE TABLE IF NOT EXISTS novalnet_subscription_detail (
+ id int(10) unsigned AUTO_INCREMENT COMMENT 'Auto increment',
+ order_no int(10) unsigned COMMENT 'Order no from shop',
+ subs_id int(10) unsigned COMMENT 'Subscription id',
+ tid bigint(20) unsigned COMMENT 'Transaction id',
+ signup_date datetime COMMENT 'Subscription signup date and time',
+ termination_reason varchar(50) COMMENT 'Subscription termination reason',
+ termination_at datetime COMMENT 'Subscription terminated date and time',
+ PRIMARY KEY (id),
+ KEY order_no (order_no),
+ KEY tid (tid)
+) COMMENT='Novalnet subscription transaction history';
+
+CREATE TABLE IF NOT EXISTS novalnet_transaction_detail (
+ id int(10) unsigned AUTO_INCREMENT COMMENT 'Auto increment',
+ tid bigint(20) unsigned COMMENT 'Transaction id',
+ vendor int(10) unsigned COMMENT 'Vendor id',
+ product int(10) unsigned COMMENT 'Product id',
+ auth_code varchar(40) COMMENT 'Vendor Authcode',
+ tariff_id int(10) unsigned COMMENT 'Tariff id',
+ subs_id int(10) unsigned COMMENT 'Subscription id',
+ payment_id int(10) unsigned COMMENT 'Payment key',
+ payment_type varchar(40) COMMENT 'Payment type',
+ amount int(10) unsigned COMMENT 'Amount',
+ currency char(10) COMMENT 'Currency',
+ status varchar(60) COMMENT 'Transaction status',
+ test_mode enum('0','1') COMMENT 'Test mode status',
+ customer_id int(10) unsigned COMMENT 'Customer no from shop',
+ order_no int(10) unsigned COMMENT 'Order no from shop',
+ novalnet_order_date datetime COMMENT 'Transaction date',
+ process_key varchar(100) COMMENT 'Process key',
+ reference_transaction enum('0','1') COMMENT 'Reference order notification',
+ payment_ref text COMMENT 'Payment reference for Invoice/Prepayment',
+ next_payment_date datetime COMMENT 'Subscription next cycle date',
+ payment_details text COMMENT 'Masked account/card details of customer',
+ instalment_cycle_details text NULL COMMENT 'Instalment information used in gateways',
+ refund_amount int(11) COMMENT 'Refund amount',
+ callback_amount int(11) COMMENT 'Callback amount',
+ PRIMARY KEY (id),
+ KEY tid (tid),
+ KEY payment_type (payment_type),
+ KEY order_no (order_no)
+) COMMENT='Novalnet transaction history';
+
+CREATE TABLE IF NOT EXISTS novalnet_aff_account_detail (
+ id int(10)unsigned AUTO_INCREMENT COMMENT 'Auto increment',
+ vendor_id int(10) unsigned COMMENT 'Vendor id',
+ vendor_authcode varchar(40) COMMENT 'Vendor authcode' ,
+ product_id int(10) unsigned COMMENT 'Product id',
+ product_url varchar(60) COMMENT 'Product URl',
+ activation_date datetime COMMENT 'Affiliate activation date',
+ aff_id int(10) unsigned COMMENT 'Affiliate id',
+ aff_authcode varchar(40) COMMENT 'Affiliate authcode',
+ aff_accesskey varchar(40)COMMENT 'Affiliate access key',
+ PRIMARY KEY (id),
+ KEY vendor_id (vendor_id),
+ KEY aff_id (aff_id)
+) COMMENT='Novalnet merchant / affiliate account information';
+
+CREATE TABLE IF NOT EXISTS novalnet_aff_user_detail (
+ id int(10) unsigned AUTO_INCREMENT COMMENT 'Auto increment',
+ aff_id int(10) unsigned COMMENT 'Affiliate id',
+ customer_id int(10)unsigned COMMENT 'Customer no from shop',
+ aff_order_no int(10)unsigned COMMENT 'Affiliate order no',
+ PRIMARY KEY (id),
+ KEY customer_id (customer_id)
+) COMMENT='Novalnet affiliate customer account information';
+CREATE TABLE IF NOT EXISTS novalnet_version_detail (
+ version varchar(10) COMMENT 'Novalnet payment module current version',
+ KEY version (version)
+) COMMENT='Novalnet version information';
+INSERT INTO novalnet_version_detail VALUES ('11.3.0');
diff --git a/ext/novalnet/sql/db_12_0_0.sql b/ext/novalnet/sql/db_12_0_0.sql
new file mode 100644
index 0000000..49edda6
--- /dev/null
+++ b/ext/novalnet/sql/db_12_0_0.sql
@@ -0,0 +1,28 @@
+CREATE TABLE IF NOT EXISTS novalnet_transaction_detail (
+ id int(10) unsigned AUTO_INCREMENT COMMENT 'Auto increment',
+ `date` timestamp DEFAULT CURRENT_TIMESTAMP,
+ order_no int(10) unsigned COMMENT 'Order no from shop',
+ tid bigint(20) unsigned COMMENT 'Transaction id',
+ amount int(10) unsigned COMMENT 'Amount',
+ currency char(10) COMMENT 'Currency',
+ customer_id int(10) unsigned COMMENT 'Customer no from shop',
+ payment_id int(10) unsigned COMMENT 'Payment key',
+ payment_type varchar(40) COMMENT 'Payment type',
+ test_mode enum('0','1') COMMENT 'Test mode status',
+ status varchar(60) COMMENT 'Transaction status',
+ payment_details text COMMENT 'Masked account/card details of customer',
+ instalment_cycle_details text NULL COMMENT 'Instalment information used in gateways',
+ refund_amount int(11) COMMENT 'Refund amount',
+ callback_amount int(11) COMMENT 'Callback amount',
+ PRIMARY KEY (id),
+ KEY tid (tid),
+ KEY payment_type (payment_type),
+ KEY order_no (order_no)
+) COMMENT='Novalnet transaction history';
+
+CREATE TABLE IF NOT EXISTS novalnet_version_detail (
+ version varchar(10) COMMENT 'Novalnet payment module current version',
+ KEY version (version)
+) COMMENT='Novalnet version information';
+INSERT INTO novalnet_version_detail VALUES ('12.0.3');
+
diff --git a/images/icons/payment/nn_loader.gif b/images/icons/payment/nn_loader.gif
new file mode 100644
index 0000000..cf70c2e
Binary files /dev/null and b/images/icons/payment/nn_loader.gif differ
diff --git a/images/icons/payment/novalnet_alipay.png b/images/icons/payment/novalnet_alipay.png
new file mode 100644
index 0000000..4fcc40a
Binary files /dev/null and b/images/icons/payment/novalnet_alipay.png differ
diff --git a/images/icons/payment/novalnet_applepay.png b/images/icons/payment/novalnet_applepay.png
new file mode 100644
index 0000000..1fadf23
Binary files /dev/null and b/images/icons/payment/novalnet_applepay.png differ
diff --git a/images/icons/payment/novalnet_bancontact.png b/images/icons/payment/novalnet_bancontact.png
new file mode 100644
index 0000000..d8e5aae
Binary files /dev/null and b/images/icons/payment/novalnet_bancontact.png differ
diff --git a/images/icons/payment/novalnet_cashpayment.png b/images/icons/payment/novalnet_cashpayment.png
new file mode 100644
index 0000000..ecc0dda
Binary files /dev/null and b/images/icons/payment/novalnet_cashpayment.png differ
diff --git a/images/icons/payment/novalnet_cc.png b/images/icons/payment/novalnet_cc.png
new file mode 100644
index 0000000..d83b159
Binary files /dev/null and b/images/icons/payment/novalnet_cc.png differ
diff --git a/images/icons/payment/novalnet_cc_amex.png b/images/icons/payment/novalnet_cc_amex.png
new file mode 100644
index 0000000..cfbbba5
Binary files /dev/null and b/images/icons/payment/novalnet_cc_amex.png differ
diff --git a/images/icons/payment/novalnet_cc_cartasi.png b/images/icons/payment/novalnet_cc_cartasi.png
new file mode 100644
index 0000000..8b2cc12
Binary files /dev/null and b/images/icons/payment/novalnet_cc_cartasi.png differ
diff --git a/images/icons/payment/novalnet_cc_cb.png b/images/icons/payment/novalnet_cc_cb.png
new file mode 100644
index 0000000..ffe67f4
Binary files /dev/null and b/images/icons/payment/novalnet_cc_cb.png differ
diff --git a/images/icons/payment/novalnet_cc_diners.png b/images/icons/payment/novalnet_cc_diners.png
new file mode 100644
index 0000000..d9d4810
Binary files /dev/null and b/images/icons/payment/novalnet_cc_diners.png differ
diff --git a/images/icons/payment/novalnet_cc_discover.png b/images/icons/payment/novalnet_cc_discover.png
new file mode 100644
index 0000000..6db9e3c
Binary files /dev/null and b/images/icons/payment/novalnet_cc_discover.png differ
diff --git a/images/icons/payment/novalnet_cc_jcb.png b/images/icons/payment/novalnet_cc_jcb.png
new file mode 100644
index 0000000..0064100
Binary files /dev/null and b/images/icons/payment/novalnet_cc_jcb.png differ
diff --git a/images/icons/payment/novalnet_cc_maestro.png b/images/icons/payment/novalnet_cc_maestro.png
new file mode 100644
index 0000000..26c6386
Binary files /dev/null and b/images/icons/payment/novalnet_cc_maestro.png differ
diff --git a/images/icons/payment/novalnet_cc_mastercard.png b/images/icons/payment/novalnet_cc_mastercard.png
new file mode 100644
index 0000000..fed2b8e
Binary files /dev/null and b/images/icons/payment/novalnet_cc_mastercard.png differ
diff --git a/images/icons/payment/novalnet_cc_unionpay.png b/images/icons/payment/novalnet_cc_unionpay.png
new file mode 100644
index 0000000..5b8c37c
Binary files /dev/null and b/images/icons/payment/novalnet_cc_unionpay.png differ
diff --git a/images/icons/payment/novalnet_cc_visa.png b/images/icons/payment/novalnet_cc_visa.png
new file mode 100644
index 0000000..87b9709
Binary files /dev/null and b/images/icons/payment/novalnet_cc_visa.png differ
diff --git a/images/icons/payment/novalnet_eps.png b/images/icons/payment/novalnet_eps.png
new file mode 100644
index 0000000..218e2e5
Binary files /dev/null and b/images/icons/payment/novalnet_eps.png differ
diff --git a/images/icons/payment/novalnet_giropay.png b/images/icons/payment/novalnet_giropay.png
new file mode 100644
index 0000000..3371b34
Binary files /dev/null and b/images/icons/payment/novalnet_giropay.png differ
diff --git a/images/icons/payment/novalnet_googlepay.png b/images/icons/payment/novalnet_googlepay.png
new file mode 100644
index 0000000..a92374f
Binary files /dev/null and b/images/icons/payment/novalnet_googlepay.png differ
diff --git a/images/icons/payment/novalnet_guarantee_invoice.png b/images/icons/payment/novalnet_guarantee_invoice.png
new file mode 100644
index 0000000..4a327d9
Binary files /dev/null and b/images/icons/payment/novalnet_guarantee_invoice.png differ
diff --git a/images/icons/payment/novalnet_guarantee_sepa.png b/images/icons/payment/novalnet_guarantee_sepa.png
new file mode 100644
index 0000000..373af31
Binary files /dev/null and b/images/icons/payment/novalnet_guarantee_sepa.png differ
diff --git a/images/icons/payment/novalnet_ideal.png b/images/icons/payment/novalnet_ideal.png
new file mode 100644
index 0000000..e9885a8
Binary files /dev/null and b/images/icons/payment/novalnet_ideal.png differ
diff --git a/images/icons/payment/novalnet_instalment_invoice.png b/images/icons/payment/novalnet_instalment_invoice.png
new file mode 100644
index 0000000..4a327d9
Binary files /dev/null and b/images/icons/payment/novalnet_instalment_invoice.png differ
diff --git a/images/icons/payment/novalnet_instalment_sepa.png b/images/icons/payment/novalnet_instalment_sepa.png
new file mode 100644
index 0000000..373af31
Binary files /dev/null and b/images/icons/payment/novalnet_instalment_sepa.png differ
diff --git a/images/icons/payment/novalnet_instantbank.png b/images/icons/payment/novalnet_instantbank.png
new file mode 100644
index 0000000..fd0e748
Binary files /dev/null and b/images/icons/payment/novalnet_instantbank.png differ
diff --git a/images/icons/payment/novalnet_invoice.png b/images/icons/payment/novalnet_invoice.png
new file mode 100644
index 0000000..4a327d9
Binary files /dev/null and b/images/icons/payment/novalnet_invoice.png differ
diff --git a/images/icons/payment/novalnet_multibanco.png b/images/icons/payment/novalnet_multibanco.png
new file mode 100644
index 0000000..b21dd4f
Binary files /dev/null and b/images/icons/payment/novalnet_multibanco.png differ
diff --git a/images/icons/payment/novalnet_online_bank_transfer.png b/images/icons/payment/novalnet_online_bank_transfer.png
new file mode 100644
index 0000000..2856393
Binary files /dev/null and b/images/icons/payment/novalnet_online_bank_transfer.png differ
diff --git a/images/icons/payment/novalnet_paypal.png b/images/icons/payment/novalnet_paypal.png
new file mode 100644
index 0000000..6333d46
Binary files /dev/null and b/images/icons/payment/novalnet_paypal.png differ
diff --git a/images/icons/payment/novalnet_postfinance.png b/images/icons/payment/novalnet_postfinance.png
new file mode 100644
index 0000000..64d1597
Binary files /dev/null and b/images/icons/payment/novalnet_postfinance.png differ
diff --git a/images/icons/payment/novalnet_postfinance_card.png b/images/icons/payment/novalnet_postfinance_card.png
new file mode 100644
index 0000000..75bec0f
Binary files /dev/null and b/images/icons/payment/novalnet_postfinance_card.png differ
diff --git a/images/icons/payment/novalnet_prepayment.png b/images/icons/payment/novalnet_prepayment.png
new file mode 100644
index 0000000..f7ea5ec
Binary files /dev/null and b/images/icons/payment/novalnet_prepayment.png differ
diff --git a/images/icons/payment/novalnet_przelewy24.png b/images/icons/payment/novalnet_przelewy24.png
new file mode 100644
index 0000000..ac5b0e0
Binary files /dev/null and b/images/icons/payment/novalnet_przelewy24.png differ
diff --git a/images/icons/payment/novalnet_sepa.png b/images/icons/payment/novalnet_sepa.png
new file mode 100644
index 0000000..373af31
Binary files /dev/null and b/images/icons/payment/novalnet_sepa.png differ
diff --git a/images/icons/payment/novalnet_trustly.png b/images/icons/payment/novalnet_trustly.png
new file mode 100644
index 0000000..f0fdbc8
Binary files /dev/null and b/images/icons/payment/novalnet_trustly.png differ
diff --git a/images/icons/payment/novalnet_visa_master_amex.png b/images/icons/payment/novalnet_visa_master_amex.png
new file mode 100644
index 0000000..694bcce
Binary files /dev/null and b/images/icons/payment/novalnet_visa_master_amex.png differ
diff --git a/images/icons/payment/novalnet_visa_master_amex_maestro.png b/images/icons/payment/novalnet_visa_master_amex_maestro.png
new file mode 100644
index 0000000..d87c4f4
Binary files /dev/null and b/images/icons/payment/novalnet_visa_master_amex_maestro.png differ
diff --git a/images/icons/payment/novalnet_visa_master_maestro.png b/images/icons/payment/novalnet_visa_master_maestro.png
new file mode 100644
index 0000000..4cbd6e4
Binary files /dev/null and b/images/icons/payment/novalnet_visa_master_maestro.png differ
diff --git a/images/icons/payment/novalnet_wechatpay.png b/images/icons/payment/novalnet_wechatpay.png
new file mode 100644
index 0000000..1e71e33
Binary files /dev/null and b/images/icons/payment/novalnet_wechatpay.png differ
diff --git a/includes/modules/payment/novalnet_alipay.php b/includes/modules/payment/novalnet_alipay.php
new file mode 100644
index 0000000..f5a1d8a
--- /dev/null
+++ b/includes/modules/payment/novalnet_alipay.php
@@ -0,0 +1,250 @@
+code = 'novalnet_alipay';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_ALIPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_ALIPAY_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_ALIPAY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_ALIPAY_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_ALIPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_ALIPAY_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_ALIPAY_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_ALIPAY_STATUS') && MODULE_PAYMENT_NOVALNET_ALIPAY_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_ALIPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_ALIPAY_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_ALIPAY_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_ALIPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site (Note : if the payment is redirect)
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ *
+ * Send params to Novalnet server
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_SORT_ORDER', '23', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * Return keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ALIPAY_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_applepay.php b/includes/modules/payment/novalnet_applepay.php
new file mode 100644
index 0000000..4e26039
--- /dev/null
+++ b/includes/modules/payment/novalnet_applepay.php
@@ -0,0 +1,494 @@
+code = 'novalnet_applepay';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_APPLEPAY_TEXT_TITLE : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_APPLEPAY_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_APPLEPAY_SORT_ORDER) : 0;
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO') && MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO != '') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO)) : '';
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_STATUS') && MODULE_PAYMENT_NOVALNET_APPLEPAY_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE == 'true') ? true : false);
+ $display_payment_page = (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY')) ? explode('|', MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY) : array();
+ if ($this->enabled === true && (in_array('shopping cart page', $display_payment_page) || in_array('product page', $display_payment_page)) && ((basename($_SERVER['PHP_SELF']) == 'shopping_cart.php') || (basename($_SERVER['PHP_SELF']) == 'product_info.php'))) {
+ $this->tmpOrders = true;
+ $this->form_action_url = xtc_href_link(FILENAME_CHECKOUT_PROCESS, 'novalnet_applepay=true', 'SSL');
+ } else if ($this->enabled === true && in_array('checkout page',$display_payment_page) && (basename($_SERVER['PHP_SELF']) == 'checkout_payment.php')) {
+ $this->tmpOrders = false;
+ }
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ global $order;
+ if (NovalnetHelper::checkMerchantCredentials($this->code) || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ if (!empty($order->info['deduction']) || $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
+ $_SESSION['novalnet']['deduction_amount'] = $order->info['deduction'];
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['deduction_amount'] = $order->info['deduction'];
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ $display_page = defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY') ? explode('|', MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY) : array();
+ if ($this->enabled === true && in_array('checkout page',$display_page)) {
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => ' ' .NovalnetHelper::showPaymentDescription($this->code) . $this->info
+ .''
+ .''
+ .''
+ .''.$this->getParam($order),
+ ];
+
+ $selection['fields'][] = ['title' => '
+ '];
+ return $selection;
+ }
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ if (!empty($_REQUEST['nn_wallet']) || !empty($_SESSION['wallet_token'])) {
+ unset($_SESSION['wallet_token']);
+ $_SESSION['wallet_token'] = $_REQUEST['nn_wallet'];
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
+ $_SESSION['novalnet']['wallet_amount'] = ($order->info['total'] - (round($order->info['deduction_amount'], 2))) + round($order->info['tax'], 2);
+ } else {
+ $_SESSION['novalnet']['wallet_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ include DIR_FS_CATALOG . 'release_info.php';
+ $receivedData = $_SESSION['received_data'];
+ // Generate Novalnet payment parameters
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $custom_data = NovalnetHelper::getCustomData();
+ if (empty($_SESSION['received_data'])) {
+ $customer_data = NovalnetHelper::getCustomerWalletData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $transaction_data['transaction']['payment_data']['wallet_token'] = $_SESSION['wallet_token'];
+ $custom_data = NovalnetHelper::getCustomData();
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ else {
+ $customer_data = NovalnetHelper::getCustomerWalletData($receivedData);
+ $transaction_data = NovalnetHelper::getTransactionData($receivedData);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $params['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ if (!empty($_SESSION['tmp_oID'])) {
+ $params['transaction']['order_no'] = $_SESSION['tmp_oID'];
+ }
+ $params['transaction']['payment_data']['wallet_token'] = $_SESSION['token'];
+ }
+ // payment call send to novalnet server
+ if ((defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_APPLEPAY_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT : ''))) { // for on-hold transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else {
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ unset($_SESSION['novalnet']['deduction_amount']);
+ unset($_SESSION['novalnet']['wallet_amount']);
+ $_SESSION['response'] = $response; // store response in session variable
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ unset($_SESSION['wallet_token']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ unset($_SESSION['received_data']);
+ unset($_SESSION['shipping']);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT', '0', '5', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_AUTHENTICATE','false', '6' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT', '', '7', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME', '', '8', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_ORDER_STATUS', '2', '8', 'order-status', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE', 'Default', '9', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME', 'Dark', '10', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT', '', '11', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS', '', '13', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY', 'shopping cart page|product page|checkout page', '12', 'multiselect', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_SORT_ORDER', '3', '13', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO', '', '14', now());");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ echo '
+
+ ';
+ echo '';
+ $button_display = defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY') != '' ? MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY : '';
+ echo ' ';
+ return array('configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * Show ApplePay button Cart Page
+ */
+ function applepayCart_page_button() {
+ if ($this->enabled === true
+ && $_SESSION['cart']->show_total() > 0
+ && (!isset($_SESSION['allow_checkout']) || $_SESSION['allow_checkout'] == 'true') && (strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') == true && MODULE_PAYMENT_NOVALNET_SIGNATURE !='' && MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY !='' && MODULE_PAYMENT_NOVALNET_TARIFF_ID !=''))
+ {
+ echo ''.$this->getParam().' ';
+ }
+ }
+
+ /**
+ * Show ApplePay button Product Page
+ */
+ function applepayProduct_page_button() {
+ if ($this->enabled === true
+ && (strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') == true && MODULE_PAYMENT_NOVALNET_SIGNATURE !='' && MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY !='' && MODULE_PAYMENT_NOVALNET_TARIFF_ID !='')) {
+ echo '';
+ echo '' . $this->getParam();
+ echo ' ';
+ echo '';
+ echo ' ';
+ }
+ }
+
+ /**
+ * Get parameter for ApplePay process
+ *
+ * @return string Hidden fields with ApplePay data.
+ */
+ function getParam($nn_order = '') {
+ global $xtPrice;
+ require_once(DIR_WS_CLASSES.'order.php');
+ $order = new order();
+ $customers = xtc_db_fetch_array(xtc_db_query("SELECT customer_id FROM admin_access_users limit 1"));
+ $address_query = xtc_db_fetch_array(xtc_db_query("SELECT entry_country_id FROM ". TABLE_ADDRESS_BOOK ." WHERE customers_id = '". $customers['customer_id'] ."'"));
+ // countries
+ $country_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_name, countries_iso_code_2, address_format_id FROM ". TABLE_COUNTRIES ." WHERE countries_id = '". $address_query['entry_country_id'] ."'"));
+ $applepay_button_type = (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE') && !empty(MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE)) ? MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE : 'plain';
+ $applepay_button_theme = (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME') && !empty(MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME)) ? MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME : 'Default';
+ $display_page = defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY') ? explode('|', MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY) : array();
+ $current_page = explode('.php', basename($_SERVER['PHP_SELF']));
+ $data = array(
+ 'client_key' => MODULE_PAYMENT_NOVALNET_CLIENT_KEY,
+ 'test_mode' => (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE == 'true') ? '1' : '0',
+ 'currency' => $order->info['currency'],
+ 'product_name' => $order->products[0]['name'],
+ 'country_code' => (isset($country_query['countries_iso_code_2']) ? $country_query['countries_iso_code_2'] : ''),
+ 'seller_name' => (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME') && MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME != '') ? MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME : STORE_NAME,
+ 'shop_name' => STORE_NAME,
+ 'lang' => ((isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'),
+ 'applepay_button_type' => $applepay_button_type,
+ 'applepay_button_theme' => $applepay_button_theme,
+ 'applepay_button_height' => defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT') ? MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT : '',
+ 'applepay_button_radius' => defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS') ? MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS : '',
+ 'payment_method' => 'APPLEPAY',
+ 'product_type' => $GLOBALS['product']->data['product_type'],
+ 'current_page' => $current_page[0],
+ 'environment' => (defined('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_APPLEPAY_TEST_MODE == 'true') ? 'SANDBOX' : 'PRODUCTION'
+ );
+ if (!empty($GLOBALS['product']->data['products_id']) && in_array('product page',$display_page)) {
+ $data['total_amount'] = (string)($order->info['total'] * 100);
+ $data['product_id'] = $GLOBALS['product']->data['products_id'];
+ $data['payment_page'] = 'product_page';
+ } else {
+ if (!empty($_SESSION['novalnet']['payment_amount']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
+ $data['total_amount'] = (string) ($_SESSION['novalnet']['payment_amount'] * 100);
+ } else {
+ $data['total_amount'] = (string)($order->info['total'] * 100);
+ }
+ }
+ $data['show_shipping_option'] = 0;
+ if($GLOBALS['product']->data['product_type'] && $GLOBALS['product']->data['product_type'] != 2) {
+ $data['show_shipping_option'] = 1;
+ }
+
+ $articleDetails = [];
+ foreach($order->products as $key => $products) {
+ if($products['product_type'] != 2) {
+ $data['show_shipping_option'] = 1;
+ }
+ $articleDetails[] = array('label'=> $products['name']. ' x ' .$products['qty'],
+ 'amount' => (string)(($products['qty'] * $products['price'])*100),
+ 'type' => 'SUBTOTAL',
+ );
+ }
+ if (empty($nn_order)) {
+ if (!empty($order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { // Price incl tax
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if (!empty($order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ }
+ if(empty($articleDetails) && !empty($GLOBALS['product']->data['products_id'])) {
+ $products_price = $xtPrice->xtcGetPrice($GLOBALS['product']->data['products_id'], true, 1, $GLOBALS['product']->data['products_tax_class_id'], $GLOBALS['product']->data['products_price'], 1, 0, true, true, '', true);
+ $articleDetails[] = array('label'=> $GLOBALS['product']->data['products_name'] . ' x ' .$GLOBALS['product']->data['qty'],
+ 'amount' => (string)($products_price['plain'] * 100) * $GLOBALS['product']->data['qty'],
+ 'type' => 'SUBTOTAL',
+ );
+ $tax_rate = $xtPrice->getTaxRateByTaxClassId($GLOBALS['product']->data['products_tax_class_id']);
+ $tax = $xtPrice->xtcGetTax($GLOBALS['product']->data['products_price'], $tax_rate);
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] != '0'){
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else {
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($tax, 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($GLOBALS['product']->data['products_price'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $articleDetails[] = array(
+ 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' .'Discount',
+ 'amount' => (string) (round($discount_price, 2) *100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ $data['total_amount'] = (string)(($products_price['plain'] * 100) - round($discount_price, 2) *100);
+ }
+
+ if ($current_page[0] == 'checkout_payment') {
+ $articleDetails[] = array('label'=> 'shipping',
+ 'amount' => (string)($nn_order->info['shipping_cost']*100),
+ 'type' => 'SUBTOTAL');
+ if(!empty($nn_order->info['deduction']) || ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00')) { // To add discount
+ $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $deduction = abs($discount_price + $nn_order->info['deduction']);
+ $articleDetails[] = array('label'=> 'Discount',
+ 'amount' => (string) (round($deduction, 2) * 100),
+ 'type' => 'SUBTOTAL');
+ }
+ if (!empty($nn_order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { // Price incl tax
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($nn_order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if (!empty($nn_order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($nn_order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) {
+ $data['total_amount'] = (string)($nn_order->info['total'] * 100);
+ $data['orig_amount'] = $data['total_amount'];
+ } else {
+ $data['total_amount'] = (string)(($nn_order->info['total'] * 100) + (round($nn_order->info['tax'], 2) * 100));
+ $data['orig_amount'] = (string)(($nn_order->info['total'] * 100) + (round($nn_order->info['tax'], 2) * 100));
+ }
+ }
+ if ($current_page[0] != 'checkout_payment') {
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) {
+ $data['orig_amount'] = $data['total_amount'];
+ } else {
+ $data['orig_amount'] = !empty($_SESSION['novalnet']['payment_amount']) ? (string)($_SESSION['novalnet']['payment_amount'] * 100) : (string)($data['total_amount'] + (round($order->info['tax'], 2) * 100));
+ }
+ }
+ $input = json_encode($data);
+ $applepay_hidden_field = " ".
+ " ".
+ " ";
+ return $applepay_hidden_field;
+ }
+}
+
+?>
diff --git a/includes/modules/payment/novalnet_bancontact.php b/includes/modules/payment/novalnet_bancontact.php
new file mode 100644
index 0000000..21c2108
--- /dev/null
+++ b/includes/modules/payment/novalnet_bancontact.php
@@ -0,0 +1,247 @@
+code = 'novalnet_bancontact';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_BANCONTACT_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_BANCONTACT_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_BANCONTACT_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_BANCONTACT_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_BANCONTACT_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_BANCONTACT_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_BANCONTACT_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_BANCONTACT_STATUS') && MODULE_PAYMENT_NOVALNET_BANCONTACT_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_BANCONTACT_TEST_MODE') && MODULE_PAYMENT_NOVALNET_BANCONTACT_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_BANCONTACT_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_BANCONTACT_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_SORT_ORDER', '20', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * Return keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_BANCONTACT_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_cashpayment.php b/includes/modules/payment/novalnet_cashpayment.php
new file mode 100644
index 0000000..404cb33
--- /dev/null
+++ b/includes/modules/payment/novalnet_cashpayment.php
@@ -0,0 +1,250 @@
+code = 'novalnet_cashpayment';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_CASHPAYMENT_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_CASHPAYMENT_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_CASHPAYMENT_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_CASHPAYMENT_SORT_ORDER) != ''? trim(MODULE_PAYMENT_NOVALNET_CASHPAYMENT_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_CASHPAYMENT_STATUS') && MODULE_PAYMENT_NOVALNET_CASHPAYMENT_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_CASHPAYMENT_TEST_MODE') && MODULE_PAYMENT_NOVALNET_CASHPAYMENT_TEST_MODE == 'true') ?true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status()
+ {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_CASHPAYMENT_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_CASHPAYMENT_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $custom_data = NovalnetHelper::getCustomData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $due_date_in_days = MODULE_PAYMENT_NOVALNET_CASHPAYMENT_DUE_DATE;
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $transaction_data['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_VISIBILITY_BY_AMOUNT', '0', '5', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_DUE_DATE', '', '6', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ORDER_STATUS', '1', '7', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_CALLBACK_ORDER_STATUS', '2', '8', 'order-status', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_SORT_ORDER', '14', '9', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ENDCUSTOMER_INFO', '', '10', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_DUE_DATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_CALLBACK_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CASHPAYMENT_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_cc.php b/includes/modules/payment/novalnet_cc.php
new file mode 100644
index 0000000..9432439
--- /dev/null
+++ b/includes/modules/payment/novalnet_cc.php
@@ -0,0 +1,492 @@
+code = 'novalnet_cc';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_CC_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_CC_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_CC_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_CC_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_CC_STATUS') && MODULE_PAYMENT_NOVALNET_CC_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_CC_TEST_MODE') && MODULE_PAYMENT_NOVALNET_CC_TEST_MODE == 'true') ? true : false);
+ $this->inline_form = ((defined('MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM') && MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM == 'true') ? true : false);
+ $this->tmpOrders = false;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_CC_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_CC_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info ,
+ ];
+ $payment_details = xtc_db_query("SELECT payment_details, id, order_no FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type = 'CREDITCARD' AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10");
+ $saved_card_details = [];
+ $count = 0;
+ while ($payment_detail = xtc_db_fetch_array($payment_details)) {
+ $decode_details = json_decode($payment_detail['payment_details'], true);
+ $check_value = $decode_details['card_brand'] . $decode_details['card_number'] . $decode_details['card_expiry_month'] . $decode_details['card_expiry_year'];
+ if (empty($check_value)) {
+ continue;
+ }
+ $decode_details['id'] = $payment_detail['id'];
+ $saved_card_details[$count] = $decode_details;
+ $count++;
+ }
+ $iframe_display = 'block';
+ $selection['fields'][] = [
+ 'title' => '
+ '
+ ];
+ if (defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') {
+ if (!empty($saved_card_details)) {
+ $payment_data = [];
+ foreach ($saved_card_details as $key => $value) {
+ $check_string = $value['card_brand'] . $value['card_number'] . $value['card_expiry_month'] . $value['card_expiry_year'];
+ if (empty($check_string) || in_array($check_string, $payment_data)) {
+ continue;
+ }
+ if (empty($value)) {
+ continue;
+ }
+ if(!empty($_SESSION['saved_card_details']) || !empty($saved_card_details)){
+ unset($_SESSION['saved_card_details']);
+ $_SESSION['saved_card_details'] = $saved_card_details;
+ }
+ $last4_digit = (!empty($value['last_four'])) ? $value['last_four'] : substr($value['card_number'],-4);
+ $month = $value['card_expiry_year'];
+ $expiry_month = substr($month,-2);
+ $icon = xtc_href_link('/images/icons/payment/novalnet_cc_' . strtolower($value['card_brand']) . '.png', '', 'SSL', false, false, false, true, true);
+ $brand = " ";
+ $oneclick = (!empty($saved_card_details)) ? ' '.sprintf(MODULE_PAYMENT_NOVALNET_CC_TOKEN_TEXT,$brand, $last4_digit, $value['card_expiry_month'], $expiry_month) . ' Delete ' : '';
+ if(!empty($last4_digit) && !empty($month) && !empty($expiry_month) && !empty($brand) && !empty($icon)){
+ $selection['fields'][] = [ 'title' => $oneclick ];
+ }
+ array_push($payment_data, $check_string);
+ }
+ $selection['fields'][] = [ 'title' => ' '.MODULE_PAYMENT_NOVALNET_CC_NEW_ACCOUNT_DETAILS.' '];
+ $iframe_display = 'none';
+ }
+ }
+ $selection['fields'][] = [
+ 'field' => '
+
+
+ '.$this->renderIframe(),
+ ];
+ if ((defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') && (!empty($saved_card_details))) {
+ $selection['fields'][] = ['title' => ''.xtc_draw_checkbox_field('nn_cc_onclick', 1 , false, '').MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS.'
'];
+ }else if((defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') && (empty($saved_card_details))){
+ $selection['fields'][] = ['title' => ''.xtc_draw_checkbox_field('nn_cc_onclick', 1 , false, '').MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS.'
'];
+ }
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ if($_REQUEST['novalnet_cc_token'] == 'new' || !empty($_SESSION['novalnet_cc_new'])){
+ unset($_SESSION['novalnet_cc_new']);
+ $_SESSION['novalnet_cc_new'] = $_REQUEST['novalnet_cc_token'];
+ }
+ if (!empty($_SESSION['novalnet_cc_token']) || !empty($_SESSION['novalnet_cc_create_token']) || !empty($_SESSION['nn_do_redirect'])) {
+ unset($_SESSION['novalnet_cc_token']);
+ unset($_SESSION['novalnet_cc_create_token']);
+ unset($_SESSION['nn_do_redirect']);
+ }
+
+ if (!empty($_REQUEST['nn_pan_hash']) && !empty($_REQUEST['nn_uniqueid'])) {
+ $_SESSION['nn_pan_hash'] = $_REQUEST['nn_pan_hash'];
+ $_SESSION['nn_uniqueid'] = $_REQUEST['nn_uniqueid'];
+ if ((defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true') && !empty($_REQUEST['nn_cc_onclick'])) {
+ $_SESSION['novalnet_cc_create_token'] = $_REQUEST['nn_cc_onclick'];
+ }
+ } elseif (!empty($_REQUEST['novalnet_cc_token']) && $_REQUEST['novalnet_cc_token'] != 'new'
+ && (defined('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION == 'true')) {
+ $_SESSION['novalnet_cc_token'] = $_REQUEST['novalnet_cc_token'];
+ } else {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false));
+ }
+ if (!empty($_REQUEST['do_redirect']) && $_REQUEST['do_redirect'] == '1') {
+ $_SESSION['nn_do_redirect'] = 1;
+ }
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site (Note : if the payment is redirect)
+ * @return boolean
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ $this->tmpOrders = true; // After return to shop set tmpOrders to true for stop update status again.
+ } else {
+ if (!empty($_SESSION['nn_do_redirect']) && $_SESSION['nn_do_redirect'] == 1) {
+ $this->tmpOrders = true;
+ } else {
+ $response = $this->doPaymentCall();
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $response);
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ *
+ * Send params to Novalnet server
+ */
+ function payment_action()
+ {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = $this->doPaymentCall($insert_id);
+ unset($_SESSION['nn_do_redirect']);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Function : doPaymentCall()
+ *
+ * @return $data
+ */
+ function doPaymentCall($order_no = '') {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ if(empty($_SESSION['novalnet_cc_token'])){
+ $transaction_data['transaction'] = array_merge(NovalnetHelper::getTransactionData()['transaction'], NovalnetHelper::getCardDetails($order_no)['transaction']);
+ }else{
+ $transaction_data = NovalnetHelper::getTransactionData();
+ }
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $custom_data = NovalnetHelper::getCustomData();
+ if (!empty($_SESSION['saved_card_details']) && $_SESSION['novalnet_cc_new'] != 'new') {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $params['transaction']['payment_data']['token'] = $transaction_data['transaction']['payment_data']['token'];
+ }else{
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ if (!empty($params['transaction']['create_token'])) {
+ $params['custom']['input1'] = 'store_payment_data';
+ $params['custom']['inputval1'] = 1;
+ }
+ if ((defined('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE == 'authorize')
+ && NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT : '')) { // Authorize transaction
+ $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue or Zero-amount transaction
+ if (MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE == 'zero_amount') {
+ $params['transaction']['amount'] = 0;
+ $params['transaction']['create_token'] = 1;
+ }
+ $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ if ($data['result']['status'] != 'SUCCESS' ) {
+ $error = (!empty($data['result']['status_text']) ? $data['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ unset($_SESSION['payment_details']);
+ unset($_SESSION['nn_pan_hash']);
+ unset($_SESSION['nn_uniqueid']);
+ unset($_SESSION['novalnet_cc_token']);
+ unset($_SESSION['novalnet_cc_create_token']);
+ unset($_SESSION['novalnet_cc_new']);
+ unset($_SESSION['saved_card_details']);
+ return $data;
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ * @param none
+ * @return void
+ */
+ function after_process() {
+ global $order, $insert_id;
+ if(!$this->tmpOrders && !empty($_SESSION['response'])) {
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ *
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_CC_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ *
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ $label = "font-weight:normal;font-family:Roboto,Arial,sans-serif;font-size:13px;line-height:1.42857";
+ $input_field = "height:30px;border:1px solid #ccc;";
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_VISIBILITY_BY_AMOUNT', '', '5', now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM','true', '6', 'switcher' ,now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE','false', '7', 'switcher' ,now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION', 'true' , '8', 'switcher' , now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE', '', '9', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT', '', '10', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS', '2', '11', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE', '.$label.', '12', now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT', '.$input_field.', '17', now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT', '.$label.', '13', now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER', '2', '14', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CC_ENDCUSTOMER_INFO', '', '15', now());");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ * @return boolean
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ $lang = (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE';
+ echo ' ';
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CC_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * To display Iframe in checkout page
+ *
+ * @return string
+ */
+ function renderIframe() {
+ $data = $this->getNovalnetCCFormDetails();
+ $cc_hidden_field = "
+
+
+ ";
+ return $cc_hidden_field;
+ }
+
+ /**
+ * To get Iframe content in checkout page
+ *
+ * @return json data
+ */
+ function getNovalnetCCFormDetails() {
+ global $order;
+ $iframedata = array(
+ 'client_key' => MODULE_PAYMENT_NOVALNET_CLIENT_KEY,
+ 'product_id' => MODULE_PAYMENT_NOVALNET_PROJECT_ID,
+ 'inline_form' => ((defined('MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM') && MODULE_PAYMENT_NOVALNET_CC_INLINE_FORM == 'true') ? '1' : '0'),
+ 'test_mode' => ((defined('MODULE_PAYMENT_NOVALNET_CC_TEST_MODE') && MODULE_PAYMENT_NOVALNET_CC_TEST_MODE == 'true') ? '1' : '0'),
+ 'enforce_3d' => ((defined('MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE') && MODULE_PAYMENT_NOVALNET_CC_3D_SECURE_FORCE == 'true') ? '1' : '0'),
+ 'first_name' => $order->billing['firstname'],
+ 'last_name' => $order->billing['lastname'],
+ 'email' => $order->customer['email_address'],
+ 'street' => $order->billing['street_address'],
+ 'city' => $order->billing['city'],
+ 'zip' => $order->customer['postcode'],
+ 'country_code' => $order->billing['country']['iso_code_2'],
+ 'amount' => $order->info['total']*100,
+ 'currency' => $order->info['currency'],
+ 'lang' => ((isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'),
+ 'iframe_error' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_ERROR,
+ 'iframe_holder_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER,
+ 'iframe_holder_input' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_HOLDER_INPUT_TEXT,
+ 'iframe_holder_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER_ERROR,
+ 'iframe_number_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO,
+ 'iframe_number_input' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_NUMBER_INPUT_TEXT,
+ 'iframe_number_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO_ERROR,
+ 'iframe_expire_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE,
+ 'iframe_expire_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE_ERROR,
+ 'iframe_cvc_label' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC,
+ 'iframe_cvc_input' => MODULE_PAYMENT_NOVALNET_CC_IFRAME_CVC_INPUT_TEXT,
+ 'iframe_cvc_error' => MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC_ERROR,
+ );
+ return json_encode($iframedata);
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_config.php b/includes/modules/payment/novalnet_config.php
new file mode 100644
index 0000000..e4c0f6a
--- /dev/null
+++ b/includes/modules/payment/novalnet_config.php
@@ -0,0 +1,210 @@
+code = 'novalnet_config';
+ $this->title = defined('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE') ? MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE : '';
+ $this->description = defined('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_DESC') ? MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_DESC : '';
+ $this->sort_order = 0;
+ $this->enabled = true;
+ $this->novalnet_version = '12.0.3';
+ }
+
+ /**
+ *
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ return false;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ $this->checkAdminAccess();
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE', '', '1', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY', '', '2', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TARIFF_ID', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CLIENT_KEY', '', '4', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PROJECT_ID', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE', '1', '4', 'order-status', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED', '99', '5', 'order-status',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE','false', '6', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_URL', '" . ((defined('ENABLE_SSL_CATALOG') && ENABLE_SSL_CATALOG === true) ? HTTPS_SERVER : HTTP_SERVER . DIR_WS_CATALOG) . 'callback/novalnet/callback.php' ."', '7',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO', '', '8',now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ * @return boolean
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ * @return boolean
+ */
+ function keys() {
+ static $error_display_count = 0;
+ echo ' ';
+
+ if (isset($_SESSION['error_msg_displayed'])) {
+ unset($_SESSION['error_msg_displayed']);
+ }
+
+ // Validate the merchant configuration in shop backend
+ if (!isset($_SESSION['error_msg_displayed']) && $error_display_count == 0) {
+ NovalnetHelper::validateMerchantConfiguration();
+ $error_display_count++;
+ }
+
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_SIGNATURE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TARIFF_ID',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CLIENT_KEY',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PROJECT_ID',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_URL',
+ 'configuration/MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO',
+ );
+
+ }
+
+ /**
+ * Check Novalnet column in admin access table
+ *
+ */
+ function checkAdminAccess() {
+ $novalet_alter_table = false;
+ if (xtc_db_fetch_array(xtc_db_query("show tables like 'admin_access'"))) {
+ $novalnet_check = xtc_db_query('DESC admin_access');
+ // Check Novalnet column in admin access table
+ while ($check_column = xtc_db_fetch_array($novalnet_check)) {
+ if (in_array($check_column['Field'], array('novalnet_extension_helper', 'novalnet'))) {
+ $novalet_alter_table = true;
+ break;
+ }
+ }
+ if (!$novalet_alter_table) {
+ xtc_db_query('ALTER TABLE admin_access ADD novalnet int(1) NOT NULL DEFAULT "1",COMMENT="Novalnet Admin page"');
+ xtc_db_query('ALTER TABLE admin_access ADD novalnet_extension_helper int(1) NOT NULL DEFAULT "1",COMMENT="Novalnet Admin extension"');
+ }
+ }
+ $version_table = xtc_db_query("SHOW TABLES LIKE 'novalnet_version_detail'");
+ $table_count = $version_table->num_rows;
+ if($table_count > 0) { // If version table exists
+ $novalnet = xtc_db_fetch_array(xtc_db_query("SELECT * FROM novalnet_version_detail"));
+ if(version_compare($novalnet['version'], '11.3.0', '<=')){
+ // Import Novalnet package SQL tables
+ $sql_file = DIR_FS_CATALOG . 'ext/novalnet/sql/db.sql';
+ $sql_lines = file_get_contents($sql_file);
+ $sql_linesArr = explode(";", $sql_lines);
+ foreach ($sql_linesArr as $sql) {
+ if (trim($sql) > '') {
+ xtc_db_query($sql);
+ }
+ }
+
+ xtc_db_perform('novalnet_version_detail',array('version' => $this->novalnet_version), 'update', "version='{$novalnet['version']}'");
+
+ // Check whether novalnet table exist in shop
+ $nn_check = xtc_db_query('DESC ' . 'novalnet_callback_history');
+ $nn_alter_table = false;
+ while ($checks_column = xtc_db_fetch_array($nn_check)) {
+ if (in_array($checks_column['Field'] ,array('callback_datetime','original_tid','order_amount','callback_amount'))) {
+ $nn_alter_table = true;
+ break;
+ }
+ }
+ // Alter the novalnet table if already exists in shop
+ if (!$nn_alter_table) {
+ xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE org_tid original_tid bigint(20) unsigned COMMENT "Original Transaction ID"');
+ xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE amount order_amount int(20) COMMENT "Amount in minimum unit of currency. E.g. enter 100 which is equal to 1.00"');
+ xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE total_amount callback_amount int(11) COMMENT "Amount in minimum unit of currency. E.g. enter 100 which is equal to 1.00"');
+ xtc_db_query('ALTER TABLE novalnet_callback_history CHANGE `date` callback_datetime datetime COMMENT "Callback excute DATE TIME"');
+ }
+
+ // Check whether novalnet table exist in shop
+ $nn_check = xtc_db_query('DESC ' . 'novalnet_transaction_detail');
+ $nn_alter_table = false;
+ while ($checks_column = xtc_db_fetch_array($nn_check)) {
+ if (in_array($checks_column['Field'] ,array('status', 'instalment_cycle_details', 'callback_amount'))) {
+ $nn_alter_table = true;
+ break;
+ }
+ }
+ // Alter the novalnet table if already exists in shop
+ if (!$nn_alter_table) {
+ xtc_db_query('ALTER TABLE novalnet_transaction_detail CHANGE gateway_status status varchar(60) COMMENT "Transaction status"');
+ xtc_db_query('ALTER TABLE novalnet_transaction_detail ADD instalment_cycle_details text NULL COMMENT "Instalment information used in gateways"');
+ xtc_db_query('ALTER TABLE novalnet_transaction_detail ADD callback_amount int(20) NULL COMMENT "Instalment information used in gateways"');
+ }
+ } else {
+ $sql_file = DIR_FS_CATALOG . 'ext/novalnet/sql/db_12_0_0.sql';
+ $sql_lines = file_get_contents($sql_file);
+ $sql_linesArr = explode(";", $sql_lines);
+ foreach ($sql_linesArr as $sql) {
+ if (trim($sql) > '') {
+ xtc_db_query($sql);
+ }
+ }
+ }
+ } else {
+ $sql_file = DIR_FS_CATALOG . 'ext/novalnet/sql/db_12_0_0.sql';
+ $sql_lines = file_get_contents($sql_file);
+ $sql_linesArr = explode(";", $sql_lines);
+ foreach ($sql_linesArr as $sql) {
+ if (trim($sql) > '') {
+ xtc_db_query($sql);
+ }
+ }
+ }
+ }
+}
diff --git a/includes/modules/payment/novalnet_eps.php b/includes/modules/payment/novalnet_eps.php
new file mode 100644
index 0000000..6b8061c
--- /dev/null
+++ b/includes/modules/payment/novalnet_eps.php
@@ -0,0 +1,246 @@
+code = 'novalnet_eps';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_EPS_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_EPS_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_EPS_STATUS') && MODULE_PAYMENT_NOVALNET_EPS_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE') && MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ global $order;
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_EPS_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_VISIBILITY_BY_AMOUNT', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_ORDER_STATUS', '2', '8', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER', '16', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO', '', '3', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_EPS_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_giropay.php b/includes/modules/payment/novalnet_giropay.php
new file mode 100644
index 0000000..7a4f5a4
--- /dev/null
+++ b/includes/modules/payment/novalnet_giropay.php
@@ -0,0 +1,247 @@
+code = 'novalnet_giropay';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GIROPAY_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS') && MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER', '13', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GIROPAY_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_googlepay.php b/includes/modules/payment/novalnet_googlepay.php
new file mode 100644
index 0000000..dceff76
--- /dev/null
+++ b/includes/modules/payment/novalnet_googlepay.php
@@ -0,0 +1,571 @@
+code = 'novalnet_googlepay';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_TITLE : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER) : 0;
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO != '') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO)) : '';
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = false;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ global $order;
+ if (NovalnetHelper::checkMerchantCredentials($this->code) || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ if (!empty($order->info['deduction']) || $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
+ $_SESSION['novalnet']['deduction_amount'] = $order->info['deduction'];
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['deduction_amount'] = $order->info['deduction'];
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ $display_page = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY') ? explode('|', MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY) : array();
+ if ($this->enabled === true && in_array('checkout page',$display_page)) {
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => ' ' .NovalnetHelper::showPaymentDescription($this->code) . $this->info
+ .''
+ .''
+ .''
+ .''.$this->getParam($order),
+ ];
+
+ $selection['fields'][] = ['title' => '
+ '];
+ return $selection;
+ }
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ if (!empty($_REQUEST['nn_google_wallet']) || !empty($_SESSION['wallet_token'])) {
+ unset($_SESSION['wallet_token']);
+ $_SESSION['wallet_token'] = $_REQUEST['nn_google_wallet'];
+ }
+ if (!empty($_REQUEST['nn_wallet_doredirect']) || !empty($_SESSION['nn_wallet_doredirect'])) {
+ unset($_SESSION['nn_wallet_doredirect']);
+ $_SESSION['nn_wallet_doredirect'] = $_REQUEST['nn_wallet_doredirect'];
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
+ $_SESSION['novalnet']['wallet_amount'] = ($order->info['total'] - (round($order->info['deduction_amount'], 2))) + round($order->info['tax'], 2);
+ } else {
+ $_SESSION['novalnet']['wallet_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ if (!empty($_SESSION['received_data'])) {
+ $receivedData = $_SESSION['received_data'];
+ $_SESSION['nn_wallet_doredirect'] = $receivedData['transaction']['doRedirect'];
+ }
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ if ($post['status'] == 'SUCCESS') {
+ if (NovalnetHelper::validateCheckSum($post)) {
+ $transaction_details = array('transaction' =>array('tid' => $post['tid']));
+ $action = NovalnetHelper::get_action_endpoint('transaction_details');
+ $response = NovalnetHelper::sendRequest($transaction_details, $action);
+ $_SESSION['response'] = $response;
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $_SESSION['nn_tempOID'], $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $_SESSION['nn_tempOID'], $post);
+ }
+ } else {
+ if (!empty($_SESSION['nn_wallet_doredirect']) && $_SESSION['nn_wallet_doredirect'] == 'true') {
+ $this->tmpOrders = true;
+ } else {
+ $response = $this->doPaymentCall();
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ }
+ }
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ }
+
+ /**
+ * Core Function : payment_action()
+ *
+ * Send params to Novalnet server
+ */
+ function payment_action()
+ {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = $this->doPaymentCall($insert_id);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ $_SESSION['nn_redirect_url'] = $response['result']['redirect_url'];
+ if (empty($_SESSION['received_data'])) {
+ xtc_redirect($response['result']['redirect_url']);
+ }
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Function : doPaymentCall()
+ *
+ * @return $data
+ */
+ function doPaymentCall($order_no = '') {
+ global $order;
+ include DIR_FS_CATALOG . 'release_info.php';
+ $receivedData = $_SESSION['received_data'];
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $custom_data = NovalnetHelper::getCustomData();
+ if (empty($_SESSION['received_data'])) {
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $transaction_data['transaction']['payment_data']['wallet_token'] = $_SESSION['wallet_token'];
+ $custom_data = NovalnetHelper::getCustomData();
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ } else{
+ $customer_data = NovalnetHelper::getCustomerData($receivedData);
+ $transaction_data = NovalnetHelper::getTransactionData($receivedData);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $params['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ if (!empty($_SESSION['tmp_oID'])) {
+ $params['transaction']['order_no'] = $_SESSION['tmp_oID'];
+ }
+ $params['transaction']['payment_data']['wallet_token'] = $_SESSION['token'];
+ }
+ if($_SESSION['nn_wallet_doredirect'] == 'true') {
+ $params['transaction']['order_no' ] = $order_no;
+ $params['transaction']['return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'];
+ $params['transaction']['error_return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'];
+ }
+ // payment call send to novalnet server
+ if ((defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT : ''))) { // for on-hold transaction
+ $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else {
+ $data = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ unset($_SESSION['novalnet']['deduction_amount']);
+ unset($_SESSION['novalnet']['wallet_amount']);
+ if ($data['result']['status'] != 'SUCCESS' ) {
+ $error = (!empty($data['result']['status_text']) ? $data['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ return $data;
+ }
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ if (!empty($_SESSION['received_data']) && !empty($_SESSION['nn_tempOID'])) {
+ NovalnetHelper::updateOrderStatus($_SESSION['nn_tempOID'], $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($_SESSION['nn_tempOID']);
+ } else {
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($_SESSION['nn_tempOID']);
+ }
+ unset($_SESSION['response']);
+ unset($_SESSION['received_data']);
+ unset($_SESSION['shipping']);
+ unset($_SESSION['nn_wallet_doredirect']);
+ unset($_SESSION['wallet_token']);
+ unset($_SESSION['token']);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT', '0', '5', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE','false', '6' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT', '', '7', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME', '', '8', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE','false', '9' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID', '', '10', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE', 'Default', '11', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT', '', '13', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY', 'shopping cart page|product page|checkout page', '11', 'multiselect', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ORDER_STATUS', '2', '14', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER', '4', '15', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO', '', '16', now());");
+ }
+
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ echo '
+
+ ';
+ echo '';
+ $button_display = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY') ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY : '';
+ echo ' ';
+ return array('configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * Show GooglePay button Cart Page
+ */
+ function googlepayCart_page_button() {
+ if ($this->enabled === true
+ && $_SESSION['cart']->show_total() > 0
+ && (!isset($_SESSION['allow_checkout']) || $_SESSION['allow_checkout'] == 'true') && (strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') == true && MODULE_PAYMENT_NOVALNET_SIGNATURE !='' && MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY !='' && MODULE_PAYMENT_NOVALNET_TARIFF_ID !=''))
+ {
+ echo ''.$this->getParam().' ';
+ }
+ }
+
+ /**
+ * Show GooglePay button Product Page
+ */
+ function googlepayProduct_page_button() {
+ if ($this->enabled === true
+ && (strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') == true && MODULE_PAYMENT_NOVALNET_SIGNATURE !='' && MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY !='' && MODULE_PAYMENT_NOVALNET_TARIFF_ID !='')) {
+ echo ''.$this->getParam().' ';
+ }
+ }
+
+ /**
+ * Get parameter for GooglePay process
+ *
+ * @return string Hidden fields with GooglePay data.
+ */
+ function getParam($nn_order = '') {
+ global $xtPrice;
+ require_once(DIR_WS_CLASSES.'order.php');
+ $order = new order();
+ // customers default address
+ $customers = xtc_db_fetch_array(xtc_db_query("SELECT customer_id FROM admin_access_users limit 1"));
+ $address_query = xtc_db_fetch_array(xtc_db_query("SELECT entry_country_id FROM ". TABLE_ADDRESS_BOOK ." WHERE customers_id = '". $customers['customer_id'] ."'"));
+ // countries
+ $country_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_name, countries_iso_code_2, address_format_id FROM ". TABLE_COUNTRIES ." WHERE countries_id = '". $address_query['entry_country_id'] ."'"));
+
+ // googlepay button types
+ $googlepay_button_type = (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE') && !empty(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE)) ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE : 'plain';
+ $display_page = defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY') ? explode('|', MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY) : array();
+ $current_page = explode('.php', basename($_SERVER['PHP_SELF']));
+ $data = array(
+ 'client_key' => MODULE_PAYMENT_NOVALNET_CLIENT_KEY,
+ 'test_mode' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE == 'true') ? '1' : '0',
+ 'currency' => $order->info['currency'],
+ 'product_name' => $order->products[0]['name'],
+ 'country_code' => (isset($country_query['countries_iso_code_2']) ? $country_query['countries_iso_code_2'] : ''),
+ 'seller_name' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME != '') ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME : STORE_NAME,
+ 'lang' => ((isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE'),
+ 'googlepay_button_type' => $googlepay_button_type,
+ 'googlepay_button_height' => MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT,
+ 'payment_method' => 'GOOGLEPAY',
+ 'product_type' => $GLOBALS['product']->data['product_type'],
+ 'current_page' => $current_page[0],
+ 'environment' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEST_MODE == 'true') ? 'SANDBOX' : 'PRODUCTION',
+ 'enforce_3d' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE') && MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE == 'true') ? true : false,
+ 'partner_id' => (defined('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID') && !empty(MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID)) ? MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID : ''
+ );
+ if (!empty($GLOBALS['product']->data['products_id']) && in_array('product page',$display_page)) {
+ $data['total_amount'] = (string)($order->info['total'] * 100);
+ $data['product_id'] = $GLOBALS['product']->data['products_id'];
+ $data['payment_page'] = 'product_page';
+ } else {
+ if (!empty($_SESSION['novalnet']['payment_amount']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') {
+ $data['total_amount'] = (string) ($_SESSION['novalnet']['payment_amount'] * 100);
+ } else {
+ $data['total_amount'] = (string)($order->info['total'] * 100);
+ }
+ }
+ $data['show_shipping_option'] = 0;
+ if($GLOBALS['product']->data['product_type'] && $GLOBALS['product']->data['product_type'] != 2) {
+ $data['show_shipping_option'] = 1;
+ }
+ $articleDetails = [];
+ foreach($order->products as $key => $products) {
+ if($products['product_type'] != 2) {
+ $data['show_shipping_option'] = 1;
+ }
+
+ $articleDetails[] = array('label'=> $products['name']. ' x ' .$products['qty'],
+ 'amount' => (string)(($products['qty'] * $products['price'])*100),
+ 'type' => 'SUBTOTAL',
+ );
+ }
+ if (empty($nn_order)) {
+ if (!empty($order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] != '0') { // Price incl tax
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if (!empty($order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ }
+ if(empty($articleDetails) && !empty($GLOBALS['product']->data['products_id'])) {
+ $products_price = $xtPrice->xtcGetPrice($GLOBALS['product']->data['products_id'], true, 1, $GLOBALS['product']->data['products_tax_class_id'], $GLOBALS['product']->data['products_price'], 1, 0, true, true, '', true);
+ $articleDetails[] = array('label'=> $GLOBALS['product']->data['products_name'] . ' x ' .$GLOBALS['product']->data['qty'],
+ 'amount' => (string)($products_price['plain'] * 100) * $GLOBALS['product']->data['qty'],
+ 'type' => 'SUBTOTAL',
+ );
+ $tax_rate = $xtPrice->getTaxRateByTaxClassId($GLOBALS['product']->data['products_tax_class_id']);
+ $tax = $xtPrice->xtcGetTax($GLOBALS['product']->data['products_price'], $tax_rate);
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] != '0'){
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else {
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($tax, 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($GLOBALS['product']->data['products_price'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $articleDetails[] = array(
+ 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' .'Discount',
+ 'amount' => (string) (round($discount_price, 2) *100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ $data['total_amount'] = (string)(($products_price['plain'] * 100) - round($discount_price, 2) *100);
+ }
+ if ($current_page[0] == 'checkout_payment') {
+ $articleDetails[] = array('label'=> 'shipping',
+ 'amount' => (string)($nn_order->info['shipping_cost']*100),
+ 'type' => 'SUBTOTAL');
+ if(!empty($nn_order->info['deduction']) || ($_SESSION['customers_status']['customers_status_discount'] != '0')) { // To add discount
+ $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $deduction = abs($discount_price + $nn_order->info['deduction']);
+ $articleDetails[] = array('label'=> 'Discount',
+ 'amount' => (string) (round($deduction, 2) * 100),
+ 'type' => 'SUBTOTAL');
+ }
+ if(!empty($nn_order->info['deduction']) || ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00')) { // Price incl tax
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($nn_order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if (!empty($nn_order->info['tax']) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0') { // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($nn_order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) {
+ $data['total_amount'] = (string)($nn_order->info['total'] * 100);
+ $data['orig_amount'] = $data['total_amount'];
+ } else {
+ $data['total_amount'] = (string)(($nn_order->info['total'] * 100) + (round($nn_order->info['tax'], 2) * 100));
+ $data['orig_amount'] = (string)(($nn_order->info['total'] * 100) + (round($nn_order->info['tax'], 2) * 100));
+ }
+ }
+ if ($current_page[0] != 'checkout_payment') {
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != 0) {
+ $data['orig_amount'] = $data['total_amount'];
+ } else {
+ $data['orig_amount'] = (string)($data['total_amount'] + (round($order->info['tax'], 2) * 100));
+ }
+ }
+ $input = json_encode($data);
+ $googlepay_hidden_field = " ".
+ " ".
+ " ";
+ return $googlepay_hidden_field;
+ }
+}
+
+?>
diff --git a/includes/modules/payment/novalnet_guarantee_invoice.php b/includes/modules/payment/novalnet_guarantee_invoice.php
new file mode 100644
index 0000000..3338945
--- /dev/null
+++ b/includes/modules/payment/novalnet_guarantee_invoice.php
@@ -0,0 +1,338 @@
+code = 'novalnet_guarantee_invoice';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ global $order;
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ // Get customer details
+ $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']);
+
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') {
+ if ($this->proceedToGuranteePayment()) {
+ $selection = [
+ 'id' => $this->code,
+ 'module' => defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEXT_TITLE : '',
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ $is_b2b = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B == 'true') && !empty($order->billing['company'])) ? true : false;
+ if (!$is_b2b) {
+ $selection['fields'][] = ['title' =>'' .MODULE_PAYMENT_GUARANTEE_DOB_FIELD.' '.' '.''. '', ];
+ $selection['fields'][] = ['title' => NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details)];
+ }
+ } else {
+ return false;
+ }
+ }
+ return $selection;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ global $order;
+ if (!empty($_REQUEST['novalnet_guarantee_invoicebirthdate'])) {
+ $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_guarantee_invoicebirthdate']);
+ if (!empty($error_message) && (((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE == 'true')
+ && (defined('MODULE_PAYMENT_NOVALNET_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'true')))) {
+ $_SESSION['error_message'] = $error_message;
+ } elseif (!empty($error_message)) {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message) .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false));
+ }
+ $_SESSION['novalnet_guarantee_invoicebirthdate'] = date("Y-m-d", strtotime($_REQUEST['novalnet_guarantee_invoicebirthdate']));
+ } elseif (empty($order->billing['company'])) {
+ $_SESSION['error_message'] = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE : '';
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($_SESSION['error_message']), 'SSL', true, false));
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process(){
+ global $order;
+ if (!empty($_SESSION['error_message']) && (defined('MODULE_PAYMENT_NOVALNET_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'true') && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE == 'true')) {
+ $this->code = 'novalnet_invoice';
+ $order->info['payment_method'] = 'novalnet_invoice';
+ $order->info['payment_class'] = 'novalnet_invoice';
+ unset($_SESSION['error_message']);
+ }
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $custom_data = NovalnetHelper::getCustomData();
+
+ if (!empty($_SESSION['novalnet_guarantee_invoicebirthdate']) && (empty($order->billing['company'])
+ || (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B == 'false'))) {
+ if(isset($customer_data['customer']['billing']['company'])) {
+ unset($customer_data['customer']['billing']['company']);
+ }
+ $customer_data['customer']['birth_date'] = $_SESSION['novalnet_guarantee_invoicebirthdate'];
+ } elseif (!empty($order->billing['company'])) {
+ $customer_data['customer']['billing']['company'] = $order->billing['company'];
+ }
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ if($this->code == 'novalnet_invoice'){
+ $due_date_in_days = defined('MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE') ? MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE : '';
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+ if ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE == 'true')&& (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ }else if($this->code == 'novalnet_guarantee_invoice'){
+ if ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE == 'true')
+ && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ }
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ unset($_SESSION['novalnet_guarantee_invoicebirthdate']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ if (in_array($_SESSION['response']['transaction']['status'], array('CONFIRMED', 'ON_HOLD'))
+ || ($_SESSION['response']['transaction']['status'] == 'PENDING' && $_SESSION['response']['transaction']['payment_type'] == 'INVOICE')
+ ) {
+ $order->info['comments'] .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL;
+ $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $_SESSION['response']['transaction']['tid'])) . PHP_EOL;
+ $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $insert_id)) . PHP_EOL;
+ }
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`,`last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE', 'false', '1', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS','false', '2', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE','false', '3', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE','true', '4', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B','true', '6', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOWED', '', '7', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE', '0', '8', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE','false', '10' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT', '', '11', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ORDER_STATUS', '2', '12', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER', '7', '13', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO', '', '14', now());");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * To Proceed and validate Guarantee payment basic requirements in checkout
+ *
+ * @return boolean
+ */
+ function proceedToGuranteePayment() {
+ global $order;
+ $b2b = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B : '';
+ $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT : '999';
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') {
+ $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),$b2b, $order->billing['company']);
+ if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame()) {
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_guarantee_sepa.php b/includes/modules/payment/novalnet_guarantee_sepa.php
new file mode 100644
index 0000000..4c8461d
--- /dev/null
+++ b/includes/modules/payment/novalnet_guarantee_sepa.php
@@ -0,0 +1,455 @@
+code = 'novalnet_guarantee_sepa';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ global $order;
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ if (!$this->proceedToGuranteePayment())
+ return false;
+
+ // Get customer details
+ $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']);
+ $selection = [
+ 'id' => $this->code,
+ 'module' => defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEXT_TITLE : '',
+ 'description' => ' ' . NovalnetHelper::showSepaDescription($this->code) . $this->info
+ .''
+ .'',
+ 'module_cost' => $this->cost,
+ ];
+ if(defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE != 'true'){
+ $selection['fields'][] = ['title' => ' '];
+ }
+ $is_b2b = (!empty($order->billing['company']) && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B == 'true')) ? true : false;
+ if (!$is_b2b || (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'false')) {
+ $dob_field = [
+ 'title' => MODULE_PAYMENT_GUARANTEE_DOB_FIELD. NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details),
+ ];
+ }
+ $bic_field = ['title' => 'BIC ' . xtc_draw_input_field('novalnet_sepa_bic', '', 'id="novalnet_sepa_bic_field" autocomplete="off" placeholder="BIC" onkeypress="return NovalnetUtility.formatBic(event);" onchange="return NovalnetUtility.formatBic(event);"') . '
'
+ ];
+ $payment_details = xtc_db_query("SELECT payment_details, id FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA') AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10");
+ $sepa_saved_card_details = [];
+ $count = 0;
+ while ($payment_detail = xtc_db_fetch_array($payment_details)) {
+ $decode_details = json_decode($payment_detail['payment_details'], true);
+ if (empty($decode_details['iban'])) {
+ continue;
+ }
+ $decode_details['id'] = $payment_detail['id'];
+ $sepa_saved_card_details[$count] = $decode_details;
+ $count++;
+ }
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true') {
+ if (!empty($sepa_saved_card_details) || !empty($_SESSION['sepa_saved_card_details'])) {
+ unset($_SESSION['sepa_saved_card_details']);
+ $payment_data = [];
+ foreach ($sepa_saved_card_details as $key => $value) {
+ if (empty($value['iban']) || in_array($value['iban'], $payment_data)) {
+ continue;
+ }
+ if (empty($value)) {
+ continue;
+ }
+ $_SESSION['sepa_saved_card_details'] = $sepa_saved_card_details;
+ $oneclick = (!empty($sepa_saved_card_details)) ? ' '.sprintf(('IBAN %s'),$value['iban']) . ' Delete ' : '';
+ if(!empty($value['iban'])){
+ $selection['fields'][] = [ 'title' => $oneclick ];
+ }
+ array_push($payment_data, $value['iban']);
+ }
+ $selection['fields'][] = [ 'title' => ' '.MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS.' '];
+
+ $selection['fields'][] = ['title' => ''.MODULE_PAYMENT_NOVALNET_SEPA_IBAN.' '. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" style="display:none;" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = $dob_field;
+ $selection['fields'][] = ['title' => ''.xtc_draw_checkbox_field('nn_sepa_checkbox', 1 , false, 'id="novalnet_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
',
+ ];
+ } else{
+ $selection['fields'][] = [
+ 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = $dob_field;
+ $selection['fields'][] = ['title' => ''.xtc_draw_checkbox_field('nn_sepa_checkbox', 1 , false, 'id="novalnet_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
',
+ ];
+ }
+ } else if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'false') {
+ $selection['fields'][] = [
+ 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = $dob_field;
+ }
+ return $selection;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ global $order;
+ if (!empty($_SESSION['novalnet_sepa_new'])) {
+ unset($_SESSION['novalnet_sepa_new']);
+ }
+ if (isset($_REQUEST['novalnet_sepa_token']) && $_REQUEST['novalnet_sepa_token'] == 'new') {
+ $_SESSION['novalnet_sepa_new'] = 'new';
+ }
+ if (isset($_SESSION['error_message'])) {
+ unset($_SESSION['error_message']);
+ }
+ if (!empty($_SESSION['novalnet_guarantee_sepa_token']) || !empty($_SESSION['novalnet_guarantee_sepa_create_token'])) {
+ unset($_SESSION['novalnet_guarantee_sepa_token']);
+ unset($_SESSION['novalnet_guarantee_sepa_create_token']);
+ }
+ if (!empty($_SESSION['novalnet_guarantee_sepa_birthdate']) || !empty($_SESSION['novalnet_sepa_iban'])) {
+ unset($_SESSION['novalnet_guarantee_sepa_birthdate']);
+ unset($_SESSION['novalnet_sepa_iban']);
+ }
+
+ if (!empty($_REQUEST['novalnet_sepa_token']) && ($_REQUEST['novalnet_sepa_token'] != 'new')
+ && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true')) {
+ $_SESSION['novalnet_guarantee_sepa_token'] = $_REQUEST['novalnet_sepa_token'];
+ } else {
+ if (!empty($_REQUEST['novalnet_sepa_iban'])) {
+ $_SESSION['novalnet_sepa_iban'] = $_REQUEST['novalnet_sepa_iban'];
+ $_SESSION['novalnet_sepa_bic'] = !empty($_REQUEST['novalnet_sepa_bic']) ? $_REQUEST['novalnet_sepa_bic'] : '';
+ if ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true') && !empty($_REQUEST['nn_sepa_checkbox'])
+ && $_REQUEST['nn_sepa_checkbox'] != 'new') {
+ $_SESSION['novalnet_guarantee_sepa_create_token'] = $_REQUEST['nn_sepa_checkbox'];
+ }
+ } else {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false));
+ }
+ }
+ if (!empty($_REQUEST['novalnet_guarantee_sepabirthdate'])) {
+ $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_guarantee_sepabirthdate']);
+ if (!empty($error_message) && (((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'true')
+ && (defined('MODULE_PAYMENT_NOVALNET_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_SEPA_STATUS == 'true')))) {
+ $_SESSION['error_message'] = $error_message;
+ } elseif (!empty($error_message)) {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message) .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false));
+ }
+ $_SESSION['novalnet_guarantee_sepa_birthdate'] = date("Y-m-d", strtotime($_REQUEST['novalnet_guarantee_sepabirthdate']));
+ } elseif (empty($order->billing['company'])) {
+ $_SESSION['error_message'] = MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE;
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($_SESSION['error_message']), 'SSL', true, false));
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ if (!empty($_SESSION['error_message']) && (defined('MODULE_PAYMENT_NOVALNET_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_SEPA_STATUS == 'true') && (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'true')) {
+ $this->code = 'novalnet_sepa';
+ $order->info['payment_method'] = 'novalnet_sepa';
+ $order->info['payment_class'] = 'novalnet_sepa';
+ if(!empty($_SESSION['novalnet_guarantee_sepa_token'])) {
+ $_SESSION[$this->code . '_token'] = $_SESSION['novalnet_guarantee_sepa_token'];
+ unset($_SESSION['novalnet_guarantee_sepa_token']);
+ }
+ if(!empty($_SESSION['novalnet_guarantee_sepa_create_token'])) {
+ $_SESSION[$this->code . '_create_token'] = $_SESSION['novalnet_guarantee_sepa_create_token'];
+ unset($_SESSION['novalnet_guarantee_sepa_create_token']);
+ }
+ unset($_SESSION['error_message']);
+ }
+
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $custom_data = NovalnetHelper::getCustomData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ if (!empty($_SESSION['novalnet_guarantee_sepa_birthdate']) && (empty($order->billing['company'])
+ || (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B == 'false'))) {
+ if(isset($customer_data['customer']['billing']['company'])) {
+ unset($customer_data['customer']['billing']['company']);
+ }
+ $customer_data['customer']['birth_date'] = $_SESSION['novalnet_guarantee_sepa_birthdate'];
+ } elseif (!empty($order->billing['company'])) {
+ $customer_data['customer']['billing']['company'] = $order->billing['company'];
+ }
+ // Add token data if it's enabled
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION == 'true') {
+ if (!empty($_SESSION['sepa_saved_card_details']) && empty($_SESSION['novalnet_sepa_new'])) {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $params['transaction']['payment_data']['token'] = $transaction_data['transaction']['payment_data']['token'];
+ }else if ((isset($_SESSION['novalnet_sepa_new']) && $_SESSION['novalnet_sepa_new'] == 'new')) {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ } else {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ } else {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ $due_date_in_days = constant('MODULE_PAYMENT_' . strtoupper($this->code) . '_DUE_DATE');
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+ if($this->code == 'novalnet_sepa'){
+ if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ }else if($this->code == 'novalnet_guarantee_sepa'){
+ if ((defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE == 'true') && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ }
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ unset($_SESSION['novalnet_sepa_iban']);
+ unset($_SESSION[$this->code .'_token']);
+ unset($_SESSION[$this->code . '_create_token']);
+ unset($_SESSION['novalnet_guarantee_sepa_birthdate']);
+ unset($_SESSION['novalnet_sepa_bic']);
+ unset($_SESSION['novalnet_sepa_new']);
+ unset($_SESSION['sepa_saved_card_details']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA', 'false', '1', 'switcher',now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS','false', '2', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE','false', '3', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE','true', '4', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B','true', '6', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOWED', '', '7', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE', '0', '8', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION','true' , '9', 'switcher' , now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE', '', '10', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE','false', '11' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT', '', '12', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ORDER_STATUS', '2', '13', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER', '8', '14', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO', '', '15', now());");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * To Proceed and validate Guarantee payment basic requirements in checkout
+ *
+ * @return boolean
+ */
+ function proceedToGuranteePayment() {
+ global $order;
+ $b2b = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B : '';
+ $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT : '999';
+ $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),$b2b, $order->billing['company']);
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') {
+ if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame()) {
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_ideal.php b/includes/modules/payment/novalnet_ideal.php
new file mode 100644
index 0000000..1db1656
--- /dev/null
+++ b/includes/modules/payment/novalnet_ideal.php
@@ -0,0 +1,244 @@
+code = 'novalnet_ideal';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_IDEAL_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_STATUS') && MODULE_PAYMENT_NOVALNET_IDEAL_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE') && MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`,`last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER', '11', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_IDEAL_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_instalment_invoice.php b/includes/modules/payment/novalnet_instalment_invoice.php
new file mode 100644
index 0000000..c628e08
--- /dev/null
+++ b/includes/modules/payment/novalnet_instalment_invoice.php
@@ -0,0 +1,317 @@
+code = 'novalnet_instalment_invoice';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER')
+ && trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS')
+ && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE')
+ && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ global $order;
+ $order_amount = NovalnetHelper::getOrderAmount($order->info['total']);
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ if (empty(NovalnetHelper::checkInstalmentConditions($order_amount, $this->code))) {
+ return false;
+ }
+ // Get customer details
+ $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']);
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info
+ . ''
+ . ''
+ . ' ',
+ ];
+ if (($order->billing['company'] == '') || ($order->billing['company'] != '' && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B == 'false')) {
+ $selection['fields'][] = ['title' => ''.MODULE_PAYMENT_GUARANTEE_DOB_FIELD.' ' ];
+ $selection['fields'][] = ['title' => ''.NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details).' '] ;
+ }
+
+ //Instalment cycles
+ $novalnet_instalment_cycle = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE') ? explode('|', MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE) : array();
+ $novalnet_recurring_period_cycle = '1m';
+ $selection['fields'][] = ['title' => (sprintf(( ''.MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT.' '), xtc_format_price_order($order_amount/100, 1, $order->info['currency'])))];
+ $selection['fields'][] = [
+ 'field' => ''.xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND , 'id="nn_cycles_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND , 'id="nn_amount_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND , 'id="nn_installment_frontend"').
+ xtc_draw_hidden_field('', $order->info['currency'], 'id="nn_installmnet_currency"').''.NovalnetHelper::getInstalmentCycles($order_amount/100,$novalnet_instalment_cycle, $order->info['currency']).' ',
+ ];
+ if (NovalnetHelper::getInstalmentCycles($order_amount/100,$novalnet_instalment_cycle, $order->info['currency']) == '0') {
+ return false;
+ }
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ global $order;
+ $_SESSION['novalnet_instalment_invoicebirthdate'] = date('Y-m-d',strtotime($_REQUEST['novalnet_instalment_invoicebirthdate']));
+ $_SESSION['novalnet_instalment_invoice_cycles'] = $_REQUEST['novalnet_global_recurring_period_cycles'];
+ if (($order->billing['company'] == '') || ($order->billing['company'] != ''
+ && (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B == 'false'))) {
+ if ($_REQUEST['novalnet_instalment_invoicebirthdate'] == '') {
+ $error_message = MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE;
+ } else if ($_REQUEST['novalnet_instalment_invoicebirthdate'] != '') {
+ $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_instalment_invoicebirthdate']);
+ }
+ }
+ if ($error_message != '') {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message), 'SSL', true, false));
+ }
+ }
+
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $custom_data = NovalnetHelper::getCustomData();
+ if (!empty($_SESSION['novalnet_instalment_invoicebirthdate']) && (empty($order->billing['company'])
+ || (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B == 'false'))){
+ if(isset($customer_data['customer']['billing']['company'])) {
+ unset($customer_data['customer']['billing']['company']);
+ }
+ $customer_data['customer']['birth_date'] = $_SESSION['novalnet_instalment_invoicebirthdate'];
+ } elseif (!empty($order->billing['company'])) {
+ $customer_data['customer']['billing']['company'] = $order->billing['company'];
+ }
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ // Instalment payments params
+ $params['instalment'] = [
+ 'interval' => '1m',
+ 'cycles' => $_SESSION['novalnet_instalment_invoice_cycles'],
+ ];
+ // To perform on-hold process
+ if ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE == 'true')
+ && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT : ''))) {
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else {
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ unset($_SESSION['novalnet_instalment_invoicebirthdate']);
+ unset($_SESSION['novalnet_instalment_invoice_cycles']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ if($_SESSION['response']['transaction']['payment_type'] == 'INSTALMENT_INVOICE' && (in_array($_SESSION['response']['transaction']['status'], array('CONFIRMED', 'ON_HOLD')))) {
+ $order->info['comments'] = str_replace('###SHOPORDERNUMBER###', $insert_id, $order->info['comments']);
+ }
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ $response = NovalnetHelper::sendTransactionUpdate($insert_id);
+ unset($_SESSION['novalnet']['payment_amount']);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`,`last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ', 'false', '1', 'switcher',now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS','false', '2', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE','false', '3', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE','2|3|4|5|6|7|8|9|10|11|12', '4', 'text' , now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT', '1998', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOWED', '', '6', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B','true', '7', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE', '0', '8', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE','false', '9' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT', '', '10', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ORDER_STATUS', '2', '11', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER', '9', '12', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO', '', '13', now());");
+
+
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_instalment_sepa.php b/includes/modules/payment/novalnet_instalment_sepa.php
new file mode 100644
index 0000000..9d52910
--- /dev/null
+++ b/includes/modules/payment/novalnet_instalment_sepa.php
@@ -0,0 +1,419 @@
+code = 'novalnet_instalment_sepa';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER')
+ && trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS')
+ && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE')
+ && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ global $order;
+ $order_amount = NovalnetHelper::getOrderAmount($order->info['total']);
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ // Get customer details
+ $customer_details = NovalnetHelper::collectCustomerDobGenderFax($order->customer['email_address']);
+ if (empty(NovalnetHelper::checkInstalmentConditions($order_amount, $this->code))) {
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => ' '.NovalnetHelper::showSepaDescription($this->code) . $this->info
+ . ''
+ . ''
+ . ' ',
+ ];
+ $is_b2b = (!empty($order->billing['company']) && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B == 'true')?true:false;
+ if (!$is_b2b) {
+ $dob_field = [
+ 'title' => MODULE_PAYMENT_GUARANTEE_DOB_FIELD. NovalnetHelper::getGuaranteeField($this->code.'birthdate', $customer_details),
+ ];
+ }
+ $bic_field = ['title' => 'BIC ' . xtc_draw_input_field('novalnet_instalment_sepa_bic', '', 'id="novalnet_instalment_sepa_bic_field" autocomplete="off" placeholder="BIC" onkeypress="return NovalnetUtility.formatBic(event);" onchange="return NovalnetUtility.formatBic(event);"') . '
'
+ ];
+ $payment_details = xtc_db_query("SELECT payment_details, id FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA') AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10");
+ $instasaved_card_details = [];
+ $count = 0;
+ while ($payment_detail = xtc_db_fetch_array($payment_details)) {
+ $decode_details = json_decode($payment_detail['payment_details'], true);
+ if (empty($decode_details['iban'])) {
+ continue;
+ }
+ $decode_details['id'] = $payment_detail['id'];
+ $instasaved_card_details[$count] = $decode_details;
+ $count++;
+ }
+ if (MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true') {
+ if(isset($_SESSION['instasaved_card_details'])) {
+ unset($_SESSION['instasaved_card_details']); // If instasaved_card_details unset it.
+ }
+ if (!empty($instasaved_card_details)) {
+ $_SESSION['instasaved_card_details'] = $instasaved_card_details;
+ $payment_data = [];
+ foreach ($instasaved_card_details as $key => $value) {
+ if (empty($value['iban']) || in_array($value['iban'], $payment_data)) {
+ continue;
+ }
+ if (empty($value)) {
+ continue;
+ }
+ $oneclick = (!empty($instasaved_card_details)) ? ' '.sprintf(('IBAN %s'),$value['iban']) . ' Delete ' : '';
+ if(!empty($value['iban'])){
+ $selection['fields'][] = [ 'title' => $oneclick ];
+ }
+ array_push($payment_data, $value['iban']);
+ }
+ $selection['fields'][] = [ 'title' => ' '.MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS.' '];
+
+ $selection['fields'][] = ['title' => ''.MODULE_PAYMENT_NOVALNET_SEPA_IBAN.' '. xtc_draw_input_field('novalnet_instalment_sepa_iban', '', 'id="novalnet_instalment_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" style="display:none;" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = $dob_field;
+ $selection['fields'][] = ['title' => ''.xtc_draw_checkbox_field('nn_instalment_sepa_checkbox', 1 , false, 'id="novalnet_instalment_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
',
+ ];
+ } else {
+ $selection['fields'][] = ['title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_instalment_sepa_iban', '', 'id="novalnet_instalment_sepa_iban_field" autocomplete="off" placeholder="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = $dob_field;
+ $selection['fields'][] = ['title' => ''.xtc_draw_checkbox_field('nn_instalment_sepa_checkbox', 1 , false, 'id="novalnet_instalment_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
',
+ ];
+ }
+ } else {
+ $selection['fields'][] = [
+ 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_instalment_sepa_iban', '', 'id="novalnet_instalment_sepa_iban_field" autocomplete="off" placeholder="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_instalment_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = $dob_field;
+ }
+ //Instalment cycles
+ $novalnet_instalment_cycle = defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE') ? explode('|', MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE) : array();
+ $novalnet_recurring_period_cycle = '1m';
+ $selection['fields'][] = ['title' => (sprintf(( '' . MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT . ' '), xtc_format_price_order($order_amount/100, 1, $order->info['currency'])))];
+
+ $selection['fields'][] = [
+ 'field' => ''.xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND , 'id="nn_cycles_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND , 'id="nn_amount_frontend"').xtc_draw_hidden_field('', MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND , 'id="nn_installment_frontend"').
+ xtc_draw_hidden_field('', $order->info['currency'], 'id="nn_installmnet_currency"').''.NovalnetHelper::getInstalmentCycles($order_amount/100,$novalnet_instalment_cycle,$order->info['currency'] ).' ',
+ ];
+ if (NovalnetHelper::getInstalmentCycles($order_amount/100,$novalnet_instalment_cycle, $order->info['currency']) == '0') {
+ return false;
+ }
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ global $order;
+ if (!empty($_SESSION['novalnet_instalment_sepa_new'])) {
+ unset($_SESSION['novalnet_instalment_sepa_new']);
+ }
+ if (isset($_REQUEST['novalnet_instalment_sepa_token']) && $_REQUEST['novalnet_instalment_sepa_token'] == 'new') {
+ unset($_SESSION['novalnet_instalment_sepa_new']);
+ $_SESSION['novalnet_instalment_sepa_new'] = 'new';
+ }
+ if (!empty($_SESSION['novalnet_instalment_sepa_token']) || !empty($_SESSION['novalnet_instalment_sepa_create_token'])) {
+ unset($_SESSION['novalnet_instalment_sepa_token']);
+ unset($_SESSION['novalnet_instalment_sepa_create_token']);
+ }
+ if (!empty($_REQUEST['novalnet_instalment_sepa_iban'])) {
+ $_SESSION['novalnet_sepa_iban'] = $_REQUEST['novalnet_instalment_sepa_iban'];
+ $_SESSION['novalnet_sepa_bic'] = !empty($_REQUEST['novalnet_instalment_sepa_bic']) ? $_REQUEST['novalnet_instalment_sepa_bic'] : '';
+ if ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true') && !empty($_REQUEST['nn_instalment_sepa_checkbox']))
+ {
+ $_SESSION['novalnet_instalment_sepa_create_token'] = $_REQUEST['nn_instalment_sepa_checkbox'];
+ }
+ } elseif (!empty($_REQUEST['novalnet_instalment_sepa_token']) && ($_REQUEST['novalnet_instalment_sepa_token'] != 'new') && (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true')) {
+ $_SESSION['novalnet_instalment_sepa_token'] = $_REQUEST['novalnet_instalment_sepa_token'];
+ } else {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false));
+ }
+ $_SESSION['novalnet_instalment_sepa_birthdate'] = date('Y-m-d',strtotime($_REQUEST['novalnet_instalment_sepabirthdate']));
+ $_SESSION['novalnet_instalment_sepa_cycles'] = $_REQUEST['novalnet_global_recurring_period_cycles_sepa'];
+ if (($order->billing['company'] == '') || ($order->billing['company'] != ''
+ && (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B == 'false'))) {
+ if ($_REQUEST['novalnet_instalment_sepabirthdate'] == '') {
+ $error_message = MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE;
+ } else if ($_REQUEST['novalnet_instalment_sepabirthdate'] != '') {
+ $error_message = NovalnetHelper::dateOfBirth($_REQUEST['novalnet_instalment_sepabirthdate']);
+ }
+ }
+ if ($error_message != '') {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error_message), 'SSL', true, false));
+ }
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $custom_data = NovalnetHelper::getCustomData();
+ if (!empty($_SESSION['novalnet_instalment_sepa_birthdate']) && (empty($order->billing['company'])
+ || (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B == 'false'))) {
+ if(isset($customer_data['customer']['billing']['company'])) {
+ unset($customer_data['customer']['billing']['company']);
+ }
+ $customer_data['customer']['birth_date'] = $_SESSION['novalnet_instalment_sepa_birthdate'];
+ } elseif (!empty($order->billing['company'])) {
+ $customer_data['customer']['billing']['company'] = $order->billing['company'];
+ }
+ // Add token data if it's enabled
+ if (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION == 'true') {
+ if (!empty($_SESSION['instasaved_card_details']) && empty($_SESSION['novalnet_instalment_sepa_new'])) {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ } else {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data); // If the create token is set it will added in request.
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ } else {
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ $due_date_in_days = constant('MODULE_PAYMENT_' . strtoupper($this->code) . '_PAYMENT_DUE_DATE');
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+ // Instalment payments params
+ $params['instalment'] = [
+ 'interval' => '1m',
+ 'cycles' => $_SESSION['novalnet_instalment_sepa_cycles'],
+ ];
+ if ((defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE == 'true')
+ && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT : ''))) {
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else {
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ unset($_SESSION['novalnet_sepa_iban']);
+ unset($_SESSION['novalnet_instalment_sepa_birthdate']);
+ unset($_SESSION['novalnet_instalment_sepa_cycles']);
+ unset($_SESSION['novalnet_instalment_sepa_create_token']);
+ unset($_SESSION['novalnet_instalment_sepa_token']);
+ unset($_SESSION['novalnet_sepa_bic']);
+ unset($_SESSION['novalnet_instalment_sepa_new']);
+ unset($_SESSION['instasaved_card_details']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ unset($_SESSION['novalnet']['payment_amount']);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ', 'false', '1', 'switcher', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS','false', '2', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE','false', '3', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE','2|3|4|5|6|7|8|9|10|11|12', '4', 'text' , now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT', '1998', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B','true', '6', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE', '', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION','true' , '8', 'switcher' , now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOWED', '', '9', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE', '0', '10', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE','false', '11' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT', '', '12', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ORDER_STATUS', '2', '13', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER', '10', '14', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO', '', '15', now());");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_instantbank.php b/includes/modules/payment/novalnet_instantbank.php
new file mode 100644
index 0000000..d457577
--- /dev/null
+++ b/includes/modules/payment/novalnet_instantbank.php
@@ -0,0 +1,245 @@
+code = 'novalnet_instantbank';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS') && MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE') && MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER', '12', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INSTANTBANK_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_invoice.php b/includes/modules/payment/novalnet_invoice.php
new file mode 100644
index 0000000..514bc12
--- /dev/null
+++ b/includes/modules/payment/novalnet_invoice.php
@@ -0,0 +1,293 @@
+code = 'novalnet_invoice';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_INVOICE_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_INVOICE_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE') && MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') {
+ if ($this->proceedToGuranteePayment()) {
+ $proceedToInvoice = false;
+ } elseif (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE == 'true') {
+ $proceedToInvoice = true;
+ }
+ } else {
+ $proceedToInvoice = true;
+ }
+
+ if ($proceedToInvoice) {
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process(){
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $custom_data = NovalnetHelper::getCustomData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName('novalnet_invoice');
+ $due_date_in_days = defined('MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE') ? MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE : '';
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $transaction_data['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ if ((defined('MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE == 'true')
+ && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ if ($response['result']['status'] == 'SUCCESS') { // Success
+ $_SESSION['response'] = $response;
+ } else { // Failure
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ }
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ $order->info['comments'] .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL;
+ $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $_SESSION['response']['transaction']['tid'])) . PHP_EOL;
+ $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $insert_id)) . PHP_EOL;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT', '', '5', now());");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE', '', '6', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE','false', '7' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT', '', '8', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS', '1', '9', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_CALLBACK_ORDER_STATUS', '2', '10', 'order-status', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER', '5', '11', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO', '', '12', now());");
+
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_DUE_DATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_CALLBACK_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * To Proceed and validate Guarantee payment basic requirements in checkout
+ *
+ * @return boolean
+ */
+ function proceedToGuranteePayment() {
+ global $order;
+ $b2b = defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B') ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B : '';
+ $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT : '999';
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_STATUS == 'true') {
+ $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),$b2b, $order->billing['company']);
+ if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check
+ && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame($order)) {
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
+?>
diff --git a/includes/modules/payment/novalnet_multibanco.php b/includes/modules/payment/novalnet_multibanco.php
new file mode 100644
index 0000000..b136b84
--- /dev/null
+++ b/includes/modules/payment/novalnet_multibanco.php
@@ -0,0 +1,237 @@
+code = 'novalnet_multibanco';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEXT_TITLE : '');
+ $this->info = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS') && MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE') && MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $custom_data = NovalnetHelper::getCustomData();
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ORDER_STATUS', '1', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_CALLBACK_ORDER_STATUS', '2', '7', 'order-status', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER', '21', '8', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO', '', '9', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_CALLBACK_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_MULTIBANCO_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_online_bank_transfer.php b/includes/modules/payment/novalnet_online_bank_transfer.php
new file mode 100644
index 0000000..e377110
--- /dev/null
+++ b/includes/modules/payment/novalnet_online_bank_transfer.php
@@ -0,0 +1,245 @@
+code = 'novalnet_online_bank_transfer';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS') && MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE') && MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER', '22', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_ONLINE_BANK_TRANSFER_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_paypal.php b/includes/modules/payment/novalnet_paypal.php
new file mode 100644
index 0000000..271abc9
--- /dev/null
+++ b/includes/modules/payment/novalnet_paypal.php
@@ -0,0 +1,309 @@
+code = 'novalnet_paypal';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_PAYPAL_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS') && MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE') && MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . '' . $this->info.' ',
+ ];
+ return $selection;
+ }
+
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ global $order;
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $paypal_sheet_details = $this->paypal_sheet_details();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $custom_data = NovalnetHelper::getCustomData();
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data, $paypal_sheet_details);
+ $params['transaction']['return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'];
+ $params['transaction']['error_return_url'] = ((isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI'];
+ $params['transaction']['order_no' ] = $insert_id;
+ if ((defined('MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE == 'true')
+ && NovalnetHelper::getOrderAmount($order->info['total']) >= (defined('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT : '')) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ return false;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE','false', '7' ,'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT', '', '8', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS', '2', '9', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER', '17', '10', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO', '', '11', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PAYPAL_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * Paypal sheet details
+ *
+ * @return $data
+ */
+ function paypal_sheet_details() {
+ global $order;
+ foreach ($order->products as $products){
+ foreach ($products['attributes'] as $attr => $value) {
+ $attributes[] = ', ' . $value['option'] . ':' . $value['value'];
+ }
+ if ($products['product_type'] == 1) {
+ $product_type = 'physical';
+ } else {
+ $product_type = 'digital';
+ }
+ $productId = str_split($products['id']);
+ $product_desc = xtc_db_fetch_array(xtc_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where language_id = '" . $_SESSION['languages_id'] . "' and products_id = '" . $productId[0] . "'"));
+ $data['cart_info']['line_items'][] = array(
+ 'name' => $products['name']. ' x ' .$products['qty'] . $attributes,
+ 'price' => (string) (round((float) $products['price'] * 100)),
+ 'quantity' => $products['qty'],
+ 'description' => !empty($product_desc['products_description']) ? $product_desc['products_description'] : '',
+ 'category' => $product_type,
+ );
+
+ }
+ $order_total = xtc_db_fetch_array(xtc_db_query("SELECT value FROM " . TABLE_ORDERS_TOTAL . " where class = 'ot_discount' AND orders_id = " . $_SESSION['tmp_oID']));
+ if (!empty($order_total)) {
+ $discount_amount = (string) (round((float) $order_total['value'] * 100));
+ $data['cart_info']['line_items'][] = array(
+ 'name' => 'Discount',
+ 'price' => $discount_amount,
+ 'quantity' => 1,
+ 'description' => '',
+ 'category' => '',
+ );
+ }
+ $data['cart_info']['items_tax_price'] = (string) (round((float) $order->info['tax'] * 100));
+ $data['cart_info']['items_shipping_price'] = (string) (round((float) $order->info['shipping_cost'] * 100));
+ return $data;
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_postfinance.php b/includes/modules/payment/novalnet_postfinance.php
new file mode 100644
index 0000000..5b4b2ba
--- /dev/null
+++ b/includes/modules/payment/novalnet_postfinance.php
@@ -0,0 +1,245 @@
+code = 'novalnet_postfinance';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO') ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO)) : '');
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER', '19', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_postfinance_card.php b/includes/modules/payment/novalnet_postfinance_card.php
new file mode 100644
index 0000000..af64ff7
--- /dev/null
+++ b/includes/modules/payment/novalnet_postfinance_card.php
@@ -0,0 +1,244 @@
+code = 'novalnet_postfinance_card';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER) != '' ? trim(MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE') && MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER', '18', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_POSTFINANCE_CARD_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_prepayment.php b/includes/modules/payment/novalnet_prepayment.php
new file mode 100644
index 0000000..77b0d27
--- /dev/null
+++ b/includes/modules/payment/novalnet_prepayment.php
@@ -0,0 +1,248 @@
+code = 'novalnet_prepayment';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS') && MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE') && MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ $due_date_in_days = defined('MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE') ? MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE : '';
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $transaction_data['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+ $custom_data = NovalnetHelper::getCustomData();
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ $order->info['comments'] .= PHP_EOL. MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT .PHP_EOL;
+ $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 1, ('TID ' . $_SESSION['response']['transaction']['tid'])) . PHP_EOL;
+ $order->info['comments'] .= sprintf(MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE, 2, ('BNR-' . MODULE_PAYMENT_NOVALNET_PROJECT_ID . '-' . $insert_id)) . PHP_EOL;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE', '', '6', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS', '1', '7', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_CALLBACK_ORDER_STATUS', '2', '8', 'order-status', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER', '6', '9', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO', '', '10', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_DUE_DATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_CALLBACK_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PREPAYMENT_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_przelewy24.php b/includes/modules/payment/novalnet_przelewy24.php
new file mode 100644
index 0000000..bdd1324
--- /dev/null
+++ b/includes/modules/payment/novalnet_przelewy24.php
@@ -0,0 +1,246 @@
+code = 'novalnet_przelewy24';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS') && MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE') && MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER', '15', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_PRZELEWY24_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_sepa.php b/includes/modules/payment/novalnet_sepa.php
new file mode 100644
index 0000000..11529a7
--- /dev/null
+++ b/includes/modules/payment/novalnet_sepa.php
@@ -0,0 +1,404 @@
+code = 'novalnet_sepa';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_SEPA_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER) != '') ? trim(MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_SEPA_STATUS == 'true') ? true : false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE') && MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE == 'true') ? true : false);
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation ()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection ()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) {
+ unset($_SESSION['payment']);
+ }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => ' ' . NovalnetHelper::showSepaDescription($this->code) . $this->info
+ .''
+ .'',
+ ];
+ $bic_field = ['title' => 'BIC '. xtc_draw_input_field('novalnet_sepa_bic', '', 'id="novalnet_sepa_bic_field" autocomplete="off" placeholder="BIC" onkeypress="return NovalnetUtility.formatBic(event);" onchange="return NovalnetUtility.formatBic(event);"') . '
'
+ ];
+ $payment_details = xtc_db_query("SELECT payment_details, id FROM novalnet_transaction_detail WHERE customer_id='" . xtc_db_input($_SESSION['customer_id']) . "' AND payment_details !='' AND payment_type in ('DIRECT_DEBIT_SEPA', 'GUARANTEED_DIRECT_DEBIT_SEPA', 'INSTALMENT_DIRECT_DEBIT_SEPA') AND status IN ('CONFIRMED', 'ON_HOLD') ORDER BY id DESC LIMIT 10");
+ $saved_card_details = [];
+ $count = 0;
+ while ($payment_detail = xtc_db_fetch_array($payment_details)) {
+ $decode_details = json_decode($payment_detail['payment_details'], true);
+ if (empty($decode_details['iban'])) {
+ continue;
+ }
+ $decode_details['id'] = $payment_detail['id'];
+ $saved_card_details[$count] = $decode_details;
+ $count++;
+ };
+ unset($_SESSION['saved_card_details']);
+ if (defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true') {
+ if (!empty($saved_card_details)) {
+ $payment_data = [];
+ foreach ($saved_card_details as $key => $value) {
+ if (empty($value['iban']) || in_array($value['iban'], $payment_data)) {
+ continue;
+ }
+ if (empty($value)) {
+ continue;
+ }
+ if(!empty($_SESSION['saved_card_details']) || !empty($saved_card_details)){
+ unset($_SESSION['saved_card_details']);
+ $_SESSION['saved_card_details'] = $saved_card_details;
+ }
+ $oneclick = (!empty($saved_card_details)) ? ' '.sprintf(('IBAN %s'),$value['iban']) . ' Delete ' : '';
+ if(!empty($value['iban'])){
+ $selection['fields'][] = [ 'title' => $oneclick ];
+ }
+ array_push($payment_data, $value['iban']);
+ }
+ $selection['fields'][] = [ 'title' => ' '.MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS.' '];
+ $selection['fields'][] = ['title' => ''.MODULE_PAYMENT_NOVALNET_SEPA_IBAN.' '. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" style="display:none;" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = [
+ 'title' => ''.xtc_draw_checkbox_field('nn_sepa_checkbox', 1 , false, 'id="novalnet_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
',
+ ];
+ }
+ }else{
+ $selection['fields'][] = [
+ 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ }
+ if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true') && empty($saved_card_details)) {
+ $selection['fields'][] = [
+ 'title' => MODULE_PAYMENT_NOVALNET_SEPA_IBAN. xtc_draw_input_field('novalnet_sepa_iban', '', 'id="novalnet_sepa_iban_field" autocomplete="off" placeholder ="DE00 0000 0000 0000 0000 00" onkeypress="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onkeyup="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');" onchange="return NovalnetUtility.formatIban(event,\'novalnet_sepa_bic\');"'),
+ ];
+ $selection['fields'][] = $bic_field;
+ $selection['fields'][] = [
+ 'title' => ''.xtc_draw_checkbox_field('nn_sepa_checkbox', 1 , false, 'id="novalnet_sepa_onclick"')." ".MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS.'
',
+ ];
+ }
+
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') {
+ if ($this->proceedToGuranteePayment()) {
+ $proceed_to_sepa = false;
+ } elseif (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE == 'true') {
+ $proceed_to_sepa = true;
+ }
+ } else {
+ $proceed_to_sepa = true;
+ }
+
+ if ($proceed_to_sepa) {
+ return $selection;
+ }
+
+ return false;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check ()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ if(isset($_REQUEST['novalnet_sepa']) && $_REQUEST['novalnet_sepa'] == 'new' || !empty($_SESSION['novalnet_sepa'])){
+ unset($_SESSION['novalnet_sepa']);
+ $_SESSION['novalnet_sepa'] = $_REQUEST['novalnet_sepa'];
+ }
+ if (!empty($_SESSION['novalnet_sepa_token']) || !empty($_SESSION['novalnet_sepa_create_token'])) {
+ unset($_SESSION['novalnet_sepa_token']);
+ unset($_SESSION['novalnet_sepa_create_token']);
+ }
+
+ if (!empty($_REQUEST['novalnet_sepa']) && $_REQUEST['novalnet_sepa'] != 'new' && (defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true')) {
+ $_SESSION['novalnet_sepa_token'] = $_REQUEST['novalnet_sepa'];
+ }
+ else if (!empty($_REQUEST['novalnet_sepa_iban'])) {
+ $_SESSION['novalnet_sepa_iban'] = $_REQUEST['novalnet_sepa_iban'];
+ $_SESSION['novalnet_sepa_bic'] = !empty($_REQUEST['novalnet_sepa_bic']) ? $_REQUEST['novalnet_sepa_bic'] : '';
+ if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true') && !empty($_REQUEST['nn_sepa_checkbox'])) {
+ $_SESSION['novalnet_sepa_create_token'] = $_REQUEST['nn_sepa_checkbox'];
+ }
+ } else {
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' .MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR, 'SSL', true, false));
+ }
+ }
+
+ /**
+ * Core Function : confirmation ()
+ *
+ * Displays confirmation page
+ */
+ function confirmation() {
+ global $order;
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] === '0') {
+ $_SESSION['novalnet']['payment_amount'] = ($order->info['total'] + (round($order->info['tax'], 2)));
+ } else {
+ $_SESSION['novalnet']['payment_amount'] = $order->info['total'];
+ }
+ }
+
+ /**
+ * Core Function : process_button ()
+ *
+ * Payments redirects from shop to payment site (Note : if the payment is redirect)
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process ()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function before_process() {
+ global $order;
+ $merchant_data = NovalnetHelper::getMerchantData();
+ $customer_data = NovalnetHelper::getCustomerData();
+ $due_date_in_days = MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE;
+ $custom_data = NovalnetHelper::getCustomData();
+ $transaction_data = NovalnetHelper::getTransactionData();
+ $transaction_data['transaction']['payment_type'] = NovalnetHelper::getPaymentName($this->code);
+ // Add token data if it's enabled
+ if((defined('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION') && MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION == 'true')){
+ if (!empty($_SESSION['saved_card_details']) && empty($_SESSION['novalnet_sepa'])) {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ $params['transaction']['payment_data']['token'] = $transaction_data['transaction']['payment_data']['token'];
+ }else if ((isset($_SESSION['novalnet_sepa']) && $_SESSION['novalnet_sepa'] == 'new')) {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ } else {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ } else {
+ NovalnetHelper::getToeknizationDetails($this->code, $transaction_data);
+ $transaction_data['transaction']['payment_data'] = NovalnetHelper::getAccountDetails()['transaction']['payment_data'];
+ $params = array_merge($merchant_data, $customer_data, $transaction_data, $custom_data);
+ }
+ if (!empty ($due_date_in_days) && is_numeric($due_date_in_days)) {
+ $params['transaction']['due_date'] = NovalnetHelper::getDueDate($due_date_in_days);
+ }
+
+ if (!empty($params['transaction']['create_token'])) {
+ $params['custom']['input1'] = 'store_payment_data';
+ $params['custom']['inputval1'] = 1;
+ }
+ if ((defined('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'authorize')
+ && (NovalnetHelper::getOrderAmount($_SESSION['novalnet']['payment_amount']) >= (defined('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT') ? MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT : ''))) { // Authorize transaction
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('authorize'));
+ } else { // Captue or Zero-amount transaction
+ if (defined('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE') && MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE == 'zero_amount') {
+ $params['transaction']['amount'] = 0;
+ $params['transaction']['create_token'] = 1;
+ }
+ $response = NovalnetHelper::sendRequest($params, NovalnetHelper::get_action_endpoint('payment'));
+ }
+ if ($response['result']['status'] == 'SUCCESS') {
+ $_SESSION['response'] = $response;
+ } else {
+ $error = (!empty($response['result']['status_text']) ? $response['result']['status_text'] : '');
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_PAYMENT, 'payment_error=' . $this->code . '&error=' . urlencode($error), 'SSL', true, false));
+ }
+ unset($_SESSION['novalnet']['payment_amount']);
+ $order->info['comments'] .= NovalnetHelper::updateTransactionDetails($this->code, $_SESSION['response']);
+ unset($_SESSION['novalnet_sepa_iban']);
+ unset($_SESSION['novalnet_sepa_token']);
+ unset($_SESSION['novalnet_sepa_create_token']);
+ unset($_SESSION['novalnet_sepa_bic']);
+ unset($_SESSION['novalnet_sepa']);
+ unset($_SESSION['saved_card_details']);
+ }
+
+ /**
+ * Core Function : after_process ()
+ *
+ * Send params to Novalnet server (Note : if the payment uses curl request)
+ */
+ function after_process() {
+ global $order, $insert_id;
+ NovalnetHelper::updateOrderStatus($insert_id, $order->info['comments'], $_SESSION['response'], $this->code);
+ NovalnetHelper::sendTransactionUpdate($insert_id);
+ }
+
+ /**
+ * Core Function : get_error ()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check ()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install ()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION', 'true' , '6', 'switcher' , now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE', '', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT', '', '8', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE', '', '9', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS', '2', '10', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER', '1', '11', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO', '', '12', now())");
+ }
+
+ /**
+ * Core Function : remove ()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys ()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code, true);
+ $lang = (isset($_SESSION['language_code'])) ? strtoupper($_SESSION['language_code']) : 'DE';
+ echo ' ';
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO',
+ );
+ }
+
+ /**
+ * To Proceed and validate Guarantee payment basic requirements in checkout
+ *
+ * @return boolean
+ */
+ function proceedToGuranteePayment() {
+ global $order;
+ $minimum_amount_gurantee = trim(MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT) != '' ? MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT : '999';
+ $country_check = NovalnetHelper::checkGuaranteeCountries(strtoupper($order->billing['country']['iso_code_2']),MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B, $order->billing['company']);
+ if (defined('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS') && MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_STATUS == 'true') {
+ if (NovalnetHelper::getOrderAmount($order->info['total']) >= $minimum_amount_gurantee && $country_check
+ && $order->info['currency'] == 'EUR' && NovalnetHelper::isBillingShippingsame()) {
+ return true;
+ }
+ return false;
+ }
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_trustly.php b/includes/modules/payment/novalnet_trustly.php
new file mode 100644
index 0000000..c5f2a0f
--- /dev/null
+++ b/includes/modules/payment/novalnet_trustly.php
@@ -0,0 +1,245 @@
+code = 'novalnet_trustly';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_TRUSTLY_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER) != '') ?trim(MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS') && MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS == 'true') ? true :false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE == 'true') ?true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ }
+ elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER', '25', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * @return array keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_TRUSTLY_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/includes/modules/payment/novalnet_wechatpay.php b/includes/modules/payment/novalnet_wechatpay.php
new file mode 100644
index 0000000..0337db7
--- /dev/null
+++ b/includes/modules/payment/novalnet_wechatpay.php
@@ -0,0 +1,245 @@
+code = 'novalnet_wechatpay';
+ $this->title = ((defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_TEXT_TITLE')) ? MODULE_PAYMENT_NOVALNET_WECHATPAY_TEXT_TITLE : '');
+ $this->info = (defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO')) ? trim(strip_tags(MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO)) : '';
+ $this->sort_order = (defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER') && trim(MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER) != '') ?trim(MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER) : 0;
+ $this->enabled = ((defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS') && MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS == 'true') ? true :false);
+ $this->test_mode = ((defined('MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE') && MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE == 'true') ? true : false);
+ $this->tmpOrders = true;
+ if (is_object($order)) {
+ $this->update_status();
+ }
+ }
+
+ /**
+ * Core Function : update_status()
+ *
+ * check if zone is allowed to see module
+ */
+ function update_status() {
+ global $order;
+ if (($this->enabled == true) && ((int) MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE > 0)) {
+ $check_flag = false;
+ $check_query = xtc_db_query("select zone_id from ".TABLE_ZONES_TO_GEO_ZONES." where geo_zone_id = '".MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE."' and zone_country_id = '".$order->delivery['country']['id']."' order by zone_id");
+ while ($check = xtc_db_fetch_array($check_query)) {
+ if ($check['zone_id'] < 1) {
+ $check_flag = true;
+ break;
+ } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
+ $check_flag = true;
+ break;
+ }
+ }
+ if ($check_flag == false) {
+ $this->enabled = false;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Core Function : javascript_validation()
+ *
+ * Javascript validation takes place
+ * @return boolean
+ */
+ function javascript_validation() {
+ return false;
+ }
+
+ /**
+ * Core Function : selection()
+ *
+ * Display checkout form in chekout payment page
+ * @return array
+ */
+ function selection() {
+ if (NovalnetHelper::checkMerchantCredentials() || strpos(MODULE_PAYMENT_INSTALLED, 'novalnet_config') === false
+ || !NovalnetHelper::hidePaymentVisibility($this->code)) {
+ if (!empty($_SESSION['payment']) && $_SESSION['payment'] == $this->code) { unset($_SESSION['payment']); }
+ return false;
+ }
+ $selection = [
+ 'id' => $this->code,
+ 'module' => $this->title,
+ 'description' => NovalnetHelper::showPaymentDescription($this->code) . $this->info,
+ ];
+ return $selection;
+ }
+
+ /**
+ * Core Function : pre_confirmation_check()
+ *
+ * Perform validations for post values
+ * @return boolean
+ */
+ function pre_confirmation_check() {
+ return false;
+ }
+
+ /**
+ * Core Function : confirmation()
+ *
+ * Displays confirmation page
+ * @return boolean
+ */
+ function confirmation() {
+ return false;
+ }
+
+ /**
+ * Core Function : process_button()
+ *
+ * Payments redirects from shop to payment site
+ */
+ function process_button() {
+ return false;
+ }
+
+ /**
+ * Core Function : before_process()
+ */
+ function before_process() {
+ $post = $_REQUEST;
+ if (isset($post['tid'])) {
+ $session_order_id = (!empty($_SESSION['nn_tempOID'])) ? $_SESSION['nn_tempOID'] : $_SESSION['tmp_oID'];
+ if ($post['status'] == 'SUCCESS') { // Success
+ if (NovalnetHelper::validateCheckSum($post)) { // Checksum success
+ NovalnetHelper::handleRedirectSuccessResponse($post, $session_order_id, $this->code);
+ } else { // Checksum fail
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post, MODULE_PAYMENT_NOVALNET_ERROR_MSG);
+ }
+ } else { // Failure
+ NovalnetHelper::processTempOrderFail($this->code, $session_order_id, $post);
+ }
+ }
+ }
+
+ /**
+ * Core Function : payment_action()
+ */
+ function payment_action() {
+ global $insert_id;
+ if (!empty($_SESSION['nn_txn_secret']) || !empty($_SESSION['nn_tempOID'])) {
+ unset($_SESSION['nn_txn_secret']);
+ unset($_SESSION['nn_tempOID']);
+ }
+ $response = NovalnetHelper::getRedirectData($insert_id, $this->code);
+ if ($response['result']['status'] == 'SUCCESS' && !empty($response['result']['redirect_url'])) {
+ $_SESSION['nn_txn_secret'] = $response['transaction']['txn_secret'];
+ $_SESSION['nn_tempOID'] = $insert_id;
+ xtc_redirect($response['result']['redirect_url']);
+ } else {
+ NovalnetHelper::processTempOrderFail($this->code, $insert_id, $response);
+ }
+ }
+
+ /**
+ * Core Function : after_process()
+ *
+ */
+ function after_process() {
+ global $order, $insert_id;
+ }
+
+ /**
+ * Core Function : get_error()
+ *
+ * Show validation / error message
+ * @return array
+ */
+ function get_error() {
+ if ($_GET['error']) {
+ $error = [
+ 'title' => $this->code,
+ 'error' => stripslashes(urldecode($_GET['error']))
+ ];
+ return $error;
+ }
+ }
+
+ /**
+ * Core Function : check()
+ *
+ * Checks for payment installation status
+ * @return boolean
+ */
+ function check() {
+ if (!isset ($this->_check)) {
+ $check_query = xtc_db_query("select `value` from `gx_configurations` where `key` = 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS'");
+ $this->_check = xtc_db_num_rows($check_query);
+ }
+ return $this->_check;
+ }
+
+ /**
+ * Core Function : install()
+ *
+ * Payment module installation
+ */
+ function install() {
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS','false', '1', 'switcher',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE','false', '2', 'switcher', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ALLOWED', '', '3', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE', '0', '4', 'geo-zone',now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_VISIBILITY_BY_AMOUNT', '', '5', now())");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `type`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ORDER_STATUS', '2', '6', 'order-status', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER', '24', '7', now()) ");
+ xtc_db_query("insert into `gx_configurations` (`key`, `value`, `sort_order`, `last_modified`) values ('configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO', '', '8', now())");
+ }
+
+ /**
+ * Core Function : remove()
+ *
+ * Payment module uninstallation
+ */
+ function remove() {
+ xtc_db_query("delete from `gx_configurations` where `key` in ('" . implode("', '", $this->keys()) . "')");
+ }
+
+ /**
+ * Core Function : keys()
+ *
+ * Return keys to display in payment configuration (Backend)
+ */
+ function keys() {
+ NovalnetHelper::includeAdminJS($this->code);
+ return array(
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_TEST_MODE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ALLOWED',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_PAYMENT_ZONE',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_VISIBILITY_BY_AMOUNT',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ORDER_STATUS',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_SORT_ORDER',
+ 'configuration/MODULE_PAYMENT_NOVALNET_WECHATPAY_ENDCUSTOMER_INFO',
+ );
+ }
+}
+
diff --git a/lang/english/modules/payment/novalnet.php b/lang/english/modules/payment/novalnet.php
new file mode 100644
index 0000000..f6df01f
--- /dev/null
+++ b/lang/english/modules/payment/novalnet.php
@@ -0,0 +1,133 @@
+I hereby grant the mandate for the SEPA direct debit (electronic transmission) and confirm that the given bank details are correct!');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ABOUT_MANDATE_TEXT',' I authorise (A) Novalnet AG to send instructions to my bank to debit my account and (B) my bank to debit my account in accordance with the instructions from Novalnet AG.Creditor identifier: DE53ZZZ00000004253 Note:You are entitled to a refund from your bank under the terms and conditions of your agreement with bank. A refund must be claimed within 8 weeks starting from the date on which your account was debited.
');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Please transfer the amount of %1$s to the following account on or before %2$s');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE', 'Please transfer the amount of %s to the following account.');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Please transfer the instalment cycle amount of %1$s to the following account on or before %2$s');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE', 'Please transfer the instalment cycle amount of %1$s to the following account.');
+define('MODULE_PAYMENT_NOVALNET_MULTIBANCO_NOTE', 'Please use the following payment reference details to pay the amount of %s at a Multibanco ATM or through your internet banking.');
+define('MODULE_PAYMENT_NOVALNET_BANK_NAME', ' Bank: ');
+define('MODULE_PAYMENT_NOVALNET_IBAN','IBAN: ');
+define('MODULE_PAYMENT_NOVALNET_BIC', ' BIC: ');
+define('MODULE_PAYMENT_NOVALNET_ACCOUNT_HOLDER','Account holder: ');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT', ' Amount: ');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_MODE', 'Test order');
+define('MODULE_PAYMENT_NOVALNET_BANK_PLACE', 'Place: ');
+define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Your account details are invalid');
+define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ID', 'Novalnet transaction ID: ');
+define('MODULE_PAYMENT_NOVALNET_TRANS_SLIP_EXPIRY_DATE', 'Slip expiry date : ');
+define('MODULE_PAYMENT_NOVALNET_NEAREST_STORE_DETAILS', 'Store(s) near to you: ');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT', 'Please use any of the following payment references when transferring the amount. This is necessary to match it with your corresponding order');
+define('MODULE_PAYMENT_NOVALNET_CONFIRM_TEXT','Confirm');
+define('MODULE_PAYMENT_NOVALNET_REFUND_TEXT','Refund');
+define('MODULE_PAYMENT_NOVALNET_CANCEL_TEXT','Cancel');
+define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ERROR', 'Payment was not successful. An error occured.');
+define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_OPTION', '--Select--');
+define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_SUCCESSFUL_MESSAGE', 'The transaction has been confirmed on %1$s');
+define('MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE', 'The transaction has been cancelled on %1$s');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCELED_MESSAGE', 'The transaction has been cancelled for the %1$s on %2$s %3$s');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_EX', ' (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG', 'Refund has been initiated for the TID: %1$s with the amount of %2$s.');
+define('MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG', 'New TID:%s for the refunded amount');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_TEXT', ' (Net loan amount: )');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND', 'INSTALMENT CYCLES ');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND', 'INSTALMENT AMOUNT');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_FRONTEND', 'per month');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_CYCLE', '%s Cycles/');
+define('MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE', 'Please enter your date of birth');
+define('MODULE_PAYMENT_GUARANTEE_PAYMENT_AGE_ERROR_MESSAGE', 'You need to be at least 18 years old');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SUMMARY_BACKEND', 'Instalment summary');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_ADMIN_TEXT','Instalment cancel');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_BACKEND', 'Amount');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DATE_BACKEND', 'Date');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_BACKEND', 'Status');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_REFERENCE_BACKEND', 'Novalnet Transaction ID');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_TEXT', 'Cancel');
+define('MODULE_PAYMENT_NOVALNET_MENTION_GUARANTEE_PAYMENT_PENDING_TEXT', 'Your order is under verification and we will soon update you with the order status. Please note that this may take upto 24 hours.');
+define('MODULE_PAYMENT_NOVALNET_VALID_MERCHANT_CREDENTIALS_ERROR','Please fill in the required fields');
+define('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE','Novalnet API Configuration (V_12.0.3)');
+define('MODULE_PAYMENT_GUARANTEE_DOB_FIELD','Your date of birth *');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT','DD.MM.YYYY');
+define('MODULE_PAYMENT_NOVALNET_TESTMODE','Test mode');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE', 'Payment Reference %1$s: %2$s');
+define('NOVALNET_WEBHOOK_CREDIT_NOTE','Credit has been successfully received for the TID: %1$s with amount %2$s on %3$s. Please refer PAID order details in our Novalnet Admin Portal for the TID: %4$s');
+define('NOVALNET_WEBHOOK_CHARGEBACK_NOTE','Chargeback executed successfully for the TID: %1$s amount: %2$s on %3$s %4$s . The subsequent TID: %5$s');
+define('NOVALNET_WEBHOOK_NEW_INSTALMENT_NOTE','A new instalment has been received for the Transaction ID: %1$s with amount %2$s on %3$s. The new instalment transaction ID is: %4$s');
+define('NOVALNET_WEBHOOK_INSTALMENT_CANCEL_NOTE','Instalment has been cancelled for the TID: %1$s on %2$s');
+define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE_DUE_DATE','Transaction updated successfully for the TID: %1$s with amount %2$s and due date %3$s.');
+define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE','Transaction updated successfully for the TID: %1$s with amount %2$s.');
+define('NOVALNET_PAYMENT_REMINDER_NOTE','Payment Reminder %1$s has been sent to the customer.');
+define('NOVALNET_COLLECTION_SUBMISSION_NOTE','The transaction has been submitted to the collection agency. Collection Reference: %1$s');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Enter your date of birth');
+
+define('MODULE_PAYMENT_NOVALNET_PARTNER_PAYMENT_REFERENCE', 'Partner Payment Reference: %s');
+define('MODULE_PAYMENT_NOVALNET_ERROR_MSG', 'Check hash failed');
+define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_TITLE','Manage Transaction ');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_CAPTURE_CONFIRM','Are you sure you want to capture the payment?');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_VOID_CONFIRM','Are you sure you want to cancel the payment?');
+define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_TEXT', 'Please select status');
+define('MODULE_PAYMENT_NOVALNET_BACK_TEXT', 'Back');
+define('MODULE_PAYMENT_NOVALNET_REFUND_TITLE', 'Refund process');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFUND_CONFIRM', 'Are you sure you want to refund the amount');
+define('MODULE_PAYMENT_NOVALNET_REFUND_REFERENCE_TEXT', 'Refund reference');
+define('MODULE_PAYMENT_NOVALNET_REFUND_AMT_TITLE', 'Please enter the refund amound');
+define('MODULE_PAYMENT_NOVALNET_REFUND_REASON_TITLE', 'Reason for refund (optional)');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND', 'Instalment');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT', 'Choose your installment plan (Net loan amount: %s ) ');
+define('SUCCESS_ORDER_UPDATED', 'Success');
+
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INSTALMENTS_INFO','Instalment information');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PROCESSED_INSTALMENTS','Processed instalments: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DUE_INSTALMENTS','Due instalments: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_AMOUNT','Next instalment amount: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_DATE','Next instalment date: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAY_DATE_BACKEND','Paid date');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_DATE_BACKEND','Next instalment date');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAID_DATE_BACKEND','Paid on');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PAID','Paid');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PENDING','Pending');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_REFUNDED','Refunded');
+define('WARNING_ORDER_NOT_UPDATED', 'Warning');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_ERROR_MSG','Enter valid date of birth');
+define('MODULE_PAYMENT_NOVALNET_ORDER_MAIL_SUBJECT', 'Your Order %s, %s, %s');
+define('MODULE_PAYMENT_NOVALNET_ORDER_CAPTURE_MAIL_SUBJECT', 'Order Confirmation - Your Order %s with Gambio has been confirmed!');
+
+define('MODULE_PAYMENT_GUARANTEE_PAYMENT_MAIL_SUBJECT','Order Confirmation - Your Order %s with %s has been confirmed!');
+define(
+'MODULE_PAYMENT_NOVALNET_SEPA_MANDATE_NOTICE',
+'I authorise (A) die Novalnet AG, meiner Bank die Weisung zu erteilen, mein Konto zu belasten und (B) meine Bank, mein Konto entsprechend der Weisung der Novalnet AG zu belasten.Gläubiger-Identifikator: DE53ZZZ00000004253 Note: Sie haben Anspruch auf eine Erstattung durch Ihre Bank gemäß den Bedingungen Ihres Vertrags mit der Bank. Eine Erstattung muss innerhalb von 8 Wochen ab dem Datum der Abbuchung von Ihrem Konto beantragt werden.
'
+);
+define('MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS', 'Save for future purchase');
+define('MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS', 'Use a new payment method');
+define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN', 'IBAN *');
+define('MODULE_PAYMENT_NOVALNET_BOOK_TITLE','Book transaction');
+define('MODULE_PAYMENT_NOVALNET_BOOK_AMT_TITLE','Transaction booking amount');
+define('MODULE_PAYMENT_NOVALNET_TRANS_BOOKED_MESSAGE','Your order has been booked with the amount of %s. Your new TID for the booked amount: %s');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_ZERO_AMOUNT_BOOK_CONFIRM','Are you sure you want to book the order amount?');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_ERROR_MESSAGE','The amount is invalid');
+define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_MESSAGE','This order processed as a zero amount booking');
+
+define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT',' This order will be processed as zero amount booking which store your payment data for further online purchases.');
+?>
+
diff --git a/lang/english/modules/payment/novalnet_alipay.php b/lang/english/modules/payment/novalnet_alipay.php
new file mode 100644
index 0000000..1d38830
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_alipay.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_applepay.php b/lang/english/modules/payment/novalnet_applepay.php
new file mode 100644
index 0000000..47abbc7
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_applepay.php
@@ -0,0 +1,41 @@
+Authorize');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_DESC','In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE_TITLE','Button Design Style for Apple pay button Button Type');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME_TITLE','Button Theme');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_TITLE','Button Height');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_DESC','Range from 30 to 64 pixels');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_TITLE','Button Corner Radius');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_DESC','Range from 1 to 10 pixels');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_TITLE','Display the Apple Pay Button on');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_DESC','The selected pages will display the Apple pay button to pay instantly as an express checkout button');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_TITLE','Allowed zone(-s)');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_DESC','This payment method will be allowed for the mentioned zone(-s). Enter the zone(-s) in the following format E.g: DE, AT, CH. In case if the field is empty, all the zones will be allowed.');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_TITLE','Payment zone');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_DESC','If a zone is selected, only enable this payment method for that zone.');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEXT_INFO','Amount will be booked from your card after successful authentication');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_applepay.png', 'Applepay'));
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('ERROR_CHECKOUT_SHIPPING_NO_MODULE','No shipping');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_TITLE','Business name');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_DESC','The business name is rendered in the Apple Pay payment sheet, and this text will appear as PAY "BUSINESS NAME" so that the customer knows where he is paying to');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+?>
diff --git a/lang/english/modules/payment/novalnet_bancontact.php b/lang/english/modules/payment/novalnet_bancontact.php
new file mode 100644
index 0000000..93ec9fd
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_bancontact.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_cashpayment.php b/lang/english/modules/payment/novalnet_cashpayment.php
new file mode 100644
index 0000000..112369d
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_cashpayment.php
@@ -0,0 +1,25 @@
+
diff --git a/lang/english/modules/payment/novalnet_cc.php b/lang/english/modules/payment/novalnet_cc.php
new file mode 100644
index 0000000..78c2df1
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_cc.php
@@ -0,0 +1,54 @@
+Label ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_TITLE','Input ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_TITLE','CSS Text ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_TITLE','Payment action');
+define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately.');
+define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_TITLE','One click shopping');
+define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_DESC','Payment details stored during the checkout process can be used for future payments');
+define('MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS', 'Save for future purchase');
+define('MODULE_PAYMENT_NOVALNET_CC_NEW_ACCOUNT_DETAILS', 'Use a new payment method');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_ERROR', 'Your credit card details are invalid');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER','Card holder name');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO','Card number');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE','Expiry date');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC','CVC/CVV/CID');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_HOLDER_INPUT_TEXT','Name on card');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_NUMBER_INPUT_TEXT','XXXX XXXX XXXX XXXX');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_CVC_INPUT_TEXT','XXX');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER_ERROR','Please enter the valid card holder name');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO_ERROR','Please enter the valid card number');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE_ERROR','Please enter the valid expiry month / year in the given format');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC_ERROR','Please enter the valid CVC/CVV/CID');
+define('MODULE_PAYMENT_NOVALNET_CC_TOKEN_TEXT','%1$s ending in %2$s ( expires %3$s/%4$s )');
+?>
diff --git a/lang/english/modules/payment/novalnet_config.php b/lang/english/modules/payment/novalnet_config.php
new file mode 100644
index 0000000..746e3a8
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_config.php
@@ -0,0 +1,24 @@
+
+Please read the Installation Guide before you start and login to the Novalnet Admin Portal using your merchant account. To get a merchant account, mail to sales@novalnet.de or call +49 (089) 923068320 ');
+define('MODULE_PAYMENT_NOVALNET_SIGNATURE_TITLE', 'Product activation key');
+define('MODULE_PAYMENT_NOVALNET_SIGNATURE_DESC', 'Get your Product activation key from the Novalnet Admin Portal Project > Choose your project > API credentials >API Signature (Product activation key)');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_TITLE', 'Payment access key');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_DESC', 'Get your Payment access key from the Novalnet Admin Portal Project > Choose your project > API credentials >Payment access key');
+define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_TITLE', 'Select Tariff ID');
+define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_DESC', 'Select a Tariff ID to match the preferred tariff plan you created at the Novalnet Admin Portal for this project');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_TITLE', 'Order status management for on-hold transactions Onhold order status');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_DESC', 'Status to be used for on-hold orders until the transaction is confirmed or canceled');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_TITLE', 'Canceled order status');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_DESC', 'Status to be used when order is canceled or fully refunded');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_TITLE', 'Notification / Webhook URL Setup Allow manual testing of the Notification / Webhook URL');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_DESC', 'Enable this to test the Novalnet Notification / Webhook URL manually. Disable this before setting your shop live to block unauthorized calls from external parties');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_TITLE', 'Notification / Webhook URL');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_DESC', 'You must configure the webhook endpoint in your Novalnet Admin Portal . This will allow you to receive notifications about the transaction');
+define('MODULE_PAYMENT_NOVALNET_CLIENT_KEY_TITLE', 'Client key');
+define('MODULE_PAYMENT_NOVALNET_PROJECT_ID_TITLE', 'Project ID');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_TITLE', ' Send e-mail to');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_DESC', 'Notification / Webhook URL execution messages will be sent to this e-mail');
+?>
diff --git a/lang/english/modules/payment/novalnet_eps.php b/lang/english/modules/payment/novalnet_eps.php
new file mode 100644
index 0000000..3254fec
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_eps.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_giropay.php b/lang/english/modules/payment/novalnet_giropay.php
new file mode 100644
index 0000000..a626cb3
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_giropay.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_googlepay.php b/lang/english/modules/payment/novalnet_googlepay.php
new file mode 100644
index 0000000..73376d1
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_googlepay.php
@@ -0,0 +1,42 @@
+Authorize');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_DESC','In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE_TITLE','Button Design Style for Google pay button Button Type');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_THEME_TITLE','Button Theme');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_TITLE','Button Height');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_DESC','Range from 30 to 64 pixels');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_TITLE','Display the Google Pay Button on');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_DESC','The selected pages will display the Google pay button to pay instantly as an express checkout button');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_TITLE','Allowed zone(-s)');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_DESC','This payment method will be allowed for the mentioned zone(-s). Enter the zone(-s) in the following format E.g: DE, AT, CH. In case if the field is empty, all the zones will be allowed.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_TITLE','Payment zone');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_DESC','If a zone is selected, only enable this payment method for that zone.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_INFO','Amount will be booked from your card after successful authentication');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_googlepay.png', "Googlepay "));
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_TITLE','Business name');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_DESC','The business name is rendered in the Google Pay payment sheet, and this text will appear as PAY "BUSINESS NAME" so that the customer knows where he is paying to');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_TITLE','Enforce 3D secure payment outside EU');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_DESC','By enabling this option, all payments from cards issued outside the EU will be authenticated via 3DS 2.0 SCA.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_TITLE','Google Merchant ID');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_DESC','Please note that Google merchant identifier is required for processing the payment method in the live environment. Google merchant identifier is issued after registration with the Google Pay and Wallet Console . See Request production access for more information about the approval process and obtaining a Google merchant identifier. The registration also involves submitting the integration with sufficient screen-shots, so collect this information by enabling the payment method in test mode. To suppress the validation of this field while saving the configuration, use this test identifier BCR2DN4XXXTN7FSI for testing and submission of your integration to Google.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+?>
diff --git a/lang/english/modules/payment/novalnet_guarantee_invoice.php b/lang/english/modules/payment/novalnet_guarantee_invoice.php
new file mode 100644
index 0000000..ea95436
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_guarantee_invoice.php
@@ -0,0 +1,30 @@
+Payment guarantee configurationBasic requirements: Allowed B2C countries: Germany, Austria, Switzerland Allowed B2B countries: European Union Allowed currency: € Minimum order amount: 9,99 € or more Age limit: 18 years or more The billing address must be the same as the shipping address');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_TITLE','Force Non-guarantee payment');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_DESC','Even if payment guarantee is enabled, payments will still be processed as non-guarantee payments if the payment guarantee requirements are not met. Review the requirements under "Enable Payment Guarantee" in the Installation Guide.');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_TITLE','Allow B2B Customers');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_DESC','Allow B2B customers to place order');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_TITLE','Payment action');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.Authorize');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+?>
diff --git a/lang/english/modules/payment/novalnet_guarantee_sepa.php b/lang/english/modules/payment/novalnet_guarantee_sepa.php
new file mode 100644
index 0000000..b3d9fa3
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_guarantee_sepa.php
@@ -0,0 +1,39 @@
+Payment guarantee configurationBasic requirements: Allowed B2C countries: Germany, Austria, Switzerland Allowed B2B countries: European Union Allowed currency: € Minimum order amount: 9,99 € or more Age limit: 18 years or more The billing address must be the same as the shipping address');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_TITLE','Force Non-guarantee payment');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_DESC','Even if payment guarantee is enabled, payments will still be processed as non-guarantee payments if the payment guarantee requirements are not met. Review the requirements under "Enable Payment Guarantee" in the Installation Guide.');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_TITLE','Allow B2B Customers');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_DESC','Allow B2B customers to place order');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_TITLE','Payment action');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.Authorize');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_TITLE','One click shopping');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_DESC','Payment details stored during the checkout process can be used for future payments');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SAVE_CARD_DETAILS', 'Save for future purchase');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_NEW_ACCOUNT_DETAILS', 'Use a new payment method');
+define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Your account details are invalid');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Enter your date of birth');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_TITLE', 'Payment due date');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_DESC', 'Number of days after which the payment is debited (must be between 2 and 14 days)');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT', 'DD-MM-YYYY');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+?>
diff --git a/lang/english/modules/payment/novalnet_ideal.php b/lang/english/modules/payment/novalnet_ideal.php
new file mode 100644
index 0000000..51cea01
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_ideal.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_instalment_invoice.php b/lang/english/modules/payment/novalnet_instalment_invoice.php
new file mode 100644
index 0000000..c412788
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_instalment_invoice.php
@@ -0,0 +1,31 @@
+Basic requirements:Allowed B2B countries: European Union Allowed B2C countries: Germany, Austria, Switzerland Allowed currency: € Minimum order amount: 19,98 € or more Please note that the instalment cycle amount has to be a minimum of 9.99 EUR and the instalment cycles which do not meet this criteria will not be displayed in the instalment plan Age limit: 18 years or more The billing address must be the same as the shipping address');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_TITLE','Allow B2B Customers');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_DESC','Allow B2B customers to place order');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_TITLE','Payment action');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.Authorize');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_TITLE', 'Instalment cycles');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_DESC', 'Select the instalment cycles that can be availed in the instalment plan');
+?>
diff --git a/lang/english/modules/payment/novalnet_instalment_sepa.php b/lang/english/modules/payment/novalnet_instalment_sepa.php
new file mode 100644
index 0000000..18fb17e
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_instalment_sepa.php
@@ -0,0 +1,37 @@
+Basic requirements:Allowed B2B countries: European Union Allowed B2C countries: Germany, Austria, Switzerland Allowed currency: € Minimum order amount: 19,98 € or more Please note that the instalment cycle amount has to be a minimum of 9.99 EUR and the instalment cycles which do not meet this criteria will not be displayed in the instalment plan Age limit: 18 years or more The billing address must be the same as the shipping address');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_TITLE','Minimum order amount');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_TITLE','Allow B2B Customers');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_DESC','Allow B2B customers to place order');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_TITLE','Payment action');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately. Authorize verifies payment details and reserves funds to capture it later, giving time for the merchant to decide on the order.Authorize');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_TITLE', 'Instalment cycles');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_DESC', 'Select the instalment cycles that can be availed in the instalment plan');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_TITLE', 'Payment due date (in days)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_DESC', 'Number of days after which the payment is debited (must be between 2 and 14 days)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_TITLE', 'One click shopping');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_DESC', 'Payment details stored during the checkout process can be used for future payments');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SAVE_CARD_DETAILS', 'Save for future purchase');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_NEW_ACCOUNT_DETAILS', 'Use a new payment method');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+?>
diff --git a/lang/english/modules/payment/novalnet_instantbank.php b/lang/english/modules/payment/novalnet_instantbank.php
new file mode 100644
index 0000000..b1d50f2
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_instantbank.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_invoice.php b/lang/english/modules/payment/novalnet_invoice.php
new file mode 100644
index 0000000..2eda178
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_invoice.php
@@ -0,0 +1,29 @@
+Authorize');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_TITLE','Notification for the buyer');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page');
+?>
diff --git a/lang/english/modules/payment/novalnet_multibanco.php b/lang/english/modules/payment/novalnet_multibanco.php
new file mode 100644
index 0000000..42d64de
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_multibanco.php
@@ -0,0 +1,23 @@
+
diff --git a/lang/english/modules/payment/novalnet_online_bank_transfer.php b/lang/english/modules/payment/novalnet_online_bank_transfer.php
new file mode 100644
index 0000000..95e6e53
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_online_bank_transfer.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_paypal.php b/lang/english/modules/payment/novalnet_paypal.php
new file mode 100644
index 0000000..200f1cf
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_paypal.php
@@ -0,0 +1,25 @@
+Authorize');
+define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+?>
diff --git a/lang/english/modules/payment/novalnet_postfinance.php b/lang/english/modules/payment/novalnet_postfinance.php
new file mode 100644
index 0000000..02566d6
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_postfinance.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_postfinance_card.php b/lang/english/modules/payment/novalnet_postfinance_card.php
new file mode 100644
index 0000000..cc08a0c
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_postfinance_card.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_prepayment.php b/lang/english/modules/payment/novalnet_prepayment.php
new file mode 100644
index 0000000..972677a
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_prepayment.php
@@ -0,0 +1,25 @@
+
diff --git a/lang/english/modules/payment/novalnet_przelewy24.php b/lang/english/modules/payment/novalnet_przelewy24.php
new file mode 100644
index 0000000..10c7d3c
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_przelewy24.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/english/modules/payment/novalnet_sepa.php b/lang/english/modules/payment/novalnet_sepa.php
new file mode 100644
index 0000000..e6f4404
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_sepa.php
@@ -0,0 +1,32 @@
+ ');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_TITLE','Allowed zone(-s)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_DESC','This payment method will be allowed for the mentioned zone(-s). Enter the zone(-s) in the following format E.g: DE, AT, CH. In case if the field is empty, all the zones will be allowed.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_TITLE','Enable payment method');
+define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_DESC','Do you want to accept sepa payment?');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_TITLE','Enable test mode');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_DESC','The payment will be processed in the test mode therefore amount for this transaction will not be charged');
+define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_TITLE','Payment due date (in days)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_DESC','
+Number of days after which the payment is debited (must be between 2 and 14 days)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_TITLE','Display Sort Order');
+define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_DESC','Display sort order; the lowest value is displayed first.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_TITLE','Completed order status');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_DESC','Status to be used for successful orders');
+define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_TITLE','Payment zone');
+define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_DESC','When a zone is selected, this payment method will be enabled for that zone only.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN','IBAN');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ACCOUNT_HOLDER','Account Holder');
+define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_TITLE','Payment action');
+define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_DESC','Choose whether or not the payment should be charged immediately.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_TITLE','Minimum transaction amount for authorization');
+define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_DESC', 'In case the order amount exceeds the mentioned limit, the transaction will be set on-hold till your confirmation of the transaction. You can leave the field empty if you wish to process all the transactions as on-hold (in minimum unit of currency. E.g. enter 100 which is equal to 1.00).');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_TITLE','One click shopping');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_DESC','Payment details stored during the checkout process can be used for future payments');
+define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_TITLE','Minimum order amount.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_DESC','Minimum order amount to display the selected payment method (s) at during checkout (in minimum unit of currency. E.g. enter 100 which is equal to 1.00)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_TITLE','Notification for the buyer.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_DESC','The entered text will be displayed on the checkout page.');
+?>
diff --git a/lang/english/modules/payment/novalnet_trustly.php b/lang/english/modules/payment/novalnet_trustly.php
new file mode 100644
index 0000000..5bf48a7
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_trustly.php
@@ -0,0 +1,22 @@
+
diff --git a/lang/english/modules/payment/novalnet_wechatpay.php b/lang/english/modules/payment/novalnet_wechatpay.php
new file mode 100644
index 0000000..b1410b0
--- /dev/null
+++ b/lang/english/modules/payment/novalnet_wechatpay.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet.php b/lang/german/modules/payment/novalnet.php
new file mode 100644
index 0000000..35473e6
--- /dev/null
+++ b/lang/german/modules/payment/novalnet.php
@@ -0,0 +1,133 @@
+Ich erteile hiermit das SEPA-Lastschriftmandat (elektronische Übermittlung) und bestätige, dass die Bankverbindung korrekt ist');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ABOUT_MANDATE_TEXT',' Ich ermächtige den Zahlungsempfänger, Zahlungen von meinem Konto mittels Lastschrift einzuziehen. Zugleich weise ich mein Kreditinstitut an, die von dem Zahlungsempfänger auf mein Konto gezogenen Lastschriften einzulösen.Gläubiger-Identifikator: DE53ZZZ00000004253 Hinweis: Ich kann innerhalb von acht Wochen, beginnend mit dem Belastungsdatum, die Erstattung des belasteten Betrages verlangen. Es gelten dabei die mit meinem Kreditinstitut vereinbarten Bedingungen.
');
+
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Bitte überweisen Sie den Betrag von %1$s spätestens bis zum %2$s auf das folgende Konto');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_TRANSFER_NOTE', 'Bitte überweisen Sie den Betrag %s auf das folgende Konto.');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE_DUE_DATE', 'Bitte überweisen Sie den anzahl der raten von %1$s spätestens bis zum %2$s auf das folgende Konto');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_TRANSFER_NOTE', 'Bitte überweisen Sie den anzahl der raten %1$s auf das folgende Konto.');
+define('MODULE_PAYMENT_NOVALNET_MULTIBANCO_NOTE', 'Bitte verwenden Sie die folgende Zahlungsreferenz, um den Betrag von %s an einem Multibanco-Geldautomaten oder über Ihr Onlinebanking zu bezahlen.');
+define('MODULE_PAYMENT_NOVALNET_BANK_NAME', 'Bank: ');
+define('MODULE_PAYMENT_NOVALNET_IBAN','IBAN: ');
+define('MODULE_PAYMENT_NOVALNET_BIC', ' BIC: ');
+define('MODULE_PAYMENT_NOVALNET_ACCOUNT_HOLDER','Kontoinhaber: ');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT', ' Betrag: ');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_MODE', 'Testbestellung');
+define('MODULE_PAYMENT_NOVALNET_BANK_PLACE', 'Ort: ');
+define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Ihre Kontodaten sind ungültig.');
+define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ID', 'Novalnet-Transaktions-ID: ');
+define('MODULE_PAYMENT_NOVALNET_TRANS_SLIP_EXPIRY_DATE', 'Verfallsdatum des Zahlscheins: ');
+define('MODULE_PAYMENT_NOVALNET_NEAREST_STORE_DETAILS', 'Barzahlen-Partnerfilialen in Ihrer Nähe: ');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE_TEXT', 'Bitte verwenden Sie einen der unten angegebenen Verwendungszwecke für die Überweisung. Nur so kann Ihr Geldeingang Ihrer Bestellung zugeordnet werden');
+define('MODULE_PAYMENT_NOVALNET_CONFIRM_TEXT','Bestätigen');
+define('MODULE_PAYMENT_NOVALNET_REFUND_TEXT','Rückerstattung');
+define('MODULE_PAYMENT_NOVALNET_CANCEL_TEXT','Stornieren');
+define('MODULE_PAYMENT_NOVALNET_TRANSACTION_ERROR', 'Die Zahlung war nicht erfolgreich. Ein Fehler ist aufgetreten.');
+define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_OPTION', '--Auswählen--');
+define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_SUCCESSFUL_MESSAGE','Die Buchung wurde am %1$s Uhr bestätigt');
+define('MODULE_PAYMENT_NOVALNET_TRANS_DEACTIVATED_MESSAGE', 'Die Transaktion wurde am %1$s Uhr storniert');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCELED_MESSAGE', 'Die Transaktion wurde storniert für die %1$s auf %2$s %3$s');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_EX', ' (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_REFUND_PARENT_TID_MSG', 'Die Rückerstattung für die TID: %1$s mit dem Betrag %2$s wurde veranlasst.');
+define('MODULE_PAYMENT_NOVALNET_REFUND_CHILD_TID_MSG', ' Die neue TID: %s für den erstatteten Betrag');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_TEXT', ' (Netto-Kreditbetrag : )');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_CYCLES_FRONTEND', 'ANZAHL DER RATEN ');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_AMOUNT_FRONTEND', 'RATENBETRAG');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_FRONTEND', 'pro Monat');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_PER_MONTH_CYCLE', '%s Raten/');
+define('MODULE_PAYMENT_GUARANTEE_PAYMENT_DOB_EMPTY_ERROR_MESSAGE', 'Geben Sie bitte Ihr Geburtsdatum ein');
+define('MODULE_PAYMENT_GUARANTEE_PAYMENT_AGE_ERROR_MESSAGE','Sie müssen mindestens 18 Jahre alt sein');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SUMMARY_BACKEND', 'Zusammenfassung der Ratenzahlung');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_ADMIN_TEXT','Raten stornier');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_AMOUNT_BACKEND', 'Betrag');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DATE_BACKEND', 'Datum');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_BACKEND', 'Status');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_REFERENCE_BACKEND', 'Novalnet-Transaktions-ID');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_CANCEL_TEXT', 'Stornieren');
+define('MODULE_PAYMENT_NOVALNET_MENTION_GUARANTEE_PAYMENT_PENDING_TEXT', 'Ihre Bestellung wird derzeit überprüft. Wir werden Sie in Kürze über den Bestellstatus informieren. Bitte beachten Sie, dass dies bis zu 24 Stunden dauern kann.');
+define('MODULE_PAYMENT_NOVALNET_VALID_MERCHANT_CREDENTIALS_ERROR', 'Bitte füllen Sie die erforderlichen Felder aus');
+define('MODULE_PAYMENT_NOVALNET_GLOBAL_CONFIG_TEXT_TITLE','Novalnet API-Konfiguration (V_12.0.3)');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT','TT.MM.JJJJ');
+define('MODULE_PAYMENT_GUARANTEE_DOB_FIELD', 'Ihr Geburtsdatum *');
+define('MODULE_PAYMENT_NOVALNET_TESTMODE','Testmodus');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFERENCE', 'Verwendungszweck %1$s: %2$s');
+define('NOVALNET_WEBHOOK_CREDIT_NOTE','Die Gutschrift für die TID ist erfolgreich eingegangen: %1$s mit Betrag %2$s am %3$s. Bitte entnehmen Sie die TID den Einzelheiten der Bestellung bei BEZAHLT in unserem Novalnet Adminportal: %4$s');
+define('NOVALNET_WEBHOOK_CHARGEBACK_NOTE','Chargeback erfolgreich importiert für die TID: %1$s Betrag: %2$s am %3$s um %4$s Uhr. TID der Folgebuchung: %5$s');
+define('NOVALNET_WEBHOOK_NEW_INSTALMENT_NOTE','Für die Transaktions-ID ist eine neue Rate eingegangen: %1$s mit Betrag %2$s am %3$s. Die Transaktions-ID der neuen Rate lautet: %4$s');
+define('NOVALNET_WEBHOOK_INSTALMENT_CANCEL_NOTE','Die Ratenzahlung für die TID wurde gekündigt: %1$s am %2$s');
+define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE_DUE_DATE','Transaktion mit TID %1$s und Betrag %2$s und neues Fälligkeitsdatum: %3$s.');
+define('NOVALNET_WEBHOOK_TRANSACTION_UPDATE_NOTE','Transaktion mit TID %1$s und Betrag %2$s wurde am um erfolgreich.');
+define('NOVALNET_PAYMENT_REMINDER_NOTE','Zahlungserinnerung %1$s wurde an den Kunden gesendet.');
+define('NOVALNET_COLLECTION_SUBMISSION_NOTE','Die Transaktion wurde an das Inkassobüro übergeben. Inkasso-Referenz: %1$s');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Geben Sie Ihr Geburtsdatum ein');
+
+define('MODULE_PAYMENT_NOVALNET_PARTNER_PAYMENT_REFERENCE', 'Partner-Zahlungsreferenz: %s');
+define('MODULE_PAYMENT_NOVALNET_ERROR_MSG', 'Prüfung des Hashes fehlgeschlagen');
+define('MODULE_PAYMENT_NOVALNET_TRANS_CONFIRM_TITLE','Transaktion verwalten ');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_CAPTURE_CONFIRM','Sind Sie sicher, dass Sie die Zahlung erfassen wollen?');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_VOID_CONFIRM','Sind Sie sicher, dass Sie die Zahlung stornieren möchten?');
+define('MODULE_PAYMENT_NOVALNET_SELECT_STATUS_TEXT', 'Bitte Status auswählen');
+define('MODULE_PAYMENT_NOVALNET_BACK_TEXT', 'Zurück');
+define('MODULE_PAYMENT_NOVALNET_REFUND_TITLE', 'Erstattungsverfahren');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_REFUND_CONFIRM', 'Sind Sie sicher, dass Sie den Betrag erstatten wollen?');
+define('MODULE_PAYMENT_NOVALNET_REFUND_REFERENCE_TEXT', 'Referenz für die Erstattung');
+define('MODULE_PAYMENT_NOVALNET_REFUND_AMT_TITLE', 'Bitte geben Sie den Erstattungsbetrag ein');
+define('MODULE_PAYMENT_NOVALNET_REFUND_REASON_TITLE', 'Grund für die Rückerstattung (optional)');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_FRONTEND', 'Ratenzahlung');
+define('MODULE_PAYMENT_NOVALNET_INSTALLMENT_TEXT', 'Wählen Sie Ihren Ratenzahlungsplan (Netto-Kreditbetrag: %s ) ');
+define('SUCCESS_ORDER_UPDATED', 'Erfolg');
+
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INSTALMENTS_INFO','Informationen zur Ratenzahlung');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PROCESSED_INSTALMENTS','Bearbeitete Raten: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_DUE_INSTALMENTS','Fällige Raten: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_AMOUNT','Nächster Ratenbetrag: ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_INSTALMENT_DATE','Datum der nächsten Ratenzahlung: ');
+
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAY_DATE_BACKEND', 'Bezahltes Datum');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_NEXT_DATE_BACKEND', 'Nächstes Ratenzahlungsdatum');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_PAID_DATE_BACKEND','Bezahlt am');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PAID','Bezahlt');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_PENDING','Ausstehend');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_STATUS_REFUNDED','Rückerstattet');
+define('WARNING_ORDER_NOT_UPDATED', 'Warnung');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_ERROR_MSG','Gültiges Geburtsdatum eingeben');
+define('MODULE_PAYMENT_NOVALNET_ORDER_MAIL_SUBJECT', 'Ihre Bestellung %s, am %s, %s');
+define('MODULE_PAYMENT_NOVALNET_ORDER_CAPTURE_MAIL_SUBJECT', 'Bestellbestätigung – Ihre Bestellung %s bei Gambio wurde bestätigt!');
+define('MODULE_PAYMENT_GUARANTEE_PAYMENT_MAIL_SUBJECT','Bestellbestätigung – Ihre Bestellung %s bei %s wurde bestätigt!');
+define(
+'MODULE_PAYMENT_NOVALNET_SEPA_MANDATE_NOTICE',
+'I authorise (A) die Novalnet AG, meiner Bank die Weisung zu erteilen, mein Konto zu belasten und (B) meine Bank, mein Konto entsprechend der Weisung der Novalnet AG zu belasten.Gläubiger-Identifikator: DE53ZZZ00000004253 Note: Sie haben Anspruch auf eine Erstattung durch Ihre Bank gemäß den Bedingungen Ihres Vertrags mit der Bank. Eine Erstattung muss innerhalb von 8 Wochen ab dem Datum der Abbuchung von Ihrem Konto beantragt werden.
'
+);
+define('MODULE_PAYMENT_NOVALNET_SEPA_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe');
+define('MODULE_PAYMENT_NOVALNET_SEPA_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode');
+define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN', 'IBAN *');
+define('MODULE_PAYMENT_NOVALNET_BOOK_TITLE','Transaktion durchführen');
+define('MODULE_PAYMENT_NOVALNET_BOOK_AMT_TITLE','Buchungsbetrag der Transaktion');
+define('MODULE_PAYMENT_NOVALNET_TRANS_BOOKED_MESSAGE','Ihre Bestellung wurde mit einem Betrag von %s gebucht. Ihre neue TID für den gebuchten Betrag: %s');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_ZERO_AMOUNT_BOOK_CONFIRM','Sind Sie sich sicher, dass Sie den Bestellbetrag buchen wollen?');
+define('MODULE_PAYMENT_NOVALNET_AMOUNT_ERROR_MESSAGE','Ungültiger Betrag');
+define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_MESSAGE','Diese Transaktion wird mit Nullbuchung bearbeitet');
+
+define('MODULE_PAYMENT_NOVALNET_ZEROAMOUNT_BOOKING_TEXT',' Diese Bestellung wird als Nullbuchung verarbeitet. Ihre Zahlungsdaten werden für zukünftige Online-Einkäufe gespeichert.');
+?>
diff --git a/lang/german/modules/payment/novalnet_alipay.php b/lang/german/modules/payment/novalnet_alipay.php
new file mode 100644
index 0000000..7782344
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_alipay.php
@@ -0,0 +1,22 @@
+
+
diff --git a/lang/german/modules/payment/novalnet_applepay.php b/lang/german/modules/payment/novalnet_applepay.php
new file mode 100644
index 0000000..12bf5ac
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_applepay.php
@@ -0,0 +1,41 @@
+ Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_MANUAL_CHECK_LIMIT_DESC','Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_TYPE_TITLE','Schaltfläche Gestaltung Stil für Apple Pay schaltfläche Schaltfläche Typ');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_THEME_TITLE','Schaltfläche Thema');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_TITLE','Schaltfläche Höhe');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_HEIGHT_DESC','Bereich von 30 bis 64 Pixel');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_TITLE','Schaltfläche Eckenradius');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_CORNER_RADIUS_DESC','Bereich von 1 bis 10 Pixel');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_TITLE','Zeigen Sie den Apple Pay Button an');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUTTON_DISPLAY_DESC','Auf den ausgewählten Seiten wird die Apple-Pay-Schaltfläche zur sofortigen Bezahlung als Express-Checkout-Schaltfläche angezeigt');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_TITLE','Erlaubte Zone(n)');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ALLOWED_DESC','Diese Zahlungsmethode ist nur für die angegebene(n) Zone(n) zulässig. Geben Sie die Zone(n) in folgendem Format ein, z.B: DE, AT, CH. Wenn das Feld leer ist, werden alle Zonen zugelassen.');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_TITLE','Zahlungsbereich');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PAYMENT_ZONE_DESC','Wenn eine Zone ausgewählt ist, aktivieren Sie diese Zahlungsmethode nur für diese Zone.');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_TEXT_INFO','Der Betrag wird nach erfolgreicher Authentifizierung von Ihrer Karte abgebucht');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_applepay.png', "Applepay "));
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('ERROR_CHECKOUT_SHIPPING_NO_MODULE','Kein Versand');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_TITLE','Name des Geschäfts');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_BUSINESS_NAME_DESC','Der Name des Geschäfts wird in den Zahlungsbeleg von Apple Pay eingefügt und der Text wird als PAY Name des Geschäfts angezeigt, so dass der Endkunde weiß, an wen er zahlt.');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_APPLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+?>
diff --git a/lang/german/modules/payment/novalnet_bancontact.php b/lang/german/modules/payment/novalnet_bancontact.php
new file mode 100644
index 0000000..ce0f609
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_bancontact.php
@@ -0,0 +1,22 @@
+
+
diff --git a/lang/german/modules/payment/novalnet_cashpayment.php b/lang/german/modules/payment/novalnet_cashpayment.php
new file mode 100644
index 0000000..8c19ad1
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_cashpayment.php
@@ -0,0 +1,25 @@
+
diff --git a/lang/german/modules/payment/novalnet_cc.php b/lang/german/modules/payment/novalnet_cc.php
new file mode 100644
index 0000000..7492d00
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_cc.php
@@ -0,0 +1,54 @@
+Beschriftung ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_TITLE','Eingabe ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_STANDARD_STYLE_INPUT_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_TITLE','Text für das CSS ');
+define('MODULE_PAYMENT_NOVALNET_CC_CSS_TEXT_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_TITLE','Kauf mit einem Klick');
+define('MODULE_PAYMENT_NOVALNET_CC_TOKENIZATION_DESC','Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden');
+define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.');
+define('MODULE_PAYMENT_NOVALNET_CC_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht.');
+define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_CC_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_CC_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe');
+define('MODULE_PAYMENT_NOVALNET_CC_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_ERROR', 'Ihre Kreditkartendaten sind ungültig');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER','Name des Karteninhabers');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO','Kartennummer');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE','Ablaufdatum');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC','CVC/CVV/CID');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_HOLDER_INPUT_TEXT','Name auf der Karte');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_NUMBER_INPUT_TEXT','XXXX XXXX XXXX XXXX');
+define('MODULE_PAYMENT_NOVALNET_CC_IFRAME_CVC_INPUT_TEXT','XXX');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_HOLDER_ERROR','Bitte geben Sie den gültigen Namen des Karteninhabers ein');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_NO_ERROR','Bitte geben Sie die gültige Kartennummer ein');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_VALID_DATE_ERROR','Bitte geben Sie den gültigen Verfallsmonat / das Verfallsjahr im angegebenen Format ein');
+define('MODULE_PAYMENT_NOVALNET_CC_FORM_CARD_CVC_ERROR','Bitte geben Sie die gültige CVC/CVV/CID ein');
+define('MODULE_PAYMENT_NOVALNET_CC_TOKEN_TEXT','%1$s mit Endziffern %2$s ( gültig bis %3$s/%4$s )');
+?>
diff --git a/lang/german/modules/payment/novalnet_config.php b/lang/german/modules/payment/novalnet_config.php
new file mode 100644
index 0000000..7a2592b
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_config.php
@@ -0,0 +1,23 @@
+ Bevor Sie beginnen, lesen Sie bitte die Installationsanleitung und melden Sie sich mit Ihrem Händlerkonto im Novalnet Admin-Portal an. Um ein Händlerkonto zu erhalten, senden Sie bitte eine E-Mail an sales@novalnet.de oder rufen Sie uns unter +49 89 923068320 an ');
+define('MODULE_PAYMENT_NOVALNET_SIGNATURE_TITLE', 'Aktivierungsschlüssel des Produkts');
+define('MODULE_PAYMENT_NOVALNET_SIGNATURE_DESC', 'Ihren Produktaktivierungsschlüssel finden Sie im Novalnet Admin-Portal Projekt > Wählen Sie Ihr Projekt > API-Anmeldeinformationen > API-Signatur (Produktaktivierungsschlüssel)');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_TITLE', 'Zahlungs-Zugriffsschlüssel');
+define('MODULE_PAYMENT_NOVALNET_PAYMENT_ACCESS_KEY_DESC', 'Ihren Paymentzugriffsschlüssel finden Sie im Novalnet Admin-Portal Projekt > Wählen Sie Ihr Projekt > API-Anmeldeinformationen > Paymentzugriffsschlüssel');
+define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_TITLE', 'Tarif-ID auswählen');
+define('MODULE_PAYMENT_NOVALNET_TARIFF_ID_DESC', 'Wählen Sie eine Tarif-ID, die dem bevorzugten Tarifplan entspricht, den Sie im Novalnet Admin-Portal für dieses Projekt erstellt haben');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_TITLE', 'Verwaltung des Bestellstatus für ausgesetzte Zahlungen On-hold-Bestellstatus');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_COMPLETE_DESC', 'Wählen Sie, welcher Status für On-hold-Bestellungen verwendet wird, solange diese nicht bestätigt oder storniert worden sind');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_TITLE', 'Status für stornierte Bestellungen');
+define('MODULE_PAYMENT_NOVALNET_ONHOLD_ORDER_CANCELLED_DESC', 'Wählen Sie, welcher Status für stornierte oder voll erstattete Bestellungen verwendet wird');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_TITLE', 'Benachrichtigungs- / Webhook-URL festlegen Manuelles Testen der Benachrichtigungs / Webhook-URL erlauben');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_TEST_MODE_DESC', 'Aktivieren Sie diese Option, um die Novalnet-Benachrichtigungs-/Webhook-URL manuell zu testen. Deaktivieren Sie die Option, bevor Sie Ihren Shop liveschalten, um unautorisierte Zugriffe von Dritten zu blockieren');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_TITLE', 'Benachrichtigung / Webhook-URL im Novalnet-Verwaltungsportal');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_URL_DESC', 'Sie müssen die folgende Webhook-URL im Novalnet Admin-Portal hinzufügen. Dadurch können Sie Benachrichtigungen über den Transaktionsstatus erhalten');
+define('MODULE_PAYMENT_NOVALNET_CLIENT_KEY_TITLE', 'Client-Schlüssel');
+define('MODULE_PAYMENT_NOVALNET_PROJECT_ID_TITLE', 'Projekt-ID');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_TITLE', ' E-Mails senden an');
+define('MODULE_PAYMENT_NOVALNET_CALLBACK_MAIL_TO_DESC', 'E-Mail-Benachrichtigungen werden an diese E-Mail-Adresse gesendet');
+?>
diff --git a/lang/german/modules/payment/novalnet_eps.php b/lang/german/modules/payment/novalnet_eps.php
new file mode 100644
index 0000000..70d3dc3
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_eps.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_giropay.php b/lang/german/modules/payment/novalnet_giropay.php
new file mode 100644
index 0000000..9806fcf
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_giropay.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_googlepay.php b/lang/german/modules/payment/novalnet_googlepay.php
new file mode 100644
index 0000000..8bc33f6
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_googlepay.php
@@ -0,0 +1,42 @@
+ Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MANUAL_CHECK_LIMIT_DESC','Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_TYPE_TITLE','Schaltfläche Gestaltung Stil für Google Pay schaltfläche Schaltfläche Typ');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_THEME_TITLE','Schaltfläche Thema');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_TITLE','Schaltfläche Höhe');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_HEIGHT_DESC','Bereich von 30 bis 64 Pixel');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_TITLE','Zeigen Sie den Google Pay Button an');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUTTON_DISPLAY_DESC','Auf den ausgewählten Seiten wird die Google-Pay-Schaltfläche zur sofortigen Bezahlung als Express-Checkout-Schaltfläche angezeigt');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_TITLE','Erlaubte Zone(n)');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ALLOWED_DESC','Diese Zahlungsmethode ist nur für die angegebene(n) Zone(n) zulässig. Geben Sie die Zone(n) in folgendem Format ein, z.B: DE, AT, CH. Wenn das Feld leer ist, werden alle Zonen zugelassen.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_TITLE','Zahlungsbereich');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PAYMENT_ZONE_DESC','Wenn eine Zone ausgewählt ist, aktivieren Sie diese Zahlungsmethode nur für diese Zone.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_TEXT_INFO','Der Betrag wird nach erfolgreicher Authentifizierung von Ihrer Karte abgebucht');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_PUBLIC_TITLE', xtc_image(DIR_WS_ICONS.'novalnet/novalnet_googlepay.png', "Googlepay "));
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_TITLE','Name des Geschäfts');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_BUSINESS_NAME_DESC','Der Name des Geschäfts wird in den Zahlungsbeleg von Google Pay eingefügt und der Text wird als PAY Name des Geschäfts angezeigt, so dass der Endkunde weiß, an wen er zahlt.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_TITLE','3D-Secure-Zahlungen außerhalb der EU erzwingen');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_ENFORCE_3D_SECCURE_DESC','Wenn Sie diese Option aktivieren, werden alle Zahlungen mit Karten, die außerhalb der EU ausgegeben wurden, mit der starken Kundenauthentifizierung (Strong Customer Authentication, SCA) von 3D-Secure 2.0 authentifiziert.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_TITLE','Google-Händler-ID');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_MERCHANT_ID_DESC','Beachten Sie bitte, dass die Händler-ID von Google für die Ausführung dieser Zahlungsart in der Live-Umgebung benötigt wird. Die Händler-ID wird nach der Registrierung bei Google Pay und der Wallet-Konsole vergeben. Siehe auch: Anfrage für Produktiv-Zugang stellen , falls Sie mehr Informationen zum Genehmigungsverfahren benötigen und dazu, wie Sie eine Google Händler-ID erhalten. Die Registrierung beinhaltet auch, dass Sie Ihre Anbindung mit ausreichenden Screenshots einreichen, deshalb sammeln Sie diese Informationen, indem Sie die Zahlungsmethode im Testmodus aktivieren. Um die Validierung dieses Feldes zu überspringen, während Sie die Konfiguration speichern, verwenden Sie diese Test-ID, BCR2DN4XXXTN7FSI , zum Testen und Einreichen Ihrer Anbindung bei Google.');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_GOOGLEPAY_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+?>
diff --git a/lang/german/modules/payment/novalnet_guarantee_invoice.php b/lang/german/modules/payment/novalnet_guarantee_invoice.php
new file mode 100644
index 0000000..6578e49
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_guarantee_invoice.php
@@ -0,0 +1,30 @@
+ Einstellungen für die ZahlungsgarantieGrundanforderungen: Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz Erlaubte B2B-Länder: Europäische Union Erlaubte Währung: € Mindestbestellwert: 9,99 € oder mehr Altersgrenze: 18 Jahre oder mehr Die Rechnungsadresse muss die gleiche sein wie die Lieferadresse');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE',' Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_TITLE',' Zahlung ohne Zahlungsgarantie erzwingen');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_FORCE_DESC','Falls die Zahlungsgarantie zwar aktiviert ist, jedoch die Voraussetzungen für Zahlungsgarantie nicht erfüllt sind, wird die Zahlung ohne Zahlungsgarantie verarbeitet. Die Voraussetzungen finden Sie in der Installationsanleitung unter "Zahlungsgarantie aktivieren"');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_TITLE','B2B-Kunden erlauben');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden. Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+?>
diff --git a/lang/german/modules/payment/novalnet_guarantee_sepa.php b/lang/german/modules/payment/novalnet_guarantee_sepa.php
new file mode 100644
index 0000000..91e3eb2
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_guarantee_sepa.php
@@ -0,0 +1,39 @@
+ Einstellungen für die ZahlungsgarantieGrundanforderungen: Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz Erlaubte B2B-Länder: Europäische Union Erlaubte Währung: € Mindestbestellwert: 9,99 € oder mehr Altersgrenze: 18 Jahre oder mehr Die Rechnungsadresse muss die gleiche sein wie die Lieferadresse');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_TITLE',' Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_TITLE',' Zahlung ohne Zahlungsgarantie erzwingen');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_FORCE_DESC','Falls die Zahlungsgarantie zwar aktiviert ist, jedoch die Voraussetzungen für Zahlungsgarantie nicht erfüllt sind, wird die Zahlung ohne Zahlungsgarantie verarbeitet. Die Voraussetzungen finden Sie in der Installationsanleitung unter "Zahlungsgarantie aktivieren"');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_TITLE','B2B-Kunden erlauben');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden. Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_TITLE','Kauf mit einem Klick');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_TOKENIZATION_DESC','Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode');
+define('MODULE_PAYMENT_NOVALNET_VALID_ACCOUNT_CREDENTIALS_ERROR', 'Ihre Kontodaten sind ungültig');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_EMPTY_ERROR_MESSAGE', 'Geben Sie Ihr Geburtsdatum ein');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_TITLE', 'Fälligkeitsdatum der Zahlung');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_DUE_DATE_DESC', 'Geben Sie die Anzahl der Tage ein, nach denen der Zahlungsbetrag eingezogen werden soll (muss zwischen 2 und 14 Tagen liegen) ');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_DOB_FORMAT', 'TT-MM-JJJJ');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_GUARANTEE_SEPA_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+?>
diff --git a/lang/german/modules/payment/novalnet_ideal.php b/lang/german/modules/payment/novalnet_ideal.php
new file mode 100644
index 0000000..0a71ff5
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_ideal.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_instalment_invoice.php b/lang/german/modules/payment/novalnet_instalment_invoice.php
new file mode 100644
index 0000000..7509375
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_instalment_invoice.php
@@ -0,0 +1,31 @@
+ Grundanforderungen: Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz Erlaubte B2B-Länder: Europäische Union Erlaubte Währung: € Mindestbestellwert: 19,98 € Bitte beachten Sie, dass der Betrag einer Rate mindestens 9.99 EUR betragen muss und Raten, die diese Kriterien nicht erfüllen, nicht im Ratenplan angezeigt werden Mindestalter: 18 Jahre oder mehr Rechnungsadresse und Lieferadresse müssen übereinstimmen');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_BASIC_REQ_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_TITLE',' Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellbetrag zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_TITLE','B2B-Kunden erlauben');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden. Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_TITLE', 'Anzahl der Raten');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_INVOICE_CYCLE_DESC', 'Wählen Sie die zeitliche Abfolge der Raten für den Ratenzahlungsplan');
+?>
diff --git a/lang/german/modules/payment/novalnet_instalment_sepa.php b/lang/german/modules/payment/novalnet_instalment_sepa.php
new file mode 100644
index 0000000..1fb939d
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_instalment_sepa.php
@@ -0,0 +1,37 @@
+ Grundanforderungen: Erlaubte B2C-Länder: Deutschland, Österreich, Schweiz Erlaubte B2B-Länder: Europäische Union Erlaubte Währung: € Mindestbestellwert: 19,98 € Bitte beachten Sie, dass der Betrag einer Rate mindestens 9.99 EUR betragen muss und Raten, die diese Kriterien nicht erfüllen, nicht im Ratenplan angezeigt werden Mindestalter: 18 Jahre oder mehr Rechnungsadresse und Lieferadresse müssen übereinstimmen');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_BASIC_REQ_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MINIMUM_ORDER_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_DESC',' ');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_TITLE','B2B-Kunden erlauben');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ALLOW_B2B_DESC','B2B-Kunden erlauben, Bestellungen aufzugeben');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht. Authorize prüft die Zahlungsdetails und reserviert Mittel, um sie später zu erfassen, damit der Händler Zeit hat, über die Bestellung zu entscheiden. Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_TITLE', 'Anzahl der Raten');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_CYCLE_DESC', 'Wählen Sie die zeitliche Abfolge der Raten für den Ratenzahlungsplan');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_TITLE', 'Fälligkeitsdatum (in Tagen)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_PAYMENT_DUE_DATE_DESC', 'Anzahl der Tage, nach denen die Zahlung abgebucht wird (muss zwischen 2 und 14 Tagen liegen)');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_TITLE', 'Kauf mit einem Klick');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_TOKENIZATION_DESC', 'Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_SAVE_CARD_DETAILS', 'Sparen für zukünftige Käufe');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_NEW_ACCOUNT_DETAILS', 'Verwenden Sie eine neue Zahlungsmethode');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_INSTALMENT_SEPA_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+?>
diff --git a/lang/german/modules/payment/novalnet_instantbank.php b/lang/german/modules/payment/novalnet_instantbank.php
new file mode 100644
index 0000000..633a6e8
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_instantbank.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_invoice.php b/lang/german/modules/payment/novalnet_invoice.php
new file mode 100644
index 0000000..e499f91
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_invoice.php
@@ -0,0 +1,30 @@
+ Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers');
+define('MODULE_PAYMENT_NOVALNET_INVOICE_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt');
+?>
diff --git a/lang/german/modules/payment/novalnet_multibanco.php b/lang/german/modules/payment/novalnet_multibanco.php
new file mode 100644
index 0000000..7061377
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_multibanco.php
@@ -0,0 +1,23 @@
+
diff --git a/lang/german/modules/payment/novalnet_online_bank_transfer.php b/lang/german/modules/payment/novalnet_online_bank_transfer.php
new file mode 100644
index 0000000..3eb1f76
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_online_bank_transfer.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_paypal.php b/lang/german/modules/payment/novalnet_paypal.php
new file mode 100644
index 0000000..006c14c
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_paypal.php
@@ -0,0 +1,25 @@
+ Zahlung autorisieren');
+define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_PAYPAL_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+?>
diff --git a/lang/german/modules/payment/novalnet_postfinance.php b/lang/german/modules/payment/novalnet_postfinance.php
new file mode 100644
index 0000000..db6fe7b
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_postfinance.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_postfinance_card.php b/lang/german/modules/payment/novalnet_postfinance_card.php
new file mode 100644
index 0000000..ef24413
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_postfinance_card.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_prepayment.php b/lang/german/modules/payment/novalnet_prepayment.php
new file mode 100644
index 0000000..3496860
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_prepayment.php
@@ -0,0 +1,25 @@
+
diff --git a/lang/german/modules/payment/novalnet_przelewy24.php b/lang/german/modules/payment/novalnet_przelewy24.php
new file mode 100644
index 0000000..3d8b44f
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_przelewy24.php
@@ -0,0 +1,21 @@
+
diff --git a/lang/german/modules/payment/novalnet_sepa.php b/lang/german/modules/payment/novalnet_sepa.php
new file mode 100644
index 0000000..649e140
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_sepa.php
@@ -0,0 +1,31 @@
+ ');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_TITLE','Erlaubte Zone(n)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ALLOWED_DESC','Diese Zahlungsmethode ist nur für die angegebene(n) Zone(n) zulässig. Geben Sie die Zone(n) in folgendem Format ein, z.B: DE, AT, CH. Wenn das Feld leer ist, werden alle Zonen zugelassen..');
+define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_TITLE','Zahlungsart aktivieren');
+define('MODULE_PAYMENT_NOVALNET_SEPA_STATUS_DESC','Möchten Sie Sepa-Zahlungen akzeptieren?');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_TITLE','Testmodus aktivieren');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TEST_MODE_DESC','Die Zahlung wird im Testmodus durchgeführt, daher wird der Betrag für diese Transaktion nicht eingezogen.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_TITLE','Fälligkeitsdatum (in Tagen)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_DUE_DATE_DESC','Geben Sie die Anzahl der Tage ein, nach denen der Zahlungsbetrag eingezogen werden soll (muss zwischen 2 und 14 Tagen liegen) ');
+define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_TITLE','Sortierreihenfolge anzeigen');
+define('MODULE_PAYMENT_NOVALNET_SEPA_SORT_ORDER_DESC','Sortierreihenfolge anzeigen; der niedrigste Wert wird zuerst angezeigt.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_TITLE','Status für erfolgreichen Auftragsabschluss');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ORDER_STATUS_DESC','Status, der für erfolgreiche Bestellungen zu verwenden ist');
+define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_TITLE','Zahlungsbereich');
+define('MODULE_PAYMENT_NOVALNET_SEPA_PAYMENT_ZONE_DESC','Wenn eine Zone ausgewählt wird, wird diese Zahlungsmethode nur für diese Zone aktiviert.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_IBAN','IBAN');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ACCOUNT_HOLDER','Kontoinhaber');
+define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_TITLE','Aktion für vom Besteller autorisierte Zahlungen.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_AUTHENTICATE_DESC','Wählen Sie, ob die Zahlung sofort belastet werden soll oder nicht.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_TITLE','Mindesttransaktionsbetrag für die Autorisierung');
+define('MODULE_PAYMENT_NOVALNET_SEPA_MANUAL_CHECK_LIMIT_DESC', 'Übersteigt der Bestellbetrag das genannte Limit, wird die Transaktion, bis zu ihrer Bestätigung durch Sie, auf on hold gesetzt. Sie können das Feld leer lassen, wenn Sie möchten, dass alle Transaktionen als on hold behandelt werden. (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR).');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_TITLE','Kauf mit einem Klick');
+define('MODULE_PAYMENT_NOVALNET_SEPA_TOKENIZATION_DESC','Zahlungsdaten, die während des Bestellvorgangs gespeichert werden, können für zukünftige Zahlungen verwendet werden');
+define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_TITLE','Mindestbestellbetrag');
+define('MODULE_PAYMENT_NOVALNET_SEPA_VISIBILITY_BY_AMOUNT_DESC','Mindestbestellsumme zur Anzeige der ausgewählten Zahlungsart(en) im Checkout (in der kleinsten Währungseinheit, z.B. 100 Cent = entsprechen 1.00 EUR)');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_TITLE','Benachrichtigung des Käufers.');
+define('MODULE_PAYMENT_NOVALNET_SEPA_ENDCUSTOMER_INFO_DESC','Der eingegebene Text wird auf der Kassenseite angezeigt.');
+?>
diff --git a/lang/german/modules/payment/novalnet_trustly.php b/lang/german/modules/payment/novalnet_trustly.php
new file mode 100644
index 0000000..92452c8
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_trustly.php
@@ -0,0 +1,22 @@
+
+
diff --git a/lang/german/modules/payment/novalnet_wechatpay.php b/lang/german/modules/payment/novalnet_wechatpay.php
new file mode 100644
index 0000000..700f3d9
--- /dev/null
+++ b/lang/german/modules/payment/novalnet_wechatpay.php
@@ -0,0 +1,22 @@
+
+
diff --git a/novalnet_auto_config.php b/novalnet_auto_config.php
new file mode 100644
index 0000000..2f59c79
--- /dev/null
+++ b/novalnet_auto_config.php
@@ -0,0 +1,71 @@
+ $signature,
+ ];
+ $data['custom'] = [
+ 'lang' => strtoupper($_REQUEST['lang'])
+ ];
+ if($action == 'merchant') { // For merchant credentials
+ $endpoint = 'https://payport.novalnet.de/v2/merchant/details';
+ } elseif($action == 'webhook') { // For webhook
+ $endpoint = 'https://payport.novalnet.de/v2/webhook/configure';
+ $data['webhook'] = [
+ 'url' => $_REQUEST['webhook_url']
+ ];
+ }
+ $json_data = json_encode($data);
+ $response = send_request($json_data, $endpoint, $access_key); // Sending request to Novalnet
+ echo $response;
+ exit();
+
+}
+
+/**
+ * cURL call
+ *
+ * @param $data
+ * @param $url
+ *
+ * @return $result
+ */
+function send_request($data, $url, $access_key) {
+ $encoded_data = base64_encode($access_key);
+ $headers = [
+ 'Content-Type:application/json',
+ 'Charset:utf-8',
+ 'Accept:application/json',
+ 'X-NN-Access-Key:' . $encoded_data,
+ ];
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($curl, CURLOPT_POST, true);
+ curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
+ $result = curl_exec($curl);
+ if (curl_errno($curl)) {
+ echo 'Request Error:' . curl_error($curl);
+ return $result;
+ }
+ curl_close($curl);
+ return $result;
+}
+?>
diff --git a/novalnet_token_delete.php b/novalnet_token_delete.php
new file mode 100644
index 0000000..4e88b55
--- /dev/null
+++ b/novalnet_token_delete.php
@@ -0,0 +1,21 @@
+ $payment_data['token'],
+ 'zero_amount_booking' => $payment_data['zero_amount_booking']
+ );
+ $cardDetails = json_encode($cardDetails);
+ }
+ xtc_db_query("UPDATE novalnet_transaction_detail SET payment_details = '$cardDetails' WHERE (status = 'CONFIRMED' or status = 'ON_HOLD' or status = 'PENDING') and id='" . $_REQUEST['id'] . "'");
+ unset($_SESSION['saved_card_details']);
+ $json_data = json_encode($data);
+ echo $json_data;
+ exit;
+}
+?>
diff --git a/novalnet_wallet_payment_process.php b/novalnet_wallet_payment_process.php
new file mode 100644
index 0000000..14566e3
--- /dev/null
+++ b/novalnet_wallet_payment_process.php
@@ -0,0 +1,405 @@
+before_process();
+ $payment_modules->after_process();
+
+ require_once (DIR_FS_CATALOG. 'system/classes/orders/SendOrderProcess.inc.php');
+ $coo_send_order_process = MainFactory::create_object('SendOrderProcess');
+ $coo_send_order_process->set_('order_id',$_SESSION['tmp_oID']);
+ $coo_send_order_process->proceed();
+
+ // BOF GM_MOD GX-Customizer
+ require(DIR_FS_CATALOG . 'gm/modules/gm_gprint_order.php');
+
+ // Reset shopping cart
+ $_SESSION['cart']->reset(true);
+ xtc_redirect(xtc_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
+}
+if (empty($_SESSION['nn_order'])) {
+ require_once('includes/classes/order.php');
+ $order = new order();
+} else {
+ $order = $_SESSION['nn_order'];
+}
+
+if (!isset($_SESSION['customer_id']) || empty($_SESSION['customer_id'])) {
+ $country_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_id FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $response['variable_name']['response']['order']['billing']['contact']['countryCode']."'"));
+ $stateParam = (($response['payment_name'] == 'novalnet_googlepay' && !empty($response['variable_name']['response']['order']['billing']['contact']['administrativeArea'])) ? $response['variable_name']['response']['order']['billing']['contact']['administrativeArea'] : $response['variable_name']['response']['order']['billing']['countryCode']);
+ if (empty($stateParam)) {
+ $state_query = xtc_db_fetch_array(xtc_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_country_id = '".$country_query['countries_id']."' limit 1"));
+ }
+ else {
+ $state_query = xtc_db_fetch_array(xtc_db_query("SELECT zone_id FROM " . TABLE_ZONES . " WHERE zone_code = '$stateParam' and zone_country_id = '".$country_query['countries_id']."'"));
+ }
+
+ $customer_array = array(
+ 'firstname' => empty($response['variable_name']['response']['order']['shipping']['contact']['firstName']) ? $response['variable_name']['response']['order']['billing']['contact']['firstName'] : $response['variable_name']['response']['order']['shipping']['contact']['firstName'] ,
+ 'lastname' => empty($response['variable_name']['response']['order']['shipping']['contact']['lastName']) ? $response['variable_name']['response']['order']['billing']['contact']['lastName'] : $response['variable_name']['response']['order']['shipping']['contact']['lastName'] ,
+ 'street_address' => $response['variable_name']['response']['order']['billing']['contact']['addressLines'] ,
+ 'company' => '',
+ 'vat' => '',
+ 'telephone' => '',
+ 'fax' => '',
+ 'city' => $response['variable_name']['response']['order']['billing']['contact']['locality'],
+ 'state' => $state_query['zone_id'],
+ 'postcode' => $response['variable_name']['response']['order']['billing']['contact']['postalCode'] ,
+ 'country' => $country_query['countries_id'],
+ 'email_address' => ($response['payment_name'] == 'novalnet_googlepay') ? $response['variable_name']['response']['order']['billing']['contact']['email'] : $response['variable_name']['response']['order']['shipping']['contact']['email'],
+ );
+
+$inputTransformer = MainFactory::create('CustomerInputToCollectionTransformer');
+
+/** * @var CountryService $countryService */
+$countryService = StaticGXCoreLoader::getService('Country');
+
+$customerCollection = $inputTransformer->getRegistreeCollectionFromInputArray($customer_array, $countryService);
+
+$createAccountProcess = MainFactory::create('CreateAccountProcess',
+ StaticGXCoreLoader::getService('CustomerWrite'),
+ $countryService);
+
+ $createAccountProcess->proceedRegistree($customerCollection,
+ MainFactory::create('GMLogoManager', 'gm_logo_mail'));
+
+}
+if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($_SESSION['nn_order']->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+}
+$received_address = $response['variable_name']['response'];
+$_SESSION['shipping']['id'] = $received_address['order']['shipping']['method']['identifier'];
+$_SESSION['received_data'] = $response['variable_name']['response'];
+$_SESSION['token'] = $response['variable_name']['response']['transaction']['token'];
+$order->info['shipping_method'] = $received_address['order']['shipping']['method']['label'];
+$order->info['shipping_class'] = $received_address['order']['shipping']['method']['identifier'];
+$order->info['shipping_cost'] = number_format($received_address['order']['shipping']['method']['amount']/100, 2);
+$order->info['payment_method'] = $_SESSION['payment'];
+$order->info['payment_class'] = $_SESSION['payment'];
+$order->info['total'] = ($order->info['subtotal'] + $order->info['shipping_cost']) - round($discount_price, 2);
+
+$payment_modules->before_process();
+
+require_once('includes/classes/order_total.php');
+$order_total_modules = new order_total();
+
+$order_totals = $order_total_modules->process();
+
+// Check if tmp order need to be created when cart page or product page load
+if (${$_SESSION['payment']}->tmpOrders) {
+ $tmp = true;
+ $orders_status_id = ${$_SESSION['payment']}->tmpStatus;
+} else {
+ $orders_status_id = constant('MODULE_PAYMENT_'.strtoupper($response['payment_name']).'_ORDER_STATUS');
+}
+
+if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == 1) {
+ $discount = $_SESSION['customers_status']['customers_status_ot_discount'];
+} else {
+ $discount = '0.00';
+}
+if (!empty($response['variable_name']['response']['order']['billing']['contact']['countryCode'])) {
+ $billing_countryQuery = xtc_db_fetch_array(xtc_db_query("SELECT countries_name FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $response['variable_name']['response']['order']['billing']['contact']['countryCode']."'"));
+}
+if (!empty($response['variable_name']['response']['order']['shipping']['contact']['countryCode'])) {
+ $delivery_countryQuery = xtc_db_fetch_array(xtc_db_query("SELECT countries_name FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $response['variable_name']['response']['order']['shipping']['contact']['countryCode']."'"));
+}
+
+$sql_data_array = array(
+ 'customers_id' => $_SESSION['customer_id'],
+ 'customers_name' => ($received_address['order']['billing']['contact']['firstName'] . ' ' . $received_address['order']['billing']['contact']['lastName']),
+ 'customers_firstname' => $received_address['order']['shipping']['contact']['firstName'] ,
+ 'customers_lastname' => $received_address['order']['shipping']['contact']['lastName'] ,
+ 'customers_gender' => !empty($order->customer['gender']) ? $order->customer['gender'] : 'o',
+ 'customers_status' => $_SESSION['customers_status']['customers_status_id'],
+ 'customers_status_name' => $_SESSION['customers_status']['customers_status_name'],
+ 'customers_status_image' => $_SESSION['customers_status']['customers_status_image'],
+ 'customers_status_discount' => $discount,
+ 'customers_street_address' => $received_address['order']['billing']['contact']['addressLines'] ,
+ 'customers_suburb' => $order->customer['suburb'],
+ 'customers_city' => $received_address['order']['billing']['contact']['locality'],
+ 'customers_postcode' => $received_address['order']['billing']['contact']['postalCode'] ,
+ 'customers_country' => $received_address['order']['billing']['contact']['country'] ,
+ 'customers_email_address' => ($response['payment_name'] == 'novalnet_googlepay') ? $received_address['order']['billing']['contact']['email'] : $received_address['order']['shipping']['contact']['email'],
+ 'customers_address_format_id' => $order->customer['format_id'],
+ 'delivery_name' => (empty($received_address['order']['shipping']['contact']['firstName']) ? $received_address['order']['billing']['contact']['firstName'] . ' ' . $received_address['order']['billing']['contact']['lastName'] : $received_address['order']['shipping']['contact']['firstName'] . ' ' . $received_address['order']['shipping']['contact']['lastName']),
+ 'delivery_firstname' => (empty($received_address['order']['shipping']['contact']['firstName']) ? $received_address['order']['billing']['contact']['firstName'] : $received_address['order']['shipping']['contact']['firstName']),
+ 'delivery_lastname' => (empty($received_address['order']['shipping']['contact']['lastName']) ? $received_address['order']['shipping']['contact']['lastName'] : $received_address['order']['shipping']['contact']['lastName']),
+ 'delivery_street_address' => (empty($received_address['order']['shipping']['contact']['addressLines']) ? $received_address['order']['billing']['contact']['addressLines'] : $received_address['order']['shipping']['contact']['addressLines']),
+ 'delivery_city' => (empty($received_address['order']['shipping']['contact']['locality']) ? $received_address['order']['billing']['contact']['locality'] : $received_address['order']['shipping']['contact']['locality']),
+ 'delivery_postcode' => (empty($received_address['order']['shipping']['contact']['postalCode']) ? $received_address['order']['billing']['contact']['postalCode'] : $received_address['order']['shipping']['contact']['postalCode']),
+ 'delivery_country' => (empty($received_address['order']['shipping']['contact']['countryCode']) ? $billing_countryQuery['countries_name'] : $delivery_countryQuery['countries_name']),
+ 'delivery_country_iso_code_2' => (empty($received_address['order']['shipping']['contact']['countryCode']) ? $received_address['order']['billing']['contact']['countryCode'] : $received_address['order']['shipping']['contact']['countryCode']),
+ 'delivery_address_format_id' => !empty($order->delivery['format_id']) ? $order->delivery['format_id'] : '5',
+ 'billing_name' => $received_address['order']['billing']['contact']['firstName'] . ' ' . $received_address['order']['billing']['contact']['lastName'],
+ 'billing_firstname' => $received_address['order']['billing']['contact']['firstName'],
+ 'billing_lastname' => $received_address['order']['billing']['contact']['lastName'],
+ 'billing_street_address' => $received_address['order']['billing']['contact']['addressLines'],
+ 'billing_city' => $received_address['order']['billing']['contact']['locality'],
+ 'billing_postcode' => $received_address['order']['billing']['contact']['postalCode'],
+ 'billing_country' => $billing_countryQuery['countries_name'],
+ 'billing_country_iso_code_2' => $received_address['order']['billing']['contact']['countryCode'],
+ 'billing_address_format_id' => !empty($order->delivery['format_id']) ? $order->delivery['format_id'] : '5',
+ 'payment_method' => $order->info['payment_method'],
+ 'payment_class' => ${$_SESSION['payment']}->title,
+ 'shipping_method' => $received_address['order']['shipping']['method']['label'],
+ 'shipping_class' => $received_address['order']['shipping']['method']['identifier'],
+ 'date_purchased' => 'now()',
+ 'orders_status' => $orders_status_id,
+ 'currency' => $order->info['currency'],
+ 'currency_value' => $order->info['currency_value'],
+ 'account_type' => $_SESSION['account_type'],
+ 'conversion_type' => 1,
+ 'customers_ip' => $_SERVER['REMOTE_ADDR'],
+ 'language' => $_SESSION['language'],
+);
+
+// refID
+$refID = '';
+if (isset($_SESSION['tracking']['refID'])) {
+ $refID = $_SESSION['tracking']['refID'];
+} else {
+ $campaign_query = xtc_db_query("SELECT cp.campaigns_refID FROM " . TABLE_CUSTOMERS . " c JOIN " . TABLE_CAMPAIGNS . " cp ON cp.campaigns_id = c.refferers_id WHERE c.customers_id = '" . (int)$_SESSION['customer_id']."'");
+ $campaign = xtc_db_fetch_array($campaign_query);
+ $refID = $campaign['campaigns_refID'];
+}
+if ($refID != '') {
+ $sql_data_array['campaign'] = $refID;
+}
+// Check if late or direct sale
+$customers_logon_query = xtc_db_query("SELECT customers_info_number_of_logons FROM " . TABLE_CUSTOMERS_INFO . " WHERE customers_info_id = '" . (int)$_SESSION['customer_id'] . "'"); $customers_logon = xtc_db_fetch_array($customers_logon_query);
+if ($customers_logon['customers_info_number_of_logons'] > 1) {
+ $sql_data_array['conversion_type'] = 2;
+}
+xtc_db_perform(TABLE_ORDERS, $sql_data_array);
+$insert_id = xtc_db_insert_id();
+$_SESSION['tmp_oID'] = $insert_id;
+
+for ($i = 0, $n = sizeof($order_totals); $i < $n; $i ++) {
+ $sql_data_array = array(
+ 'orders_id' => $insert_id,
+ 'title' => $order_totals[$i]['title'],
+ 'text' => $order_totals[$i]['text'],
+ 'value' => $order_totals[$i]['value'],
+ 'class' => $order_totals[$i]['code'],
+ 'sort_order' => $order_totals[$i]['sort_order']
+ );
+ xtc_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array);
+}
+/* magnalister v1.0.1 */
+if (function_exists('magnaExecute')) magnaExecute('magnaInsertOrderDetails', array('oID' => $insert_id), array('order_details.php'));
+if (function_exists('magnaExecute')) magnaExecute('magnaInventoryUpdate', array('action' => 'inventoryUpdateOrder'), array('inventoryUpdate.php'));
+/* END magnalister */
+$customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
+$sql_data_array = array(
+ 'orders_id' => $insert_id,
+ 'orders_status_id' => $orders_status_id,
+ 'date_added' => 'now()',
+ 'customer_notified' => $customer_notification,
+ 'comments' => xtc_db_prepare_input($order->info['comments'])
+);
+
+xtc_db_perform(TABLE_ORDERS_STATUS_HISTORY, $sql_data_array);
+$_SESSION['disable_products'] = array();
+for ($i = 0, $n = sizeof($order->products); $i < $n; $i ++) {
+ // Stock update
+ $stock_set = '';
+ if (STOCK_LIMITED == 'true') {
+ if (DOWNLOAD_ENABLED == 'true') {
+ $add_stock_query_raw = '';
+ $products_attributes = $order->products[$i]['attributes'];
+ if (is_array($products_attributes)) {
+ $add_stock_query_raw .= " AND pa.options_id = '".$products_attributes[0]['option_id']."' AND pa.options_values_id = '".$products_attributes[0]['value_id']."'";
+ }
+ $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename FROM " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES." pa ON p.products_id = pa.products_id " . $add_stock_query_raw . " LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id = pad.products_attributes_id WHERE p.products_id = '" . xtc_get_prid($order->products[$i]['id']) . "'";
+ // Will work with only one option for downloadable products
+ // otherwise, we have to build the query dynamically with a loop
+ $stock_query = xtc_db_query($stock_query_raw);
+ } else {
+ $stock_query = xtc_db_query("SELECT products_quantity FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . xtc_get_prid($order->products[$i]['id']) . "'");
+ }
+ if (xtc_db_num_rows($stock_query) > 0) {
+ $stock_values = xtc_db_fetch_array($stock_query);
+ // Do not decrement quantities if products_attributes_filename exists
+ if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename'])) {
+ $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
+ } else {
+ $stock_left = $stock_values['products_quantity'];
+ }
+ $stock_set = " products_quantity = '".$stock_left."', ";
+ if (($stock_left < 1) && (STOCK_CHECKOUT_UPDATE_PRODUCTS_STATUS == 'true')) {
+ $_SESSION['disable_products'][] = xtc_get_prid($order->products[$i]['id']);
+ }
+ }
+ }
+ // Update product
+ xtc_db_query("UPDATE " . TABLE_PRODUCTS . " SET " . $stock_set . "products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " WHERE products_id = '" .xtc_get_prid($order->products[$i]['id']) . "'");
+ $sql_data_array = array(
+ 'orders_id' => $insert_id,
+ 'products_id' => xtc_get_prid($order->products[$i]['id']),
+ 'products_model' => $order->products[$i]['model'],
+ 'products_name' => $order->products[$i]['name'],
+ 'products_price' => $order->products[$i]['price'],
+ 'products_shipping_time' => strip_tags($order->products[$i]['shipping_time']),
+ 'products_discount_made' => $order->products[$i]['discount_allowed'],
+ 'final_price' => $order->products[$i]['final_price'],
+ 'products_tax' => $order->products[$i]['tax'],
+ 'products_quantity' => $order->products[$i]['qty'],
+ 'allow_tax' => $_SESSION['customers_status']['customers_status_show_price_tax'],
+ );
+
+ foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_products/', 'php') as $file) require ($file);
+ xtc_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
+ $order_products_id = xtc_db_insert_id();
+ // update specials quantity
+ $specials_query = xtc_db_query("SELECT `products_id`, `specials_quantity` FROM `". TABLE_SPECIALS ."` WHERE `products_id` = '" . xtc_get_prid($order->products[$i]['id']) . "'" .`SPECIALS_CONDITIONS`);
+ if (xtc_db_num_rows($specials_query)) {
+ $specials = xtc_db_fetch_array($specials_query);
+ if ($specials['specials_quantity'] != 0) {
+ $specials_quantity = ($specials['specials_quantity'] - $order->products[$i]['qty']);
+ $stock_set = '';
+ if ($specials_quantity < 1) {
+ $stock_set = " status = '0', ";
+ }
+ xtc_db_query("UPDATE `" . TABLE_SPECIALS . "` SET " . $stock_set . "`specials_quantity` = '" . $specials_quantity . "' WHERE `products_id` = '" . xtc_get_prid($order->products[$i]['id']) . "' ");
+ }
+ }
+ $order_total_modules->update_credit_account($i); // GV Code ICW ADDED FOR CREDIT CLASS SYSTEM
+ if (isset($order->products[$i]['attributes'])) {
+ $order->products[$i]['attributes'] = array_values($order->products[$i]['attributes']); // reset keys for $j
+ for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j ++) {
+ // Update attribute stock
+ $update_attr_stock = false;
+ if (STOCK_LIMITED == 'true' && isset($order->products[$i]['attributes'][$j]['value_id']) && isset($order->products[$i]['attributes'][$j]['option_id'])) {
+ $update_attr_stock = true;
+ if (DOWNLOAD_ENABLED == 'true') {
+ $attr_stock_query = xtc_db_query("SELECT pad.products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES . " pa JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id = pad.products_attributes_id WHERE pa.products_id = '" . xtc_get_prid($order->products[$i]['id']) . "' AND pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' AND pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'");
+ $update_attr_stock = ((xtc_db_num_rows($attr_stock_query) > 0) ? false : true);
+ }
+ }
+ // Update attribute stock
+ if ($update_attr_stock === true) {
+ xtc_db_query("UPDATE " . TABLE_PRODUCTS_ATTRIBUTES . " SET attributes_stock = attributes_stock - '" . $order->products[$i]['qty'] . "' WHERE products_id = '" . xtc_get_prid($order->products[$i]['id']) . "' AND options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' AND options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'");
+ }
+ // Attributes
+ $sql_data_array = array(
+ 'orders_id' => $insert_id,
+ 'orders_products_id' => $order_products_id,
+ 'products_options' => $order->products[$i]['attributes'][$j]['option'],
+ 'products_options_values' => $order->products[$i]['attributes'][$j]['value'],
+ 'options_values_price' => $order->products[$i]['attributes'][$j]['price'],
+ 'price_prefix' => $order->products[$i]['attributes'][$j]['prefix'],
+ 'options_id' => $order->products[$i]['attributes'][$j]['option_id'],
+ 'options_values_id' => $order->products[$i]['attributes'][$j]['value_id'],
+ );
+ foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_attributes/','php') as $file) require ($file);
+ xtc_db_perform(TABLE_ORDERS_PRODUCTS_ATTRIBUTES, $sql_data_array);
+ // Attributes download
+ if (DOWNLOAD_ENABLED == 'true') {
+ $attributes_dl_query = xtc_db_query("SELECT pad.products_attributes_maxdays, pad.products_attributes_maxcount, pad.products_attributes_filename FROM " . TABLE_PRODUCTS_ATTRIBUTES." pa LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad ON pa.products_attributes_id = pad.products_attributes_id WHERE pa.products_id = '" .$order->products[$i]['id'] . "' AND pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' AND pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'");
+ $attributes_dl_array = xtc_db_fetch_array($attributes_dl_query);
+ if (isset($attributes_dl_array['products_attributes_filename']) && xtc_not_null($attributes_dl_array['products_attributes_filename'])) {
+ $sql_data_array = array(
+ 'orders_id' => $insert_id,
+ 'orders_products_id' => $order_products_id,
+ 'orders_products_filename' => $attributes_dl_array['products_attributes_filename'],
+ 'download_maxdays' => $attributes_dl_array['products_attributes_maxdays'],
+ 'download_count' => $attributes_dl_array['products_attributes_maxcount'],
+ );
+ foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_download/','php') as $file) require ($file);
+ xtc_db_perform(TABLE_ORDERS_PRODUCTS_DOWNLOAD, $sql_data_array);
+ }
+ }
+ }
+ }
+}
+
+foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_order/', 'php') as $file) require ($file);
+
+if ($tmp == true) {
+ $payment_modules->payment_action();
+ $response = json_encode(['redirect_url' => $_SESSION['nn_redirect_url'], 'isRedirect'=>1], true);
+ echo $response;
+ exit;
+}
+$payment_modules->after_process();
+require_once (DIR_FS_CATALOG. 'system/classes/orders/SendOrderProcess.inc.php');
+$coo_send_order_process = MainFactory::create_object('SendOrderProcess');
+$coo_send_order_process->set_('order_id', $insert_id);
+$coo_send_order_process->proceed();
+
+// BOF GM_MOD GX-Customizer
+require(DIR_FS_CATALOG . 'gm/modules/gm_gprint_order.php');
+
+// Reset shopping cart
+$_SESSION['cart']->reset(true);
+
+foreach(auto_include(DIR_FS_CATALOG.'includes/extra/checkout/checkout_process_end/', 'php') as $file) require ($file);
+unset($_SESSION['nn_order']);
+unset($_SESSION['initial_shipping_amount']);
+unset($_SESSION['method_update_shipping_amount']);
+
+// unregister session variables used during checkout
+unset($_SESSION['sendto']);
+unset($_SESSION['delivery_zone']);
+unset($_SESSION['billto']);
+unset($_SESSION['shipping']);
+unset($_SESSION['payment']);
+unset($_SESSION['comments']);
+unset($_SESSION['last_order']);
+unset($_SESSION['tmp_oID']);
+unset($_SESSION['cc']);
+unset($_SESSION['disable_products']);
+// GV Code Start
+if (isset($_SESSION['credit_covers'])) {
+ unset($_SESSION['credit_covers']);
+}
+$return_url = xtc_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL');
+$response = json_encode(['return_url' => $return_url], true);
+echo $response;
+exit;
+function auto_include($dir, $ext = 'php', $expr = '*', $flags = 0) {
+ $dir = rtrim($dir, '/');
+ $files = glob("{$dir}/$expr." . $ext, $flags);
+ $files = ((false !== $files) ? $files : array());
+ natcasesort($files);
+ if (function_exists('debugMessage')) {
+ debugMessage('auto_include',$files);
+ }
+ return $files;
+}
+
+?>
diff --git a/novalnet_wallet_shipping_data_update_process.php b/novalnet_wallet_shipping_data_update_process.php
new file mode 100644
index 0000000..fcc6efb
--- /dev/null
+++ b/novalnet_wallet_shipping_data_update_process.php
@@ -0,0 +1,407 @@
+get_available_combis_ids_by_values($post['products_id'], $post['variant_info']);
+ if(empty($_SESSION['cart'])) {
+ $_SESSION['cart'] = new shoppingCart();
+ $cart_object = $_SESSION['cart'];
+ }
+ $amount = 0;
+ if($combi_id) {
+ $variant_data = $coo_properties_control->get_properties_combis_details($combi_id[0], 1);
+ foreach ($variant_data as $key => $value) {
+ $amount += $value['value_price'];
+ }
+ }
+ $response = json_encode(['amount' => (string)($amount * 100)], true);
+ echo $response;
+ exit;
+}
+
+
+if ($post['action'] == 'add_virtual_product_in_cart') {
+ if (isset($post['products_id']) && isset($post['products_qty'])) { // Add product to cart in product page
+ if(empty($_SESSION['cart'])) {
+ $_SESSION['cart'] = new shoppingCart();
+ $cart_object = $_SESSION['cart'];
+ }
+
+ if (isset($post['products_id']) && is_numeric($post['products_id']) && isset($post['products_qty']) && $post['products_qty'] > 0) {
+ $cart_quantity = (xtc_remove_non_numeric($post['products_qty']) + $cart_object->get_quantity(xtc_get_uprid($post['products_id'], $post['attribute_info'])));
+ $cart_object->add_cart((int)$post['products_id'], $cart_quantity, $post['attribute_info']);
+
+ }
+ }
+ $order = new order();
+ $virtual_articleDetails = [];
+ if ($post['get_article_details'] == 1) {
+ foreach($order->products as $products) {
+ $virtual_articleDetails[] = array(
+ 'label'=> $products['name']. ' x ' .$products['qty'],
+ 'amount' => (string)(($products['qty'] * $products['price'])*100),
+ 'type' => 'SUBTOTAL',
+ );
+ }
+ // Price incl tax
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($order->info['tax'] != 0)) {
+ $virtual_articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if($order->info['tax'] != 0){ // Price excl tax
+ $virtual_articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $virtual_articleDetails[] = array(
+ 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount',
+ 'amount' => (string) (round($discount_price, 2) *100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ }
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') {
+ $amount = (string)($order->info['total'] * 100) - (string) (round($discount_price, 2) *100);
+ } else {
+ $amount = (string)($order->info['total'] * 100) + (string)((round($order->info['tax'], 2))*100) - (string) (round($discount_price, 2) *100);
+ }
+ $data = json_encode(['amount' => $amount, 'article_details' => $virtual_articleDetails], true);
+ echo $data;
+ exit;
+}
+
+if ($post['action'] == 'updated_amount') {
+ require_once(DIR_WS_CLASSES.'order.php');
+ $order = new order();
+ $articleDetails = [];
+ if ($post['get_article_details'] == 1) {
+ foreach($order->products as $products) {
+ $articleDetails[] = array(
+ 'label'=> $products['name']. ' x ' .$products['qty'],
+ 'amount' => (string)(($products['qty'] * $products['price'])*100),
+ 'type' => 'SUBTOTAL',
+ );
+ }
+ // Price incl tax
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($order->info['tax'] != 0)) {
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if($order->info['tax'] != 0){ // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $articleDetails[] = array(
+ 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount',
+ 'amount' => (string) (round($discount_price, 2) *100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ }
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') {
+ $amount = (string)($order->info['total'] * 100) - (string) (round($discount_price, 2) *100);
+ } else {
+ $amount = (string)($order->info['total'] * 100) + (string)((round($order->info['tax'], 2))*100) - (string) (round($discount_price, 2) *100);
+ }
+ $response = json_encode(['amount' => $amount, 'article_details' => $articleDetails], true);
+ echo $response;
+ exit;
+}
+
+// Shipping address change
+if ($post['action'] == 'novalnet_shipping_address_update') {
+ $response = $post['shippingInfo'];
+ $received_address = json_decode($response, true);
+ $coo_properties_control = MainFactory::create_object('PropertiesControl');
+ $combi_id = $coo_properties_control->get_available_combis_ids_by_values($post['products_id'], $post['variant_info']);
+ if (isset($post['products_id']) && isset($post['products_qty'])) { // Add product to cart in product page
+ $_SESSION['cart'] = new shoppingCart();
+ $cart_object = $_SESSION['cart'];
+ if (isset($post['products_id']) && is_numeric($post['products_id']) && isset($post['products_qty']) && $post['products_qty'] > 0) {
+
+ $cart_quantity = (xtc_remove_non_numeric($post['products_qty']) + $cart_object->get_quantity(xtc_get_uprid($post['products_id'], isset($post['id']) ? $post['id'] : '')));
+
+ if ($cart_quantity > MAX_PRODUCTS_QTY) {
+ $cart_quantity = MAX_PRODUCTS_QTY;
+ $messageStack->add_session('global', sprintf(MAX_PROD_QTY_EXCEEDED, xtc_get_products_name($post['products_id'])));
+ }
+
+ $cart_object->add_cart((int)$post['products_id'], $cart_quantity, '', true, $combi_id[0]);
+
+ }
+ }
+ $order = new order();
+
+ $delivery_zone_query = xtc_db_fetch_array(xtc_db_query("SELECT countries_id, countries_iso_code_3 FROM " . TABLE_COUNTRIES . " WHERE countries_iso_code_2 = '" . $received_address['address']['countryCode']."'"));
+ $order->delivery['country']['id'] = $delivery_zone_query['countries_id'];
+ $order->delivery['country']['iso_code_2'] = $received_address['address']['countryCode'];// assign country code in order object
+ $order->delivery['country']['iso_code_3'] = $delivery_zone_query['countries_iso_code_3'];
+ $order->delivery['country_id'] = $delivery_zone_query['countries_id'];
+ $order->delivery['country']['title'] = '';
+ $order->delivery['zone_id'] = 0;
+ $zone_query = xtc_db_fetch_array(xtc_db_query("SELECT zone_id FROM " . TABLE_ZONES. " WHERE zone_country_id = '".$delivery_zone_query['countries_id']."' and zone_code = '" . $received_address['address']['administrativeArea']."'"));
+
+ $_SESSION['delivery_zone'] = $received_address['address']['countryCode'];
+ $articleDetails = [];
+ if (!empty($order->products)) {
+ $order->info['subtotal'] = 0;
+ $order->info['total'] = 0;
+ $order->info['tax'] = 0;
+ $order->info['tax_groups'] =[];
+ }
+ if (MODULE_ORDER_TOTAL_SHIPPING_STATUS == 'true') {
+ require_once ('includes/classes/shipping.php');
+ $shipping_obj = new shipping();
+ // Load all enabled shipping modules
+ $quotes = $shipping_obj->quote();
+ foreach ($order->products as $key => $products) {
+ $tax_removed_amount = $xtPrice->xtcRemoveTax($order->products[$key]['price'], $order->products[$key]['tax']);
+
+ $tax_rate = xtc_get_tax_rate($order->products[$key]['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']);
+ $products_price = $xtPrice->xtcAddTax($tax_removed_amount, $tax_rate, false);
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') {
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = ($xtPrice->calcTax($order->products[$key]['price'], $tax_rate) * round($_SESSION['customers_status']['customers_status_ot_discount']))/100;
+ $tax_value = (($xtPrice->calcTax($order->products[$key]['price'], $tax_rate)) - $discount_price) * $order->products[$key]['qty'];
+ } else {
+ $tax_value = ($products_price- $tax_removed_amount) * $order->products[$key]['qty'];
+ }
+ $products = array(
+ 'tax_class_id' => $products['tax_class_id'],
+ 'tax' => xtc_get_tax_rate($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']),
+ 'tax_description' => xtc_get_tax_description($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']),
+ 'price' => $products_price,
+ 'price_formated' => $xtPrice->xtcFormat($products_price, true),
+ 'final_price' => $products_price * $products['qty'],
+ 'final_price_formated' => $xtPrice->xtcFormat($products_price * $products['qty'], true),
+ );
+ } else {
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = ($xtPrice->calcTax($order->products[$key]['price'], $tax_rate) * round($_SESSION['customers_status']['customers_status_ot_discount']))/100;
+ $tax_value = (($xtPrice->calcTax($order->products[$key]['price'], $tax_rate)) - $discount_price) * $order->products[$key]['qty'];
+ } else {
+ $tax_value = ($xtPrice->calcTax($order->products[$key]['price'], $tax_rate)) * $order->products[$key]['qty'];
+ }
+ $products = array(
+ 'tax_class_id' => $products['tax_class_id'],
+ 'tax' => xtc_get_tax_rate($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']),
+ 'tax_description' => xtc_get_tax_description($products['tax_class_id'], $delivery_zone_query['countries_id'], $zone_query['zone_id']),
+ 'price' => $order->products[$key]['price'],
+ 'price_formated' => $xtPrice->xtcFormat($order->products[$key]['price'], true),
+ 'final_price' => $order->products[$key]['price'] * $products['qty'],
+ 'final_price_formated' => $xtPrice->xtcFormat($order->products[$key]['price'] * $products['qty'], true),
+ );
+ }
+ $order->products[$key]['tax_class_id'] = $products['tax_class_id'];
+ $order->products[$key]['tax'] = $products['tax'];
+ $order->products[$key]['tax_description'] = $products['tax_description'];
+ $order->products[$key]['price'] = $products['price'];
+ $order->products[$key]['price_formated'] = $products['price_formated'];
+ $order->products[$key]['final_price'] = $products['final_price'];
+ $order->products[$key]['final_price_formated'] = $products['final_price_formated'];
+ if ($tax_rate != 0) {
+ $order->products[$key]['tax_value'] = $tax_value;
+ }
+ // tax information needed in OrderTaxInformation class for storing orders_tax_sum_items data
+ $_SESSION['customer_cart_tax_info'] = [
+ $products['tax_description'] => [
+ 'tax_class_id' => $products['tax_class_id'],
+ 'country_id' => $delivery_zone_query['countries_id'],
+ 'zone_id' => $zone_query['zone_id']
+ ]
+ ];
+
+ $order->info['subtotal'] += $order->products[$key]['final_price'];
+ if ($tax_rate != 0) {
+ $order->info['tax'] += $order->products[$key]['tax_value'];
+ }
+ $products_tax_description = $products['tax_description'];
+
+ // Price incl tax
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] == '1') {
+ $order->info['tax_groups'][TAX_ADD_TAX . "$products_tax_description"] += (string)((round($order->products[$key]['tax_value'], 2)));
+ } else { // Price excl tax
+ $order->info['tax_groups'][TAX_NO_TAX . "$products_tax_description"] += (string)((round($order->products[$key]['tax_value'], 2)));
+ }
+ // Price incl tax
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($order->info['tax'] != 0)) {
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if ($order->info['tax'] != 0){ // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($order->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ }
+ foreach ($order->products as $products) {
+ $articleDetails[] = array(
+ 'label' => $products['name']. 'x' .$products['qty'],
+ 'amount' => (string)(($products['qty'] * $products['price'])*100),
+ 'type' => 'SUBTOTAL'
+ );
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($order->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $articleDetails[] = array(
+ 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount',
+ 'amount' => (string) (round($discount_price, 2) *100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if($_SESSION['customers_status']['customers_status_show_price_tax'] != '0') {
+ $total += ($products['qty'] * $products['price']) - (round($discount_price, 2));
+ } else {
+ $total += (($products['qty'] * $products['price'])) + (round($order->info['tax'], 2)) - round($discount_price, 2);
+ }
+ }
+ if(!empty($_SESSION['initial_shipping_amount'])) {
+ unset($_SESSION['initial_shipping_amount']);
+ }
+ $shipping_content = array ();
+ $count = 1;
+ for ($i = 0, $n = sizeof($quotes); $i < $n; $i ++) {
+ $value = 0;
+ $title = $quotes[$i]['module'];
+ if (!isset($quotes[$i]['error'])) {
+ for ($j = 0, $n2 = sizeof($quotes[$i]['methods']); $j < $n2; $j ++) {
+ if (!defined('SHOW_SHIPPING_MODULE_TITLE') || SHOW_SHIPPING_MODULE_TITLE == 'shipping_default') {
+ $title .= ' - ' . $quotes[$i]['methods'][$j]['title'];
+ }
+ if (isset($quotes[$i]['methods'][$j]['cost']) && $quotes[$i]['methods'][$j]['cost'] > 0) {
+ if (isset($quotes[$i]['tax']) && $quotes[$i]['tax'] > 0) {
+ $value = ($quotes[$i]['methods'][$j]['cost'] * $quotes['tax']);
+ } else {
+ $value = ($quotes[$i]['methods'][$j]['cost']);
+ }
+ }
+ $shipping_content[] = array(
+ 'label' => $title,
+ 'amount' => (string)($value * 100),
+ 'identifier' => $quotes[$i]['id'].'_'.$quotes[$i]['methods'][$j]['id'],
+ 'detail' => ''
+ );
+ if ($count == 1) {
+ $articleDetails[] = array(
+ 'label' => $quotes[$i]['module'],
+ 'amount' => (string)($value * 100),
+ 'type' => 'SUBTOTAL'
+ );
+ $total += $value;
+ }
+ $count++;
+ }
+ }
+ $order->info['total'] = $order->info['subtotal'] + ($xtPrice->xtcFormat($quotes[$i]['methods'][$j]['cost'], false, 0, true)) - (round($discount_price, 2) *100);
+ }
+ $_SESSION['nn_order'] = $order;
+ $shipping_address_change = array(
+ 'amount' => (string)($total*100),
+ 'shipping_address' => $shipping_content,
+ 'article_details' => $articleDetails
+ );
+ $_SESSION['initial_shipping_amount'] = $shipping_content['amount'];
+ $response = json_encode($shipping_address_change, true);
+ echo $response;
+ exit;
+ }
+}
+
+// Shpping method change
+if($post['action'] == 'novalnet_shipping_method_update') {
+ $order = new order();
+ $received_shipping_method = json_decode($post['shippingInfo'], true);
+ if(!empty($_SESSION['method_update_shipping_amount'])) {
+ unset($_SESSION['method_update_shipping_amount']);
+ }
+ $articleDetails = [];
+ foreach($_SESSION['nn_order']->products as $products) {
+ $articleDetails[] = array(
+ 'label' => $products['name']. 'x' .$products['qty'],
+ 'amount' => (string)(($products['qty'] * $products['price'])*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ // Price incl tax
+
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($_SESSION['nn_order']->info['tax'] != 0)) {
+ $articleDetails[] = array(
+ 'label' => 'Incl.Tax',
+ 'amount' => (string)((round($_SESSION['nn_order']->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ } else if($_SESSION['nn_order']->info['tax'] != 0){ // Price excl tax
+ $articleDetails[] = array(
+ 'label' => 'Excl.Tax',
+ 'amount' => (string)((round($_SESSION['nn_order']->info['tax'], 2))*100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount']!='0.00') {
+ $discount_price = round($xtPrice->xtcFormat($_SESSION['nn_order']->info['subtotal'], false) / 100 * $_SESSION['customers_status']['customers_status_ot_discount']*1, 2);
+ $articleDetails[] = array(
+ 'label' => $_SESSION['customers_status']['customers_status_discount']. '%' . 'Discount',
+ 'amount' => (string) (round($discount_price, 2) *100),
+ 'type' => 'SUBTOTAL'
+ );
+ }
+ if ($_SESSION['customers_status']['customers_status_show_price_tax'] != '0' && ($_SESSION['nn_order']->info['tax'] != 0)) {
+ $total = (($_SESSION['nn_order']->info['subtotal'] * 100) - round($discount_price, 2) *100) + ($received_shipping_method['shippingMethod']['amount']*100);
+ } else if(($_SESSION['nn_order']->info['tax'] != 0)){
+ $total = (($_SESSION['nn_order']->info['subtotal'] * 100) - round($discount_price, 2) *100) + (string)((round($_SESSION['nn_order']->info['tax'], 2))*100) + ($received_shipping_method['shippingMethod']['amount']*100);
+ } else {
+ $total = (($_SESSION['nn_order']->info['subtotal'] * 100) - round($discount_price, 2) *100) + ($received_shipping_method['shippingMethod']['amount']*100);
+ }
+
+ $_SESSION['method_update_shipping_amount'] = (string)($received_shipping_method['shippingMethod']['amount']*100);
+ $articleDetails[] = array(
+ 'label' => $received_shipping_method['shippingMethod']['label'],
+ 'amount' => (string)($received_shipping_method['shippingMethod']['amount']*100),
+ 'type' => 'SUBTOTAL');
+ $shipping_method_change = array(
+ 'article_details' => $articleDetails,
+ 'amount' => (string)$total);
+ $result = json_encode($shipping_method_change, true);
+ echo $result;
+ exit;
+}
+?>