From 7e271a7c4cce4bd3b30241095aeb76933f186001 Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Mon, 27 Mar 2023 14:26:05 +0200 Subject: [PATCH] Remove support for passing return_items_attributes in API as hash of hashes Ref https://github.com/solidusio/solidus/pull/4007 --- .../spree/api/customer_returns_controller.rb | 8 ----- .../spree/api/customer_returns_spec.rb | 29 ------------------- 2 files changed, 37 deletions(-) diff --git a/api/app/controllers/spree/api/customer_returns_controller.rb b/api/app/controllers/spree/api/customer_returns_controller.rb index 9bbaeaf73d3..6999c44aade 100644 --- a/api/app/controllers/spree/api/customer_returns_controller.rb +++ b/api/app/controllers/spree/api/customer_returns_controller.rb @@ -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| diff --git a/api/spec/requests/spree/api/customer_returns_spec.rb b/api/spec/requests/spree/api/customer_returns_spec.rb index 4f5e043b87d..c9fe4584d4e 100644 --- a/api/spec/requests/spree/api/customer_returns_spec.rb +++ b/api/spec/requests/spree/api/customer_returns_spec.rb @@ -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 {