Plugin Directory

Changeset 2953032


Ignore:
Timestamp:
08/14/2023 06:23:16 AM (3 years ago)
Author:
tomlister
Message:

Compatibility with wordpress 6.3

Location:
payflex-payment-gateway/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • payflex-payment-gateway/trunk/partpay.php

    r2934945 r2953032  
    33Plugin Name: Payflex Payment Gateway
    44Description: Use Payflex as a credit card processor for WooCommerce.
    5 Version: 2.4.7
     5Version: 2.4.8
    66Author: Payflex
    77*/
     
    4747        class WC_Gateway_PartPay extends WC_Payment_Gateway
    4848        {
    49 
     49            protected array $environments = [];
     50            protected string $configurationUrl = '';
     51            protected string $orderurl = '';
    5052            /**
    5153             * @var $_instance WC_Gateway_PartPay The reference to the singleton instance of this class
     
    926928                $responsecode = isset($refund_response['response']['code']) ? intval($refund_response['response']['code']) : 0;
    927929
    928                 if ($responsecode == 201 || $responsecode == 200)
    929                 {
     930                if ($responsecode == 201 || $responsecode == 200) {
    930931                    $order->add_order_note(sprintf(__('Refund of $%s successfully sent to PayFlex.', 'woo_partpay') , $amount));
    931932                    return true;
    932                 }
    933                 else
    934                 {
    935                     if ($responsecode == 404)
    936                     {
     933                } else if($responsecode === 400 && $refund_body->errorCode==='MRM007') {
     934                    $error_message = $refund_body->message;
     935                    $order->add_order_note(sprintf(__($error_message), 'woo_partpay'));
     936                    $error = new WP_Error( 'woocommerce_api_create_order_refund_api_failed', $error_message);   
     937                    return $error;
     938                } else {
     939                    if ($responsecode == 404) {
    937940                        $order->add_order_note(sprintf(__('Order not found on Payflex.', 'woo_partpay')));
    938                     }
    939                     else
    940                     {
     941                    } else {
    941942                        $order->add_order_note(sprintf(__('There was an error submitting the refund to Payflex.', 'woo_partpay')));
    942943                    }
     
    12651266    add_filter('cron_schedules', 'partpay_add_two_minute_schedule');
    12661267    add_shortcode('payflex_widget', 'widget_shortcode_content');
    1267     add_action('woocommerce_single_product_summary', 'widget_content', 25);
     1268    global $wp_version;
     1269    if($wp_version >= 6.3){
     1270        add_action('woocommerce_before_add_to_cart_form', 'widget_content', 0);
     1271    }else{
     1272        add_action('woocommerce_single_product_summary', 'widget_content', 12);
     1273    }
     1274   
     1275   
    12681276    // FUNCTION - Frontend show on single product page
    12691277    function widget_content(){
     
    12871295        if ($payflex_frontend == 'no' && $payflex_frontend_page_builder == 'no'){ return; }   
    12881296        global $product;
     1297        if(!$product){ return; }
    12891298        // Early exit if product is a WooCommerce Subscription type product:
    12901299        if (class_exists('WC_Subscriptions_Product') && WC_Subscriptions_Product::is_subscription($product)){
  • payflex-payment-gateway/trunk/readme.txt

    r2934945 r2953032  
    33Tags: credit card,debit card, payflex, payment request, woocommerce, automattic
    44Requires at least: 4.4
    5 Tested up to: 6.2
     5Tested up to: 6.3
    66Requires PHP: 7.4
    7 Stable tag: 2.4.7
     7Stable tag: 2.4.8
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
     
    9090     * Fixd minor bug
    9191= 2.4.7 =
    92      * Updated widget UI     
     92     * Updated widget UI
     93= 2.4.8 =
     94     * Initialized $environments, $configurationUrl & $orderurl variables to elimiate possible deprication warning.
     95     * Added alert when refund is disabled.
     96     * Added conditions for wordpress 6.2 and 6.3 to display widget using different hooks .       
Note: See TracChangeset for help on using the changeset viewer.