Skip to content

Commit

Permalink
render null shipment when shipment adjustment doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
abdellani committed Oct 30, 2023
1 parent 23a56d3 commit 6d0f7d7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/models/invoice/data_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,15 @@ def shipment_adjustment

# contains limited information about the shipment
def shipment
shipment_adjustment.adjustable
shipment_adjustment&.adjustable || null_shipment
end

def null_shipment
Struct.new(
:amount,
:included_tax_total,
:additional_tax_total,
).new(0, 0, 0)
end

def display_shipment_amount_without_taxes
Expand Down

0 comments on commit 6d0f7d7

Please sign in to comment.