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

Enable frozen_string_literals #367

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'
gemspec

Expand Down
6 changes: 4 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ GEM
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mimemagic (0.3.3)
mimemagic (0.3.10)
nokogiri (~> 1)
rake
mini_mime (1.0.1)
mini_portile2 (2.5.0)
minitest (5.11.3)
Expand Down Expand Up @@ -193,4 +195,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.1.4
2.2.22
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

$:.unshift File.expand_path('../lib', __FILE__)
require 'offsite_payments/version'

Expand Down
1 change: 1 addition & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

require "bundler/setup"
require "offsite_payments"
Expand Down
2 changes: 2 additions & 0 deletions generators/integration_generator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require "thor/group"

class IntegrationGenerator < Thor::Group
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

fail %q{
Money is required for offsite_payments to work, please refer to https://github.com/activemerchant/offsite_payments#money-gem-dependency
} unless defined?(Money)
Expand Down
4 changes: 3 additions & 1 deletion lib/offsite_payments/action_view_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'action_pack'

module OffsitePayments #:nodoc:
Expand Down Expand Up @@ -63,7 +65,7 @@ def payment_service_for(order, account, options = {}, &proc)
end

result << '</form>'
result= result.join("\n")
result = result.join("\n")

concat(result.respond_to?(:html_safe) ? result.html_safe : result)
nil
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module MoneyCompatibility
def to_cents(money)
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments
module Integrations
Dir[File.dirname(__FILE__) + '/integrations/*.rb'].each do |f|
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/a1agregator.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module A1agregator
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/authorize_net_sim.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module AuthorizeNetSim
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/bit_pay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module BitPay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/bogus.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Bogus
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/checkout_finland.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module CheckoutFinland
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/chronopay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Chronopay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/citrus.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments
module Integrations
module Citrus
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/coinbase.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Coinbase
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/direc_pay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module DirecPay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/directebanking.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Directebanking
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/doku.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Doku
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/dotpay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Dotpay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/dwolla.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Dwolla
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/e_payment_plans.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module EPaymentPlans
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/easy_pay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# Documentation: https://ssl.easypay.by/light/
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/epay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Epay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/first_data.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module FirstData
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/gestpay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

# With help from Giovanni Intini and his code for RGestPay - http://medlar.it/it/progetti/rgestpay

module OffsitePayments #:nodoc:
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/hi_trust.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module HiTrust
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/ipay88.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Ipay88
Expand Down
11 changes: 5 additions & 6 deletions lib/offsite_payments/integrations/klarna.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Klarna
Expand All @@ -17,12 +19,9 @@ def self.return(query_string, options = {})
def self.cart_items_payload(fields, cart_items)
check_required_fields!(fields)

payload = ""
REQUIRED_FIELDS.sort.each do |field|
payload << fields[field].to_s
end

payload
REQUIRED_FIELDS.sort.map do |field|
fields[field].to_s
end.join
end

def self.sign(fields, cart_items, shared_secret)
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/liqpay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# Documentation: https://www.liqpay.com/?do=pages&p=cnb10
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/maksuturva.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# USAGE:
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/mollie.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Mollie
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/mollie_ideal.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module MollieIdeal
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/mollie_mistercash.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module MollieMistercash
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/molpay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Molpay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/moneybookers.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Moneybookers
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/nochex.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# To start with Nochex, follow the instructions for installing
Expand Down
8 changes: 4 additions & 4 deletions lib/offsite_payments/integrations/pag_seguro.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# encoding: utf-8
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
Expand Down Expand Up @@ -117,10 +117,10 @@ def fetch_token

def area_code_and_number(phone)
return if phone.nil?
phone.gsub!(/[^\d]/, '')
clean_phone = phone.gsub(/[^\d]/, '')

ddd = phone.slice(0..1)
number = phone.slice(2..12)
ddd = clean_phone.slice(0..1)
number = clean_phone.slice(2..12)

[ddd, number]
end
Expand Down
5 changes: 3 additions & 2 deletions lib/offsite_payments/integrations/paxum.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# Documentation:
Expand Down Expand Up @@ -89,8 +91,7 @@ class Notification < OffsitePayments::Notification

def initialize(post, options = {})
@raw_post = post.dup
post.slice!(0)
super
super(post.slice(1..-1), options)
end

def self.recognizes?(params)
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/pay_fast.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
# Documentation:
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/paydollar.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Paydollar
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/payflow_link.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module PayflowLink
Expand Down
6 changes: 3 additions & 3 deletions lib/offsite_payments/integrations/paypal.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Paypal
Expand Down Expand Up @@ -93,10 +95,8 @@ def shipping_address(params = {})
add_field(mappings[:shipping_address][:country], country_code)

if params.has_key?(:phone)
phone = params.delete(:phone).to_s

# Wipe all non digits
phone.gsub!(/\D+/, '')
phone = params.delete(:phone).to_s.gsub(/\D+/, '')

if ['US', 'CA'].include?(country_code) && phone =~ /(\d{3})(\d{3})(\d{4})$/
add_field('night_phone_a', $1)
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/paypal_payments_advanced.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments
module Integrations
module PaypalPaymentsAdvanced
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/paysbuy.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Paysbuy
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/paytm.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Paytm
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/payu_in.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module PayuIn
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/payu_in_paisa.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments
module Integrations
module PayuInPaisa
Expand Down
4 changes: 3 additions & 1 deletion lib/offsite_payments/integrations/platron.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'builder'

module OffsitePayments #:nodoc:
Expand Down Expand Up @@ -137,7 +139,7 @@ def acknowledge(authcode = nil)

def success_response(path,secret)
salt = rand(36**15).to_s(36)
xml = ""
xml = +""
doc = Builder::XmlMarkup.new(:target => xml)
sign = Platron.generate_signature({:pg_status => 'ok', :pg_salt => salt}, path, secret)
doc.response do
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/pxpay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'rexml/document'

module OffsitePayments #:nodoc:
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/quickpay.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

module OffsitePayments #:nodoc:
module Integrations #:nodoc:
module Quickpay
Expand Down
2 changes: 2 additions & 0 deletions lib/offsite_payments/integrations/quickpay_v10.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# frozen_string_literal: true

require 'openssl'

module OffsitePayments #:nodoc:
Expand Down
Loading