lnrpc: expose PaymentStatus for ListPayments

Also make it optional to list non-succeeded payments.
This commit is contained in:
Johan T. Halseth 2019-06-11 14:48:47 +02:00
parent 89f6db11e6
commit 6794708ed5
No known key found for this signature in database
GPG key ID: 15BAADA29DA20D26
4 changed files with 589 additions and 489 deletions

File diff suppressed because it is too large Load diff

View file

@ -558,10 +558,18 @@ func request_Lightning_DecodePayReq_0(ctx context.Context, marshaler runtime.Mar
} }
var (
filter_Lightning_ListPayments_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Lightning_ListPayments_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { func request_Lightning_ListPayments_0(ctx context.Context, marshaler runtime.Marshaler, client LightningClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ListPaymentsRequest var protoReq ListPaymentsRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Lightning_ListPayments_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ListPayments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) msg, err := client.ListPayments(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err return msg, metadata, err

View file

@ -2158,9 +2158,21 @@ message Payment {
/// The optional payment request being fulfilled. /// The optional payment request being fulfilled.
string payment_request = 9 [json_name = "payment_request"]; string payment_request = 9 [json_name = "payment_request"];
enum PaymentStatus {
UNKNOWN = 0;
IN_FLIGHT = 1;
SUCCEEDED = 2;
FAILED = 3;
}
// The status of the payment.
PaymentStatus status = 10 [json_name = "status"];
} }
message ListPaymentsRequest { message ListPaymentsRequest {
/// Set to also return payments that are not (yet) succeeded.
bool non_succeeded = 1;
} }
message ListPaymentsResponse { message ListPaymentsResponse {

View file

@ -938,6 +938,16 @@
} }
} }
}, },
"parameters": [
{
"name": "non_succeeded",
"description": "/ Set to also return payments that are not (yet) succeeded.",
"in": "query",
"required": false,
"type": "boolean",
"format": "boolean"
}
],
"tags": [ "tags": [
"Lightning" "Lightning"
] ]
@ -1297,6 +1307,16 @@
], ],
"default": "OPEN" "default": "OPEN"
}, },
"PaymentPaymentStatus": {
"type": "string",
"enum": [
"UNKNOWN",
"IN_FLIGHT",
"SUCCEEDED",
"FAILED"
],
"default": "UNKNOWN"
},
"PeerSyncType": { "PeerSyncType": {
"type": "string", "type": "string",
"enum": [ "enum": [
@ -2835,6 +2855,10 @@
"payment_request": { "payment_request": {
"type": "string", "type": "string",
"description": "/ The optional payment request being fulfilled." "description": "/ The optional payment request being fulfilled."
},
"status": {
"$ref": "#/definitions/PaymentPaymentStatus",
"description": "The status of the payment."
} }
} }
}, },