Skip to content

Commit

Permalink
Adyen: Pass updateShopperStatement, industryUsage
Browse files Browse the repository at this point in the history
Remote:
60 tests, 187 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Unit:
38 tests, 182 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
curiousepic committed May 28, 2019
1 parent b0e2907 commit ab2a09d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Qvalent: Adds support for standard stored credential framework [molbrown] #3227
* Cybersource: Send tokenization data when card is :master [pi3r] #3230
* Bluesnap: Omit state codes for unsupported countries [therufs] #3229
* Adyen: Pass updateShopperStatement, industryUsage [curiousepic] #3233

== Version 1.94.0 (May 21, 2019)
* Mundipagg: Fix number lengths for both VR and Sodexo [dtykocki] #3195
Expand Down
2 changes: 2 additions & 0 deletions lib/active_merchant/billing/gateways/adyen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def add_extra_data(post, payment, options)
post[:additionalData]['paymentdatasource.type'] = NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
post[:additionalData][:authorisationType] = options[:authorisation_type] if options[:authorisation_type]
post[:additionalData][:adjustAuthorisationData] = options[:adjust_authorisation_data] if options[:adjust_authorisation_data]
post[:additionalData][:industryUsage] = options[:industry_usage] if options[:industry_usage]
post[:additionalData][:updateShopperStatement] = options[:update_shopper_statement] if options[:update_shopper_statement]
post[:additionalData][:RequestedTestAcquirerResponseCode] = options[:requested_test_acquirer_response_code] if options[:requested_test_acquirer_response_code] && test?
post[:deviceFingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
add_risk_data(post, options)
Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,10 @@ def test_failed_asynchronous_adjust

# Requires Adyen to set your test account to Synchronous Adjust mode.
def test_successful_synchronous_adjust_using_adjust_data
authorize = @gateway.authorize(@amount, @credit_card, @options.merge(authorisation_type: 'PreAuth'))
authorize = @gateway.authorize(@amount, @credit_card, @options.merge(authorisation_type: 'PreAuth', shopper_statement: 'statement note'))
assert_success authorize

options = @options.merge(adjust_authorisation_data: authorize.params['additionalData']['adjustAuthorisationData'])
options = @options.merge(adjust_authorisation_data: authorize.params['additionalData']['adjustAuthorisationData'], update_shopper_statement: 'new statement note', industry_usage: 'DelayedCharge')
assert adjust = @gateway.adjust(200, authorize.authorization, options)
assert_success adjust
assert_equal 'Authorised', adjust.message
Expand Down
8 changes: 4 additions & 4 deletions test/remote/gateways/remote_blue_snap_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def test_successful_purchase_with_level3_data
def test_successful_purchase_with_unused_state_code
unrecognized_state_code_options = {
billing_address: {
city: "Dresden",
state: "Sachsen",
country: "DE",
zip: "01069"
city: 'Dresden',
state: 'Sachsen',
country: 'DE',
zip: '01069'
}
}

Expand Down
9 changes: 9 additions & 0 deletions test/unit/gateways/adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ def test_custom_routing_sent
end.respond_with(successful_authorize_response)
end

def test_update_shopper_statement_and_industry_usage_sent
stub_comms do
@gateway.adjust(@amount, '123', @options.merge({update_shopper_statement: 'statement note', industry_usage: 'DelayedCharge'}))
end.check_request do |endpoint, data, headers|
assert_equal 'statement note', JSON.parse(data)['additionalData']['updateShopperStatement']
assert_equal 'DelayedCharge', JSON.parse(data)['additionalData']['industryUsage']
end.respond_with(successful_adjust_response)
end

def test_risk_data_sent
stub_comms do
@gateway.authorize(@amount, @credit_card, @options.merge({risk_data: {'operatingSystem' => 'HAL9000'}}))
Expand Down
2 changes: 1 addition & 1 deletion test/unit/gateways/blue_snap_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_successful_purchase_with_unused_state_code
response = @gateway.purchase(@amount, @credit_card, unrecognized_state_code_options)
assert_success response
assert_equal '1021645629', response.authorization
assert_not_includes(response.params, "state")
assert_not_includes(response.params, 'state')
end

def test_successful_echeck_purchase
Expand Down

0 comments on commit ab2a09d

Please sign in to comment.