· 7 years ago · Sep 13, 2018, 08:52 PM
1<?php
2/**
3*
4* @ This file is created by http://DeZender.Net
5* @ deZender (PHP7 Decoder for ionCube Encoder)
6*
7* @ Version : 4.0.5.1
8* @ Author : DeZender
9* @ Release on : 28.07.2018
10* @ Official site : http://DeZender.Net
11*
12*/
13
14function woocommerce_nbghps()
15{
16 if (!class_exists('WC_Payment_Gateway')) {
17 return NULL;
18 }
19
20 if (class_exists('WC_NBGHPS')) {
21 return NULL;
22 }
23
24 class WC_NBGHPS extends WC_Payment_Gateway
25 {
26 public $return_url;
27
28 public function __construct()
29 {
30 $plugin_dir = plugin_dir_url(__FILE__);
31 global $woocommerce;
32 $this->id = 'nbghps';
33 $this->icon = apply_filters('woocommerce_nbghps_icon', '' . $plugin_dir . 'nbghps.png');
34 $this->has_fields = false;
35 $this->init_form_fields();
36 $this->init_settings();
37 $this->title = $this->settings['title'];
38 $this->description = $this->settings['description'];
39 $this->nbghps_merchantid = $this->settings['nbghps_merchantid'];
40 $this->nbghps_merchantpass = html_entity_decode($this->settings['nbghps_merchantpass']);
41 $this->nbghps_merchantname = $this->settings['nbghps_merchantname'];
42 $this->nbghps_mode = $this->settings['nbghps_mode'];
43 $this->nbghps_tds = $this->settings['nbghps_tds'];
44 $this->nbghps_type = $this->settings['nbghps_type'];
45 $this->nbghps_instal = $this->settings['nbghps_instal'];
46 $this->nbghps_processing = $this->settings['nbghps_processing'];
47 $this->nbghps_processing_notrd = $this->settings['nbghps_processing_notrd'];
48 $this->return_url = str_replace('https:', 'http:', esc_url_raw(add_query_arg('wc-api', __CLASS__, home_url('/'))));
49 add_action('valid-nbghps-standard-ipn-reques', [$this, 'successful_request']);
50 add_action('woocommerce_receipt_nbghps', [$this, 'receipt_page']);
51 add_action('woocommerce_update_options_payment_gateways_' . $this->id, [$this, 'process_admin_options']);
52 add_action('woocommerce_api_wc_nbghps', [$this, 'check_ipn_response']);
53
54 if (!defined('PLUGINDIR')) {
55 define('PLUGINDIR', 'wp-content/plugins');
56 }
57
58 load_plugin_textdomain('nbghps-for-woocommerce2', PLUGINDIR . '/nbghps-for-woocommerce2/languages', 'nbghps-for-woocommerce2/languages');
59
60 if (!$this->is_valid_for_use()) {
61 $this->enabled = false;
62 }
63 }
64
65 public function is_valid_for_use()
66 {
67 if (!in_array(get_option('woocommerce_currency'), ['EUR'])) {
68 return false;
69 }
70
71 return true;
72 }
73
74 public function admin_options()
75 {
76 global $wpdb;
77 $query = 'CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'nbghps_data (' . "\r\n\t\t" . ' id int(11) unsigned NOT NULL AUTO_INCREMENT,' . "\r\n\t\t" . ' cid int(11) DEFAULT NULL,' . "\r\n\t\t" . ' oid int(11) DEFAULT NULL,' . "\r\n\t\t" . ' merchantreference varchar(150) DEFAULT NULL,' . "\r\n\t\t" . ' datacashreference varchar(255) DEFAULT NULL,' . "\r\n\t\t" . ' datacashurl varchar(255) DEFAULT NULL,' . "\r\n\t\t" . ' datacashsession varchar(255) DEFAULT NULL,' . "\r\n\t\t" . ' datacashmode varchar(255) DEFAULT NULL,' . "\r\n\t\t" . ' token varchar(150) DEFAULT NULL,' . "\r\n\t\t" . ' authcode varchar(150) DEFAULT NULL,' . "\r\n\t\t" . ' expdate varchar(5) DEFAULT NULL,' . "\r\n\t\t" . ' threed varchar(255) DEFAULT NULL,' . "\r\n\t\t" . ' reason varchar(255) DEFAULT NULL,' . "\r\n\t\t" . ' period varchar(50) DEFAULT NULL,' . "\r\n\t\t" . ' status varchar(50) DEFAULT NULL,' . "\r\n\t\t" . ' trstamp datetime DEFAULT NULL,' . "\r\n\t\t" . ' total_cost varchar(50) DEFAULT NULL,' . "\r\n\t\t" . ' currency char(3) DEFAULT NULL,' . "\r\n\t\t" . ' order_state char(1) DEFAULT NULL,' . "\r\n\t\t" . ' sessionid varchar(50) DEFAULT NULL,' . "\r\n\t\t" . ' PRIMARY KEY (id))';
78 $wpdb->query($query);
79 echo "\t\t" . '<h3>';
80 _e('NBG HPS', 'nbghps-for-woocommerce2');
81.......................................................................
82........................................
83................