Class: OffsitePayments::Integrations::Dotpay::Helper

Inherits:
Helper
  • Object
show all
Defined in:
lib/offsite_payments/integrations/dotpay.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, inherited, mapping, #raw_html_fields, #shipping_address, #test?

Constructor Details

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


16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/offsite_payments/integrations/dotpay.rb', line 16

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 OffsitePayments::Helper

Instance Method Details

#billing_address(params = {}) ⇒ Object


64
65
66
67
68
69
70
71
72
73
# File 'lib/offsite_payments/integrations/dotpay.rb', line 64

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