Class: ActiveMerchant::Billing::Integrations::Dotpay::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/active_merchant/billing/integrations/dotpay/helper.rb

Instance Attribute Summary

Attributes inherited from Helper

#fields

Instance Method Summary collapse

Methods inherited from Helper

#add_field, #add_fields, #add_raw_html_field, #form_fields, #form_method, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

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

Returns a new instance of Helper.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/active_merchant/billing/integrations/dotpay/helper.rb', line 6

def initialize(order, , options = {})
  options = {:currency => 'PLN'}.merge options

  super

  add_field('channel', '0')
  add_field('ch_lock', '0')
  add_field('lang', 'PL')
  add_field('onlinetransfer', '0')
  add_field('tax', '0')
  add_field('type', '2')
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ActiveMerchant::Billing::Integrations::Helper

Instance Method Details

#billing_address(params = {}) ⇒ Object



54
55
56
57
58
59
60
61
62
63
# File 'lib/active_merchant/billing/integrations/dotpay/helper.rb', line 54

def billing_address(params = {})
  country = lookup_country_code(params.delete(:country) { 'POL' }, :alpha3)
  add_field(mappings[:billing_address][:country], country)

  # Everything else
  params.each do |k, v|
    field = mappings[:billing_address][k]
    add_field(field, v) unless field.nil?
  end
end