Quickening icon indicating copy to clipboard operation
Quickening copied to clipboard

Checkpayment on LNBits version not working

Open iamjackharper opened this issue 5 years ago • 1 comments

Hello, with LNBits version of the code when I use checkpayment() function it can't correctly retrieve the status of the invoice for me.

Line 336, client.readStringUntil('\n') just returns "HTTP/1.1 200 OK". If I call client.readString() instead it gives me

HTTP/1.1 200 OK
Server: nginx/1.14.0 (Ubuntu)
Date: Tue, 25 Feb 2020 16:08:15 GMT
Content-Type: application/json
Content-Length: 17
Connection: close

{"PAID":"FALSE"}

So I guess I need a function to pick just the last line.

iamjackharper avatar Feb 25 '20 16:02 iamjackharper

A solution I came up with is to replace line 336 with

while (client.connected()) {
    String line = client.readStringUntil('\n');
    if (line == "\r") {
      break;
    }
  }
  
  String line = client.readString();

This way the data_status variable can correctly be set as "paid", so it's a step forward, anyway I see that data_status isn't considered in the main function to reach the green screen of completed transaction.

iamjackharper avatar Feb 25 '20 16:02 iamjackharper