Skip to content

Commit 8031385

Browse files
authored
Merge pull request #39 from marinsagovac/38-logs-of-undefined-array-key-request_method
feat: fix server logging and simply determined language
2 parents 687a40e + 46148e6 commit 8031385

File tree

4 files changed

+16
-25
lines changed

4 files changed

+16
-25
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Most recent latest changes is defined on every major, minor and bug fixes.
66

77
## Versions
88

9+
### 1.8.6
10+
11+
* bugfixing on undefined $_SERVER request method REQUEST_METHOD to clear logs
12+
* simply determine language code determine_language() function
13+
914
### 1.8.5
1015

1116
* fix redirection of t-com payway

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ Removed
4545

4646
Latest version:
4747

48-
* Version [1.8.5](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.8.5) November/2024
48+
* Version [1.8.6](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.8.6) December/2024
4949

5050
API 2.x.x:
5151

52+
* Version [1.8.6](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.8.6) December/2024
5253
* Version [1.8.5](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.8.5) November/2024
5354
* Version [1.8.3](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.8.3) November/2024
5455
* Version [1.8.1](https://github.com/marinsagovac/woocommerce-tcom-payway/releases/tag/1.8.1) February/2024

classes/class-wc-tpayway.php

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ public function generate_ipg_form($order_id)
261261
global $wpdb;
262262

263263
$order = wc_get_order($order_id);
264-
$productinfo = "Order $order_id";
264+
// $productinfo = "Order $order_id";
265265

266266
$currency_symbol = get_woocommerce_currency();
267267
$order_total = $order->get_total();
@@ -396,28 +396,11 @@ public function generate_ipg_form($order_id)
396396
private function determine_language($country_code)
397397
{
398398
$languages = array(
399-
'HR' => 'hr',
400-
'SR' => 'sr',
401-
'SL' => 'sl',
402-
'BS' => 'bs',
403-
'CG' => 'cg',
404-
'DE' => 'de',
405-
'IT' => 'it',
406-
'FR' => 'fr',
407-
'NL' => 'nl',
408-
'HU' => 'hu',
409-
'RU' => 'ru',
410-
'SK' => 'sk',
411-
'CZ' => 'cz',
412-
'PL' => 'pl',
413-
'PT' => 'pt',
414-
'ES' => 'es',
415-
'BG' => 'bg',
416-
'RO' => 'ro',
417-
'EL' => 'el',
399+
'HR', 'SR', 'SL', 'BS', 'CG', 'DE', 'IT', 'FR', 'NL', 'HU',
400+
'RU', 'SK', 'CZ', 'PL', 'PT', 'ES', 'BG', 'RO', 'EL',
418401
);
419402

420-
return isset($languages[$country_code]) ? $languages[$country_code] : 'en';
403+
return in_array($country_code, $languages) ? strtolower($country_code) : 'en';
421404
}
422405

423406
public function process_payment($order_id)
@@ -478,8 +461,10 @@ function get_response_codes($id)
478461

479462
function check_tcompayway_response()
480463
{
481-
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
482-
return;
464+
if (isset($_SERVER['REQUEST_METHOD'])) {
465+
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
466+
return;
467+
}
483468
}
484469

485470
if (!isset($_POST['ShoppingCartID'])) {

tcom-payway-woocommerce.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: WooCommerce PayWay Hrvatski Telekom payment gateway
44
* Plugin URI: https://github.com/marinsagovac/woocommerce-tcom-payway
55
* Description: WooCommerce PayWay Hrvatski Telekom payment gateway
6-
* Version: 1.8.5
6+
* Version: 1.8.6
77
* Licence: MIT
88
* License URI: https://opensource.org/licenses/MIT
99
* Author: Marin Šagovac

0 commit comments

Comments
 (0)