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

Adyen: Fix adding phone from billing address #3179

Closed
Closed
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/active_merchant/billing/gateways/adyen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def scrub(transcript)
}

def add_extra_data(post, payment, options)
post[:telephoneNumber] = options[:billing_address][:phone] if options[:billing_address][:phone]
Copy link
Contributor

@molbrown molbrown Mar 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this simplify by using:
post[:telephoneNumber] = options[:billing_address][:phone] if options.dig( :billing_address, :phone)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Updated.

post[:telephoneNumber] = options[:billing_address][:phone] if options.dig(:billing_address, :phone)
post[:shopperEmail] = options[:shopper_email] if options[:shopper_email]
post[:shopperIP] = options[:shopper_ip] if options[:shopper_ip]
post[:shopperReference] = options[:shopper_reference] if options[:shopper_reference]
Expand Down
14 changes: 14 additions & 0 deletions test/remote/gateways/remote_adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ def test_successful_authorize_with_3ds_dynamic_rule_broken
assert_equal response.params['resultCode'], 'Authorised'
end

def test_successful_authorize_with_no_address
options = {
reference: '345123',
shopper_email: '[email protected]',
shopper_ip: '77.110.174.153',
shopper_reference: 'John Smith',
order_id: '123',
recurring_processing_model: 'CardOnFile'
}
response = @gateway.authorize(@amount, @credit_card, options)
assert_success response
assert_equal 'Authorised', response.message
end

def test_failed_authorize
response = @gateway.authorize(@amount, @declined_card, @options)
assert_failure response
Expand Down