diff --git a/woocommerce-wirecard-checkout-seamless/classes/class-wirecard-admin.php b/woocommerce-wirecard-checkout-seamless/classes/class-wirecard-admin.php index c4ea0e8..47cc85f 100644 --- a/woocommerce-wirecard-checkout-seamless/classes/class-wirecard-admin.php +++ b/woocommerce-wirecard-checkout-seamless/classes/class-wirecard-admin.php @@ -35,6 +35,17 @@ */ class WC_Gateway_Wirecard_Checkout_Seamless_Admin { + protected $_settings; + + /** + * constructor + * + * @param $settings + */ + public function __construct( $settings ) { + $this->_settings = $settings; + } + /** * Handles form output for admin panel * @@ -52,7 +63,7 @@ function print_admin_form_fields( $gateway ){ - + @@ -190,7 +201,7 @@ function include_backend_header( $gateway ){ function print_transaction_table( $transaction, $start ) { ?> @@ -209,14 +220,14 @@ function print_transaction_table( $transaction, $start ) { 20 ){ ?> - + - + @@ -229,7 +240,7 @@ function setStartValue(data){ document.getElementById("wcs-transaction-start").setAttribute("href", start); } - + + + +

+
+ create_support_request(); + echo '
'; + } + ?> +
+ + + + + + + + + + + + + +
+
+
+ +
+ version . "\n"; + $message .= "PHP: " . phpversion() . "\n"; + $message .= "Pluginname: " . WOOCOMMERCE_GATEWAY_WCS_NAME . "\n"; + $message .= "Pluginversion: " . WOOCOMMERCE_GATEWAY_WCS_VERSION . "\n"; + $message .= "-----------------------------------------\n"; + $message .= "Message: \n" . strip_tags( $postdata['support-message'] ) . "\n"; + $message .= "-----------------------------------------\n"; + + foreach ( $this->get_settings_fields() as $group => $fields ) { + foreach ( $fields as $key => $field ) { + $message .= $field['title'] . ": "; + $message .= $this->_settings[ $key ] . "\n"; + } + } + + $send_to = $postdata['support-mail']; + $from = $postdata['customer-mail']; + $headers = 'From: <' . $from . '>'; + $subject = 'WooCommerce Support Request'; + + $send = wp_mail( $send_to, $subject, $message, $headers ); + ?> + +
+

+ + +

+
+ init_settings(); $this->_logger = new WC_Logger(); - $this->_admin = new WC_Gateway_Wirecard_Checkout_Seamless_Admin(); + $this->_admin = new WC_Gateway_Wirecard_Checkout_Seamless_Admin( $this->settings ); $this->_config = new WC_Gateway_Wirecard_Checkout_Seamless_Config( $this->settings ); $this->_transaction = new WC_Gateway_Wirecard_Checkout_Seamless_Transaction(); // if any of the payment types are enabled, set this to "yes", otherwise "no" $this->enabled = count( $this->get_enabled_payment_types( false ) ) > 0 ? "yes" : "no"; + $this->title = 'Wirecard Checkout Seamless'; add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( @@ -248,12 +249,14 @@ class="" type="checkbox" */ public function admin_options() { $this->_admin->include_backend_header( $this ); - if ( ! isset( $_GET['transaction_start'] ) ) { - $this->_admin->print_admin_form_fields( $this ); - } else { + + if ( isset( $_GET['transaction_start'] ) ) { $this->_admin->print_transaction_table( $this->_transaction, $_GET['transaction_start'] ); unset( $_GET['transaction_start'] ); } + else { + $this->_admin->print_admin_form_fields( $this ); + } } @@ -735,4 +738,14 @@ function datastorage_return() { die( require_once 'includes/datastorage_fallback.php' ); } + /** + * Opens the support request form + * + * @since 1.0.0 + */ + function do_support_request() { + $this->_admin->include_backend_header( $this ); + $this->_admin->print_support_form(); + } + } diff --git a/woocommerce-wirecard-checkout-seamless/woocommerce-wirecard-checkout-seamless.php b/woocommerce-wirecard-checkout-seamless/woocommerce-wirecard-checkout-seamless.php index 23b673a..13770df 100644 --- a/woocommerce-wirecard-checkout-seamless/woocommerce-wirecard-checkout-seamless.php +++ b/woocommerce-wirecard-checkout-seamless/woocommerce-wirecard-checkout-seamless.php @@ -59,6 +59,7 @@ ); add_action( 'plugins_loaded', 'init_woocommerce_wcs_gateway' ); +add_action( 'admin_menu', 'add_wirecard_support_request_page' ); /** * Intialize the Wirecard payment gateway @@ -134,3 +135,19 @@ function woocommerce_install_wirecard_checkout_seamless() { dbDelta( $sql ); } + +/** + * Add extra page for wirecard support request + * + * @since 1.0.0 + */ +function add_wirecard_support_request_page() { + add_submenu_page( + null, + __( 'Wirecard Support Request', 'woocommerce-wirecard-checkout-seamless' ), + __( 'Wirecard Support Request', 'woocommerce-wirecard-checkout-seamless' ), + 'manage_options', + 'wirecard_support_request', + array( new WC_Gateway_Wirecard_Checkout_Seamless(), 'do_support_request') + ); +}