Skip to content

Commit

Permalink
CheckoutV2: Add inquire method
Browse files Browse the repository at this point in the history
113 tests, 280 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
99.115% passed
  • Loading branch information
Alma Malambo committed Aug 19, 2024
1 parent 59545a5 commit 8e14454
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* Braintree: Support override_application_id [aenand] #5194
* Decidir: Pass CVV for NT [almalee24] #5205
* NMI: Add customer vault fields [yunnydang] #5215
* CheckoutV2: Add inquire method [almalee24] #5209

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
4 changes: 4 additions & 0 deletions lib/active_merchant/billing/gateways/checkout_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ def verify(credit_card, options = {})
authorize(0, credit_card, options)
end

def inquire(authorization, options = {})
verify_payment(authorization, {})
end

def verify_payment(authorization, options = {})
commit(:verify_payment, nil, options, authorization, :get)
end
Expand Down
16 changes: 16 additions & 0 deletions test/remote/gateways/remote_checkout_v2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,22 @@ def test_successful_purchase
assert_equal 'Succeeded', response.message
end

def test_successful_inquire
response = @gateway.purchase(@amount, @credit_card, @options)
assert_success response
assert_equal 'Succeeded', response.message

response = @gateway.inquire(response.authorization, {})
assert_success response
assert_equal 'Succeeded', response.message
end

def test_unsuccessful_inquire
response = @gateway.inquire('123EDSE', {})
assert_failure response
assert_equal '404: Not Found', response.message
end

def test_successful_purchase_via_oauth
response = @gateway_oauth.purchase(@amount, @credit_card, @options)
assert_success response
Expand Down

0 comments on commit 8e14454

Please sign in to comment.