Skip to content

Commit

Permalink
Merge pull request #51 from appinlet/release/1.4.8
Browse files Browse the repository at this point in the history
= 1.4.8 - 2024-05-28 =
  • Loading branch information
appinlet authored May 28, 2024
2 parents b6108db + aa0e9f4 commit e1678f9
Show file tree
Hide file tree
Showing 9 changed files with 435 additions and 330 deletions.
10 changes: 7 additions & 3 deletions README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# PayWeb_WooCommerce
## PayGate WooCommerce plugin v1.4.7 for WooCommerce v8.3.1

This is the Paygate plugin for WooCommerce. Please feel free to contact the Payfast support team at [email protected] should you require any assistance.
## PayGate WooCommerce plugin v1.4.8 for WooCommerce v8.9.1

This is the Paygate plugin for WooCommerce. Please feel free to contact the Payfast support team at [email protected]
should you require any assistance.

## Installation

[![How To Setup PayGate PayWeb for WooCommerce](https://appinlet.com/wp-content/uploads/2021/01/How-To-Setup-PayGate-PayWeb-for-WooCommerce.jpg)](https://www.youtube.com/watch?v=MMcEG7FmoEM "How To Setup PayGate PayWeb for WooCommerce")

Please navigate to the [releases page](https://github.com/PayGate/PayWeb_WooCommerce/releases), download the latest release (v1.4.7) and unzip. You will them be able to follow the integration guide PDF which is included in the zip.
Please navigate to the [releases page](https://github.com/PayGate/PayWeb_WooCommerce/releases), download the latest
release (v1.4.8) and unzip. You will them be able to follow the integration guide PDF which is included in the zip.

## Collaboration

Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
*** Paygate for WooCommerce Changelog ***
= 1.4.8 - 2024-05-28 =
* Tested on WooCommerce 8.9.1, PHP 8.1 and WordPress 6.5.3.
* Fix payment types compatibility.

= 1.4.7 - 2023-11-22 =
* Tested on WooCommerce 8.3.1, PHP 8.0 and WordPress 6.4.1.
* Add support for HPOS and Blocks.
Expand Down
396 changes: 227 additions & 169 deletions classes/WC_Gateway_PayGate.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions classes/WC_Gateway_PayGate_Admin_Actions.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
/*
* Copyright (c) 2023 Payfast (Pty) Ltd
* Copyright (c) 2024 Payfast (Pty) Ltd
*
* Author: App Inlet (Pty) Ltd
*
* Released under the GNU General Public License
*/

if ( ! defined('ABSPATH')) {
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
}

Expand Down Expand Up @@ -78,12 +78,12 @@ public static function paygate_order_query_action($order)
$transactionStatus = $gwp->paywebQueryStatus($response);

if ((int)$transactionStatus === 1) {
if ( ! $order->has_status(self::PROCESSING) && ! $order->has_status(self::COMPLETED)) {
if (!$order->has_status(self::PROCESSING) && !$order->has_status(self::COMPLETED)) {
$order->payment_complete();
$responseText .= "<br>Order set to \"Processing\"";
}
} else {
if ( ! $order->has_status(self::FAILED)) {
if (!$order->has_status(self::FAILED)) {
$order->update_status(self::FAILED);
}
}
Expand Down
28 changes: 15 additions & 13 deletions classes/WC_Gateway_PayGate_Blocks_Support.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2023 Payfast (Pty) Ltd
* Copyright (c) 2024 Payfast (Pty) Ltd
*
* Author: App Inlet (Pty) Ltd
*
Expand Down Expand Up @@ -30,7 +30,7 @@ final class WC_Gateway_PayGate_Blocks_Support extends AbstractPaymentMethodType
*/
public function initialize()
{
$this->settings = get_option('woocommerce_paygate_settings', []);
$this->settings = get_option('woocommerce_paygate_settings', []);
$this->paygate_gateway = new WC_Gateway_PayGate();
}

Expand All @@ -42,7 +42,7 @@ public function initialize()
public function is_active()
{
$payment_gateways_class = WC()->payment_gateways();
$payment_gateways = $payment_gateways_class->payment_gateways();
$payment_gateways = $payment_gateways_class->payment_gateways();

return $payment_gateways['paygate']->is_available();
}
Expand All @@ -55,14 +55,14 @@ public function is_active()
public function get_payment_method_script_handles()
{
$parent_directory_path = dirname(__FILE__, 2);
$plugin_url = $this->paygate_gateway->get_plugin_url();
$indexJsPath = $plugin_url . '/assets/js/index.js';
$asset_path = $parent_directory_path . '/assets/js/index.asset.php';
$version = $this->paygate_gateway->version;
$dependencies = [];
$plugin_url = $this->paygate_gateway->get_plugin_url();
$indexJsPath = $plugin_url . '/assets/js/index.js';
$asset_path = $parent_directory_path . '/assets/js/index.asset.php';
$version = $this->paygate_gateway->version;
$dependencies = [];
if (file_exists($asset_path)) {
$asset = require $asset_path;
$version = is_array($asset) && isset($asset['version'])
$asset = require $asset_path;
$version = is_array($asset) && isset($asset['version'])
? $asset['version']
: $version;
$dependencies = is_array($asset) && isset($asset['dependencies'])
Expand All @@ -80,6 +80,7 @@ public function get_payment_method_script_handles()
'wc-paygate-blocks-integration',
'woocommerce'
);

return ['wc-paygate-blocks-integration'];
}

Expand All @@ -91,10 +92,10 @@ public function get_payment_method_script_handles()
public function get_payment_method_data()
{
return [
'title' => $this->get_setting('title'),
'title' => $this->get_setting('title'),
'description' => $this->get_setting('description'),
'supports' => $this->get_supported_features(),
'logo_url' => $this->paygate_gateway->get_plugin_url() . '/assets/images/PayGate_logo.svg',
'supports' => $this->get_supported_features(),
'logo_url' => $this->paygate_gateway->get_plugin_url() . '/assets/images/PayGate_logo.svg',
];
}

Expand All @@ -106,6 +107,7 @@ public function get_payment_method_data()
public function get_supported_features()
{
$payment_gateways = WC()->payment_gateways->payment_gateways();

return $payment_gateways['paygate']->supports;
}
}
10 changes: 5 additions & 5 deletions classes/WC_Gateway_PayGate_Cron.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (c) 2023 Payfast (Pty) Ltd
* Copyright (c) 2024 Payfast (Pty) Ltd
*
* Author: App Inlet (Pty) Ltd
*
Expand All @@ -9,7 +9,7 @@

class WC_Gateway_PayGate_Cron extends WC_Gateway_PayGate
{
const LOGGING = 'logging';
const LOGGING = 'logging';
const CUTOFF_MINUTES = 30;

public static function paygate_order_query_cron()
Expand Down Expand Up @@ -41,9 +41,9 @@ public static function paygate_order_query_cron_site()
$logger = wc_get_logger();
$logger->add('payweb-site-cron', 'Redirected to here');

$cutoffTime = new DateTime('now', new DateTimeZone('UTC'));
$cutoffTime = new DateTime('now', new DateTimeZone('UTC'));
$cutoffMinutes = self::CUTOFF_MINUTES;
$cutoff = $cutoffTime->sub(new DateInterval("P0DT0H{$cutoffMinutes}M"))->getTimestamp();
$cutoff = $cutoffTime->sub(new DateInterval("P0DT0H{$cutoffMinutes}M"))->getTimestamp();

// Load the settings
$settings = get_option('woocommerce_paygate_settings', false);
Expand All @@ -57,7 +57,7 @@ public static function paygate_order_query_cron_site()
$logging ? $logger->add('payweb-site-cron', 'Starting site cron job') : '';

$orders = wc_get_orders([
'post_status' => 'wc-pending',
'post_status' => 'wc-pending',
'date_created' => '<' . $cutoff,
]);
$logging ? $logger->add('payweb-site-cron', 'Orders: ' . serialize($orders)) : '';
Expand Down
Loading

0 comments on commit e1678f9

Please sign in to comment.