This commit is contained in:
@ -66,13 +66,14 @@ impl LightningNode for BitvoraNode {
|
|||||||
if r.endpoint != "/api/v1/webhook/bitvora" {
|
if r.endpoint != "/api/v1/webhook/bitvora" {
|
||||||
return InvoiceUpdate::Unknown;
|
return InvoiceUpdate::Unknown;
|
||||||
}
|
}
|
||||||
let body: BitvoraWebhookPayload<BitvoraWebhook> =
|
let r_body = r.body.as_slice();
|
||||||
match serde_json::from_slice(r.body.as_slice()) {
|
info!("Received webhook {}", String::from_utf8_lossy(r_body));
|
||||||
|
let body: BitvoraWebhook =
|
||||||
|
match serde_json::from_slice(r_body) {
|
||||||
Ok(b) => b,
|
Ok(b) => b,
|
||||||
Err(e) => return InvoiceUpdate::Error(e.to_string()),
|
Err(e) => return InvoiceUpdate::Error(e.to_string()),
|
||||||
};
|
};
|
||||||
info!("Received webhook {:?}", body);
|
|
||||||
let body = body.payload;
|
|
||||||
if let Err(e) = verify_webhook(&secret, &r) {
|
if let Err(e) = verify_webhook(&secret, &r) {
|
||||||
return InvoiceUpdate::Error(e.to_string());
|
return InvoiceUpdate::Error(e.to_string());
|
||||||
}
|
}
|
||||||
@ -122,11 +123,6 @@ struct CreateInvoiceResponse {
|
|||||||
pub payment_request: String,
|
pub payment_request: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
|
||||||
struct BitvoraWebhookPayload<T> {
|
|
||||||
pub payload: T,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone)]
|
#[derive(Deserialize, Debug, Clone)]
|
||||||
struct BitvoraWebhook {
|
struct BitvoraWebhook {
|
||||||
pub event: BitvoraWebhookEvent,
|
pub event: BitvoraWebhookEvent,
|
||||||
|
Reference in New Issue
Block a user