From 43ac5c65172d6afacc07c19f3f452b5d55f9ab7f Mon Sep 17 00:00:00 2001 From: Alex Komarichev Date: Fri, 20 Sep 2024 15:15:25 +0300 Subject: [PATCH] Json decode for correct context view --- src/include/api/class-wc-retailcrm-proxy.php | 2 +- src/include/class-wc-retailcrm-loyalty.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/include/api/class-wc-retailcrm-proxy.php b/src/include/api/class-wc-retailcrm-proxy.php index 4f9f9c8..f2bd53e 100644 --- a/src/include/api/class-wc-retailcrm-proxy.php +++ b/src/include/api/class-wc-retailcrm-proxy.php @@ -121,7 +121,7 @@ if (!class_exists('WC_Retailcrm_Proxy')) : $response->getStatusCode(), $response->getErrorString() ), - ['response' => $response->getRawResponse()], + ['response' => json_decode($response->getRawResponse(), true)], WC_Retailcrm_Logger::TYPE['res'] ); } diff --git a/src/include/class-wc-retailcrm-loyalty.php b/src/include/class-wc-retailcrm-loyalty.php index 32ae458..f53754e 100644 --- a/src/include/class-wc-retailcrm-loyalty.php +++ b/src/include/class-wc-retailcrm-loyalty.php @@ -95,7 +95,8 @@ if (!class_exists('WC_Retailcrm_Loyalty')) : if (!$response->isSuccessful()) { WC_Retailcrm_Logger::error( __METHOD__, - 'Error while registering in the loyalty program: ' . $response->getRawResponse() + 'Error while registering in the loyalty program', + ['response' => json_decode($response->getRawResponse(), true)] ); } @@ -125,7 +126,8 @@ if (!class_exists('WC_Retailcrm_Loyalty')) : if (!$response->isSuccessful()) { WC_Retailcrm_Logger::error( __METHOD__, - 'Error while registering in the loyalty program: ' . $response->getRawResponse() + 'Error while registering in the loyalty program', + ['response' => json_decode($response->getRawResponse(), true)] ); }