lib/atol/request/post_document/sell/body.rb in atol-0.4 vs lib/atol/request/post_document/sell/body.rb in atol-0.4.1
- old
+ new
@@ -31,10 +31,10 @@
result[:external_id] = @external_id
result[:receipt][:attributes][:email] = @email unless @email.empty?
result[:receipt][:attributes][:phone] = @phone unless @phone.empty?
result[:service][:callback_url] = @config.callback_url if @config.callback_url
- total = @items.sum(0) { |item| item[:sum] }
+ total = @items.inject(0) { |sum, item| sum += item[:sum] }
result[:receipt][:total] = total
result[:receipt][:payments][0][:sum] = total
result[:receipt][:items] = @items
end