Files
GoblinPay/connectors/woocommerce/includes/class-blocks.php
T
2ro bd67bfc92e GoblinPay: receive-only Grin payment server
A self-hostable Grin payment server for shops, creators, and sites: show a
code, Grin lands in your wallet, with a verifiable Grin payment proof on
receive. Workspace crates (gp-core / gp-nostr / gp-server / gp-wallet /
gp-goblin-sender), a WooCommerce connector, a hosted /pay/<token> checkout,
and NIP-44 v3 gift-wrapped payment DMs carried over the Nym mixnet. All
secrets are read from the environment; none are committed.
2026-07-02 04:29:54 -04:00

52 lines
1.6 KiB
PHP

<?php
/**
* WooCommerce Blocks payment-method integration for the GoblinPay gateway.
*
* @package GoblinPayWooCommerce
*/
if (!defined('ABSPATH')) {
exit;
}
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
final class GoblinPay_WC_Blocks_Support extends AbstractPaymentMethodType {
protected $name = 'goblinpay';
/** @var array Named to avoid clashing with the parent's protected $settings. */
private $gw_settings = array();
public function initialize() {
$this->gw_settings = get_option('woocommerce_goblinpay_settings', array());
if (!is_array($this->gw_settings)) {
$this->gw_settings = array();
}
}
public function is_active() {
return !empty($this->gw_settings['enabled']) && 'yes' === $this->gw_settings['enabled'];
}
public function get_payment_method_script_handles() {
$handle = 'goblinpay-blocks';
wp_register_script(
$handle,
plugins_url('assets/js/blocks.js', GOBLINPAY_WC_PLUGIN_FILE),
array('wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-html-entities'),
GOBLINPAY_WC_VERSION,
true
);
return array($handle);
}
public function get_payment_method_data() {
return array(
'title' => !empty($this->gw_settings['title']) ? $this->gw_settings['title'] : 'Grin (GRIN)',
'description' => isset($this->gw_settings['description']) ? $this->gw_settings['description'] : '',
'supports' => array('products'),
);
}
}