Module: PayCertify::Gateway::AttributeMapping

Defined in:
lib/paycertify/gateway/attribute_mapping.rb

Class Method Summary collapse

Class Method Details

.chargeObject



57
58
59
60
61
62
63
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 57

def charge
  {
    'CardToken' => :credit_card_id,
    'Amount' => :amount,
    'PNRef' => :transaction_id
  }
end

.credit_cardObject



48
49
50
51
52
53
54
55
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 48

def credit_card
  {
    'CardNum' => :card_number,
    'NameOnCard' => :name_on_card,
    'CustomerKey' => :customer_id,
    'PostalCode' => :zip
  }
end

.customerObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 32

def customer
  {
    'CustomerID' => :app_customer_id,
    'CustomerKey' => :customer_id,
    'CustomerName' => :name,
    'Street1' => :address,
    'City' => :city,
    'StateID' => :state,
    'Zip' => :zip,
    'MobilePhone' => :phone,
    'Fax' => :fax,
    'Email' => :email,
    'Status' => :status
  }
end

.expiration_date(transaction) ⇒ Object



65
66
67
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 65

def expiration_date(transaction)
  { 'ExpDate' => [transaction.expiration_month, transaction.expiration_year].join }
end

.status(customer) ⇒ Object



80
81
82
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 80

def status(customer)
  object.status.to_s.upcase
end

.transactionObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 5

def transaction
  {
    'Amount' => :amount,
    'Currency' => :currency,
    'CardNum' => :card_number,
    'NameOnCard' => :name_on_card,
    'CVNum' => :cvv,
    'InvNum' => :transaction_id,
    'PNRef' => :transaction_id,
    'Street' => :billing_address,
    'City' => :billing_city,
    'State' => :billing_state,
    'Zip' => :billing_zip,
    'Country' => :billing_country,
    'ShippingStreet' => :billing_address,
    'ShippingCity' => :billing_city,
    'ShippingState' => :billing_state,
    'ShippingZip' => :billing_zip,
    'ShippingCountry' => :billing_country,
    'MobilePhone' => :phone,
    'Email' => :email,
    'Description' => :order_description,
    'CustomerID' => :customer_id,
    'ServerID' => :ip
  }
end

.type(object) ⇒ Object



69
70
71
72
73
74
75
76
77
78
# File 'lib/paycertify/gateway/attribute_mapping.rb', line 69

def type(object)
  case object.class.name
  when /.*Transaction.*/, /.*Charge.*/
    { 'TransType' => object.type.to_s.capitalize }
  when /.*Customer.*/
    { 'TransType' => object.type.to_s.upcase }
  else
    {}
  end
end