| @@ -75,13 +75,13 @@ | ||
| 75 | 75 | * @return mixed|string |
| 76 | 76 | */ |
| 77 | 77 | private function handle_cc_enabled() |
| 78 | 78 | { |
| 79 | - if (!empty($this->settings['enabled']) && $this->settings['enabled']) { | |
| 80 | - $enabled = !empty($this->settings[$this->id]) ? $this->settings[$this->id] : $this->settings['enabled']; | |
| 81 | - $this->enabled = $enabled ? 'yes' : 'no'; | |
| 79 | + if (!empty($this->settings['enabled']) && (bool) $this->settings['enabled']) { | |
| 80 | + $active = $this->get_configuration()->get_option('payment_methods.configuration.payplug.active'); | |
| 81 | + $this->enabled = ($active === null || (bool) $active) ? 'yes' : 'no'; | |
| 82 | 82 | } else { |
| 83 | - $this->enabled = 'yes'; | |
| 83 | + $this->enabled = 'no'; | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | return $this->enabled; |
| 87 | 87 | } |
| @@ -114,9 +114,9 @@ | ||
| 114 | 114 | * |
| 115 | 115 | * Register scripts and additionnal data needed for the |
| 116 | 116 | * embedded payment form. |
| 117 | 117 | */ |
| 118 | - public function scripts() | |
| 118 | + public function scripts(): void | |
| 119 | 119 | { |
| 120 | 120 | if (!is_cart() && !is_checkout() && !isset($_GET['pay_for_order']) && !is_add_payment_method_page() && !isset($_GET['change_payment_method'])) { |
| 121 | 121 | return; |
| 122 | 122 | } |
| @@ -154,9 +154,9 @@ | ||
| 154 | 154 | * |
| 155 | 155 | * Register scripts and additionnal data needed for the |
| 156 | 156 | * embedded payment form. |
| 157 | 157 | */ |
| 158 | - public function integrated_payments_scripts() | |
| 158 | + public function integrated_payments_scripts(): void | |
| 159 | 159 | { |
| 160 | 160 | $translations = [ |
| 161 | 161 | 'cardholder' => __('payplug_integrated_payment_cardholder', 'payplug'), |
| 162 | 162 | 'your_card' => __('payplug_integrated_payment_your_card', 'payplug'), |
| @@ -168,8 +168,9 @@ | ||
| 168 | 168 | 'order_review_url' => \WC_AJAX::get_endpoint('payplug_order_review_url'), |
| 169 | 169 | 'nonce' => wp_create_nonce('woocommerce-process_checkout'), |
| 170 | 170 | 'mode' => PayplugWoocommerceHelper::check_mode(), // true for TEST, false for LIVE |
| 171 | 171 | 'check_payment_url' => \WC_AJAX::get_endpoint('payplug_check_payment'), |
| 172 | + 'secureDomain' => PayplugWoocommerceHelper::get_secure_domain(), | |
| 172 | 173 | ]; |
| 173 | 174 | |
| 174 | 175 | /**x |
| 175 | 176 | * Integrated payments scripts |
| @@ -195,9 +196,9 @@ | ||
| 195 | 196 | * |
| 196 | 197 | * Register scripts and additionnal data needed for the |
| 197 | 198 | * embedded payment form. |
| 198 | 199 | */ |
| 199 | - public function popup_payments_scripts() | |
| 200 | + public function popup_payments_scripts(): void | |
| 200 | 201 | { |
| 201 | 202 | //load popup features |
| 202 | 203 | wp_register_script('payplug', 'https://api.payplug.com/js/1/form.latest.js', [], null, true); |
| 203 | 204 | wp_register_script('payplug-checkout', PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/js/payplug-checkout.js', ['jquery', 'payplug'], PAYPLUG_GATEWAY_VERSION, true); |
| @@ -215,9 +216,9 @@ | ||
| 215 | 216 | |
| 216 | 217 | /** |
| 217 | 218 | * extra payment fields |
| 218 | 219 | */ |
| 219 | - public function payment_fields() | |
| 220 | + public function payment_fields(): void | |
| 220 | 221 | { |
| 221 | 222 | $description = $this->get_description(); |
| 222 | 223 | |
| 223 | 224 | if (!empty($description)) { |