Skip to content

Commit

Permalink
Payeezy change method on capture (#4684)
Browse files Browse the repository at this point in the history
For Apple Pay transactions, the value for `method` is set to `3DS`, but
when executing a `capture`, this value should be changed to
`credit_card`.

This differs from other use cases where the value provided on auth
transactions should be the same one given for capture.

Unit: 45 tests, 206 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

46 tests, 184 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
naashton authored Jan 20, 2023
1 parent ac06be7 commit f6e3f6c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/active_merchant/billing/gateways/payeezy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def amount_from_authorization(authorization)
def add_authorization_info(params, authorization, options = {})
transaction_id, transaction_tag, method, = authorization.split('|')
params[:method] = method == 'token' ? 'credit_card' : method
# If the previous transaction `method` value was 3DS, it needs to be set to `credit_card` on follow up transactions
params[:method] = 'credit_card' if method == '3DS'

if options[:reversal_id]
params[:reversal_id] = options[:reversal_id]
Expand Down
8 changes: 8 additions & 0 deletions test/remote/gateways/remote_payeezy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def test_successful_purchase_with_apple_pay
assert_success response
end

def test_successful_authorize_and_capture_with_apple_pay
assert auth = @gateway.authorize(@amount, @apple_pay_card, @options)
assert_success auth

assert capture = @gateway.capture(@amount, auth.authorization)
assert_success capture
end

def test_successful_purchase_with_echeck
options = @options.merge({ customer_id_type: '1', customer_id_number: '1', client_email: 'test@example.com' })
assert response = @gateway.purchase(@amount, @check, options)
Expand Down

0 comments on commit f6e3f6c

Please sign in to comment.