<commit_before>module KillBillIntegrationTests
  module RefundHelper

    def refund(payment_id, amount, adjusted = false, adjustments = nil, user, options)
      refund = KillBillClient::Model::Refund.new
      refund.payment_id = payment_id
      refund.adjusted = adjusted
      refund.amount = amount
      if adjustments
        refund.adjustments = []
        adjustments.each do |iia|
          item = KillBillClient::Model::InvoiceItem.new
          item.invoice_item_id = iia[:invoice_item_id]
          item.currency = iia[:currency]
          item.amount = iia[:amount]
          refund.adjustments << item
        end
      end
      refund.create(user, nil, nil, options)

    end
  end
end<commit_msg>refund_helper: fix implementation of refund<commit_after>module KillBillIntegrationTests
  module RefundHelper

    def refund(payment_id, amount, adjustments, user, options)
      item_adjustments = nil
      unless adjustments.nil?
        item_adjustments = []
        adjustments.each do |iia|
          item                 = KillBillClient::Model::InvoiceItem.new
          item.invoice_item_id = iia[:invoice_item_id]
          item.amount          = iia[:amount]
          item_adjustments << item
        end
      end

      KillBillClient::Model::InvoicePayment.refund(payment_id, amount, item_adjustments, user, nil, nil, options)
    end
  end
end
{'fraction_non_alphanumeric': 0.08072727272727273, 'fraction_numerical': 0.0, 'mean_word_length': 2.602094240837696, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3135539', 'n_tokens_mistral': 393, 'n_tokens_neox': 390, 'n_words': 87}