settings = get_option( 'woocommerce_' . $this->name . '_settings', [] ); $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 $this->gateway->is_available(); } /** * Returns an array of scripts/handles to be registered for this payment method. * * @return array */ public function get_payment_method_script_handles() { wp_register_script( 'paykeeper-blocks-integration', plugin_dir_url(__FILE__) . 'checkout.js', [ 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities', 'wp-i18n', ], null, true ); if( function_exists( 'wp_set_script_translations' ) ) { wp_set_script_translations( 'paykeeper-blocks-integration'); } return [ 'paykeeper-blocks-integration' ]; } /** * 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 [ 'title' => $this->gateway->title, 'description' => $this->gateway->description, 'supports' => array_filter( $this->gateway->supports, [ $this->gateway, 'supports' ] ) ]; } } ?>