From 8adb53490998eaa18311980f8e7d41ca08faf3ef Mon Sep 17 00:00:00 2001 From: naashton Date: Thu, 19 Jan 2023 18:59:21 -0500 Subject: [PATCH] Payeezy change `method` on capture 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 --- lib/active_merchant/billing/gateways/payeezy.rb | 2 ++ test/remote/gateways/remote_payeezy_test.rb | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/lib/active_merchant/billing/gateways/payeezy.rb b/lib/active_merchant/billing/gateways/payeezy.rb index b27eb7edac2..b961ee62925 100644 --- a/lib/active_merchant/billing/gateways/payeezy.rb +++ b/lib/active_merchant/billing/gateways/payeezy.rb @@ -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] diff --git a/test/remote/gateways/remote_payeezy_test.rb b/test/remote/gateways/remote_payeezy_test.rb index ebe148841a8..fc9b60877e4 100644 --- a/test/remote/gateways/remote_payeezy_test.rb +++ b/test/remote/gateways/remote_payeezy_test.rb @@ -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)