Skip to content

Commit

Permalink
SBUG-59+60 (#86)
Browse files Browse the repository at this point in the history
**Fixes**
- Order validation failed if consumer entered certain characters instead of correct cardholder values
- WooCommerce log files showed an error when a customer submitted an order without selecting any payment method

**Internal**
- Add CI workflow that creates installable development snapshot plugin packages for every commit and PR
  • Loading branch information
HMKnapp authored Jan 21, 2022
1 parent 20b1322 commit ecace6e
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 14 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/artifact.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions woocommerce-qenta-checkout-seamless/assets/scripts/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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";
}
Expand Down Expand Up @@ -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 "<div class='wrap'>";

Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
8 changes: 5 additions & 3 deletions woocommerce-qenta-checkout-seamless/readme.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ecace6e

Please sign in to comment.