Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preferred_reimbursement_type_id as permitted attributes for ReturnAuthorization #3215

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,21 @@ module Spree
it "can create a new return authorization" do
stock_location = FactoryBot.create(:stock_location)
reason = FactoryBot.create(:return_reason)
reimbursement = FactoryBot.create(:reimbursement_type)
unit = FactoryBot.create(:inventory_unit)
rma_params = { stock_location_id: stock_location.id,
return_reason_id: reason.id,
return_items_attributes: [{
inventory_unit_id: unit.id,
preferred_reimbursement_type_id: reimbursement.id,
}],
ibudiallo marked this conversation as resolved.
Show resolved Hide resolved
memo: "Defective" }
post spree.api_order_return_authorizations_path(order), params: { order_id: order.number, return_authorization: rma_params }
expect(response.status).to eq(201)
expect(json_response).to have_attributes(attributes)
expect(json_response["state"]).not_to be_blank
return_authorization = Spree::ReturnAuthorization.last
expect(return_authorization.return_items.first.preferred_reimbursement_type).to eql reimbursement
end
end

Expand Down
2 changes: 1 addition & 1 deletion core/lib/spree/permitted_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ module PermittedAttributes

@@property_attributes = [:name, :presentation]

@@return_authorization_attributes = [:memo, :stock_location_id, :return_reason_id, return_items_attributes: [:inventory_unit_id, :exchange_variant_id, :return_reason_id]]
@@return_authorization_attributes = [:memo, :stock_location_id, :return_reason_id, return_items_attributes: [:inventory_unit_id, :exchange_variant_id, :return_reason_id, :preferred_reimbursement_type_id]]

@@shipment_attributes = [
:special_instructions, :stock_location_id, :id, :tracking,
Expand Down