Skip to content

Commit

Permalink
Merge pull request #18 from niftynei/nifty/invoice-hacks
Browse files Browse the repository at this point in the history
Add plugin option for setting an invoice expiry.
  • Loading branch information
shesek authored Jun 24, 2020
2 parents 8d2ba52 + 4132a7e commit ec0a753
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions woocommerce-gateway-lightning.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ public function init_form_fields() {
'default' => 'You will pay using the Lightning Network.',
'desc_tip' => true,
),
'invoice_expiry' => array(
'title' => __('Invoice Expiry', 'lightning'),
'type' => 'text',
'description' => __('Time til an invoice expires. Examples: 2w (2 weeks), 1m (1 month), 3h (3 hours), 3600s (3600 seconds). Defaults to 2h.', 'lightning'),
'default' => '2h',
'desc_tip' => true,
),
);
}

Expand All @@ -116,6 +123,7 @@ public function process_payment( $order_id ) {
'currency' => $order->get_currency(),
'amount' => $order->get_total(),
'description' => self::make_desc($order),
'expiry' => $this->get_option('invoice_expiry', '2h'),
'metadata' => [ 'source' => 'woocommerce-gateway', 'order_id' => $order->get_id(), 'url' => get_home_url() ],
'webhook' => self::get_webhook_url($order->get_id())
]);
Expand Down

0 comments on commit ec0a753

Please sign in to comment.