10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/friendly_shipping/services/ups/parse_modifier_element.rb', line 10
def self.call(element, currency_code:)
return unless element
amount = element.at('Amount').text.to_d
return if amount.zero?
currency = Money::Currency.new(currency_code)
amount = Money.new(amount * currency.subunit_to_unit, currency)
modifier_type = element.at('ModifierType').text
modifier_description = element.at('ModifierDesc').text
label = "#{modifier_type} (#{modifier_description})"
[label, amount]
end
|