Skip to content

Commit

Permalink
[API] Remove support for passing return_items_attributes in API as ha…
Browse files Browse the repository at this point in the history
…sh of hashes

Ref solidusio#4007
  • Loading branch information
kennyadsl committed Apr 14, 2023
1 parent e313ae3 commit d6ae667
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
8 changes: 0 additions & 8 deletions api/app/controllers/spree/api/customer_returns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,6 @@ def build_customer_return
return_items_params = customer_return_attributes.
delete(:return_items_attributes)

if return_items_params.is_a? ActionController::Parameters
return_items_params = return_items_params.values
Spree::Deprecation.warn(
"Passing `return_items_attributes` as a hash of hashes is \
deprecated and will be removed in future versions of Solidus."
)
end

@customer_return = CustomerReturn.new(customer_return_attributes)

@customer_return.return_items = return_items_params.map do |item_params|
Expand Down
29 changes: 0 additions & 29 deletions api/spec/requests/spree/api/customer_returns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,35 +172,6 @@ module Spree::Api
from("awaiting")
end

context "and return items attributes passed in as a hash of hashes" do
let(:customer_return_params) do
{
stock_location_id: stock_location.id,
return_items_attributes: {
"0" => return_item.attributes
}
}
end

it "can create a new customer return" do
expect(Spree::Deprecation).to receive(:warn)
expect { subject }.to change { Spree::CustomerReturn.count }.
from(0).to(1)

expect(response).to have_http_status(:success)
expect(json_response).to have_attributes(attributes)
end

it "logs a deprecation warning" do
expect(Spree::Deprecation).
to receive(:warn).
with(
/Passing `return_items_attributes` as a hash of hashes is deprecated/
)
subject
end
end

context "with reception_status_event provided for return item" do
let(:customer_return_params) do
{
Expand Down

0 comments on commit d6ae667

Please sign in to comment.