Class ActiveMerchant::Billing::Integrations::Chronopay::Helper
In: lib/active_merchant/billing/integrations/chronopay/helper.rb
Parent: ActiveMerchant::Billing::Integrations::Helper

Methods

Public Class methods

[Source]

    # File lib/active_merchant/billing/integrations/chronopay/helper.rb, line 8
 8:           def initialize(order, account, options = {})
 9:             super
10:             add_field('cb_type', 'p')
11:             add_field('language', 'EN')
12:           end

Public Instance methods

[Source]

    # File lib/active_merchant/billing/integrations/chronopay/helper.rb, line 44
44:           def billing_address(mapping = {})
45:             # Gets the country code in the appropriate format or returns what we were given
46:             # The appropriate format for Chronopay is the alpha 3 country code
47:             country_code = lookup_country_code(mapping.delete(:country))
48:             add_field(mappings[:billing_address][:country], country_code)
49:             
50:             countries_with_supported_states = ['USA', 'CAN']
51:             if !countries_with_supported_states.include?(country_code)
52:               mapping.delete(:state)
53:               add_field(mappings[:billing_address][:state], 'XX')
54:             end  
55:             mapping.each do |k, v|
56:               field = mappings[:billing_address][k]
57:               add_field(field, v) unless field.nil?
58:             end 
59:           end

[Validate]