lib/active_shipping/carriers/ups.rb in active_shipping-1.0.0 vs lib/active_shipping/carriers/ups.rb in active_shipping-1.0.1
- old
+ new
@@ -441,9 +441,21 @@
end
build_address_artifact_format_location(xml, 'TransitFrom', origin)
build_address_artifact_format_location(xml, 'TransitTo', destination)
+ xml.ShipmentWeight do
+ xml.UnitOfMeasurement do
+ xml.Code(options[:imperial] ? 'LBS' : 'KGS')
+ end
+
+ value = packages.inject(0) do |sum, package|
+ sum + (options[:imperial] ? package.lbs.to_f : package.kgs.to_f )
+ end
+
+ xml.Weight([value.round(3), 0.1].max)
+ end
+
xml.InvoiceLineTotal do
xml.CurrencyCode('USD')
total_value = packages.inject(0) {|sum, package| sum + package.value}
xml.MonetaryValue(total_value)
end