Module: Workarea::Payment::CreditCardData

Defined in:
app/models/workarea/payment/credit_card_data.rb

Instance Method Summary collapse

Instance Method Details

#billing_addressObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/models/workarea/payment/credit_card_data.rb', line 13

def billing_address
  {
    name:       "#{address.first_name} #{address.last_name}",
    company:    address.company,
    address1:   address.street,
    city:       address.city,
    state:      address.region,
    country:    address.country.try(:alpha2),
    zip:        address.postal_code,
    phone:      nil
  }
end

#payment_sourceObject



26
27
28
# File 'app/models/workarea/payment/credit_card_data.rb', line 26

def payment_source
  tender.token.presence || tender.to_active_merchant
end

#transaction_argsObject



4
5
6
7
8
9
10
11
# File 'app/models/workarea/payment/credit_card_data.rb', line 4

def transaction_args
  ip_address = options[:checkout]&.order&.ip_address
  {
    order_id: tender.payment.id,
    billing_address: billing_address,
    ip_address: ip_address
  }
end