class OffsitePayments::Integrations::Dotpay::Helper
Public Class Methods
new(order, account, options = {})
click to toggle source
Calls superclass method
# File lib/offsite_payments/integrations/dotpay.rb, line 16 def initialize(order, account, 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
Public Instance Methods
billing_address(params = {})
click to toggle source
# 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
Private Instance Methods
lookup_country_code(name_or_code, format = country_format)
click to toggle source
# File lib/offsite_payments/integrations/dotpay.rb, line 77 def lookup_country_code(name_or_code, format = country_format) country = ActiveUtils::Country.find(name_or_code) country.code(format).to_s rescue ActiveUtils::InvalidCountryCodeError name_or_code end