From c2be225526e69fbbf883be7b479d5697be3853a8 Mon Sep 17 00:00:00 2001 From: Alastair Ong Date: Fri, 23 Aug 2024 08:58:41 +0100 Subject: [PATCH] Invoice note hha_id as string and handled later --- src/routes/host/shared.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/routes/host/shared.rs b/src/routes/host/shared.rs index b3ce4ea..11b1c95 100644 --- a/src/routes/host/shared.rs +++ b/src/routes/host/shared.rs @@ -129,7 +129,7 @@ fn get_hosted_happ_invoice_details( let happ_name = read_happ_name(&human_readable_note).to_owned(); let InvoiceNote { - hha_id, + hha_id_string, invoice_period_start, invoice_period_end, invoiced_items, @@ -148,6 +148,14 @@ fn get_hosted_happ_invoice_details( } }; + let hha_id = match ActionHashB64::from_b64_str(&hha_id_string) { + Ok(hha_id) => hha_id, + Err(e) => { + warn!("Could not cast the hha_id_string in the invoice note into an ActionHash: {:?}", e); + return None; + } + }; + Some(TransactionAndInvoiceDetails { id, amount, @@ -368,7 +376,7 @@ struct Note(String, InvoiceNote); #[derive(Serialize, Deserialize, Debug)] #[serde(crate = "rocket::serde")] struct InvoiceNote { - hha_id: ActionHashB64, + hha_id_string: String, invoice_period_start: Timestamp, invoice_period_end: Timestamp, #[serde(flatten)]