@@ -18,7 +18,7 @@ def initialize(order)
1818 # associations try to save and then in turn try to call +update!+ again.)
1919 def recalculate
2020 order . transaction do
21- update_item_count
21+ recalculate_item_count
2222 update_shipment_amounts
2323 update_totals
2424 if order . completed?
@@ -118,7 +118,7 @@ def recalculate_adjustments
118118 # http://www.boe.ca.gov/formspubs/pub113/
119119 update_promotions
120120 update_tax_adjustments
121- update_item_totals
121+ recalculate_item_totals
122122 end
123123
124124 # Updates the following Order total values:
@@ -129,9 +129,9 @@ def recalculate_adjustments
129129 # +promo_total+ The total value of all promotion adjustments
130130 # +total+ The so-called "order total." This is equivalent to +item_total+ plus +adjustment_total+.
131131 def update_totals
132- update_payment_total
133- update_item_total
134- update_shipment_total
132+ recalculate_payment_total
133+ recalculate_item_total
134+ recalculate_shipment_total
135135 update_adjustment_total
136136 end
137137
@@ -144,18 +144,24 @@ def update_shipments
144144 shipments . each ( &:update_state )
145145 end
146146
147- def update_payment_total
147+ def recalculate_payment_total
148148 order . payment_total = payments . completed . includes ( :refunds ) . sum { |payment | payment . amount - payment . refunds . sum ( :amount ) }
149149 end
150+ alias_method :update_payment_total , :recalculate_payment_total
151+ deprecate update_payment_total : :recalculate_payment_total , deprecator : Spree . deprecator
150152
151- def update_shipment_total
153+ def recalculate_shipment_total
152154 order . shipment_total = shipments . to_a . sum ( &:cost )
153- update_order_total
155+ recalculate_order_total
154156 end
157+ alias_method :update_shipment_total , :recalculate_shipment_total
158+ deprecate update_shipment_total : :recalculate_shipment_total , deprecator : Spree . deprecator
155159
156- def update_order_total
160+ def recalculate_order_total
157161 order . total = order . item_total + order . shipment_total + order . adjustment_total
158162 end
163+ alias_method :update_order_total , :recalculate_order_total
164+ deprecate update_order_total : :recalculate_order_total , deprecator : Spree . deprecator
159165
160166 def update_adjustment_total
161167 recalculate_adjustments
@@ -170,17 +176,21 @@ def update_adjustment_total
170176 order . included_tax_total = all_items . sum ( &:included_tax_total ) + order_tax_adjustments . select ( &:included? ) . sum ( &:amount )
171177 order . additional_tax_total = all_items . sum ( &:additional_tax_total ) + order_tax_adjustments . reject ( &:included? ) . sum ( &:amount )
172178
173- update_order_total
179+ recalculate_order_total
174180 end
175181
176- def update_item_count
182+ def recalculate_item_count
177183 order . item_count = line_items . to_a . sum ( &:quantity )
178184 end
185+ alias_method :update_item_count , :recalculate_item_count
186+ deprecate update_item_count : :recalculate_item_count , deprecator : Spree . deprecator
179187
180- def update_item_total
188+ def recalculate_item_total
181189 order . item_total = line_items . to_a . sum ( &:amount )
182- update_order_total
190+ recalculate_order_total
183191 end
192+ alias_method :update_item_total , :recalculate_item_total
193+ deprecate update_item_total : :recalculate_item_total , deprecator : Spree . deprecator
184194
185195 def persist_totals
186196 order . save!
@@ -214,7 +224,7 @@ def update_cancellations
214224 end
215225 deprecate :update_cancellations , deprecator : Spree . deprecator
216226
217- def update_item_totals
227+ def recalculate_item_totals
218228 [ *line_items , *shipments ] . each do |item |
219229 Spree ::Config . item_total_class . new ( item ) . recalculate!
220230
0 commit comments