Skip to content

Commit 2fd2e98

Browse files
committed
Add a separate field for API access token
Instead of specifying it as part of the URL
1 parent 11e5d79 commit 2fd2e98

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

woocommerce-gateway-lightning.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct() {
4343
$this->description = $this->get_option('description');
4444

4545
// Lightning Charge REST client
46-
$this->charge = new LightningChargeClient($this->get_option('server_url', 'http://localhost:9112'));
46+
$this->charge = new LightningChargeClient($this->get_option('charge_url', 'http://localhost:9112'), $this->get_option('charge_token'));
4747

4848
add_action('woocommerce_payment_gateways', array($this, 'register_gateway'));
4949
add_action('woocommerce_update_options_payment_gateways_lightning', array($this, 'process_admin_options'));
@@ -73,13 +73,19 @@ public function init_form_fields() {
7373
'default' => __('Bitcoin Lightning', 'lightning'),
7474
'desc_tip' => true,
7575
),
76-
'server_url' => array (
76+
'charge_url' => array (
7777
'title' => __('Lightning Charge server', 'lightning'),
7878
'type' => 'text',
7979
'description' => __('URL of the Lightning Charge REST server to connect to.', 'lightning'),
8080
'default' => __('http://localhost:9112', 'lightning'),
8181
'desc_tip' => true,
8282
),
83+
'charge_token' => array (
84+
'title' => __('Lightning Charge API token', 'lightning'),
85+
'type' => 'text',
86+
'description' => __('API access token configured in the Lightning Charge server.', 'lightning'),
87+
'desc_tip' => true,
88+
),
8389
'description' => array(
8490
'title' => __('Customer Message', 'lightning'),
8591
'type' => 'textarea',

0 commit comments

Comments
 (0)