Skip to content

Commit

Permalink
Update processor tests
Browse files Browse the repository at this point in the history
Incorporate the updates to Credorax to implement 3DS.

Unit:
42 tests, 198 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions,
0 notifications
100% passed

Remote:
27 tests, 78 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions,
0 notifications
100% passed
  • Loading branch information
leila-alderman committed Sep 20, 2019
1 parent 6463c5a commit fdb52be
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
4 changes: 1 addition & 3 deletions lib/active_merchant/billing/gateways/credorax.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ def add_3d_secure(post, options)

def add_3d_secure_1_data(post, options)
post[:i8] = build_i8(options[:eci], options[:cavv], options[:xid])
post[:r1] = 'CREDORAX'
end

def add_normalized_3d_secure_2_data(post, options)
Expand All @@ -319,7 +318,6 @@ def add_normalized_3d_secure_2_data(post, options)
)
post[:'3ds_version'] = three_d_secure_options[:version]
post[:'3ds_dstrxid'] = three_d_secure_options[:ds_transaction_id]
post[:r1] = 'CREDORAX'
end

def build_i8(eci, cavv=nil, xid=nil)
Expand All @@ -341,7 +339,7 @@ def add_transaction_type(post, options)
end

def add_processor(post, options)
post[:r1] = options[:processor] if options[:processor]
post[:r1] = options[:processor] || 'CREDORAX'
post[:r2] = options[:processor_merchant_id] if options[:processor_merchant_id]
end

Expand Down
16 changes: 2 additions & 14 deletions test/remote/gateways/remote_credorax_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ def setup
order_id: '1',
currency: 'EUR',
billing_address: address,
description: 'Store Purchase',
processor: 'TPR',
processor_merchant_id: 'crxtest1'
description: 'Store Purchase'
}
@normalized_3ds_2_options = {
reference: '345123',
Expand Down Expand Up @@ -303,20 +301,10 @@ def test_transcript_scrubbing
assert_cvv_scrubbed(clean_transcript)
end

def test_purchase_passes_processor
# returns a successful response when a valid processor is sent
assert good_response = @gateway.purchase(@amount, @credit_card, @options.merge(fixtures(:credorax_with_processor)))
assert_success good_response
assert_equal 'Succeeded', good_response.message

# returns a failed response when an invalid processor is sent
assert bad_response = @gateway.purchase(@amount, @credit_card, @options.merge(processor: 'invalid'))
assert_failure bad_response
end

def test_purchase_passes_processor
# returns a successful response when a valid processor parameter is sent
assert good_response = @gateway.purchase(@amount, @credit_card, @options.merge(processor: 'CREDORAX', processor_merchant_id: fixtures(:credorax)[:merchant_id]))
assert good_response = @gateway.purchase(@amount, @credit_card, @options.merge(fixtures(:credorax_with_processor)))
assert_success good_response
assert_equal 'Succeeded', good_response.message

Expand Down

0 comments on commit fdb52be

Please sign in to comment.