Skip to content

Commit

Permalink
add preferred_reimbursement_type_id as permitted attributes for the api
Browse files Browse the repository at this point in the history
  • Loading branch information
ibudiallo committed Jun 25, 2019
1 parent 9ae2ed1 commit 5b7f5ee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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,
}],
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

0 comments on commit 5b7f5ee

Please sign in to comment.