From fe946dd7d4cb104c1cdd4753dc0332e8211421f1 Mon Sep 17 00:00:00 2001 From: Sameer Ababneh Date: Thu, 22 Apr 2021 02:14:12 +0300 Subject: [PATCH] Bugs relating to latest WooCommerce plugin + minor default text rewrite --- .../class-woocommerce-pointcheckout-card.php | 36 ++++---- .../includes/lib/class-pc-config.php | 4 +- .../includes/lib/class-pc-payment-service.php | 6 +- ...lass-woocommerce-pointcheckout-rewards.php | 87 ++++++++++--------- .../includes/lib/class-pc-config.php | 28 +++--- .../includes/lib/class-pc-parent.php | 3 +- .../includes/lib/class-pc-payment-service.php | 2 +- .../includes/lib/class-pc-utils.php | 14 +-- .../woocommerce-pointcheckout-rewards.php | 2 +- 9 files changed, 91 insertions(+), 91 deletions(-) diff --git a/pointcheckout_payment_card/includes/class-woocommerce-pointcheckout-card.php b/pointcheckout_payment_card/includes/class-woocommerce-pointcheckout-card.php index 04660b4..12c02bd 100755 --- a/pointcheckout_payment_card/includes/class-woocommerce-pointcheckout-card.php +++ b/pointcheckout_payment_card/includes/class-woocommerce-pointcheckout-card.php @@ -23,7 +23,7 @@ public function __construct() $this->description = PointCheckout_Card_Config::getInstance()->getDescription(); $this->paymentService = PointCheckout_Card_Payment::getInstance(); $this->config = PointCheckout_Card_Config::getInstance(); - $this->icon = plugin_dir_url(__FILE__) . '../assets/images/mc-visa-network-logos.png'; + $this->icon = plugin_dir_url(__FILE__) . '../assets/images/mc-visa-network-logos.png'; if ( !$this->config->isLiveMode() ) { $this->description .= ' ' . sprintf( __( 'TEST MODE ENABLED. You can use test cards only. ' . @@ -61,13 +61,15 @@ public function is_available() $valid = true; if ($this->config->isSpecificUserRoles()) { $valid = false; - $user_id = WC()->customer->get_id(); - $user = new WP_User($user_id); - if (!empty($user->roles) && is_array($user->roles)) { - foreach ($user->roles as $user_role) { - foreach ($this->config->getSpecificUserRoles() as $role) { - if ($role == $user_role) { - $valid = true; + if(WC()->customer != null) { + $user_id = WC()->customer->get_id(); + $user = new WP_User($user_id); + if (!empty($user->roles) && is_array($user->roles)) { + foreach ($user->roles as $user_role) { + foreach ($this->config->getSpecificUserRoles() as $role) { + if ($role == $user_role) { + $valid = true; + } } } } @@ -76,12 +78,14 @@ public function is_available() if ($valid && $this->config->isSpecificCountries()) { $valid = false; - $billingCountry = WC()->customer->get_billing_country(); + if(WC()->customer != null) { + $billingCountry = WC()->customer->get_billing_country(); - if (!$billingCountry == null) { - foreach ($this->config->getSpecificCountries() as $country) { - if ($country == $billingCountry) { - $valid = true; + if (!$billingCountry == null) { + foreach ($this->config->getSpecificCountries() as $country) { + if ($country == $billingCountry) { + $valid = true; + } } } } @@ -185,11 +189,11 @@ function init_form_fields() 'type' => 'select', 'options' => $staging_enabled ? array( '1' => __('Live', 'pointcheckout_card'), - '0' => __('Test', 'pointcheckout_card'), + '0' => __('Testing', 'pointcheckout_card'), '2' => __('Staging', 'pointcheckout_card'), ) : array( - '1' => 'Live', - '0' => 'Test', + '1' => __('Live', 'pointcheckout_card'), + '0' => __('Testing', 'pointcheckout_card'), ), 'default' => '0', 'desc_tip' => true, diff --git a/pointcheckout_payment_card/includes/lib/class-pc-config.php b/pointcheckout_payment_card/includes/lib/class-pc-config.php index 81296f5..c391156 100755 --- a/pointcheckout_payment_card/includes/lib/class-pc-config.php +++ b/pointcheckout_payment_card/includes/lib/class-pc-config.php @@ -4,8 +4,8 @@ class PointCheckout_Card_Config extends PointCheckout_Card_Parent { private static $instance; - private $api_Secret; - private $api_Key; + private $api_secret; + private $api_key; private $Mode; private $orderPlacement; private $allowSpecific; diff --git a/pointcheckout_payment_card/includes/lib/class-pc-payment-service.php b/pointcheckout_payment_card/includes/lib/class-pc-payment-service.php index 14edb09..7c8767d 100755 --- a/pointcheckout_payment_card/includes/lib/class-pc-payment-service.php +++ b/pointcheckout_payment_card/includes/lib/class-pc-payment-service.php @@ -1,5 +1,5 @@ pcOrder->clearSessionCurrentOrder(); $form = '