Snippets

greatghoul 8yjjeM: Untitled snippet

Created by greatghoul
Proc.new do
  CompanyPayment.all.each do |payment|
    groups = payment.detail.group_by { |detail| "#{detail[:name]} - #{detail[:amount]}" }
    groups.each do |name, details|
      if details.count > 1
        puts "Payment #{payment.id}, #{payment.account_id}, #{payment.period}"
        details.each do |detail|
          transaction = Braintree::Transaction.find(detail[:transaction_id])
          result = detail.dup.merge(transaction_status: transaction.status)
          puts "  - #{result}"
        end
      end
    end
  end

  nil
end.call

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.