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 6959b63
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 do
def amount; 0 end
def included_tax_total; 0 end
def additional_tax_total; 0 end
end
end

def display_shipment_amount_without_taxes
Expand Down

0 comments on commit 6959b63

Please sign in to comment.