Sha256: 603ee0fad9bc5b55089fe6556e3c56d627e5454f489c8c393f9c7230e73c6d98

Contents?: true

Size: 888 Bytes

Versions: 9

Compression:

Stored size: 888 Bytes

Contents

module ActiveMerchant #:nodoc:
  module Billing #:nodoc:
    module CyberSourceCommon
      def check_billing_field_value(default, submitted)
        if submitted.nil?
          nil
        elsif submitted.blank?
          default
        else
          submitted
        end
      end

      def address_names(address_name, payment_method)
        names = split_names(address_name)
        return names if names.any?(&:present?)

        [
          payment_method&.first_name,
          payment_method&.last_name
        ]
      end

      def lookup_country_code(country_field)
        return unless country_field.present?

        country_code = Country.find(country_field)
        country_code&.code(:alpha2)
      end

      def eligible_for_zero_auth?(payment_method, options = {})
        payment_method.is_a?(CreditCard) && options[:zero_amount_auth]
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
swiss-activemerchant-1.0.5 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
swiss-activemerchant-1.0.4 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
activemerchant-1.137.0 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
swiss-activemerchant-1.0.2 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
swiss-activemerchant-1.0.1 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
activemerchant-1.133.0 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
activemerchant-1.131.0 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
activemerchant-1.130.0 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
activemerchant-1.129.0 lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb