From 963a9bbc932cdbec0cfdf8f1763afd8bc7004a9e Mon Sep 17 00:00:00 2001 From: Alberto Vena Date: Thu, 16 Jul 2020 09:37:32 +0200 Subject: [PATCH] Permit passing an address via payment source parameters This is a complementary commit for the last security fix. Bill address can be passed as params when submitting a new source. This also resumes a spec that was removed a while ago and apparently it was the only one testing this feature. --- core/lib/spree/permitted_attributes.rb | 2 +- frontend/spec/features/checkout_spec.rb | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/lib/spree/permitted_attributes.rb b/core/lib/spree/permitted_attributes.rb index 55ad36780ce..755cb0d4ea9 100644 --- a/core/lib/spree/permitted_attributes.rb +++ b/core/lib/spree/permitted_attributes.rb @@ -90,7 +90,7 @@ module PermittedAttributes :number, :month, :year, :expiry, :verification_value, :first_name, :last_name, :cc_type, :gateway_customer_profile_id, :gateway_payment_profile_id, :last_digits, :name, :encrypted_data, - :existing_card_id, :wallet_payment_source_id + :existing_card_id, :wallet_payment_source_id, address_attributes: address_attributes ] @@stock_item_attributes = [:variant, :stock_location, :backorderable, :variant_id] diff --git a/frontend/spec/features/checkout_spec.rb b/frontend/spec/features/checkout_spec.rb index e541662dfb5..a463a11e64c 100644 --- a/frontend/spec/features/checkout_spec.rb +++ b/frontend/spec/features/checkout_spec.rb @@ -374,6 +374,14 @@ expect(page).to have_current_path(spree.order_path(Spree::Order.last)) expect(page).to have_content('Ending in 1111') end + + it "allows user to save a billing address associated to the credit card" do + choose "use_existing_card_no" + fill_in_credit_card + + click_on "Save and Continue" + expect(Spree::CreditCard.last.address).to be_present + end end # regression for https://github.com/spree/spree/issues/2921