diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e574b3f..73c72c63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## v5.6.0 - 2024-09-16 + +### Changes + +### 🚀 New Features + +- feat: compatibility woocommerce 9.2.3 wordpress 6.6.1 (#278) + +### 🐛 Bug Fixes + +- fix: force picture_url to string (#277) + +#### Contributors + +@Benjamin-Freoua-Alma, @Francois-Gomis, @alma-create-pr-with-team-review and @joyet-simon + ## v5.5.0 - 2024-07-29 ### Changes diff --git a/README.md b/README.md index a3bb36c2..8cc37e04 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ - Tags: payments, payment gateway, woocommerce, ecommerce, e-commerce, sell, woo commerce, alma, monthly payments, split payments - Requires at least Wordpress: 4.4 - Requires at least Woocommerce: 3.0.0 -- Tested up to Wordpress: 6.5.5 -- Tested up to Woocommerce: 9.0.2 +- Tested up to Wordpress: 6.6.1 +- Tested up to Woocommerce: 9.2.3 - Requires PHP: 5.6 -- Stable tag: 5.5.0 +- Stable tag: 5.6.0 - License: GPLv3 - License URI: https://www.gnu.org/licenses/gpl-3.0.html - Support: support@getalma.eu diff --git a/readme.txt b/readme.txt index 1bc0fa6c..ef9d3f0d 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: payments, BNPL, woocommerce, ecommerce, e-commerce, payment gateway, sell, Requires at least: 4.4 Tested up to: 6.3 Requires PHP: 5.6 -Stable tag: 5.5.0 +Stable tag: 5.6.0 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -51,6 +51,22 @@ You can find more documentation on our [website](https://docs.almapay.com/docs/w == Changelog == +## v5.6.0 - 2024-09-16 + +### Changes + +### 🚀 New Features + +- feat: compatibility woocommerce 9.2.3 wordpress 6.6.1 (#278) + +### 🐛 Bug Fixes + +- fix: force picture_url to string (#277) + +#### Contributors + +@Benjamin-Freoua-Alma, @Francois-Gomis, @alma-create-pr-with-team-review and @joyet-simon + ## v5.5.0 - 2024-07-29 ### Changes diff --git a/src/alma-gateway-for-woocommerce.php b/src/alma-gateway-for-woocommerce.php index 8a82499c..d98fafb7 100644 --- a/src/alma-gateway-for-woocommerce.php +++ b/src/alma-gateway-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: Alma - Pay in installments or later for WooCommerce * Plugin URI: https://docs.almapay.com/docs/woocommerce * Description: Install Alma and boost your sales! It's simple and guaranteed, your cash flow is secured. 0 commitment, 0 subscription, 0 risk. - * Version: 5.5.0 + * Version: 5.6.0 * Author: Alma * Author URI: https://almapay.com * License: GNU General Public License v3.0 @@ -12,12 +12,12 @@ * Domain Path: /languages * Requires at least: 4.4 * Requires PHP: 5.6 - * Tested up to: 6.5.5 + * Tested up to: 6.6.1 * * @package Alma_Gateway_For_Woocommerce * * WC requires at least: 2.6 - * WC tested up to: 9.0.2 + * WC tested up to: 9.2.3 * * Alma Payment Gateway for WooCommerce is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ } if ( ! defined( 'ALMA_VERSION' ) ) { - define( 'ALMA_VERSION', '5.5.0' ); + define( 'ALMA_VERSION', '5.6.0' ); } if ( ! defined( 'ALMA_PLUGIN_FILE' ) ) { define( 'ALMA_PLUGIN_FILE', __FILE__ ); diff --git a/src/includes/Admin/Helpers/FormFieldsHelper.php b/src/includes/Admin/Helpers/FormFieldsHelper.php index a657cbd5..a91dd5c4 100644 --- a/src/includes/Admin/Helpers/FormFieldsHelper.php +++ b/src/includes/Admin/Helpers/FormFieldsHelper.php @@ -702,7 +702,7 @@ public function init_payment_upon_trigger_fields( $default_settings ) { 'title' => __( 'Trigger typology', 'alma-gateway-for-woocommerce' ), 'description' => __( 'Text that will appear in the payments schedule and in the customer\'s payment authorization email.', 'alma-gateway-for-woocommerce' ), 'default' => $default_settings['payment_upon_trigger_display_text'], - 'options' => $this->internalionalization_helper->get_display_texts_keys_and_values(), + 'options' => $this->internationalization_helper->get_display_texts_keys_and_values(), ), 'payment_upon_trigger_event' => array( 'type' => 'select', diff --git a/src/includes/Helpers/PaymentHelper.php b/src/includes/Helpers/PaymentHelper.php index 2e58f039..53d9ccc9 100644 --- a/src/includes/Helpers/PaymentHelper.php +++ b/src/includes/Helpers/PaymentHelper.php @@ -23,6 +23,7 @@ use Alma\Woocommerce\AlmaLogger; use Alma\Woocommerce\AlmaSettings; use Alma\Woocommerce\Builders\Helpers\CartHelperBuilder; +use Alma\Woocommerce\Builders\Helpers\ProductHelperBuilder; use Alma\Woocommerce\Builders\Helpers\ToolsHelperBuilder; use Alma\Woocommerce\Exceptions\AlmaException; use Alma\Woocommerce\Exceptions\AmountMismatchException; @@ -38,7 +39,6 @@ */ class PaymentHelper { - /** * The logger. * @@ -82,6 +82,12 @@ class PaymentHelper { */ protected $cart_helper; + /** + * Product helper. + * + * @var ProductHelper + */ + protected $product_helper; /** * Contructor. @@ -98,6 +104,9 @@ public function __construct() { $this->cart_helper = $cart_helper_builder->get_instance(); $this->order_helper = new OrderHelper(); + + $product_helper_builder = new ProductHelperBuilder(); + $this->product_helper = $product_helper_builder->get_instance(); } /** @@ -532,7 +541,7 @@ protected function add_product_data( $item ) { 'line_price' => $this->tool_helper->alma_price_to_cents( $item->get_total() ), 'categories' => $categories, 'url' => $product->get_permalink(), - 'picture_url' => wp_get_attachment_url( $product->get_image_id() ), + 'picture_url' => $this->product_helper->get_attachment_url( $product->get_image_id() ), 'requires_shipping' => $product->needs_shipping(), ); } diff --git a/src/includes/Helpers/ProductHelper.php b/src/includes/Helpers/ProductHelper.php index 101bb403..0cf9cc09 100644 --- a/src/includes/Helpers/ProductHelper.php +++ b/src/includes/Helpers/ProductHelper.php @@ -135,4 +135,14 @@ public function is_product_excluded( $product_id ) { return false; } + + /** + * Return attachment url or empty string + * + * @param int $attachment_id Attachment ID. + * @return string + */ + public function get_attachment_url( $attachment_id = 0 ) { + return wp_get_attachment_url( $attachment_id ) ? wp_get_attachment_url( $attachment_id ) : ''; + } }