Skip to content

Commit

Permalink
Make Order#address_from_distributor public
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinalim committed Mar 29, 2019
1 parent e2b8731 commit 5e8bdaa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/models/order_updater.rb
Expand Up @@ -27,7 +27,7 @@ def before_save_hook
def shipping_address_from_distributor
return if order.shipping_method.blank? || order.shipping_method.require_ship_address

order.ship_address = order.__send__(:address_from_distributor)
order.ship_address = order.address_from_distributor
end

private
Expand Down
4 changes: 2 additions & 2 deletions app/models/spree/order_decorator.rb
Expand Up @@ -341,8 +341,6 @@ def pending_payments
payments.select {|p| p.state == "checkout"} # Original definition
end

private

def address_from_distributor
address = distributor.address.clone
if bill_address
Expand All @@ -353,6 +351,8 @@ def address_from_distributor
address
end

private

def provided_by_order_cycle?(line_item)
order_cycle_variants = order_cycle.andand.variants || []
order_cycle_variants.include? line_item.variant
Expand Down
2 changes: 1 addition & 1 deletion app/services/order_syncer.rb
Expand Up @@ -107,7 +107,7 @@ def ship_address_updatable?(order)
# address on the order matches the shop's address
def force_ship_address_required?(order)
return false unless shipping_method.require_ship_address?
distributor_address = order.__send__(:address_from_distributor)
distributor_address = order.address_from_distributor
relevant_address_attrs.all? do |attr|
order.ship_address[attr] == distributor_address[attr]
end
Expand Down

0 comments on commit 5e8bdaa

Please sign in to comment.