HEX
Server: Apache
System: Linux web5.visualcom.es 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: ensaco.es (10019)
PHP: 8.3.32
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/ensaco.es/httpdocs/wp-content/plugins/redsyspur/wc-redsys-block.php
<?php

/**
 * Dummy Payments Blocks integration
 *
 * @since 1.0.3
 */
final class WC_Gateway_Redsys_Block extends Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType {

	/**
	 * Payment method name/id/slug.
	 *
	 * @var string
	 */
	protected $name;

	private $gateway;

	public function __construct( $name ) {
		$this->name = $name;
	}

	/**
	 * Initializes the payment method type.
	 */
	public function initialize() {
		$this->settings = get_option( 'woocommerce_' . $this->name . '_settings', array() );
		$gateways       = WC()->payment_gateways->payment_gateways();
		$this->gateway  = $gateways[ $this->name ];
	}

	/**
	 * Returns if this payment method should be active. If false, the scripts will not be enqueued.
	 *
	 * @return boolean
	 */
	public function is_active() {
		return true;
	}

	/**
	 * Returns an array of scripts/handles to be registered for this payment method.
	 *
	 * @return array
	 */
	public function get_payment_method_script_handles() {
		$blockJsURL = '/wp-content/plugins/redsyspur/pages/assets/js/block.js?name=' . $this->name;
		if(property_exists($this->gateway, 'payment_fields_url') && $this->gateway->payment_fields_url){
			$blockJsURL .= '&payment_fields_url=' . $this->gateway->payment_fields_url;
		}
		wp_register_script(
			'wc-payment-method-' . $this->name,
			$blockJsURL,
			array(
				'wc-blocks-registry', 
				'wc-settings', 
				'wp-element', 
				'wp-html-entities', 
				'wp-i18n',
				'jquery',
				'jquery-ui-core',
				'jquery-ui-dialog'
			),
			MODULE_VERSION,
		);
		return [ 'wc-payment-method-' . $this->name ];
	}

	/**
	 * Returns an array of key=>value pairs of data made available to the payment methods script.
	 *
	 * @return array
	 */
	public function get_payment_method_data() {
		return array(
			'title'       => $this->get_setting( 'title' ),
			'description' => $this->get_setting( 'description' ),
			'supports'    => $this->get_supported_features(),
		);
	}
}