Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update required Ruby version #4823

Merged
merged 2 commits into from
Jul 25, 2023
Merged
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
2 changes: 0 additions & 2 deletions .github/workflows/ruby-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
strategy:
matrix:
version:
- 2.5
- 2.6
- 2.7
gemfile:
- gemfiles/Gemfile.rails50
Expand Down
4 changes: 2 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ AllCops:
- "lib/active_merchant/billing/gateways/paypal_express.rb"
- "vendor/**/*"
ExtraDetails: false
TargetRubyVersion: 2.5
TargetRubyVersion: 2.7

# Active Merchant gateways are not amenable to length restrictions
Metrics/ClassLength:
Expand All @@ -33,7 +33,7 @@ Layout/DotPosition:
Layout/CaseIndentation:
EnforcedStyle: end

Layout/IndentHash:
Layout/IndentFirstHashElement:
EnforcedStyle: consistent

Naming/PredicateName:
Expand Down
7 changes: 5 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
= ActiveMerchant CHANGELOG

== HEAD
* Paysafe: Map order_id to merchantRefNum [jcreiff] #4839
* Stripe PI: Gate sending NTID [almalee24] #4828

== Version 1.134.0 (July 25, 2023)
* Update required Ruby version [almalee24] #4823

== Version 1.133.0 (July 20, 2023)
* CyberSource: remove credentials from tests [bbraschi] #4836
* Paysafe: Map order_id to merchantRefNum [jcreiff] #4839
* Stripe PI: Gate sending NTID [almalee24] #4828

== Version 1.132.0 (July 20, 2023)
* Stripe Payment Intents: Add support for new card on file field [aenand] #4807
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'
gemspec

gem 'jruby-openssl', platforms: :jruby
gem 'rubocop', '~> 0.62.0', require: false
gem 'rubocop', '~> 0.72.0', require: false

group :test, :remote_test do
# gateway-specific dependencies, keeping these gems out of the gemspec
Expand Down
2 changes: 1 addition & 1 deletion activemerchant.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Gem::Specification.new do |s|
s.email = '[email protected]'
s.homepage = 'http://activemerchant.org/'

s.required_ruby_version = '>= 2.5'
s.required_ruby_version = '>= 2.7'

s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'lib/**/*', 'vendor/**/*']
s.require_path = 'lib'
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
machine:
ruby:
version: '2.5.0'
version: '2.7.0'

dependencies:
cache_directories:
Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module Billing #:nodoc:
# You may use Check in place of CreditCard with any gateway that supports it.
class Check < Model
attr_accessor :first_name, :last_name,
:bank_name, :routing_number, :account_number,
:account_holder_type, :account_type, :number
:bank_name, :routing_number, :account_number,
:account_holder_type, :account_type, :number

# Used for Canadian bank accounts
attr_accessor :institution_number, :transit_number
Expand Down
4 changes: 3 additions & 1 deletion lib/active_merchant/billing/gateways/airwallex.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ def setup_access_token

def build_request_url(action, id = nil)
base_url = (test? ? test_url : live_url)
base_url + ENDPOINTS[action].to_s % { id: id }
endpoint = ENDPOINTS[action].to_s
endpoint = id.present? ? endpoint % { id: id } : endpoint
base_url + endpoint
end

def add_referrer_data(post)
Expand Down
4 changes: 2 additions & 2 deletions lib/active_merchant/billing/gateways/alelo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ def ensure_credentials(try_again = true)
access_token: access_token,
multiresp: multiresp.responses.present? ? multiresp : nil
}
rescue ResponseError => error
rescue ResponseError => e
# retry to generate a new access_token when the provided one is expired
raise error unless try_again && %w(401 404).include?(error.response.code) && @options[:access_token].present?
raise e unless try_again && %w(401 404).include?(e.response.code) && @options[:access_token].present?

@options.delete(:access_token)
@options.delete(:encryption_key)
Expand Down
8 changes: 6 additions & 2 deletions lib/active_merchant/billing/gateways/authorize_net_arb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,13 @@ def recurring_commit(action, request)
test_mode = test? || message =~ /Test Mode/
success = response[:result_code] == 'Ok'

Response.new(success, message, response,
Response.new(
success,
message,
response,
test: test_mode,
authorization: response[:subscription_id])
authorization: response[:subscription_id]
)
end

def recurring_parse(action, xml)
Expand Down
8 changes: 6 additions & 2 deletions lib/active_merchant/billing/gateways/axcessms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ def commit(paymentcode, money, payment, options)
message = "#{response[:reason]} - #{response[:return]}"
authorization = response[:unique_id]

Response.new(success, message, response,
Response.new(
success,
message,
response,
authorization: authorization,
test: (response[:mode] != 'LIVE'))
test: (response[:mode] != 'LIVE')
)
end

def parse(body)
Expand Down
6 changes: 4 additions & 2 deletions lib/active_merchant/billing/gateways/banwire.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,13 @@ def commit(money, parameters)
response = json_error(raw_response)
end

Response.new(success?(response),
Response.new(
success?(response),
response['message'],
response,
test: test?,
authorization: response['code_auth'])
authorization: response['code_auth']
)
end

def success?(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,15 @@ def recurring_commit(params)
def post(data, use_profile_api = nil)
response = parse(ssl_post((use_profile_api ? SECURE_PROFILE_URL : self.live_url), data))
response[:customer_vault_id] = response[:customerCode] if response[:customerCode]
build_response(success?(response), message_from(response), response,
build_response(
success?(response),
message_from(response),
response,
test: test? || response[:authCode] == 'TEST',
authorization: authorization_from(response),
cvv_result: CVD_CODES[response[:cvdId]],
avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] })
avs_result: { code: AVS_CODES.include?(response[:avsId]) ? AVS_CODES[response[:avsId]] : response[:avsId] }
)
end

def recurring_post(data)
Expand Down
16 changes: 12 additions & 4 deletions lib/active_merchant/billing/gateways/blue_pay.rb
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,13 @@ def parse_recurring(response_fields, opts = {}) # expected status?
success = parsed[:status] != 'error'
message = parsed[:status]

Response.new(success, message, parsed,
Response.new(
success,
message,
parsed,
test: test?,
authorization: parsed[:rebill_id])
authorization: parsed[:rebill_id]
)
end

def parse(body)
Expand All @@ -364,11 +368,15 @@ def parse(body)
# normalize message
message = message_from(parsed)
success = parsed[:response_code] == '1'
Response.new(success, message, parsed,
Response.new(
success,
message,
parsed,
test: test?,
authorization: (parsed[:rebid] && parsed[:rebid] != '' ? parsed[:rebid] : parsed[:transaction_id]),
avs_result: { code: parsed[:avs_result_code] },
cvv_result: parsed[:card_code])
cvv_result: parsed[:card_code]
)
end

def message_from(parsed)
Expand Down
31 changes: 21 additions & 10 deletions lib/active_merchant/billing/gateways/braintree_blue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,20 @@ def update(vault_id, creditcard, options = {})
}
}, options)[:credit_card]

result = @braintree_gateway.customer.update(vault_id,
result = @braintree_gateway.customer.update(
vault_id,
first_name: creditcard.first_name,
last_name: creditcard.last_name,
email: scrub_email(options[:email]),
phone: phone_from(options),
credit_card: credit_card_params)
Response.new(result.success?, message_from_result(result),
credit_card: credit_card_params
)
Response.new(
result.success?,
message_from_result(result),
braintree_customer: (customer_hash(@braintree_gateway.customer.find(vault_id), :include_credit_cards) if result.success?),
customer_vault_id: (result.customer.id if result.success?))
customer_vault_id: (result.customer.id if result.success?)
)
end
end

Expand Down Expand Up @@ -271,13 +276,16 @@ def add_customer_with_credit_card(creditcard, options)
device_data: options[:device_data]
}.merge credit_card_params
result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
Response.new(result.success?, message_from_result(result),
Response.new(
result.success?,
message_from_result(result),
{
braintree_customer: (customer_hash(result.customer, :include_credit_cards) if result.success?),
customer_vault_id: (result.customer.id if result.success?),
credit_card_token: (result.customer.credit_cards[0].token if result.success?)
},
authorization: (result.customer.id if result.success?))
authorization: (result.customer.id if result.success?)
)
end
end

Expand Down Expand Up @@ -371,8 +379,8 @@ def map_address(address)

def commit(&block)
yield
rescue Braintree::BraintreeError => ex
Response.new(false, ex.class.to_s)
rescue Braintree::BraintreeError => e
Response.new(false, e.class.to_s)
end

def message_from_result(result)
Expand Down Expand Up @@ -901,13 +909,16 @@ def add_bank_account_to_customer(payment_method, options)
message = message_from_result(result)
message = not_verified_reason(result.payment_method) unless verified

Response.new(verified, message,
Response.new(
verified,
message,
{
customer_vault_id: options[:customer],
bank_account_token: result.payment_method&.token,
verified: verified
},
authorization: result.payment_method&.token)
authorization: result.payment_method&.token
)
end

def not_verified_reason(bank_account)
Expand Down
7 changes: 5 additions & 2 deletions lib/active_merchant/billing/gateways/card_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,12 @@ def store(payment, options = {})

def unstore(authorization, options = {})
account_id, profile_id = authorization.split('|')
commit('profile', {},
commit(
'profile',
{},
verb: :delete,
path: "/#{profile_id}/#{account_id}/#{@options[:merchant_id]}")
path: "/#{profile_id}/#{account_id}/#{@options[:merchant_id]}"
)
end

def supports_scrubbing?
Expand Down
8 changes: 6 additions & 2 deletions lib/active_merchant/billing/gateways/cyber_source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1068,12 +1068,16 @@ def commit(request, action, amount, options)

message = auto_void?(authorization_from(response, action, amount, options), response, message, options)

Response.new(success, message, response,
Response.new(
success,
message,
response,
test: test?,
authorization: authorization,
fraud_review: in_fraud_review?(response),
avs_result: { code: response[:avsCode] },
cvv_result: response[:cvCode])
cvv_result: response[:cvCode]
)
end

def auto_void?(authorization, response, message, options = {})
Expand Down
38 changes: 21 additions & 17 deletions lib/active_merchant/billing/gateways/data_cash.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,23 @@ def add_credit_card(xml, credit_card, address)
# a predefined one
xml.tag! :ExtendedPolicy do
xml.tag! :cv2_policy,
notprovided: POLICY_REJECT,
notchecked: POLICY_REJECT,
matched: POLICY_ACCEPT,
notmatched: POLICY_REJECT,
partialmatch: POLICY_REJECT
notprovided: POLICY_REJECT,
notchecked: POLICY_REJECT,
matched: POLICY_ACCEPT,
notmatched: POLICY_REJECT,
partialmatch: POLICY_REJECT
xml.tag! :postcode_policy,
notprovided: POLICY_ACCEPT,
notchecked: POLICY_ACCEPT,
matched: POLICY_ACCEPT,
notmatched: POLICY_REJECT,
partialmatch: POLICY_ACCEPT
notprovided: POLICY_ACCEPT,
notchecked: POLICY_ACCEPT,
matched: POLICY_ACCEPT,
notmatched: POLICY_REJECT,
partialmatch: POLICY_ACCEPT
xml.tag! :address_policy,
notprovided: POLICY_ACCEPT,
notchecked: POLICY_ACCEPT,
matched: POLICY_ACCEPT,
notmatched: POLICY_REJECT,
partialmatch: POLICY_ACCEPT
notprovided: POLICY_ACCEPT,
notchecked: POLICY_ACCEPT,
matched: POLICY_ACCEPT,
notmatched: POLICY_REJECT,
partialmatch: POLICY_ACCEPT
end
end
end
Expand All @@ -260,9 +260,13 @@ def add_credit_card(xml, credit_card, address)
def commit(request)
response = parse(ssl_post(test? ? self.test_url : self.live_url, request))

Response.new(response[:status] == '1', response[:reason], response,
Response.new(
response[:status] == '1',
response[:reason],
response,
test: test?,
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}")
authorization: "#{response[:datacash_reference]};#{response[:authcode]};#{response[:ca_reference]}"
)
end

def format_date(month, year)
Expand Down
8 changes: 6 additions & 2 deletions lib/active_merchant/billing/gateways/efsnet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,15 @@ def add_creditcard(post, creditcard)
def commit(action, parameters)
response = parse(ssl_post(test? ? self.test_url : self.live_url, post_data(action, parameters), 'Content-Type' => 'text/xml'))

Response.new(success?(response), message_from(response[:result_message]), response,
Response.new(
success?(response),
message_from(response[:result_message]),
response,
test: test?,
authorization: authorization_from(response, parameters),
avs_result: { code: response[:avs_response_code] },
cvv_result: response[:cvv_response_code])
cvv_result: response[:cvv_response_code]
)
end

def success?(response)
Expand Down
1 change: 0 additions & 1 deletion lib/active_merchant/billing/gateways/element.rb
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,6 @@ def build_soap_request
xml['soap'].Envelope('xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/') do

xml['soap'].Body do
yield(xml)
end
Expand Down
Loading
Loading