From d1cd0a01dc6a52bc4053aa22b0889f464795f788 Mon Sep 17 00:00:00 2001 From: Salvatore Pruiti Date: Wed, 16 Jul 2025 16:20:46 +0200 Subject: [PATCH] BCSAT-85 - Add missing text domains for i18n, replace constants on i18n method, integrate missing information on the plugin header, add string escape and sanitization on messages, update readme with the required external service notice --- includes/blocks/wc-satispay-blocks.php | 4 +- readme.txt | 11 +++++- resources/js/frontend/index.js | 8 +--- wc-satispay.php | 21 +++++----- woo-satispay.php | 6 ++- woo-satispay.pot | 53 +++++++++++++++++--------- 6 files changed, 63 insertions(+), 40 deletions(-) diff --git a/includes/blocks/wc-satispay-blocks.php b/includes/blocks/wc-satispay-blocks.php index b28a539..cc9a568 100644 --- a/includes/blocks/wc-satispay-blocks.php +++ b/includes/blocks/wc-satispay-blocks.php @@ -76,8 +76,8 @@ public function get_payment_method_script_handles() { */ public function get_payment_method_data() { return [ - 'title' => __(WC_Satispay::METHOD_TITLE, 'woo-satispay'), - 'description' => __(WC_Satispay::METHOD_DESCRIPTION, 'woo-satispay'), + 'title' => __('Satispay', 'woo-satispay'), + 'description' => __('Do it smart. Choose Satispay and pay with a tap!', 'woo-satispay'), 'icon' => WC_Satispay::plugin_url() . '/logo.svg', 'supports' => WC_Satispay::SUPPORTS ]; diff --git a/readme.txt b/readme.txt index 033bf7c..6201bae 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: Satispay Tags: woocommerce, satispay, payment method Requires at least: 5.0 -Tested up to: 6.8.1 +Tested up to: 6.8 Stable tag: 2.2.7 License: MIT License URI: https://opensource.org/licenses/MIT @@ -35,6 +35,15 @@ Manage all of your refund requests directly with the Refund function integrated **Eliminate the risk of chargeback** As soon as the customer confirms the payment, the transaction is completed, thus eliminating the possibility of chargeback. +== External Services == + +This plugin connects to the Satispay API to process payments. To function correctly, it sends payment and order details to Satispay's servers. +This is essential for creating and verifying transactions. + +You can view Satispay's terms of service and privacy policy here: +* Terms of Service: https://www.satispay.com/en-it/legal-hub/terms-and-conditions/ +* Privacy Policy: https://www.satispay.com/en-it/legal-hub/privacy-policy/ + == Changelog == = 2.2.7 = * Updated compatibility to WP-6.8.1 diff --git a/resources/js/frontend/index.js b/resources/js/frontend/index.js index d63f7fb..fe7d1ad 100644 --- a/resources/js/frontend/index.js +++ b/resources/js/frontend/index.js @@ -6,13 +6,9 @@ import { getSetting } from '@woocommerce/settings'; const settings = getSetting( 'satispay_data', {} ); -const defaultLabel = __( - 'Satispay' -); +const defaultLabel = __('Satispay', 'woo-satispay'); -const defaultDescription = __( - 'Do it smart. Choose Satispay and pay with a tap!' -); +const defaultDescription = __('Do it smart. Choose Satispay and pay with a tap!','woo-satispay'); const iconUrl = settings.icon; diff --git a/wc-satispay.php b/wc-satispay.php index 1082bff..ec6cde2 100644 --- a/wc-satispay.php +++ b/wc-satispay.php @@ -7,9 +7,6 @@ class WC_Satispay extends WC_Payment_Gateway { - const METHOD_TITLE = 'Satispay'; - const ORDER_BUTTON_TEXT = 'Pay with Satispay'; - const METHOD_DESCRIPTION = 'Do it smart. Choose Satispay and pay with a tap!'; const SUPPORTS = array( 'products', 'refunds' @@ -20,9 +17,9 @@ public function __construct() { $GLOBALS['hide_save_button'] = false; } $this->id = 'satispay'; - $this->method_title = __(self::METHOD_TITLE, 'woo-satispay'); - $this->order_button_text = __(self::ORDER_BUTTON_TEXT, 'woo-satispay'); - $this->method_description = __(self::METHOD_DESCRIPTION, 'woo-satispay'); + $this->method_title = __('Satispay', 'woo-satispay'); + $this->order_button_text = __('Pay with Satispay', 'woo-satispay'); + $this->method_description = __('Do it smart. Choose Satispay and pay with a tap!', 'woo-satispay'); $this->has_fields = false; $this->supports = self::SUPPORTS; @@ -46,8 +43,8 @@ public function __construct() { add_action('woocommerce_available_payment_gateways', array($this, 'check_gateway'), 15); } - public function process_refund($order, $amount = null, $reason = '') { - $order = new WC_Order($order); + public function process_refund($order_id, $amount = null, $reason = '') { + $order = new WC_Order($order_id); try { $response = \SatispayGBusiness\Payment::create(array( @@ -122,14 +119,14 @@ public function init_form_fields() { 'activationCode' => array( 'title' => __('Activation Code', 'woo-satispay'), 'type' => 'text', - 'description' => sprintf(__('Get a six characters Activation Code from Online Shop section on Satispay Dashboard.', 'woo-satispay'), 'https://dashboard.satispay.com') + 'description' => wp_kses_post(sprintf(__('Get a six characters Activation Code from Online Shop section on Satispay Dashboard.', 'woo-satispay'), 'https://dashboard.satispay.com')) ), 'sandbox' => array( 'title' => __('Sandbox', 'woo-satispay'), 'label' => __('Sandbox Mode', 'woo-satispay'), 'type' => 'checkbox', 'default' => 'no', - 'description' => sprintf(__('Sandbox Mode can be used to test payments. Request a Sandbox Account.', 'woo-satispay'), 'https://developers.satispay.com/docs/sandbox-account') + 'description' => wp_kses_post(sprintf(__('Sandbox Mode can be used to test payments. Request a Sandbox Account.', 'woo-satispay'), 'https://developers.satispay.com/docs/sandbox-account')) ), 'finalizeUnhandledTransactions' => array( 'title' => __('Finalize unhandled payments', 'woo-satispay'), @@ -214,7 +211,7 @@ public function process_admin_options() { \SatispayGBusiness\Api::setPublicKey($authentication->publicKey); } catch(\Exception $ex) { echo '
'; - echo '

'.sprintf(__('The Activation Code "%s" is invalid', 'woo-satispay'), $newActivationCode).'

'; + echo '

'. esc_html(sprintf(__('The Activation Code "%s" is invalid', 'woo-satispay'), $newActivationCode)).'

'; echo '
'; } } else if (empty($newActivationCode)) { @@ -232,7 +229,7 @@ public function admin_options() { \SatispayGBusiness\Payment::all(); } catch (\Exception $ex) { echo '
'; - echo '

'.sprintf(__('Satispay is not correctly configured, get an Activation Code from Online Shop section on Satispay Dashboard', 'woo-satispay'), 'https://dashboard.satispay.com').'

'; + echo '

' . wp_kses_post(sprintf(__('Satispay is not correctly configured, get an Activation Code from Online Shop section on Satispay Dashboard', 'woo-satispay'), 'https://dashboard.satispay.com')) .'

'; echo '
'; } diff --git a/woo-satispay.php b/woo-satispay.php index a3fa3d5..7ab880b 100644 --- a/woo-satispay.php +++ b/woo-satispay.php @@ -5,7 +5,11 @@ * Description: Save time and money by accepting payments from your customers with Satispay. Free, simple, secure! #doitsmart * Author: Satispay * Author URI: https://www.satispay.com/ + * License: MIT + * License URI: https://opensource.org/licenses/MIT * Version: 2.2.7 + * Requires at least: 5.0 + * Requires Plugins: woocommerce * WC tested up to: 8.9.2 */ @@ -67,7 +71,7 @@ function wc_satispay_action_links($links) { function wc_satispay_cron_schedule($schedules) { $schedules['every_four_hours'] = array( 'interval' => 14400, // Every 4 hours - 'display' => __( 'Every 4 hours' ), + 'display' => __( 'Every 4 hours', 'woo-satispay'), ); return $schedules; } diff --git a/woo-satispay.pot b/woo-satispay.pot index 63c704a..4c1d7c5 100644 --- a/woo-satispay.pot +++ b/woo-satispay.pot @@ -1,5 +1,5 @@ # Copyright (C) 2025 Satispay -# This file is distributed under the same license as the Satispay for WooCommerce plugin. +# This file is distributed under the MIT. msgid "" msgstr "" "Project-Id-Version: Satispay for WooCommerce 2.2.7\n" @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2025-07-14T11:14:10+00:00\n" +"POT-Creation-Date: 2025-07-16T13:28:09+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.12.0\n" "X-Domain: woo-satispay\n" @@ -31,6 +31,9 @@ msgstr "" #. Author of the plugin #: woo-satispay.php +#: includes/blocks/wc-satispay-blocks.php:79 +#: wc-satispay.php:20 +#: resources/js/frontend/index.js:9 msgid "Satispay" msgstr "" @@ -39,67 +42,81 @@ msgstr "" msgid "https://www.satispay.com/" msgstr "" -#: wc-satispay.php:117 +#: includes/blocks/wc-satispay-blocks.php:80 +#: wc-satispay.php:22 +#: resources/js/frontend/index.js:11 +msgid "Do it smart. Choose Satispay and pay with a tap!" +msgstr "" + +#: wc-satispay.php:21 +msgid "Pay with Satispay" +msgstr "" + +#: wc-satispay.php:114 msgid "Enable/Disable" msgstr "" -#: wc-satispay.php:118 +#: wc-satispay.php:115 msgid "Enable Satispay" msgstr "" -#: wc-satispay.php:123 +#: wc-satispay.php:120 msgid "Activation Code" msgstr "" -#: wc-satispay.php:125 +#: wc-satispay.php:122 #, php-format msgid "Get a six characters Activation Code from Online Shop section on Satispay Dashboard." msgstr "" -#: wc-satispay.php:128 +#: wc-satispay.php:125 msgid "Sandbox" msgstr "" -#: wc-satispay.php:129 +#: wc-satispay.php:126 msgid "Sandbox Mode" msgstr "" -#: wc-satispay.php:132 +#: wc-satispay.php:129 #, php-format msgid "Sandbox Mode can be used to test payments. Request a Sandbox Account." msgstr "" -#: wc-satispay.php:135 +#: wc-satispay.php:132 msgid "Finalize unhandled payments" msgstr "" -#: wc-satispay.php:136 +#: wc-satispay.php:133 msgid "Enable cron" msgstr "" -#: wc-satispay.php:139 +#: wc-satispay.php:136 msgid "Finalize unhandled Satispay payments with a cron." msgstr "" -#: wc-satispay.php:142 -#: wc-satispay.php:143 +#: wc-satispay.php:139 +#: wc-satispay.php:140 msgid "Finalize pending payments up to" msgstr "" -#: wc-satispay.php:146 +#: wc-satispay.php:143 msgid "Choose a number of hours, default is four and minimum is two." msgstr "" -#: wc-satispay.php:217 +#: wc-satispay.php:214 #, php-format msgid "The Activation Code \"%s\" is invalid" msgstr "" -#: wc-satispay.php:235 +#: wc-satispay.php:232 #, php-format msgid "Satispay is not correctly configured, get an Activation Code from Online Shop section on Satispay Dashboard" msgstr "" -#: woo-satispay.php:53 +#: woo-satispay.php:57 msgid "Settings" msgstr "" + +#: woo-satispay.php:74 +msgid "Every 4 hours" +msgstr ""