Skip to content

Commit

Permalink
task: place invoice PaymentMethod at the end
Browse files Browse the repository at this point in the history
  • Loading branch information
d-kuen committed Nov 8, 2023
1 parent 2a734c3 commit caca525
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/invoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,6 @@ impl<'a> Invoice<'a> {
.with_element(self.invoice_recipient.as_xml())
.with_element(self.details.as_xml());

if let Some(payment_method) = &self.payment_method {
match payment_method.as_xml() {
Ok(pm) => {
invoice = invoice.with_element(pm);
}
Err(e) => return Err(e),
}
}

invoice = invoice
.with_element(tax)
.with_text_element(
Expand All @@ -108,6 +99,15 @@ impl<'a> Invoice<'a> {
payable_amount.clone_with_scale(2).to_string(),
);

if let Some(payment_method) = &self.payment_method {
match payment_method.as_xml() {
Ok(pm) => {
invoice = invoice.with_element(pm);
}
Err(e) => return Err(e),
}
}

Ok(format!(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>{}",
invoice.to_string()
Expand Down

0 comments on commit caca525

Please sign in to comment.