Skip to content

Commit

Permalink
Moneris: Update crypt_type for 3DS
Browse files Browse the repository at this point in the history
Update crypt_type to only be one digit by removing leading zero
if present.

Unit:
54 tests, 294 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote:
53 tests, 259 assertions, 0 failures, 0 errors, 0 pendings, 1 omissions, 0 notifications
100% passed
  • Loading branch information
Alma Malambo committed Jul 2, 2024
1 parent a26afd1 commit 84788bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/moneris.rb
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def add_external_mpi_fields(post, options)
three_d_secure_options = options[:three_d_secure]

post[:threeds_version] = three_d_secure_options[:version]
post[:crypt_type] = three_d_secure_options[:eci]
post[:crypt_type] = three_d_secure_options.dig(:eci)&.to_s&.sub!(/^0/, '')
post[:cavv] = three_d_secure_options[:cavv]
post[:threeds_server_trans_id] = three_d_secure_options[:three_ds_server_trans_id]
post[:ds_trans_id] = three_d_secure_options[:ds_transaction_id]
Expand Down
3 changes: 2 additions & 1 deletion test/unit/gateways/moneris_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def setup
@credit_card = credit_card('4242424242424242')

# https://developer.moneris.com/livedemo/3ds2/reference/guide/php
@fully_authenticated_eci = 5
@fully_authenticated_eci = '02'
@no_liability_shift_eci = 7

@options = { order_id: '1', customer: '1', billing_address: address }
Expand Down Expand Up @@ -86,6 +86,7 @@ def test_failed_mpi_cavv_purchase
assert_match(/<ds_trans_id>12345<\/ds_trans_id>/, data)
assert_match(/<threeds_server_trans_id>d0f461f8-960f-40c9-a323-4e43a4e16aaa<\/threeds_server_trans_id>/, data)
assert_match(/<threeds_version>2<\/threeds_version>/, data)
assert_match(/<crypt_type>2<\/crypt_type>/, data)
end.respond_with(failed_cavv_purchase_response)

assert_failure response
Expand Down

0 comments on commit 84788bd

Please sign in to comment.