Plugin Directory

Changeset 3236683


Ignore:
Timestamp:
02/07/2025 03:19:29 PM (14 months ago)
Author:
bucksbuspay
Message:

Update all API settings for all gateways from any gateway

Location:
bucksbus/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bucksbus/trunk/README.txt

    r3236637 r3236683  
    55Requires at least: 6.0
    66Tested up to: 6.7
    7 Stable tag: 1.0.5
     7Stable tag: 1.1.0
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    5050== Changelog ==
    5151
     52= 1.1.0 =
     53* Update all API settings for all gateways from any gateway.
     54
    5255= 1.0.5 =
    5356* Add support for USDC.ERC20, USDC.POLY
  • bucksbus/trunk/bucksbus.php

    r3236637 r3236683  
    44 * Plugin Name: BucksBus
    55 * Description: Adds BucksBus to your WooCommerce website.
    6  * Version: 1.0.5
     6 * Version: 1.1.0
    77 *
    88 * Author: BucksBus
  • bucksbus/trunk/includes/class-wc-gateway-bucksbus-base.php

    r3086345 r3236683  
    9898    }
    9999
     100    public function process_admin_options()
     101    {
     102        parent::process_admin_options();
     103
     104        $default_prefix = "bucksbus_";
     105
     106        $common_fields = array("api_key", "api_secret", "webhook_secret");
     107
     108        $gateways = WC()->payment_gateways->get_available_payment_gateways();
     109
     110        if ($gateways) {
     111            foreach ($gateways as $gateway) {
     112                if (substr($gateway->id, 0, strlen($default_prefix)) === $default_prefix && $gateway->id !== $this->id) {
     113                    foreach ($common_fields as $field) {
     114                        $gateway->update_option($field, $this->get_option($field));
     115                    }
     116                }
     117            }
     118        }
     119    }
     120
    100121    // public function get_option_key()
    101122    // {
     
    147168                'default'     => '',
    148169                'desc_tip'    => true,
     170            ),
     171            'warning'        => array(
     172                'title'       => __('API Settings', 'bucksbus'),
     173                'type'        => 'title',
     174                'default'     => '',
     175                'description' => sprintf(
     176                    // translators: Description field for API on settings page. Includes external link.
     177                    __(
     178                        'WARNING: When updating the API settings, the API settings on ALL your BucksBus payment gateway coins will be updated.',
     179                        'bucksbus'
     180                    ),
     181                    esc_url('https://merchant.bucksbus.com/')
     182                ),
    149183            ),
    150184            'api_key'        => array(
Note: See TracChangeset for help on using the changeset viewer.