diff --git a/.github/workflows/artifact.yml b/.github/workflows/artifact.yml new file mode 100644 index 0000000..1c95eee --- /dev/null +++ b/.github/workflows/artifact.yml @@ -0,0 +1,27 @@ +on: [push, pull_request] + +name: Create Artifact + +jobs: + build: + name: Add Artifact + runs-on: ubuntu-20.04 + 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: Upload Artifact + id: upload_artifact + uses: actions/upload-artifact@v2 + with: + name: woocommerce-qenta-checkout-seamless + path: woocommerce-qenta-checkout-seamless diff --git a/woocommerce-qenta-checkout-seamless/assets/scripts/payment.js b/woocommerce-qenta-checkout-seamless/assets/scripts/payment.js index 1bd8772..6712c51 100644 --- a/woocommerce-qenta-checkout-seamless/assets/scripts/payment.js +++ b/woocommerce-qenta-checkout-seamless/assets/scripts/payment.js @@ -245,6 +245,20 @@ form.addEventListener('submit', (event) => { var paybox = document.getElementById('payment_method_wcs_PBX'); var giropay = document.getElementById('payment_method_wcs_GIROPAY'); + var pmArray = Array.from(document.querySelectorAll('input.input-radio.qcs_payment_method_list')); + if(pmArray.length == 1) { + pmArray[0].click(); + } + + var pmSelected = !!pmArray.filter(function (pm) { + return pm.checked; + }).length; + + if(pmSelected === false) { + event.preventDefault(); + return false; + } + if (document.woo_wcs_ok) { return true; } diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php index df2ba7b..18ffd2d 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-admin.php @@ -539,7 +539,7 @@ public function print_support_form() { */ public function create_support_request() { global $wp_version; - $postdata = array_map( 'sanitize_text_field', $_POST ); + $postdata = $this->get_post_data(); $message = "WordPress: " . $wp_version . "\n"; $message .= "WooCommerce: " . WC()->version . "\n"; 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 9df58bd..b3ab451 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-backend-operations.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-backend-operations.php @@ -89,7 +89,7 @@ public function __construct( $settings ) { public function refund( $order_id = 0, $amount = 0, $reason = '' ) { global $wpdb; - $params_post = array_map( 'sanitize_text_field', $_POST ); + $params_post = $this->get_post_data(); $order_id = $params_post['order_id']; $refund_amount = $params_post['refund_amount']; if ( $refund_amount <= 0 ) { @@ -507,7 +507,7 @@ public function depositreversal( $orderNumber, $paymentNumber ) { * @return array */ public function approvereversal( $orderNumber ) { - $params_post = array_map( 'sanitize_text_field', $_POST ); + $params_post = $this->get_post_data(); $response = $this->get_client()->approveReversal( $orderNumber ); $transaction = new WC_Gateway_Qenta_Checkout_Seamless_Transaction( $this->_settings ); diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php index f1fa248..ddd0440 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-config.php @@ -31,7 +31,7 @@ */ define( 'WOOCOMMERCE_GATEWAY_QMORE_NAME', 'QentaCheckoutSeamless' ); -define( 'WOOCOMMERCE_GATEWAY_QMORE_VERSION', '2.0.4' ); +define( 'WOOCOMMERCE_GATEWAY_QMORE_VERSION', '2.0.5' ); /** * Config class diff --git a/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php b/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php index ab7cf52..48d61b7 100644 --- a/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php +++ b/woocommerce-qenta-checkout-seamless/classes/class-qenta-gateway.php @@ -396,11 +396,19 @@ public function process_refund( $order_id, $amount = null, $reason = '' ) { * @return array */ public function process_payment( $order_id ) { - $params_post = array_map( 'sanitize_text_field', $_POST ); + $params_post = $this->get_post_data(); $order = wc_get_order( $order_id ); $payment_type = $params_post['wcs_payment_method']; + // payment_type woocommerce_wcs means no input was selected and the default value was sent + // this fails when instantiating $paymentClass + // we abort here and return a message to the consumer + if(strtolower($payment_type) === 'woocommerce_wcs'){ + wc_add_notice( esc_html(__( 'Please select a payment method!', 'woocommerce-qenta-checkout-seamless' )), 'error' ); + return; + } + $paymentClass = 'WC_Gateway_Qenta_Checkout_Seamless_'. str_replace('-', '_', ucfirst(strtolower($payment_type))); $paymentClass = new $paymentClass( $this->settings ); update_post_meta( $order_id, '_payment_method_title', $paymentClass->get_label()); @@ -641,7 +649,7 @@ public function create_return_url( $order, $payment_state ) { * @return string */ public function confirm_request() { - $params_post = array_map( 'sanitize_text_field', $_POST ); + $params_post = $this->get_post_data(); $params_request = array_map( 'sanitize_text_field', $_REQUEST ); $message = null; @@ -819,7 +827,7 @@ public function confirm_request() { */ private function create_payment_data() { $data = ''; - $params_post = array_map( 'sanitize_text_field', $_POST ); + $params_post = $this->get_post_data(); foreach ( $params_post as $key => $value ) { $data .= "$key:$value\n"; } @@ -998,7 +1006,7 @@ public function datastorage_return() { * @since 1.0.0 */ public function qenta_transaction_do_page() { - $params_post = array_map( 'sanitize_text_field', $_POST ); + $params_post = $this->get_post_data(); $params_request = array_map( 'sanitize_text_field', $_REQUEST ); echo "
"; diff --git a/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-de_DE.po b/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-de_DE.po index c99cba0..2dab55b 100644 --- a/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-de_DE.po +++ b/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-de_DE.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"Project-Id-Version: QentaCheckoutSeamless 2.0.4\n" +"Project-Id-Version: QentaCheckoutSeamless 2.0.5\n" "Report-Msgid-Bugs-To: https://github.com/qenta-cee/woocommerce-qcs/issues\n" "POT-Creation-Date: 2017-05-05 10:52+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-en_US.po b/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-en_US.po index 0dd4dcf..efef996 100644 --- a/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-en_US.po +++ b/woocommerce-qenta-checkout-seamless/languages/woocommerce-qenta-checkout-seamless-en_US.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"Project-Id-Version: QentaCheckoutSeamless 2.0.4\n" +"Project-Id-Version: QentaCheckoutSeamless 2.0.5\n" "Report-Msgid-Bugs-To: https://github.com/qenta-cee/woocommerce-qcs\n" "POT-Creation-Date: 2017-05-05 10:52+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" diff --git a/woocommerce-qenta-checkout-seamless/readme.txt b/woocommerce-qenta-checkout-seamless/readme.txt index f67b2fc..6c0e67c 100644 --- a/woocommerce-qenta-checkout-seamless/readme.txt +++ b/woocommerce-qenta-checkout-seamless/readme.txt @@ -1,9 +1,9 @@ === Qenta Checkout Seamless === Contributors: -Tags: ecommerce, e-commerce, sales, checkout, paypal, credit card, woocommerce, payment, gateway, visa, mastercard +Tags: visa, mastercard, sofort, paypal, credit card, klarna, eps, giropay, sepa, ecommerce, checkout, payment Requires at least: 5.5.1 -Tested up to: 5.8.2 -Stable tag: 2.0.4 +Tested up to: 5.8.3 +Stable tag: 2.0.5 License: GPLv2 License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -34,6 +34,8 @@ Qenta Checkout Seamless offers: * WordPress 5.5.1 * WooCommerce 5 += Manual Installation = + 1. Download woocommerce-qenta-checkout-seamless.zip from https://github.com/qenta-cee/woocommerce-qcs/releases 2. Remove any older Version of Qenta Checkout Seamless. Your settings will stay safe!. (Plugins → Qenta Checkout Seamless → Deactivate → Delete) 3. Upload the plugin (Plugins → Add New → Upload Plugin). Choose the downloaded .zip file and click Install Now. diff --git a/woocommerce-qenta-checkout-seamless/woocommerce-qenta-checkout-seamless.php b/woocommerce-qenta-checkout-seamless/woocommerce-qenta-checkout-seamless.php index 14cc394..c9df569 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.4 + * Version: 2.0.5 * Author: Qenta Payment CEE GmbH * Author URI: https://www.qenta-cee.at/ * License: GPL2