Module: Spree::Conekta::PaymentSource::Card

Defined in:
lib/spree/conekta/payment_source/card.rb

Class Method Summary collapse

Class Method Details

.customer_address(gateway_options) ⇒ Object



8
9
10
11
12
13
# File 'lib/spree/conekta/payment_source/card.rb', line 8

def self.customer_address(gateway_options)
  customer = gateway_options[:billing_address]
  customer['street1'] = customer.delete(:address1)
  customer['street2'] = customer.delete(:address2)
  customer
end

.installments_number(source) ⇒ Object



15
16
17
# File 'lib/spree/conekta/payment_source/card.rb', line 15

def installments_number(source)
  [3,6,9,12].include?(source.installments_number) ? source.installments_number : nil
end

.request(common, method, gateway_options) ⇒ Object



3
4
5
6
# File 'lib/spree/conekta/payment_source/card.rb', line 3

def request(common, method, gateway_options)
  common['card'] = method.gateway_payment_profile_id
  common['monthly_installments'] = installments_number(method)
end