Skip to content

Commit

Permalink
Fix yaml deserialisation of invoice note (#50)
Browse files Browse the repository at this point in the history
* Invoice note hha_id as string and handled later

* fix var naming
  • Loading branch information
alastairong1 authored and zo-el committed Aug 23, 2024
1 parent 4e33200 commit 3fc00d1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/routes/host/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,14 @@ fn get_hosted_happ_invoice_details(
}
};

let hha_id_holohash = match ActionHashB64::from_b64_str(&hha_id) {
Ok(hha_id_holohash) => hha_id_holohash,
Err(e) => {
warn!("Could not cast the hha_id_string in the invoice note into an ActionHash: {:?}", e);
return None;
}
};

Some(TransactionAndInvoiceDetails {
id,
amount,
Expand All @@ -163,7 +171,7 @@ fn get_hosted_happ_invoice_details(
url,
happ: HappNameAndId {
name: happ_name,
id: hha_id,
id: hha_id_holohash,
},
invoice_details: InvoiceDetails {
start: invoice_period_start,
Expand Down Expand Up @@ -368,7 +376,7 @@ struct Note(String, InvoiceNote);
#[derive(Serialize, Deserialize, Debug)]
#[serde(crate = "rocket::serde")]
struct InvoiceNote {
hha_id: ActionHashB64,
hha_id: String, // Would prefer to rename this but the invoice note strings already have this as hha_id
invoice_period_start: Timestamp,
invoice_period_end: Timestamp,
#[serde(flatten)]
Expand Down

0 comments on commit 3fc00d1

Please sign in to comment.