Module: ActiveMerchant::Billing::CyberSourceCommon

Included in:
CyberSourceRestGateway
Defined in:
lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb

Instance Method Summary collapse

Instance Method Details

#address_names(address_name, payment_method) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb', line 14

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

#check_billing_field_value(default, submitted) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb', line 4

def check_billing_field_value(default, )
  if .nil?
    nil
  elsif .blank?
    default
  else
    
  end
end

#eligible_for_zero_auth?(payment_method, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb', line 31

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

#lookup_country_code(country_field) ⇒ Object



24
25
26
27
28
29
# File 'lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb', line 24

def lookup_country_code(country_field)
  return unless country_field.present?

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