Module: ActiveMerchant::Billing::CyberSourceCommon
- Included in:
- CyberSourceRestGateway
- Defined in:
- lib/active_merchant/billing/gateways/cyber_source/cyber_source_common.rb
Instance Method Summary collapse
- #address_names(address_name, payment_method) ⇒ Object
- #check_billing_field_value(default, submitted) ⇒ Object
- #eligible_for_zero_auth?(payment_method, options = {}) ⇒ Boolean
- #lookup_country_code(country_field) ⇒ Object
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, submitted) if submitted.nil? nil elsif submitted.blank? default else submitted end end |
#eligible_for_zero_auth?(payment_method, options = {}) ⇒ 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, = {}) payment_method.is_a?(CreditCard) && [: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 |