settings = get_option( $this->option_name, array() ); } public function is_active() { return 'yes' === $this->get_setting( 'enabled', 'no' ); } public function get_payment_method_script_handles() { $file = ACQUIREROS_GATEWAY_PATH . 'assets/js/checkout-block.js'; $ver = file_exists( $file ) ? (string) filemtime( $file ) : ACQUIREROS_GATEWAY_VERSION; wp_register_script( 'acquireros-checkout-block', ACQUIREROS_GATEWAY_URL . 'assets/js/checkout-block.js', array( 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n' ), $ver, true ); return array( 'acquireros-checkout-block' ); } public function get_payment_method_data() { $logo_id = absint( $this->get_setting( 'payment_method_logo_id', 0 ) ); $icon_url = ''; if ( $logo_id && wp_attachment_is_image( $logo_id ) ) { $url = wp_get_attachment_image_url( $logo_id, 'full' ); if ( is_string( $url ) ) { $icon_url = esc_url_raw( $url ); } } return array( 'title' => $this->get_setting( 'title', $this->default_title ), 'icon' => $icon_url, 'description' => wp_kses_post( (string) $this->get_setting( 'description', '' ) ), 'paymentMode' => $this->supports_s2s ? $this->get_setting( 'payment_mode', 'redirect' ) : 'redirect', 'supports' => array( 'products' ), ); } } class AcquirerOS_Blocks_Card_Payment_Method extends AcquirerOS_Blocks_Payment_Method_Base { protected $name = 'acquireros_gateway'; protected $option_name = 'woocommerce_acquireros_gateway_settings'; protected $default_title = 'Credit Card'; protected $default_description = ''; protected $supports_s2s = true; } class AcquirerOS_Blocks_PayPal_Payment_Method extends AcquirerOS_Blocks_Payment_Method_Base { protected $name = 'acquireros_paypal'; protected $option_name = 'woocommerce_acquireros_paypal_settings'; protected $default_title = 'PayPal'; protected $default_description = ''; } class AcquirerOS_Blocks_Apple_Pay_Payment_Method extends AcquirerOS_Blocks_Payment_Method_Base { protected $name = 'acquireros_apple_pay'; protected $option_name = 'woocommerce_acquireros_apple_pay_settings'; protected $default_title = 'Apple Pay'; protected $default_description = ''; } class AcquirerOS_Blocks_Google_Pay_Payment_Method extends AcquirerOS_Blocks_Payment_Method_Base { protected $name = 'acquireros_google_pay'; protected $option_name = 'woocommerce_acquireros_google_pay_settings'; protected $default_title = 'Google Pay'; protected $default_description = ''; } } class AcquirerOS_Blocks_Support { public static function init() { add_action( 'woocommerce_blocks_payment_method_type_registration', array( __CLASS__, 'register' ) ); } public static function register( $registry ) { foreach ( array( 'AcquirerOS_Blocks_Card_Payment_Method', 'AcquirerOS_Blocks_PayPal_Payment_Method', 'AcquirerOS_Blocks_Apple_Pay_Payment_Method', 'AcquirerOS_Blocks_Google_Pay_Payment_Method', ) as $class ) { if ( class_exists( $class ) ) { $registry->register( new $class() ); } } } }