Make Order#address_from_distributor public

This commit is contained in:
Kristina Lim
2019-03-30 01:44:25 +08:00
parent 92dc43d7a2
commit 19726061e4
3 changed files with 8 additions and 8 deletions

View File

@@ -27,7 +27,7 @@ class OrderUpdater < SimpleDelegator
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

View File

@@ -326,12 +326,6 @@ Spree::Order.class_eval do
total.to_f > 0.0 && !skip_payment_for_subscription?
end
private
def skip_payment_for_subscription?
subscription.present? && order_cycle.orders_close_at.andand > Time.zone.now
end
def address_from_distributor
address = distributor.address.clone
if bill_address
@@ -342,6 +336,12 @@ Spree::Order.class_eval do
address
end
private
def skip_payment_for_subscription?
subscription.present? && order_cycle.orders_close_at.andand > Time.zone.now
end
def provided_by_order_cycle?(line_item)
order_cycle_variants = order_cycle.andand.variants || []
order_cycle_variants.include? line_item.variant

View File

@@ -107,7 +107,7 @@ class OrderSyncer
# 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