gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-gnu-taler-payment-for-woocommerce] branch master updated: -fix lo


From: gnunet
Subject: [taler-gnu-taler-payment-for-woocommerce] branch master updated: -fix logging
Date: Thu, 23 Feb 2023 14:50:15 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnu-taler-payment-for-woocommerce.

The following commit(s) were added to refs/heads/master by this push:
     new a6b36d5  -fix logging
a6b36d5 is described below

commit a6b36d5cee4e464233ec28cfc320b27a339338e4
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Feb 23 14:50:12 2023 +0100

    -fix logging
---
 class-wc-gnutaler-gateway.php | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/class-wc-gnutaler-gateway.php b/class-wc-gnutaler-gateway.php
index 31fc632..940cc1a 100644
--- a/class-wc-gnutaler-gateway.php
+++ b/class-wc-gnutaler-gateway.php
@@ -37,12 +37,12 @@
  * Which version of the Taler merchant protocol is implemented
  * by this implementation?  Used to determine compatibility.
  */
-define( 'GNU_TALER_MERCHANT_PROTOCOL_CURRENT', 1 );
+define( 'GNU_TALER_MERCHANT_PROTOCOL_CURRENT', 3 );
 
 /**
  * How many merchant protocol versions are we backwards compatible with?
  */
-define( 'GNU_TALER_MERCHANT_PROTOCOL_AGE', 0 );
+define( 'GNU_TALER_MERCHANT_PROTOCOL_AGE', 2 );
 
 require_once ABSPATH . 'wp-admin/includes/plugin.php';
 
@@ -131,15 +131,15 @@ function gnutaler_init_gateway_class() {
                 * Class constructor
                 */
                public function __construct() {
-                       // Setup logging.
-                       $this->log = new WC_logger( $this->id ); // Setup 
logging.
-                       $this->debug       = 'yes' === $this->get_option( 
'debug', 'no' );
-                       self::$log_enabled = $this->debug;
 
                        $this->setup_properties();
                        $this->init_form_fields();
                        $this->init_settings();
 
+                       // Setup logging.
+                       $this->debug       = 'yes' === $this->get_option( 
'debug', 'no' );
+                       self::$log_enabled = $this->debug;
+
                        // This gateway can support refunds, saved payment 
methods.
                        $this->supports = array(
                                'products',
@@ -184,6 +184,7 @@ function gnutaler_init_gateway_class() {
                                20,
                                4
                        );
+                       $this->debug( "GNU Taler payment gateway class 
constructed" );
                }
 
 
@@ -425,6 +426,8 @@ function gnutaler_init_gateway_class() {
                 * @return array The return array will either have the 
successful return value or a detailed error message.
                 */
                private function call_api( $method, $url, $body ): array {
+                       $this->warning( "Running " . $method . " on " . $url );
+
                        $apikey = $this->get_option( 
'GNU_Taler_Backend_API_Key' );
                        $args   = array(
                                'timeout'             => 30, // In seconds.
@@ -511,6 +514,8 @@ function gnutaler_init_gateway_class() {
                 * @return bool - Returns if valid or not.
                 */
                private function verify_backend_url( $url, $ecurrency ): bool {
+                       $this->warning( "Verifying backend URL " . $url );
+
                        $config             = $this->call_api( 'GET', $url . 
'/config', false );
                        $config_http_status = $config['http_code'];
                        $config_body        = $config['message'];
@@ -1042,7 +1047,13 @@ function gnutaler_init_gateway_class() {
                        // We intentionally do NOT verify the nonce here, as 
logging
                        // should always work.
                         // phpcs:disable WordPress.Security.NonceVerification
-                       $order_id = sanitize_text_field( wp_unslash( 
$_GET['order_id'] ) );
+                       if ( isset ($_GET['order_id'] ) ) {
+                               $order_id = sanitize_text_field( wp_unslash( 
$_GET['order_id'] ) );
+                       }
+                       else
+                       {
+                               $order_id = 'NONE';
+                       }
                         // phpcs:enable
                        if ( empty( self::$log ) ) {
                                self::$log = wc_get_logger();

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]