Skip to content

Commit

Permalink
Iveri: Add AuthReversal for Authorizations
Browse files Browse the repository at this point in the history
If the transaction to be voided is an Authorization then
use AuthReversal instead of Void.

Remote
22 tests, 56 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
95.4545% passed

Unit
16 tests, 67 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
Alma Malambo committed Aug 21, 2024
1 parent 8e14454 commit 89ddf53
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* Decidir: Pass CVV for NT [almalee24] #5205
* NMI: Add customer vault fields [yunnydang] #5215
* CheckoutV2: Add inquire method [almalee24] #5209
* Iveri: Add AuthReversal for Authorizations [almalee24] #5201

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
5 changes: 3 additions & 2 deletions lib/active_merchant/billing/gateways/iveri.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def refund(money, authorization, options = {})
end

def void(authorization, options = {})
post = build_vxml_request('Void', options) do |xml|
txn_type = options[:reference_type] == :authorize ? 'AuthReversal' : 'Void'
post = build_vxml_request(txn_type, options) do |xml|
add_authorization(xml, authorization, options)
end

Expand All @@ -65,7 +66,7 @@ def void(authorization, options = {})
def verify(credit_card, options = {})
MultiResponse.run(:use_first_response) do |r|
r.process { authorize(100, credit_card, options) }
r.process(:ignore_result) { void(r.authorization, options) }
r.process(:ignore_result) { void(r.authorization, options.merge(reference_type: :authorize)) }
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/remote/gateways/remote_iveri_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def test_successful_verify
assert_success response
assert_equal 'Authorisation', response.responses[0].params['transaction_command']
assert_equal '0', response.responses[0].params['result_status']
assert_equal 'Void', response.responses[1].params['transaction_command']
assert_equal '0', response.responses[1].params['result_status']
assert_equal 'AuthReversal', response.responses[1].params['transaction_command']
assert_equal '-1', response.responses[1].params['result_status']
assert_equal 'Succeeded', response.message
end

Expand Down

0 comments on commit 89ddf53

Please sign in to comment.