From 8455a8e0f088b84ffa1d68d64a0cb88f4e755188 Mon Sep 17 00:00:00 2001 From: ramin Date: Mon, 18 Mar 2024 22:08:54 +0000 Subject: [PATCH] add more docs for pay invoice --- README.md | 9 ++++++++- examples/invoices/main.go | 22 ++++++++++++++++++++++ invoice.go | 1 - 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 83e6214..69026d5 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,16 @@ if err != nil { } fmt.Println(invoice.Serialized) - ``` +### Pay Invoice + +```go +resp, err := client.PayInvoice(eclair.PayInvoiceRequest{ + Invoice: resp.Serialized, +}) +fmt.Println(resp.Message) +``` #### Watching Events diff --git a/examples/invoices/main.go b/examples/invoices/main.go index e7384bc..0171b9a 100644 --- a/examples/invoices/main.go +++ b/examples/invoices/main.go @@ -31,4 +31,26 @@ func main() { fmt.Println(dresp.Message) + // Create Invoice + + resp, err = client.CreateInvoice(eclair.CreateInvoiceRequest{ + Description: "test6", + Amount: 169420, + }) + + if err != nil { + fmt.Println(err) + return + } + + presp, err := client.PayInvoice(eclair.PayInvoiceRequest{ + Invoice: resp.Serialized, + }) + + if err != nil { + fmt.Println(err) + } + + fmt.Println(presp.Message) + } diff --git a/invoice.go b/invoice.go index c73c060..74f1f4e 100644 --- a/invoice.go +++ b/invoice.go @@ -106,7 +106,6 @@ func (c *DeleteInvoiceRequest) FormData() (io.Reader, error) { } func (c *Client) DeleteInvoice(settings DeleteInvoiceRequest) (*DeleteInvoiceResponse, error) { - data, err := settings.FormData() if err != nil { return nil, err