Skip to content

Commit

Permalink
Remove deprecated Spree::Order#finalize!
Browse files Browse the repository at this point in the history
Please, use Spree::Order#complete! now.

Ref solidusio#4260
  • Loading branch information
kennyadsl committed Mar 21, 2023
1 parent e4ebbe4 commit 7872fa5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
12 changes: 0 additions & 12 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -395,18 +395,6 @@ def valid_credit_cards
Spree::CreditCard.where(id: credit_card_ids)
end

# TODO: Remove on Solidus 4.0
# @api private
def finalize!
Spree::Deprecation.warn <<~MSG
Calling `Spree::Order#finalize!` is discouraged. Instead, use
`Spree::Order#complete!`, which goes through all the needed safety
checks before finalizing an order. This method will be removed
altogether on Solidus 4.0.
MSG
finalize
end

def fulfill!
shipments.each { |shipment| shipment.update_state if shipment.persisted? }
updater.update_shipment_state
Expand Down
12 changes: 0 additions & 12 deletions core/spec/models/spree/order/finalizing_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,4 @@
end
end
end

context '#finalize!' do
it 'deprecates method and goes ahead' do
order = create(:order_ready_to_complete)

expect(Spree::Deprecation).to receive(:warn).with(/discouraged/)

order.finalize!

expect(order.state).to eq("confirm")
end
end
end

0 comments on commit 7872fa5

Please sign in to comment.