Class: AbtainBilling::Billing::Integrations::Chronopay::Helper
- Defined in:
- lib/abtain_billing/billing/integrations/chronopay/helper.rb
Instance Attribute Summary
Attributes inherited from Helper
Instance Method Summary collapse
- #billing_address(mapping = {}) ⇒ Object
-
#initialize(order, account, options = {}) ⇒ Helper
constructor
A new instance of Helper.
Methods inherited from Helper
#add_field, #add_fields, #form_fields, mapping, #shipping_address
Constructor Details
#initialize(order, account, options = {}) ⇒ Helper
Returns a new instance of Helper.
8 9 10 11 12 |
# File 'lib/abtain_billing/billing/integrations/chronopay/helper.rb', line 8 def initialize(order, account, = {}) super add_field('cb_type', 'p') add_field('language', 'EN') end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AbtainBilling::Billing::Integrations::Helper
Instance Method Details
#billing_address(mapping = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/abtain_billing/billing/integrations/chronopay/helper.rb', line 44 def billing_address(mapping = {}) # Gets the country code in the appropriate format or returns what we were given # The appropriate format for Chronopay is the alpha 3 country code country_code = lookup_country_code(mapping.delete(:country)) add_field(mappings[:billing_address][:country], country_code) countries_with_supported_states = ['USA', 'CAN'] if !countries_with_supported_states.include?(country_code) mapping.delete(:state) add_field(mappings[:billing_address][:state], 'XX') end mapping.each do |k, v| field = mappings[:billing_address][k] add_field(field, v) unless field.nil? end end |