Skip to content

Commit

Permalink
Merge pull request #33 from paywith/update-with-original-repo
Browse files Browse the repository at this point in the history
[MREWARDS-4093] Merge original repo to fork
  • Loading branch information
fernando-bosso authored Sep 11, 2024
2 parents c0fa24d + 28540ec commit 912527b
Show file tree
Hide file tree
Showing 126 changed files with 6,119 additions and 1,069 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ AllCops:
- "lib/active_merchant/billing/gateways/paypal_express.rb"
- "vendor/**/*"
ExtraDetails: false
TargetRubyVersion: 3.0.5
TargetRubyVersion: 3.1.4
43 changes: 25 additions & 18 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2024-06-03 05:57:29 UTC using RuboCop version 1.64.1.
# on 2024-09-11 21:07:26 UTC using RuboCop version 1.65.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand All @@ -22,7 +22,7 @@ Layout/FirstArgumentIndentation:
Exclude:
- 'test/remote/gateways/remote_litle_test.rb'

# Offense count: 63
# Offense count: 68
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultilineFinalElement.
Layout/FirstArrayElementLineBreak:
Expand All @@ -34,7 +34,7 @@ Layout/FirstArrayElementLineBreak:
Layout/FirstHashElementLineBreak:
Enabled: false

# Offense count: 1302
# Offense count: 1320
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
Expand All @@ -49,7 +49,7 @@ Layout/HashAlignment:
Layout/LeadingCommentSpace:
Enabled: false

# Offense count: 7281
# Offense count: 7463
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
# URISchemes: http, https
Expand Down Expand Up @@ -91,7 +91,7 @@ Layout/SpaceBeforeFirstArg:
Exclude:
- 'test/unit/gateways/bogus_test.rb'

# Offense count: 9
# Offense count: 10
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
Expand All @@ -103,6 +103,7 @@ Layout/SpaceInsideHashLiteralBraces:
- 'lib/active_merchant/billing/gateways/tsys_multipass.rb'
- 'test/remote/gateways/remote_litle_test.rb'
- 'test/remote/gateways/remote_simetrik_test.rb'
- 'test/remote/gateways/remote_worldpay_test.rb'
- 'test/unit/gateways/fat_zebra_test.rb'
- 'test/unit/gateways/stripe_test.rb'

Expand All @@ -113,7 +114,7 @@ Layout/TrailingWhitespace:
Exclude:
- 'lib/active_merchant/billing/gateways/tsys_multipass.rb'

# Offense count: 355
# Offense count: 362
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSafeAssignment.
Lint/AssignmentInCondition:
Expand All @@ -137,7 +138,13 @@ Lint/FormatParameterMismatch:
Exclude:
- 'test/unit/credit_card_formatting_test.rb'

# Offense count: 26
# Offense count: 1
# This cop supports safe autocorrection (--autocorrect).
Lint/RedundantCopDisableDirective:
Exclude:
- 'lib/active_merchant/billing/gateways/mercury.rb'

# Offense count: 25
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowedMethods.
# AllowedMethods: instance_of?, kind_of?, is_a?, eql?, respond_to?, equal?
Expand Down Expand Up @@ -201,7 +208,7 @@ Style/CaseLikeIf:
- 'lib/active_merchant/billing/gateways/stripe.rb'
- 'lib/active_merchant/billing/gateways/vantiv_express.rb'

# Offense count: 45
# Offense count: 44
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: is_a?, kind_of?
Expand Down Expand Up @@ -262,7 +269,7 @@ Style/HashLikeCase:
- 'lib/active_merchant/billing/gateways/trust_commerce.rb'
- 'lib/active_merchant/billing/gateways/worldpay.rb'

# Offense count: 77
# Offense count: 75
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowedMethods, AllowedPatterns.
Style/MethodCallWithoutArgsParentheses:
Expand Down Expand Up @@ -300,7 +307,7 @@ Style/MultilineTernaryOperator:
- 'lib/active_merchant/billing/gateways/swipe_checkout.rb'
- 'lib/active_merchant/billing/gateways/transact_pro.rb'

# Offense count: 648
# Offense count: 650
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Expand Down Expand Up @@ -373,7 +380,7 @@ Style/OrAssignment:
Exclude:
- 'lib/active_merchant/billing/gateways/net_registry.rb'

# Offense count: 1759
# Offense count: 1801
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Expand All @@ -395,19 +402,19 @@ Style/PerlBackrefs:
Style/PreferredHashMethods:
Enabled: false

# Offense count: 58
# Offense count: 60
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedCompactTypes.
# SupportedStyles: compact, exploded
Style/RaiseArgs:
Enabled: false

# Offense count: 97
# Offense count: 98
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantParentheses:
Enabled: false

# Offense count: 1397
# Offense count: 1574
# This cop supports safe autocorrection (--autocorrect).
Style/RedundantRegexpEscape:
Enabled: false
Expand Down Expand Up @@ -457,7 +464,7 @@ Style/Semicolon:
- 'test/unit/gateways/cardknox_test.rb'
- 'test/unit/gateways/omise_test.rb'

# Offense count: 56
# Offense count: 58
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SingleArgumentDig:
Enabled: false
Expand All @@ -469,7 +476,7 @@ Style/SingleLineMethods:
Exclude:
- 'test/unit/gateways/paypal/paypal_common_api_test.rb'

# Offense count: 57
# Offense count: 60
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SlicingWithRange:
Enabled: false
Expand All @@ -488,14 +495,14 @@ Style/SoleNestedConditional:
Style/StringConcatenation:
Enabled: false

# Offense count: 147
# Offense count: 154
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Style/TrailingCommaInArrayLiteral:
Enabled: false

# Offense count: 3496
# Offense count: 3648
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: EnforcedStyleForMultiline.
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
Expand Down
73 changes: 73 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,75 @@
= ActiveMerchant CHANGELOG

== HEAD
* Mercury, TransFirst: Repair gateways following updates to `rexml` [aenand] #5206
* NMI: Fix Decrypted indicator for Google/Apple pay [javierpedrozaing] #5196
* FlexCharge: add more descriptives error messages [gasb150] #5199
* Braintree: Updates to Paypal Integration [almalee24] #5190
* Stripe and Stripe PI: Add metadata and order_id for refund and void [yunnydang] #5204
* CommerceHub: Update test url [DustinHaefele] #5211
* Adyen: Fix billing address empty string error [yunnydang] #5208
* Elavon: Update sending CVV for MIT transactions [almalee24] #5210
* Adyen: Fix NT integration [jherreraa] #5155
* HPS: Update NetworkTokenizationCreditCard flow [almalee24] #5178
* Braintree: Support override_application_id [aenand] #5194
* Decidir: Pass CVV for NT [almalee24] #5205
* NMI: Add customer vault fields [yunnydang] #5215
* CheckoutV2: Add inquire method [almalee24] #5209
* Decidir & Braintree: Scrub cryptogram and card number [almalee24] #5220
* Naranja: Update valid number check to include luhn10 [DustinHaefele] #5217
* Cybersource: Add apple_pay with discover. [DustinHaefele] #5213
* MercadoPago: Add idempotency key field [yunnydang] #5229
* Adyen: Update split refund method [yunnydang] #5218
* Adyen: Remove raw_error_message [almalee24] #5202
* Elavon: Remove old Stored Credential method [almalee24] #5219
* PayTrace: Update MultiResponse for Capture [almalee24] #5203
* Adyen: Add support for Pan Only GooglePay [almalee24] #5221
* Decidir: Send extra fields for tokenized NT transactions [sinourain] #5224
* StripePI: Skip add_network_token_cryptogram_and_eci method to accept ApplePay recurring payments [sinourain] #5212
* Decidir: Fix scrub method after update NT fields [sinourain] #5241
* Cybersource and Cybersource Rest: Update card type code for Carnet cards [rachelkirk] #5235
* Stripe PI: Add challenge as valid value for request_three_d_secure [jcreiff] #5238
* StripePI: Add metadata for GooglePay FPAN [almalee24] #5242
* Paypal: Add inquire method [almalee24] #5231
* Adyen: Enable multiple legs within airline data [jcreiff] #5249
* SafeCharge: Add card holder verification fields [yunnydang] #5252
* Iveri: Add AuthorisationReversal for Auth Void [almalee24] #5233
* Stripe PI: Update Stored Credentials [almalee24] #5236
* Checkout V2: Update stored credential options function [jherreraa] #5239
* Ebanx: Add support for Stored Credentials [almalee24] #5243

== Version 1.137.0 (August 2, 2024)
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).
* Bump Ruby version to 3.1 [dustinhaefele] #5104
* FlexCharge: Update inquire method to use the new orders end-point
* Worldpay: Prefer options for network_transaction_id [aenand] #5129
* Braintree: Prefer options for network_transaction_id [aenand] #5129
* Cybersource Rest: Update support for stored credentials [aenand] #5083
* Plexo: Add support to NetworkToken payments [euribe09] #5130
* Braintree: Update card verfification payload if billing address fields are not present [yunnydang] #5142
* DLocal: Update the phone and ip fields [yunnydang] #5143
* CheckoutV2: Add support for risk data fields [yunnydang] #5147
* Pin Payments: Add new 3DS params mentioned in Pin Payments docs [hudakh] #4720
* RedsysRest: Add support for stored credentials & 3DS exemptions [jherreraa] #5132
* CheckoutV2: Truncate the reference id for amex transactions [yunnydang] #5151
* CommerceHub: Add billing address name override [yunnydang] #5157
* StripePI: Add optional ability for 3DS exemption on verify calls [yunnydang] #5160
* CyberSource: Update stored credentials [sinourain] #5136
* Orbital: Update to accept UCAF Indicator GSF [almalee24] #5150
* CyberSource: Add addtional invoiceHeader fields [yunnydang] #5161
* MerchantWarrior: Update phone, email, ip and store ID [almalee24] #5158
* Credorax: Update 3DS version mapping [almalee24] #5159
* Add Maestro card bins [yunnydang] #5172
* Braintree: Remove stored credential v1 [almalee24] #5175
* Braintree Blue: Pass overridden mid into client token for GS 3DS [sinourain] #5166
* Moneris: Update crypt_type for 3DS [almalee24] #5162
* CheckoutV2: Update 3DS message & error code [almalee24] #5177
* DecicirPlus: Update error_message to add safety navigator [almalee24] #5187
* Elavon: Add updated stored credential version [almalee24] #5170
* Adyen: Add header fields to response body [yunnydang] #5184
* Stripe and Stripe PI: Add header fields to response body [yunnydang] #5185

== Version 1.136.0 (June 3, 2024)
* Shift4V2: Add new gateway based on SecurionPay adapter [heavyblade] #4860
* TNS: Use the specified order_id in request if available [yunnydang] #4880
* Cybersource: Support recurring apple pay [aenand] #4874
Expand Down Expand Up @@ -174,6 +243,10 @@
* Worldpay: Add support for deafult ECI value [aenand] #5126
* DLocal: Update stored credentials [sinourain] #5112
* NMI: Add NTID override [yunnydang] #5134
* Cybersource Rest: Support L2/L3 data [aenand] #5117
* Worldpay: Support L2/L3 data [aenand] #5117
* Support UATP cardtype [javierpedrozaing] #5137
* Litle: Add 141 and 142 as successful responses [almalee24] #5135

== Version 1.135.0 (August 24, 2023)
* PaymentExpress: Correct endpoints [steveh] #4827
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:3.0.5
FROM ruby:3.1.4

ARG GITHUB_TOKEN
ARG GITHUB_USERNAME
Expand All @@ -11,4 +11,4 @@ RUN gem install bundler && \
bundle config set https://rubygems.pkg.github.com/paywith $GITHUB_USERNAME:$GITHUB_TOKEN && \
bundle install -j$(nproc)

ENTRYPOINT [ "./entrypoint.sh" ]
ENTRYPOINT [ "./entrypoint.sh" ]
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem 'jruby-openssl', platforms: :jruby
group :test, :remote_test do
# gateway-specific dependencies, keeping these gems out of the gemspec
gem 'braintree', '>= 4.14.0'
gem 'jose', '~> 1.1.3'
gem 'jose', '~> 1.2.0'
gem 'jwe'
gem 'mechanize'
gem 'timecop'
Expand Down
4 changes: 2 additions & 2 deletions 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.7'
s.required_ruby_version = '>= 3.1'

s.files = Dir['CHANGELOG', 'README.md', 'MIT-LICENSE', 'CONTRIBUTORS', 'lib/**/*', 'vendor/**/*']
s.require_path = 'lib'
Expand All @@ -26,7 +26,7 @@ Gem::Specification.new do |s|
s.add_dependency('builder', '>= 2.1.2', '< 4.0.0')
s.add_dependency('i18n', '>= 0.6.9')
s.add_dependency('nokogiri', '~> 1.4')
s.add_dependency('rexml', '~> 3.2.5')
s.add_dependency('rexml', '~> 3.3', '>= 3.3.4')

s.add_development_dependency('mocha', '~> 1')
s.add_development_dependency('pry')
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.7.0'
version: '3.1.0'

dependencies:
cache_directories:
Expand Down
2 changes: 2 additions & 0 deletions lib/active_merchant/billing/credit_card.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module Billing #:nodoc:
# * Panal
# * Verve
# * Tuya
# * UATP
#
# For testing purposes, use the 'bogus' credit card brand. This skips the vast majority of
# validations, allowing you to focus on your core concerns until you're ready to be more concerned
Expand Down Expand Up @@ -136,6 +137,7 @@ def number=(value)
# * +'panal'+
# * +'verve'+
# * +'tuya'+
# * +'uatp'+
#
# Or, if you wish to test your implementation, +'bogus'+.
#
Expand Down
8 changes: 5 additions & 3 deletions lib/active_merchant/billing/credit_card_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ module CreditCardMethods
'hipercard' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), HIPERCARD_RANGES) },
'panal' => ->(num) { num&.size == 16 && in_bin_range?(num.slice(0, 6), PANAL_RANGES) },
'verve' => ->(num) { (16..19).cover?(num&.size) && in_bin_range?(num.slice(0, 6), VERVE_RANGES) },
'tuya' => ->(num) { num =~ /^588800\d{10}$/ }
'tuya' => ->(num) { num =~ /^588800\d{10}$/ },
'uatp' => ->(num) { num =~ /^(1175|1290)\d{11}$/ }
}

SODEXO_NO_LUHN = ->(num) { num =~ /^(505864|505865)\d{10}$/ }
Expand Down Expand Up @@ -127,6 +128,7 @@ module CreditCardMethods
501879 502113 502120 502121 502301
503175 503337 503645 503670
504310 504338 504363 504533 504587 504620 504639 504656 504738 504781 504910
505616
507001 507002 507004 507082 507090
560014 560565 561033
572402 572610 572626
Expand Down Expand Up @@ -174,7 +176,7 @@ module CreditCardMethods
(501104..501105),
(501107..501108),
(501104..501105),
(501107..501108),
(501107..501109),
(501800..501899),
(502000..502099),
(503800..503899),
Expand Down Expand Up @@ -462,7 +464,7 @@ def sodexo_no_luhn?(numbers)
def valid_by_algorithm?(brand, numbers) #:nodoc:
case brand
when 'naranja'
valid_naranja_algo?(numbers)
valid_naranja_algo?(numbers) || valid_luhn?(numbers)
when 'creditel'
valid_creditel_algo?(numbers)
when 'alia', 'confiable', 'maestro_no_luhn', 'anda', 'tarjeta-d', 'hipercard'
Expand Down
Loading

0 comments on commit 912527b

Please sign in to comment.