Skip to content
This repository has been archived by the owner on Mar 10, 2023. It is now read-only.

Add country to list of known attributes #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/samurai/payment_method.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def process_response_errors

# Setup the PaymentMethod schema for ActiveResource, so that new objects contain empty attributes
KNOWN_ATTRIBUTES = [
:first_name, :last_name, :address_1, :address_2, :city, :state, :zip,
:first_name, :last_name, :address_1, :address_2, :city, :state, :zip, :country,
:card_number, :cvv, :expiry_month, :expiry_year, :sandbox, :custom
]
include Samurai::ActiveResourceSupport
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/payment_method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
:address_2 => "Apt #3X",
:city => "ChicagoX",
:state => "IL",
:country => "US",
:zip => "10101",
:card_number => "5454-5454-5454-5454",
:cvv => "456",
Expand All @@ -133,6 +134,7 @@
pm.city.should == @params[:city]
pm.state.should == @params[:state]
pm.zip.should == @params[:zip]
pm.country.should == @params[:country]
pm.last_four_digits.should == @params[:card_number][-4, 4]
pm.expiry_month.should == @params[:expiry_month].to_i
pm.expiry_year.should == @params[:expiry_year].to_i
Expand All @@ -154,6 +156,7 @@
pm.city.should == @params[:city]
pm.state.should == @params[:state]
pm.zip.should == @params[:zip]
pm.country.should == @params[:country]
pm.last_four_digits.should == '1111'
pm.expiry_month.should == @params[:expiry_month].to_i
pm.expiry_year.should == @params[:expiry_year].to_i
Expand Down Expand Up @@ -233,6 +236,7 @@
pm.city.should == @params[:city]
pm.state.should == @params[:state]
pm.zip.should == @params[:zip]
pm.country.should == @params[:country]
pm.last_four_digits.should == @params[:card_number][-4, 4]
pm.expiry_month.should == @params[:expiry_month].to_i
pm.expiry_year.should == @params[:expiry_year].to_i
Expand Down Expand Up @@ -263,6 +267,7 @@
pm.city.should == @params[:city]
pm.state.should == @params[:state]
pm.zip.should == @params[:zip]
pm.country.should == @params[:country]
pm.last_four_digits.should == @params[:card_number][-4, 4]
pm.expiry_month.should == @params[:expiry_month].to_i
pm.expiry_year.should == @params[:expiry_year].to_i
Expand Down Expand Up @@ -294,6 +299,7 @@
pm.city.should == @params[:city]
pm.state.should == @params[:state]
pm.zip.should == @params[:zip]
pm.country.should == @params[:country]
pm.last_four_digits.should == @params[:card_number][-4, 4]
pm.expiry_month.should == @params[:expiry_month].to_i
pm.expiry_year.should == @params[:expiry_year].to_i
Expand Down
1 change: 1 addition & 0 deletions spec/support/transparent_redirect_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def default_payment_method_params
'credit_card[city]' => 'Chicago',
'credit_card[state]' => 'IL',
'credit_card[zip]' => '10101',
'credit_card[country]' => 'US',
'credit_card[card_number]' => '4111111111111111',
'credit_card[cvv]' => '111',
'credit_card[expiry_month]' => '05',
Expand Down