diff --git a/.env b/.env index 33fda83..2e46c27 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ WORDPRESS_HOST= NGROK_TOKEN= -PLUGIN_URL=https://github.com/qenta-cee/woocommerce-qcs.git +PLUGIN_URL= PLUGIN_VERSION= WORDPRESS_ADMIN_USER= WORDPRESS_ADMIN_PASS= diff --git a/.github/workflows/plugin-test.yml b/.github/workflows/plugin-test.yml index fa52338..e9a6269 100644 --- a/.github/workflows/plugin-test.yml +++ b/.github/workflows/plugin-test.yml @@ -9,13 +9,21 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer - name: Get Branch Name shell: bash run: echo "::set-output name=name::$(bash docker/branchname.sh)" id: branch - name: Start NGROK shell: bash - run: echo "::set-output name=host::$(timeout 1m bash docker/wordpress/ngrok.sh)" + run: | + NGROK_HOST=$(timeout 5m bash docker/wordpress/ngrok.sh) + echo "ngrok hostname: ${NGROK_HOST}" + echo "::set-output name=host::${NGROK_HOST}" id: ngrok env: NGROK_TOKEN: ${{ secrets.NGROK_TOKEN }} @@ -31,3 +39,14 @@ jobs: env: WP_URL: ${{ steps.ngrok.outputs.host }} run: curl https://${{ steps.ngrok.outputs.host }} + - name: Prepare Artifact + run: | + mkdir -p /tmp/artifact + cp -r woocommerce-qenta-checkout-seamless composer.* /tmp/artifact/ + cd /tmp/artifact && composer install && rm composer.* + - name: Upload Artifact + id: upload_artifact + uses: actions/upload-artifact@v2 + with: + name: woocommerce-qenta-checkout-seamless + path: /tmp/artifact diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ab7c329..358fd8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,6 +12,11 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + tools: composer - name: Install Dependencies run: composer install - name: Pack Release zip diff --git a/docker/wordpress/init.sh b/docker/wordpress/init.sh index ff109ff..bb13804 100644 --- a/docker/wordpress/init.sh +++ b/docker/wordpress/init.sh @@ -2,6 +2,8 @@ set -e +touch /tmp/shop.log + # If we are in Github plugin repo CI environment CI_REPO_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} if [[ ${CI_REPO_URL} == ${PLUGIN_URL//.git/} ]]; then @@ -80,16 +82,21 @@ function setup_store() { wp option set woocommerce_default_country "AT" wp_set_array woocommerce_onboarding_profile skipped 1 wp wc --user=admin tool run install_pages + wp option update page_on_front 5 + wp option update show_on_front page + wp option update blogdescription "QENTA Plugin DEMO" + wp theme install twentytwenty --activate + wp post delete 2 --force + wp post delete 1 --force } function print_info() { echo echo '####################################' echo - echo "URL: https://${WORDPRESS_URL}" - echo "Shop: https://${WORDPRESS_URL}/?post_type=product" - echo "Panel: https://${WORDPRESS_URL}/wp-admin/" - echo "Plugin Config: https://${WORDPRESS_URL}/wp-admin/admin.php?page=wc-settings&tab=checkout" + echo "Shop: https://${WORDPRESS_URL}" + echo "Admin Panel: https://${WORDPRESS_URL}/wp-admin/" + echo "Plugin Config: https://${WORDPRESS_URL}/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=woocommerce_wcs" echo "User: ${WORDPRESS_ADMIN_USER}" echo "Password: ${WORDPRESS_ADMIN_PASS}" echo diff --git a/docker/wordpress/ngrok.sh b/docker/wordpress/ngrok.sh index 01d24d4..0ab690f 100644 --- a/docker/wordpress/ngrok.sh +++ b/docker/wordpress/ngrok.sh @@ -1,15 +1,13 @@ #!/bin/bash -set -e - which ngrok >/dev/null if [[ $? == 0 ]]; then NGROK_BINARY="$(which ngrok)" else >&2 echo "Installing NGROK" cd ~/ - npm install ngrok - NGROK_BINARY="~/node_modules/ngrok/bin/ngrok" + npm install ngrok >&2 + NGROK_BINARY="./node_modules/ngrok/bin/ngrok" fi function get_ngrok_url() { diff --git a/woocommerce-qenta-checkout-seamless/assets/scripts/admin.js b/woocommerce-qenta-checkout-seamless/assets/scripts/admin.js index 6cce0cb..2f6c60a 100644 --- a/woocommerce-qenta-checkout-seamless/assets/scripts/admin.js +++ b/woocommerce-qenta-checkout-seamless/assets/scripts/admin.js @@ -46,4 +46,9 @@ wpOnload = function () { tabPane.className = tabPane.className + ' active'; }); } -} \ No newline at end of file +} + +function goToWctPage(page) { + start = "?page=qenta_transactions_page&transaction_start=" + page; + window.location.href = start; +} diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php index da2272d..df2ba7b 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php @@ -69,75 +69,73 @@ public function __construct( $settings ) { public function print_admin_form_fields( $gateway ) { ?>
generate_settings_html( $this->get_settings_fields( 'basicdata' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'basicdata' ), false ); ?>
- generate_settings_html( $this->get_settings_fields( 'options' ), +
generate_settings_html( $this->get_settings_fields( 'options' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'creditcardoptions' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'creditcardoptions' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'sepaoptions' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'sepaoptions' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'invoiceoptions' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'invoiceoptions' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'installmentoptions' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'installmentoptions' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'standardpayments' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'standardpayments' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'bankingpayments' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'bankingpayments' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'alternativepayments' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'alternativepayments' ), false ); ?>
generate_settings_html( $this->get_settings_fields( 'mobilepayments' ), + class="form-table">generate_settings_html( $this->get_settings_fields( 'mobilepayments' ), false ); ?>
@@ -170,39 +168,37 @@ public function get_settings_fields( $which = null ) { * @param $gateway */ public function include_backend_header( $gateway ) { + wp_enqueue_style('paymentCSS', esc_url_raw( WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/styles/admin.css" )); + wp_enqueue_script('adminJS', esc_url_raw( WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/scripts/admin.js" )); ?> - '> - -

method_title ) ) ? $gateway->method_title : __( 'Settings', - 'woocommerce-qenta-checkout-seamless' ); ?>

- +

method_title ) ) ? esc_html($gateway->method_title) : esc_html(__( 'Settings', + 'woocommerce-qenta-checkout-seamless' )); ?>

- -

+ +

-

+

-

+

@@ -220,13 +216,13 @@ public function include_backend_header( $gateway ) { public function print_transaction_table( $transaction, $page ) { echo '
-

' . __( 'Transaction overview', - 'woocommerce-qenta-checkout-seamless' ) . '

+

' . esc_html(__( 'Transaction overview', + 'woocommerce-qenta-checkout-seamless' )) . '

'; - $back = __( '< Back', 'woocommerce-qenta-checkout-seamless' ); - $next = __( 'Next >', 'woocommerce-qenta-checkout-seamless' ); + $back = esc_html(__( '< Back', 'woocommerce-qenta-checkout-seamless' )); + $next = esc_html(__( 'Next >', 'woocommerce-qenta-checkout-seamless' )); $pages = $transaction->get_rows( $page ); @@ -234,15 +230,15 @@ public function print_transaction_table( $transaction, $page ) { if ( $page > 1 ) { $prev_page = $page - 1; - echo "$back"; + echo "" . esc_html($back) . ""; } if ( $pages < 5 ) { for ( $i = 0; $i < $pages; $i ++ ) { $pagenr = $i + 1; $active = ( $pagenr == $page ) ? ' active' : ''; - $href = ( $pagenr == $page ) ? 'javascript:void(0)' : "?page=qenta_transactions_page&transaction_start=$pagenr"; - echo "$pagenr"; + $href = ( $pagenr == $page ) ? 'javascript:void(0)' : "?page=qenta_transactions_page&transaction_start=" . esc_html($pagenr); + echo "" . esc_html($pagenr) . ""; } } @@ -259,26 +255,14 @@ public function print_transaction_table( $transaction, $page ) { } for ( $i = $start; $i < $stop + 1; $i ++ ) { $selected = ( $i == $page ) ? "selected='selected'" : ''; - echo ""; + echo ""; } echo ""; - ?> - - - - - $next"; + echo "$next"; } ?> @@ -299,37 +283,37 @@ public function print_transaction_details( $data ) { echo "

"; echo '
-

' . __( 'Transaction details', - 'woocommerce-qenta-checkout-seamless' ) . '

+

' . esc_html(__( 'Transaction details', + 'woocommerce-qenta-checkout-seamless' )) . '

- - + + - - + + - - + + - - + + - - + + - - + + - - + +
' . __( 'Order', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->id_order . '' . esc_html(__( 'Order', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->id_order) . '
' . __( 'Payment method', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->payment_method . '' . esc_html(__( 'Payment method', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->payment_method) . '
' . __( 'Payment state', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->payment_state . '' . esc_html(__( 'Payment state', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->payment_state) . '
' . __( 'Amount', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->amount . '' . esc_html(__( 'Amount', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->amount) . '
' . __( 'Currency', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->currency . '' . esc_html(__( 'Currency', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->currency) . '
' . __( 'Gateway reference number', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->gateway_reference . '' . esc_html(__( 'Gateway reference number', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->gateway_reference) . '
' . __( 'Qenta order number', 'woocommerce-qenta-checkout-seamless' ) . '' . $data->order_number . '' . esc_html(__( 'Qenta order number', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html($data->order_number) . '
@@ -337,38 +321,38 @@ public function print_transaction_details( $data ) { if ( $data->order_details ) { echo '
-

' . __( 'Qenta order details', - 'woocommerce-qenta-checkout-seamless' ) . '

+

' . esc_html(__( 'Qenta order details', + 'woocommerce-qenta-checkout-seamless' )) . '

'; foreach ( $data->order_details as $key => $value ) { - echo ""; + echo ""; } echo '
$key$value
" . esc_html($key) . "" . esc_html($value) . "
'; } echo '
-

' . __( 'Payments', 'woocommerce-qenta-checkout-seamless' ) . '

+

' . esc_html(__( 'Payments', 'woocommerce-qenta-checkout-seamless' )) . '

- - - - - - - - + + + + + + + + '; if ( count( $data->payments ) == 0 ) { echo ""; } @@ -376,20 +360,20 @@ public function print_transaction_details( $data ) { foreach ( $data->payments as $payment ) { $payment = $payment->getData(); - echo " - - - - - - + echo " + + + + + + "; foreach ( $this->_fields_list as $field_key => $field_value ) { echo ""; } echo ""; @@ -265,13 +265,13 @@ public function get_rows( $page = 1 ) { foreach ( $this->_fields_list as $field_key => $field_value ) { echo ""; } - echo ""; } diff --git a/woocommerce-qenta-checkout-seamless/classes/includes/datastorage_fallback.php b/woocommerce-qenta-checkout-seamless/classes/includes/datastorage_fallback.php index 76d2301..882f427 100644 --- a/woocommerce-qenta-checkout-seamless/classes/includes/datastorage_fallback.php +++ b/woocommerce-qenta-checkout-seamless/classes/includes/datastorage_fallback.php @@ -29,23 +29,26 @@ * By installing the plugin into the shop system the customer agrees to these terms of use. * Please do not use the plugin if you do not agree to these terms of use! */ -$response = isset( $_POST['response'] ) ? $_POST['response'] : ''; - +$response = isset( $_POST['response'] ) ? sanitize_text_field($_POST['response']) : ''; +// arguments for wp_register_script to allow a no-dependency inline script and add it to the header +wp_register_script( 'setResponseJS', '' ); +$jsSetReponse = << - - + - \ No newline at end of file + diff --git a/woocommerce-qenta-checkout-seamless/classes/includes/form_fields.php b/woocommerce-qenta-checkout-seamless/classes/includes/form_fields.php index 5e8b64f..434dde9 100644 --- a/woocommerce-qenta-checkout-seamless/classes/includes/form_fields.php +++ b/woocommerce-qenta-checkout-seamless/classes/includes/form_fields.php @@ -48,7 +48,7 @@ 'woo_wcs_configuration' => array( 'title' => __( 'Configuration', 'woocommerce-qenta-checkout-seamless' ), 'type' => 'select', - 'default' => 'production', + 'default' => 'demo', 'description' => __( 'For integration, select predefined configuration settings or \'Production\' for live systems ', 'woocommerce-qenta-checkout-seamless' @@ -56,7 +56,6 @@ 'options' => array( 'production' => __( 'Production', 'woocommerce-qenta-checkout-seamless' ), 'demo' => __( 'Demo', 'woocommerce-qenta-checkout-seamless' ), - 'test' => __( 'Test', 'woocommerce-qenta-checkout-seamless' ), 'test3d' => __( 'Test 3D', 'woocommerce-qenta-checkout-seamless' ) ) ), @@ -130,6 +129,7 @@ 'Forwarding basket data to the respective financial service provider. ', 'woocommerce-qenta-checkout-seamless' ), + 'default' => 1, 'type' => 'switch' ), 'woo_wcs_notificationemail' => array( @@ -220,6 +220,7 @@ ), 'woo_wcs_cc_display_exp_date_field' => array( 'type' => 'switch', + 'default' => 1, 'title' => __( 'Display expiration date field', 'woocommerce-qenta-checkout-seamless' ), 'description' => __( 'Display input field to enter the expiration date in your credit card form during the checkout process.', 'woocommerce-qenta-checkout-seamless' ) @@ -345,6 +346,7 @@ 'standardpayments' => array( 'wcs_ccard_enable' => array( 'title' => __( 'Credit Card', 'woocommerce-qenta-checkout-seamless' ), + 'default' => 1, 'type' => 'switch' ), 'wcs_ccard-moto_enable' => array( @@ -389,33 +391,9 @@ 'title' => __( 'giropay', 'woocommerce-qenta-checkout-seamless' ), 'type' => 'switch' ), - 'wcs_tatrapay_enable' => array( - 'title' => __( 'TatraPay', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), - 'wcs_trustpay_enable' => array( - 'title' => __( 'TrustPay', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), - 'wcs_bancontact_mistercash_enable' => array( - 'title' => __( 'Bancontact', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), - 'wcs_poli_enable' => array( - 'title' => __( 'POLi', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), 'wcs_przelewy24_enable' => array( 'title' => __( 'Przelewy24', 'woocommerce-qenta-checkout-seamless' ), 'type' => 'switch' - ), - 'wcs_ekonto_enable' => array( - 'title' => __( 'eKonto', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), - 'wcs_trustly_enable' => array( - 'title' => __( 'Trustly', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' ) ), 'alternativepayments' => array( @@ -423,27 +401,9 @@ 'title' => __( 'paysafecard', 'woocommerce-qenta-checkout-seamless' ), 'type' => 'switch' ), - 'wcs_epay_bg_enable' => array( - 'title' => __( 'ePay.bg', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), 'wcs_installment_enable' => array( 'title' => __( 'Installment', 'woocommerce-qenta-checkout-seamless' ), 'type' => 'switch' - ), - 'wcs_moneta_enable' => array( - 'title' => __( 'moneta.ru', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ), - 'wcs_skrillwallet_enable' => array( - 'title' => __( 'Skrill Digital Wallet', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' - ) - ), - 'mobilepayments' => array( - 'wcs_pbx_enable' => array( - 'title' => __( 'paybox', 'woocommerce-qenta-checkout-seamless' ), - 'type' => 'switch' ) ) ); diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-bancontact_mistercash.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-bancontact_mistercash.php index d2e65f6..6f28b16 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-bancontact_mistercash.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-bancontact_mistercash.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/Bancontact_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/Bancontact_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ccard.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ccard.php index ea2a2d3..d0f5f3a 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ccard.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ccard.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . "assets/images/cc_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/images/cc_h32.png"; } /** @@ -114,8 +114,7 @@ public function get_payment_fields( $storage_id ) { return $html; } else { - $html .= ' - '; + '; + wp_register_script( 'parse' . $payment_type . 'JS', '', [], '', true ); + wp_enqueue_script( 'parse' . $payment_type . 'JS' ); + wp_add_inline_script( 'parse' . $payment_type . 'JS', $jsParse ); if ( $this->_settings['woo_wcs_cc_display_cardholder_field'] ) { $html .= "

"; $html .= ""; diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ekonto.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ekonto.php index c4b7b78..019efdd 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ekonto.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-ekonto.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/Ekonto_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/Ekonto_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-epay_bg.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-epay_bg.php index bb00325..1e4438f 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-epay_bg.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-epay_bg.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/ePay_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/ePay_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-eps.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-eps.php index 82267a0..c3dce87 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-eps.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-eps.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/eps-Ueberweisung_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/eps-Ueberweisung_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-giropay.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-giropay.php index 4277aee..1f08de0 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-giropay.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-giropay.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . "assets/images/giropay_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/images/giropay_h32.png"; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-idl.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-idl.php index d53434d..6fd34f3 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-idl.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-idl.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/iDEAL_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/iDEAL_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-installment.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-installment.php index 7e9fb71..64a4748 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-installment.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-installment.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . "assets/images/Installments_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/images/Installments_h32.png"; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoice.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoice.php index abd65bd..43ece38 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoice.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoice.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . "assets/images/Invoice_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/images/Invoice_h32.png"; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoiceb2b.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoiceb2b.php index d0d9a78..15e4a00 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoiceb2b.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-invoiceb2b.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . "assets/images/Invoice_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/images/Invoice_h32.png"; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-maestro.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-maestro.php index 58d42ee..b4d14b3 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-maestro.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-maestro.php @@ -73,7 +73,7 @@ public function get_payment_type() { * @return array */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/Maestro_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/Maestro_h32.png'; } } diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-moneta.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-moneta.php index 7392b8d..88c4b70 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-moneta.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-moneta.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/moneta-ru_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/moneta-ru_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-paypal.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-paypal.php index e6e9ead..fe1ea87 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-paypal.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-paypal.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL."assets/images/paypal_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL."assets/images/paypal_h32.png"; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-pbx.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-pbx.php index 5470905..dbc2100 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-pbx.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-pbx.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/paybox_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/paybox_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-poli.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-poli.php index e92ac14..35cb450 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-poli.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-poli.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/POLi_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/POLi_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-przelewy24.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-przelewy24.php index d3c08f7..b5f33f9 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-przelewy24.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-przelewy24.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/p24_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/p24_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-psc.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-psc.php index 59719ee..de7f9b5 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-psc.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-psc.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/paysafecard_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/paysafecard_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sepa_dd.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sepa_dd.php index e8aa175..bb80b16 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sepa_dd.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sepa_dd.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . "assets/images/SEPA_h32.png"; + return WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/images/SEPA_h32.png"; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-skrillwallet.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-skrillwallet.php index e31fd81..774382f 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-skrillwallet.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-skrillwallet.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/Skrill_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/Skrill_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sofortueberweisung.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sofortueberweisung.php index 7f72591..3d6bdf6 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sofortueberweisung.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-sofortueberweisung.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . __( 'assets/images/sofort_h32.png', + return WOOCOMMERCE_GATEWAY_QMORE_URL . __( 'assets/images/sofort_h32.png', 'woocommerce-qenta-checkout-seamless' ); } diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-tatrapay.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-tatrapay.php index b73709c..f480e8d 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-tatrapay.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-tatrapay.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/TatraPay_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/TatraPay_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustly.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustly.php index b857ce7..d19b4e5 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustly.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustly.php @@ -80,7 +80,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/Trustly_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/Trustly_h32.png'; } /** diff --git a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustpay.php b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustpay.php index 2ab3a76..e13d867 100644 --- a/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustpay.php +++ b/woocommerce-qenta-checkout-seamless/classes/payment-methods/class-qenta-trustpay.php @@ -90,7 +90,7 @@ public function get_label() { * @return string */ public function get_icon() { - return WOOCOMMERCE_GATEWAY_WCS_URL . 'assets/images/TrustPay_h32.png'; + return WOOCOMMERCE_GATEWAY_QMORE_URL . 'assets/images/TrustPay_h32.png'; } /** @@ -121,7 +121,7 @@ public function get_payment_fields() { try { $backend_client = new QentaCEE\QMore\BackendClient( $config_array ); } catch ( QentaCEE\QMore\Exception\InvalidArgumentException $e ) { - $this->_logger->error( __METHOD__ . ':' . print_r( $e, true ) ); + $this->_logger->error( __METHOD__ . ':' . print_r( esc_html( $e ), true ) ); return __( 'This payment method is not available. Please contact the administrator.', 'woocommerce-qenta-checkout-seamless' ); @@ -132,7 +132,7 @@ public function get_payment_fields() { $response = $backend_client->getFinancialInstitutions( 'TRUSTPAY' ); } catch ( Exception $e ) { - $this->_logger->error( __METHOD__ . ':' . print_r( $e, true ) ); + $this->_logger->error( __METHOD__ . ':' . print_r( esc_html( $e ), true ) ); return __( 'This payment method is not available. Please contact the administrator.', 'woocommerce-qenta-checkout-seamless' ); @@ -145,17 +145,17 @@ public function get_payment_fields() { return strcmp( $a['id'], $b['id'] ); } ); } else { - $this->_logger->error( __METHOD__ . ':' . print_r( $response->getErrors(), true ) ); + $this->_logger->error( __METHOD__ . ':' . print_r( esc_html( $response->getErrors() ), true ) ); } $html = '

'; // dropdown for financial institution $html .= "

"; - $html .= ""; + $html .= ""; $html .= " $v ) { @@ -48,12 +51,5 @@ } ?> - - \ No newline at end of file + diff --git a/woocommerce-qenta-checkout-seamless/woocommerce-qenta-checkout-seamless.php b/woocommerce-qenta-checkout-seamless/woocommerce-qenta-checkout-seamless.php index 1a624d8..803ac65 100644 --- a/woocommerce-qenta-checkout-seamless/woocommerce-qenta-checkout-seamless.php +++ b/woocommerce-qenta-checkout-seamless/woocommerce-qenta-checkout-seamless.php @@ -3,7 +3,7 @@ * Plugin Name: Qenta Checkout Seamless * Plugin URI: https://github.com/qenta-cee/woocommerce-qcs * Description: Qenta Checkout Seamless plugin for WooCommerce - * Version: 2.0.2 + * Version: 2.0.3 * Author: Qenta Payment CEE GmbH * Author URI: https://www.qenta-cee.at/ * License: GPL2 @@ -45,8 +45,8 @@ } -define( 'WOOCOMMERCE_GATEWAY_WCS_BASEDIR', plugin_dir_path( __FILE__ ) ); -define( 'WOOCOMMERCE_GATEWAY_WCS_URL', plugin_dir_url( __FILE__ ) ); +define( 'WOOCOMMERCE_GATEWAY_QMORE_BASEDIR', plugin_dir_path( __FILE__ ) ); +define( 'WOOCOMMERCE_GATEWAY_QMORE_URL', plugin_dir_url( __FILE__ ) ); register_activation_hook( __FILE__, 'woocommerce_install_qenta_checkout_seamless' ); @@ -72,15 +72,15 @@ function init_woocommerce_wcs_gateway() { return; } - require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-gateway.php' ); - require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'vendor/autoload.php' ); + require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-gateway.php' ); + require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'vendor/autoload.php' ); spl_autoload_register( function ( $class_name ) { if ( strpos( $class_name, "Qenta_Checkout_Seamless" ) ) { $method = str_replace( "WC_Gateway_Qenta_Checkout_Seamless_", "", $class_name ); - if ( file_exists( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/payment-methods/class-qenta-' . strtolower( $method ) . ".php" ) ) { - require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/payment-methods/class-qenta-' . strtolower( $method ) . ".php" ); + if ( file_exists( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/payment-methods/class-qenta-' . strtolower( $method ) . ".php" ) ) { + require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/payment-methods/class-qenta-' . strtolower( $method ) . ".php" ); } } } ); @@ -157,7 +157,7 @@ function qenta_transactions_add_page() { $parent_slug = 'options-general.php'; } - require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-gateway.php' ); + require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-gateway.php' ); $gateway = new WC_Gateway_Qenta_Checkout_Seamless(); @@ -188,7 +188,7 @@ function qenta_transactions_add_page() { * @since 1.0.0 */ function add_qenta_support_request_page() { - require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-gateway.php' ); + require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-gateway.php' ); add_submenu_page( null, @@ -206,7 +206,7 @@ function add_qenta_support_request_page() { * @since 1.0.0 */ function init_config_values() { - require_once WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/includes/form_fields.php'; + require_once WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/includes/form_fields.php'; $settings = array(); @@ -222,18 +222,20 @@ function init_config_values() { } function add_qenta_storage_check() { - ?> - -

' . __( 'Number', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Date', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Gateway reference', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Payment state', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Approved', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Deposited', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Currency', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Operations', 'woocommerce-qenta-checkout-seamless' ) . '' . esc_html(__( 'Number', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Date', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Gateway reference', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Payment state', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Approved', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Deposited', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Currency', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Operations', 'woocommerce-qenta-checkout-seamless' )) . '

- " . __( 'No payments available', 'woocommerce-qenta-checkout-seamless' ) . " + " . esc_html(__( 'No payments available', 'woocommerce-qenta-checkout-seamless' )) . "
{$payment['paymentNumber']}{$payment['timeCreated']}{$payment['gatewayReferenceNumber']}{$payment['state']}{$payment['approveAmount']}{$payment['depositAmount']}{$payment['currency']}" . esc_html($payment['paymentNumber']) . "" . esc_html($payment['timeCreated']) . "" . esc_html($payment['gatewayReferenceNumber']) ."" . esc_html($payment['state']) . "" . esc_html($payment['approveAmount']) . "" . esc_html($payment['depositAmount']) . "" . esc_html($payment['currency']) . "
"; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; // suppres notices for transferFund transactions, otherwise no notices are raised $operations_allowed = explode( ",", @$payment['operationsAllowed'] ); @@ -406,13 +390,13 @@ public function print_transaction_details( $data ) { echo "
"; if ( $brand == 'Invoice' ) { - echo ""; + echo ""; } elseif ( $operation == 'DEPOSIT' or $operation == 'REFUND' ) { echo ""; } - echo ""; + echo ""; echo "
"; } @@ -426,24 +410,24 @@ public function print_transaction_details( $data ) { // credits echo '
-

' . __( 'Credits', 'woocommerce-qenta-checkout-seamless' ) . '

+

' . esc_html(__( 'Credits', 'woocommerce-qenta-checkout-seamless' )) . '

- - - - - - - + + + + + + + '; if ( count( $data->credits ) == 0 ) { echo ""; } @@ -451,25 +435,25 @@ public function print_transaction_details( $data ) { foreach ( $data->credits as $credit ) { $credit = $credit->getData(); - echo " - - - - - + echo " + + + + + @@ -493,7 +477,7 @@ public function print_support_form() {

- +

@@ -510,13 +494,13 @@ public function print_support_form() {
@@ -524,7 +508,7 @@ public function print_support_form() { @@ -532,7 +516,7 @@ public function print_support_form() { @@ -540,7 +524,7 @@ public function print_support_form() {
' . __( 'Number', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Date', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Gateway reference', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Credit state', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Amount', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Currency', 'woocommerce-qenta-checkout-seamless' ) . '' . __( 'Operations', 'woocommerce-qenta-checkout-seamless' ) . '' . esc_html(__( 'Number', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Date', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Gateway reference', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Credit state', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Amount', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Currency', 'woocommerce-qenta-checkout-seamless' )) . '' . esc_html(__( 'Operations', 'woocommerce-qenta-checkout-seamless' )) . '

- " . __( 'No credits available', 'woocommerce-qenta-checkout-seamless' ) . " + " . esc_html(__( 'No credits available', 'woocommerce-qenta-checkout-seamless' )) . "
{$credit['creditNumber']}{$credit['timeCreated']}{$credit['gatewayReferenceNumber']}{$credit['state']}{$credit['amount']}{$credit['currency']}" . esc_html($credit['creditNumber']) . "" . esc_html($credit['timeCreated']) . "" . esc_html($credit['gatewayReferenceNumber']) . "" . esc_html($credit['state']) . "" . esc_html($credit['amount']) . "" . esc_html($credit['currency']) . " "; - echo ""; - echo ""; - echo ""; - echo ""; - echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; foreach ( explode( ",", $credit['operationsAllowed'] ) as $operation ) { if ( empty( $operation ) ) { continue; } - echo ""; + echo ""; } echo "

+ value=""/>
@@ -555,13 +539,13 @@ public function print_support_form() { */ public function create_support_request() { global $wp_version; - $postdata = $_POST; + $postdata = array_map( 'sanitize_text_field', $_POST ); $message = "WordPress: " . $wp_version . "\n"; $message .= "WooCommerce: " . WC()->version . "\n"; $message .= "PHP: " . phpversion() . "\n"; - $message .= "Pluginname: " . WOOCOMMERCE_GATEWAY_WCS_NAME . "\n"; - $message .= "Pluginversion: " . WOOCOMMERCE_GATEWAY_WCS_VERSION . "\n"; + $message .= "Pluginname: " . WOOCOMMERCE_GATEWAY_QMORE_NAME . "\n"; + $message .= "Pluginversion: " . WOOCOMMERCE_GATEWAY_QMORE_VERSION . "\n"; $message .= "-----------------------------------------\n"; $message .= "Message: \n" . strip_tags( $postdata['support-message'] ) . "\n"; $message .= "-----------------------------------------\n"; @@ -579,7 +563,7 @@ public function create_support_request() { } $send_to = $postdata['support-mail']; $from = $postdata['customer-mail']; - $headers = 'From: <' . $from . '>'; + $headers = 'From: <' . sanitize_email($from) . '>'; $subject = 'WooCommerce Support Request'; @@ -587,7 +571,7 @@ public function create_support_request() { add_settings_error( '', '', __( 'Your e-mail address must not be empty.', 'woocommerce-qenta-checkout-seamless' ), 'error' ); } else { - $send = wp_mail( $send_to, $subject, $message, $headers ); + $send = wp_mail( sanitize_email($send_to), esc_html($subject), esc_html($message), $headers ); if ( $send ) { add_settings_error( '', '', diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-backend-operations.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-backend-operations.php index 07aa2ff..9df58bd 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-backend-operations.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-backend-operations.php @@ -89,16 +89,17 @@ public function __construct( $settings ) { public function refund( $order_id = 0, $amount = 0, $reason = '' ) { global $wpdb; - $order_id = $_POST['order_id']; - $refund_amount = $_POST['refund_amount']; + $params_post = array_map( 'sanitize_text_field', $_POST ); + $order_id = $params_post['order_id']; + $refund_amount = $params_post['refund_amount']; if ( $refund_amount <= 0 ) { - $this->_logger->error( __( 'Refund amount must be greater than zero.', 'woocommerce-qenta-checkout-seamless' ) ); + $this->_logger->error( esc_html( __( 'Refund amount must be greater than zero.', 'woocommerce-qenta-checkout-seamless' ) ) ); return false; } - $line_item_qtys = json_decode( str_replace( '\\', "", $_POST['line_item_qtys'] ) ); - $line_item_totals = (array) json_decode( str_replace( '\\', "", $_POST['line_item_totals'] ) ); + $line_item_qtys = json_decode( str_replace( '\\', "", $params_post['line_item_qtys'] ) ); + $line_item_totals = (array) json_decode( str_replace( '\\', "", $params_post['line_item_totals'] ) ); $refund_items = array(); $total_items = 0; @@ -331,7 +332,7 @@ private function logResponseErrors( $method, $errors ) { foreach ( $errors as $error ) { $_errors[] = $error->getConsumerMessage(); } - $this->_logger->error( "$method : processing refund failed with error(s): " . join( '|', $_errors ) ); + $this->_logger->error( esc_html( "$method : processing refund failed with error(s): " . join( '|', $_errors ) ) ); } /** @@ -358,7 +359,7 @@ public function transfer_fund_refund( $amount, $currency, $order_number, $woocom $refundable_sum = $wpdb->get_row( $refundable_sum ); if ( $refundable_sum !== null && $amount > $refundable_sum->sum ) { - $this->_logger->error( __METHOD__ . ":" . __( 'The refunded amount must be less than deposited amount.', 'woocommerce-qenta-checkout-seamless' ) ); + $this->_logger->error( __METHOD__ . ":" . esc_html( __( 'The refunded amount must be less than deposited amount.', 'woocommerce-qenta-checkout-seamless' ) ) ); return false; } @@ -506,6 +507,7 @@ public function depositreversal( $orderNumber, $paymentNumber ) { * @return array */ public function approvereversal( $orderNumber ) { + $params_post = array_map( 'sanitize_text_field', $_POST ); $response = $this->get_client()->approveReversal( $orderNumber ); $transaction = new WC_Gateway_Qenta_Checkout_Seamless_Transaction( $this->_settings ); @@ -518,8 +520,8 @@ public function approvereversal( $orderNumber ) { return array( 'type' => 'error', 'message' => join( "
", $errors ) ); } else { - if( isset($_POST['id_tx'])){ - $transaction->update( array( 'payment_state' => 'CANCELED BY ADMIN' ), array( 'id_tx' => $_POST['id_tx'] ) ); + if( isset($params_post['id_tx'])){ + $transaction->update( array( 'payment_state' => 'CANCELED BY ADMIN' ), array( 'id_tx' => $params_post['id_tx'] ) ); } return array( 'type' => 'updated', 'message' => __( 'APPROVEREVERSAL', 'woocommerce-qenta-checkout-seamless' ) ); } diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php index 3d5915a..279f03d 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php @@ -30,8 +30,8 @@ * Please do not use the plugin if you do not agree to these terms of use! */ -define( 'WOOCOMMERCE_GATEWAY_WCS_NAME', 'QentaCheckoutSeamless' ); -define( 'WOOCOMMERCE_GATEWAY_WCS_VERSION', '2.0.2' ); +define( 'WOOCOMMERCE_GATEWAY_QMORE_NAME', 'QentaCheckoutSeamless' ); +define( 'WOOCOMMERCE_GATEWAY_QMORE_VERSION', '2.0.3' ); /** * Config class @@ -205,8 +205,8 @@ public function get_plugin_version() { return QentaCEE\QMore\FrontendClient::generatePluginVersion( 'woocommerce', WC()->version, - WOOCOMMERCE_GATEWAY_WCS_NAME, - WOOCOMMERCE_GATEWAY_WCS_VERSION + WOOCOMMERCE_GATEWAY_QMORE_NAME, + WOOCOMMERCE_GATEWAY_QMORE_VERSION ); } diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php index 739a058..aec1cb4 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php @@ -30,11 +30,11 @@ * Please do not use the plugin if you do not agree to these terms of use! */ -require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-admin.php' ); -require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-config.php' ); -require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-datastorage.php' ); -require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-transaction.php' ); -require_once( WOOCOMMERCE_GATEWAY_WCS_BASEDIR . 'classes/class-qenta-backend-operations.php' ); +require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-admin.php' ); +require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-config.php' ); +require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-datastorage.php' ); +require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-transaction.php' ); +require_once( WOOCOMMERCE_GATEWAY_QMORE_BASEDIR . 'classes/class-qenta-backend-operations.php' ); /** * Basic gateway class @@ -269,12 +269,11 @@ public function generate_switch_html( $key, $data ) {
get_description_html( $data ); ?> @@ -313,25 +312,6 @@ public function payment_fields() { WC()->session->set( 'consumerDeviceId', $consumerDeviceId ); } - - if( ($this->settings['wcs_invoice_enable'] == "1" && $this->settings['woo_wcs_invoiceprovider'] == "ratepay") || - ($this->settings['wcs_installment_enable'] == "1" && $this->settings['woo_wcs_installmentprovider'] == "ratepay") ) - { - echo " - - - - - - - "; - } - - try { $response = $dataStorage->init(); @@ -342,41 +322,44 @@ public function payment_fields() { ?> - - - - + getJavascriptUrl() )); + wp_add_inline_script('javascriptUrlJS', $jsChangeWCSPayment, 'before'); + wp_enqueue_script('paymentJS', esc_url_raw( WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/scripts/payment.js" ), ['javascriptUrlJS']); + wp_enqueue_style('paymentCSS', esc_url_raw( WOOCOMMERCE_GATEWAY_QMORE_URL . "assets/styles/payment.css" )); + ?> get_enabled_payment_types() as $type ) { ?> - +
  • -
  • "; - echo $field_value['title']; + echo esc_html($field_value['title']); echo "
    "; if ( key_exists( $field_key, $row ) ) { - echo $row[ $field_key ]; + echo esc_html($row[ $field_key ]); } echo ""; - echo __( 'View', 'woocommerce-qenta-checkout-seamless' ); + echo ""; + echo esc_html(__( 'View', 'woocommerce-qenta-checkout-seamless' )); echo "