Sha256: f529d48301ff2ace8fef8dbe4cab16ec4a0ec4dda6969e6698b62f8fa0c23750

Contents?: true

Size: 598 Bytes

Versions: 3

Compression:

Stored size: 598 Bytes

Contents

module Affirm
  class AddressValidator
    def self.normalize_affirm_address(affirm_address_details)
      _address_mapping = {
        "city"         => 'city',
        "street1"      => 'line1',
        "street2"      => 'line2',
        "postal_code"  => 'zipcode',
        "region1_code" => 'state',
        "country_code" => 'country'
      }

      _address_mapping.each do |key, mapped_key|

        unless affirm_address_details[key].present?
          affirm_address_details[key] = affirm_address_details[mapped_key]
        end

      end

      affirm_address_details
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_affirm-0.2.22 app/models/affirm/address_validator.rb
spree_affirm-0.2.21 app/models/affirm/address_validator.rb
spree_affirm-0.2.20 app/models/affirm/address_validator.rb