From 62378da253f1e836da63229a1826c8566514c009 Mon Sep 17 00:00:00 2001 From: Alma Malambo Date: Tue, 28 Jan 2025 17:27:31 +0200 Subject: [PATCH] Cashnet: Update max_retries to 1 Updating maxx_retries to 1 ensures that retries are not attempt which was the original purpose of setting max_retries in this gateway Remote 8 tests, 36 assertions, 2 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 75% passed --- CHANGELOG | 1 + lib/active_merchant/billing/gateways/cashnet.rb | 2 +- test/unit/gateways/cashnet_test.rb | 9 +++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index b9d4a23155f..9a6b0e2fd4b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -122,6 +122,7 @@ * Worldpay: Update passing 3DS data for NT [almalee24] #5389 * Ebanx: Add the merchant_payment_code override [yunnydang] #5394 * Credorax: Add AFT fields [yunnydang] #5390 +* Cashnet: Update max_retries to 1 [almalee24] #5393 == Version 1.137.0 (August 2, 2024) * Unlock dependency on `rexml` to allow fixing a CVE (#5181). diff --git a/lib/active_merchant/billing/gateways/cashnet.rb b/lib/active_merchant/billing/gateways/cashnet.rb index 3d232aedb35..64fe12d7c2d 100644 --- a/lib/active_merchant/billing/gateways/cashnet.rb +++ b/lib/active_merchant/billing/gateways/cashnet.rb @@ -11,7 +11,7 @@ class CashnetGateway < Gateway self.homepage_url = 'https://transactcampus.com' self.display_name = 'Cashnet' self.money_format = :dollars - self.max_retries = 0 + self.max_retries = 1 # Creates a new CashnetGateway # diff --git a/test/unit/gateways/cashnet_test.rb b/test/unit/gateways/cashnet_test.rb index 7aeee072c3a..c1706a51dd8 100644 --- a/test/unit/gateways/cashnet_test.rb +++ b/test/unit/gateways/cashnet_test.rb @@ -175,6 +175,15 @@ def test_scrub assert_equal @gateway.scrub(pre_scrubbed), post_scrubbed end + def test_preventing_retries + Net::HTTP.any_instance. + expects(:request). + raises(Errno::ECONNREFUSED) + + error = assert_raises(ActiveMerchant::ConnectionError) { @gateway.purchase(@amount, @credit_card) } + assert_equal 'The remote server refused the connection', error.message + end + private def expected_expiration_date