Plugin Directory

Changeset 3044666


Ignore:
Timestamp:
03/04/2024 01:13:29 AM (2 years ago)
Author:
afterpayit
Message:

Release v3.8.5.

Location:
afterpay-gateway-for-woocommerce
Files:
196 added
1 deleted
10 edited
1 copied

Legend:

Unmodified
Added
Removed
  • afterpay-gateway-for-woocommerce/tags/3.8.5/afterpay-gateway-for-woocommerce.php

    r3036618 r3044666  
    55 * Author: Afterpay
    66 * Author URI: https://www.afterpay.com/
    7  * Version: 3.8.4
     7 * Version: 3.8.5
    88 * Text Domain: afterpay-gateway-for-woocommerce
    99 * WC requires at least: 3.2.6
    10  * WC tested up to: 8.5.2
     10 * WC tested up to: 8.6.1
    1111 *
    1212 * Copyright: (c) 2020 Afterpay
     
    4646         *                                          the value in the comments above.
    4747         */
    48         public static $version = '3.8.4';
     48        public static $version = '3.8.5';
    4949
    5050        /**
  • afterpay-gateway-for-woocommerce/tags/3.8.5/class/Cron/Afterpay_Plugin_Cron.php

    r2959051 r3044666  
    121121                    $settings['pay-over-time-limit-max'] = 'N/A';
    122122                    $settings['settlement-currency'] = '';
     123                    $settings['trading-country'] = '';
    123124                    $settings['cbt-countries'] = 'N/A';
    124125                    $settings['cbt-limits'] = 'N/A';
     
    152153                    $gateway::log("Cron changing settlement currency from '{$old_currency}' to '{$new_currency}'.");
    153154                    $settings['settlement-currency'] = $new_currency;
     155                }
     156
     157                $old_country = isset($settings['trading-country']) ? $settings['trading-country'] : '';
     158                $new_country = property_exists($configuration, 'merchantCountry') ? $configuration->merchantCountry : '';
     159                if ($new_country != $old_country) {
     160                    $settings_changed = true;
     161                    $gateway::log("Cron changing merchant country from '{$old_country}' to '{$new_country}'.");
     162                    $settings['trading-country'] = $new_country;
    154163                }
    155164
  • afterpay-gateway-for-woocommerce/tags/3.8.5/class/WC_Gateway_Afterpay.php

    r3036618 r3044666  
    977977        public function get_country_code () {
    978978            if (!isset($this->settings['trading-country']) || $this->settings['trading-country'] == 'auto') {
     979                // keep this chunk for stale users
    979980                $currency = get_option('woocommerce_currency'); // Unfiltered base currency
    980981                $mapping = array(
     
    17451746                }
    17461747
     1748                self::log("[EC] Creating WC order for token: {$_POST['token']}");
    17471749                $order = $this->create_wc_order_from_cart();
    17481750                if (!$order) {
     
    17761778        private function create_wc_order_from_cart() {
    17771779            try {
     1780                register_shutdown_function(function() {
     1781                    $error = error_get_last();
     1782                    if (isset($error['type']) && $error['type'] === E_ERROR) {
     1783                        self::log("[EC] Shutdown Error:");
     1784                        self::log($error);
     1785                    }
     1786                });
     1787
    17781788                /**
    17791789                 * WC()->cart->calculate_totals() should be run before WC()->get_checkout()
     
    17851795
    17861796                $order_id = $checkout->create_order(array());
     1797                if (is_wp_error($order_id)) {
     1798                    throw new Exception("{$order_id->get_error_code()}: {$order_id->get_error_message()}");
     1799                }
     1800                self::log("[EC] WC order #{$order_id} created.");
    17871801                $order = wc_get_order($order_id);
    17881802
     
    18111825
    18121826                $order->set_payment_method($this);
    1813             } catch(Exception $e) {
     1827            } catch(Throwable $e) {
    18141828                wc_add_notice( __( 'Your order couldn\'t be created. Please try again.', 'woo_afterpay' ), 'error' );
    18151829                throw new Exception("Woocommerce couldn't create the order: {$e->getMessage()}", 3);
     1830            } catch(Exception $e) {
     1831                // Backward compatibility for PHP 5
     1832                wc_add_notice( __( 'Your order couldn\'t be created. Please try again.', 'woo_afterpay' ), 'error' );
     1833                throw new Exception("(Exception) Woocommerce couldn't create the order: {$e->getMessage()}", 3);
    18161834            }
    18171835
  • afterpay-gateway-for-woocommerce/tags/3.8.5/class/WC_Gateway_Afterpay/form_fields.php

    r2993698 r3044666  
    111111    'trading-country' => array(
    112112        'title'             => __( 'Merchant Country', 'woo_afterpay' ),
    113         'type'              => 'select',
    114         'options'           => array(
    115                                     'auto' => __( 'Auto', 'woo_afterpay' ),
    116                                     'AU' => __( 'Australia', 'woo_afterpay' ),
    117                                     'CA' => __( 'Canada', 'woo_afterpay' ),
    118                                     'NZ' =>__( 'New Zealand', 'woo_afterpay' ),
    119                                     'US' => __( 'United States', 'woo_afterpay' )
    120                                 ),
    121         'description'       => __( 'Select the country in which your Afterpay merchant account is based.', 'woo_afterpay' ),
    122         'default'           => 'auto'
     113        'type'              => 'input',
     114        'description'       => __( 'This information is supplied by Afterpay and cannot be edited.', 'woo_afterpay' ),
     115        'custom_attributes' =>  array(
     116                                    'readonly' => 'true'
     117                                ),
     118        'default'           => ''
    123119    ),
    124120    'excluded-categories' => array(
  • afterpay-gateway-for-woocommerce/tags/3.8.5/readme.txt

    r3036618 r3044666  
    44Requires at least: 4.8.3
    55Tested up to: 6.4.3
    6 Stable tag: 3.8.4
     6Stable tag: 3.8.5
    77License: GNU Public License
    88License URI: https://www.gnu.org/licenses/
     
    3939
    4040== Changelog ==
     41
     42= 3.8.5 =
     43*Release Date: Monday, 04 Mar 2024*
     44
     45* Minor improvements.
     46* Tested and verified support for WordPress 6.4.3 and WooCommerce 8.6.1.
    4147
    4248= 3.8.4 =
  • afterpay-gateway-for-woocommerce/trunk/afterpay-gateway-for-woocommerce.php

    r3036618 r3044666  
    55 * Author: Afterpay
    66 * Author URI: https://www.afterpay.com/
    7  * Version: 3.8.4
     7 * Version: 3.8.5
    88 * Text Domain: afterpay-gateway-for-woocommerce
    99 * WC requires at least: 3.2.6
    10  * WC tested up to: 8.5.2
     10 * WC tested up to: 8.6.1
    1111 *
    1212 * Copyright: (c) 2020 Afterpay
     
    4646         *                                          the value in the comments above.
    4747         */
    48         public static $version = '3.8.4';
     48        public static $version = '3.8.5';
    4949
    5050        /**
  • afterpay-gateway-for-woocommerce/trunk/class/Cron/Afterpay_Plugin_Cron.php

    r2959051 r3044666  
    121121                    $settings['pay-over-time-limit-max'] = 'N/A';
    122122                    $settings['settlement-currency'] = '';
     123                    $settings['trading-country'] = '';
    123124                    $settings['cbt-countries'] = 'N/A';
    124125                    $settings['cbt-limits'] = 'N/A';
     
    152153                    $gateway::log("Cron changing settlement currency from '{$old_currency}' to '{$new_currency}'.");
    153154                    $settings['settlement-currency'] = $new_currency;
     155                }
     156
     157                $old_country = isset($settings['trading-country']) ? $settings['trading-country'] : '';
     158                $new_country = property_exists($configuration, 'merchantCountry') ? $configuration->merchantCountry : '';
     159                if ($new_country != $old_country) {
     160                    $settings_changed = true;
     161                    $gateway::log("Cron changing merchant country from '{$old_country}' to '{$new_country}'.");
     162                    $settings['trading-country'] = $new_country;
    154163                }
    155164
  • afterpay-gateway-for-woocommerce/trunk/class/WC_Gateway_Afterpay.php

    r3036618 r3044666  
    977977        public function get_country_code () {
    978978            if (!isset($this->settings['trading-country']) || $this->settings['trading-country'] == 'auto') {
     979                // keep this chunk for stale users
    979980                $currency = get_option('woocommerce_currency'); // Unfiltered base currency
    980981                $mapping = array(
     
    17451746                }
    17461747
     1748                self::log("[EC] Creating WC order for token: {$_POST['token']}");
    17471749                $order = $this->create_wc_order_from_cart();
    17481750                if (!$order) {
     
    17761778        private function create_wc_order_from_cart() {
    17771779            try {
     1780                register_shutdown_function(function() {
     1781                    $error = error_get_last();
     1782                    if (isset($error['type']) && $error['type'] === E_ERROR) {
     1783                        self::log("[EC] Shutdown Error:");
     1784                        self::log($error);
     1785                    }
     1786                });
     1787
    17781788                /**
    17791789                 * WC()->cart->calculate_totals() should be run before WC()->get_checkout()
     
    17851795
    17861796                $order_id = $checkout->create_order(array());
     1797                if (is_wp_error($order_id)) {
     1798                    throw new Exception("{$order_id->get_error_code()}: {$order_id->get_error_message()}");
     1799                }
     1800                self::log("[EC] WC order #{$order_id} created.");
    17871801                $order = wc_get_order($order_id);
    17881802
     
    18111825
    18121826                $order->set_payment_method($this);
    1813             } catch(Exception $e) {
     1827            } catch(Throwable $e) {
    18141828                wc_add_notice( __( 'Your order couldn\'t be created. Please try again.', 'woo_afterpay' ), 'error' );
    18151829                throw new Exception("Woocommerce couldn't create the order: {$e->getMessage()}", 3);
     1830            } catch(Exception $e) {
     1831                // Backward compatibility for PHP 5
     1832                wc_add_notice( __( 'Your order couldn\'t be created. Please try again.', 'woo_afterpay' ), 'error' );
     1833                throw new Exception("(Exception) Woocommerce couldn't create the order: {$e->getMessage()}", 3);
    18161834            }
    18171835
  • afterpay-gateway-for-woocommerce/trunk/class/WC_Gateway_Afterpay/form_fields.php

    r2993698 r3044666  
    111111    'trading-country' => array(
    112112        'title'             => __( 'Merchant Country', 'woo_afterpay' ),
    113         'type'              => 'select',
    114         'options'           => array(
    115                                     'auto' => __( 'Auto', 'woo_afterpay' ),
    116                                     'AU' => __( 'Australia', 'woo_afterpay' ),
    117                                     'CA' => __( 'Canada', 'woo_afterpay' ),
    118                                     'NZ' =>__( 'New Zealand', 'woo_afterpay' ),
    119                                     'US' => __( 'United States', 'woo_afterpay' )
    120                                 ),
    121         'description'       => __( 'Select the country in which your Afterpay merchant account is based.', 'woo_afterpay' ),
    122         'default'           => 'auto'
     113        'type'              => 'input',
     114        'description'       => __( 'This information is supplied by Afterpay and cannot be edited.', 'woo_afterpay' ),
     115        'custom_attributes' =>  array(
     116                                    'readonly' => 'true'
     117                                ),
     118        'default'           => ''
    123119    ),
    124120    'excluded-categories' => array(
  • afterpay-gateway-for-woocommerce/trunk/readme.txt

    r3036618 r3044666  
    44Requires at least: 4.8.3
    55Tested up to: 6.4.3
    6 Stable tag: 3.8.4
     6Stable tag: 3.8.5
    77License: GNU Public License
    88License URI: https://www.gnu.org/licenses/
     
    3939
    4040== Changelog ==
     41
     42= 3.8.5 =
     43*Release Date: Monday, 04 Mar 2024*
     44
     45* Minor improvements.
     46* Tested and verified support for WordPress 6.4.3 and WooCommerce 8.6.1.
    4147
    4248= 3.8.4 =
Note: See TracChangeset for help on using the changeset viewer.