Class: ActiveMerchant::Billing::Integrations::Ogone::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/active_merchant_ogone/helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(order, account, options = {}) ⇒ Helper

Returns a new instance of Helper.



8
9
10
11
# File 'lib/active_merchant_ogone/helper.rb', line 8

def initialize(order, , options = {})
  super
  @outbound_signature = options[:credential2]
end

Instance Attribute Details

#outbound_signatureObject (readonly)

Returns the value of attribute outbound_signature.



6
7
8
# File 'lib/active_merchant_ogone/helper.rb', line 6

def outbound_signature
  @outbound_signature
end

Instance Method Details

#after_pay(mapping = {}) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/active_merchant_ogone/helper.rb', line 45

def after_pay(mapping = {})
  # Billing adres
  add_field('ECOM_BILLTO_POSTAL_NAME_FIRST', mapping[:bill_first_name])
  add_field('ECOM_BILLTO_POSTAL_NAME_LAST', mapping[:bill_last_name])
  add_field('ECOM_BILLTO_POSTAL_STREET_NUMBER', mapping[:bill_street_number])
  # Shipping adres
  add_field('ECOM_SHIPTO_POSTAL_NAME_FIRST', mapping[:ship_first_name])
  add_field('ECOM_SHIPTO_POSTAL_NAME_LAST', mapping[:ship_last_name])
  add_field('ECOM_SHIPTO_POSTAL_STREET_LINE1', mapping[:ship_adress])
  add_field('ECOM_SHIPTO_POSTAL_STREET_NUMBER', mapping[:ship_adress_number])
  add_field('ECOM_SHIPTO_POSTAL_POSTALCODE', mapping[:ship_adress_zip])
  add_field('ECOM_SHIPTO_POSTAL_CITY', mapping[:ship_adress_city])
  add_field('ECOM_SHIPTO_POSTAL_COUNTRYCODE', mapping[:ship_adress_country_code])
  add_field('ECOM_SHIPTO_DOB', mapping[:ship_dob])
end

#customer(mapping = {}) ⇒ Object



38
39
40
41
42
43
# File 'lib/active_merchant_ogone/helper.rb', line 38

def customer(mapping = {})
  add_field('ownertelno', mapping[:phone])
  add_field('EMAIL', mapping[:email])
  add_field('CN', "#{mapping[:first_name]} #{mapping[:last_name]}")
  add_field('CIVILITY', mapping[:civility])
end

#form_fieldsObject

return the fields



72
73
74
75
# File 'lib/active_merchant_ogone/helper.rb', line 72

def form_fields
  add_field('SHASign', outbound_message_signature)
  super
end

#operation(operation) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/active_merchant_ogone/helper.rb', line 61

def operation operation
  op = case operation
  when :authorization, :auth; 'RES'
  when :payment, :pay;        'SAL'
  else;                       operation
  end

  add_field('operation', op)
end