Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
* StripePI: Add support for multicapture [mjdonga] #5491
* Normalize API Version for Plexo, Pin, Priority [adarsh-spreedly] #5517
* Stripe PI: Update API version [almalee24] #5360
* TNS/TransFirstTransactionExpress/USA EPAY: Normalize API_VERSION usage [sumit-sharmas] #5516

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
Expand Down
10 changes: 5 additions & 5 deletions lib/active_merchant/billing/gateways/tns.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ class TnsGateway < Gateway

class_attribute :live_na_url, :live_ap_url, :live_eu_url, :test_na_url, :test_ap_url, :test_eu_url

VERSION = '52'
version '52'

self.live_na_url = "https://secure.na.tnspayments.com/api/rest/version/#{VERSION}/"
self.live_ap_url = "https://secure.ap.tnspayments.com/api/rest/version/#{VERSION}/"
self.live_eu_url = "https://secure.eu.tnspayments.com/api/rest/version/#{VERSION}/"
self.live_na_url = "https://secure.na.tnspayments.com/api/rest/version/#{fetch_version}/"
self.live_ap_url = "https://secure.ap.tnspayments.com/api/rest/version/#{fetch_version}/"
self.live_eu_url = "https://secure.eu.tnspayments.com/api/rest/version/#{fetch_version}/"

self.test_url = "https://secure.uat.tnspayments.com/api/rest/version/#{VERSION}/"
self.test_url = "https://secure.uat.tnspayments.com/api/rest/version/#{fetch_version}/"

self.display_name = 'TNS'
self.homepage_url = 'http://www.tnsi.com/'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,20 @@
module ActiveMerchant # :nodoc:
module Billing # :nodoc:
class TransFirstTransactionExpressGateway < Gateway
version 'v1'

self.display_name = 'TransFirst Transaction Express'
self.homepage_url = 'http://transactionexpress.com/'

self.test_url = 'https://ws.cert.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl'
self.live_url = 'https://ws.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl'
self.test_url = "https://ws.cert.transactionexpress.com/portal/merchantframework/MerchantWebServices-#{fetch_version}?wsdl"
self.live_url = "https://ws.transactionexpress.com/portal/merchantframework/MerchantWebServices-#{fetch_version}?wsdl"

self.supported_countries = ['US']
self.default_currency = 'USD'
self.money_format = :cents
self.supported_cardtypes = %i[visa master american_express discover diners_club]

V1_NAMESPACE = 'http://postilion/realtime/merchantframework/xsd/v1/'
V1_NAMESPACE = "http://postilion/realtime/merchantframework/xsd/#{fetch_version}/"
SOAPENV_NAMESPACE = 'http://schemas.xmlsoap.org/soap/envelope/'
AUTHORIZATION_FIELD_SEPARATOR = '|'

Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/usa_epay_advanced.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module Billing # :nodoc:
# * {USA ePay Developer Login}[https://www.usaepay.com/developer/login]
#
class UsaEpayAdvancedGateway < Gateway
API_VERSION = '1.4'
version '1.4'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adarsh-spreedly yes, it is not used anywhere.


TEST_URL_BASE = 'https://sandbox.usaepay.com/soap/gate/' # :nodoc:
LIVE_URL_BASE = 'https://www.usaepay.com/soap/gate/' # :nodoc:
Expand Down
11 changes: 11 additions & 0 deletions test/unit/gateways/tns_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def setup
}
end

def test_api_version
assert_equal '52', @gateway.fetch_version
end

def test_successful_purchase
@gateway.expects(:ssl_request).twice.returns(successful_authorize_response).then.returns(successful_capture_response)

Expand Down Expand Up @@ -178,6 +182,13 @@ def test_scrub
assert_equal @gateway.scrub(pre_scrubbed), post_scrubbed
end

def test_url
assert_equal 'https://secure.na.tnspayments.com/api/rest/version/52/', @gateway.live_na_url
assert_equal 'https://secure.ap.tnspayments.com/api/rest/version/52/', @gateway.live_ap_url
assert_equal 'https://secure.eu.tnspayments.com/api/rest/version/52/', @gateway.live_eu_url
assert_equal 'https://secure.uat.tnspayments.com/api/rest/version/52/', @gateway.test_url
end

private

def pre_scrubbed
Expand Down
9 changes: 9 additions & 0 deletions test/unit/gateways/trans_first_transaction_express_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ def setup
@declined_amount = 21
end

def test_api_version
assert_equal 'v1', @gateway.fetch_version
end

def test_successful_purchase
response = stub_comms do
@gateway.purchase(@amount, @credit_card)
Expand Down Expand Up @@ -274,6 +278,11 @@ def test_account_number_scrubbing
assert_equal post_scrubbed_account_number, @gateway.scrub(pre_scrubbed_account_number)
end

def test_url
assert_equal 'https://ws.cert.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl', @gateway.test_url
assert_equal 'https://ws.transactionexpress.com/portal/merchantframework/MerchantWebServices-v1?wsdl', @gateway.live_url
end

private

def successful_purchase_response
Expand Down
4 changes: 4 additions & 0 deletions test/unit/gateways/usa_epay_advanced_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def setup

# Standard Gateway ==================================================

def test_api_version
assert_equal '1.4', @gateway.fetch_version
end

def test_successful_purchase
@gateway.expects(:ssl_post).returns(successful_purchase_response)
assert response = @gateway.purchase(1234, @credit_card, @options)
Expand Down