Skip to content

Commit

Permalink
Merge pull request #7 from hf2186/fix-state-lookup-issues
Browse files Browse the repository at this point in the history
Fix state lookup issues
  • Loading branch information
hf2186 authored Mar 30, 2019
2 parents b185405 + 0055d63 commit 8e6ee8f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
source 'https://rubygems.org'

gem 'spree', github: 'spree/spree', tag: 'v0.2.24'
gem 'spree_gateway', github: 'spree/spree_gateway', tag: 'v0.2.24'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', tag: 'v0.2.24'
gem 'spree', github: 'spree/spree', tag: 'v0.2.25'
gem 'spree_gateway', github: 'spree/spree_gateway', tag: 'v0.2.25'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise', tag: 'v0.2.25'

group :test do
gem 'coffee-rails'
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2018, Affirm
Copyright (c) 2019, Affirm
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ Simply add this require statement to your spec_helper:
require 'spree_affirm/factories'
```

Copyright (c) 2018 Affirm, released under the New BSD License
Copyright (c) 2019 Affirm, released under the New BSD License
7 changes: 5 additions & 2 deletions app/controllers/spree/affirm_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ def completion_route(order)

def generate_spree_address(affirm_address)
# find the state and country in spree
_state = Spree::State.find_by_abbr(affirm_address["address"]["region1_code"]) or
Spree::State.find_by_name(affirm_address["address"]["region1_code"])
_country = Spree::Country.find_by_iso3(affirm_address["address"]["country_code"]) or
Spree::Country.find_by_iso(affirm_address["address"]["country_code"])


_state = Spree::State.find_by(abbr: affirm_address["address"]["region1_code"], country: _country) or
Spree::State.find_by_abbr(affirm_address["address"]["region1_code"]) or
Spree::State.find_by_name(affirm_address["address"]["region1_code"])

# try to get the name from first and last
_firstname = affirm_address["name"]["first"] if affirm_address["name"]["first"].present?
_lastname = affirm_address["name"]["last"] if affirm_address["name"]["last"].present?
Expand Down
2 changes: 1 addition & 1 deletion lib/spree_affirm/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module SpreeAffirm
VERSION = "0.2.24"
VERSION = "0.2.25"
end

0 comments on commit 8e6ee8f

Please sign in to comment.