From 97f38d00f6d7793deba61860e628b2a53d0c8d8d Mon Sep 17 00:00:00 2001 From: Richard Gallagher Date: Tue, 6 Jan 2026 14:26:36 -0500 Subject: [PATCH] Fix date comparison error and add disbursement transaction support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit addresses two issues in the Venmo history export script: 1. Fixed date comparison error (line 203-204): - Added type check before date comparison to handle cases where hash[:date_completed] might already be a Date object - Prevents comparison errors by parsing only when needed 2. Added support for disbursement transaction type (lines 181-189): - Added new 'when "disbursement"' case handler - Maps disbursement events to transaction format with proper fields: date_completed, description, amount, and merchant display_name - Prevents disbursements from falling through to unknown event handler 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- venmo_history.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/venmo_history.rb b/venmo_history.rb index 808ff0e..ff56113 100644 --- a/venmo_history.rb +++ b/venmo_history.rb @@ -177,7 +177,17 @@ def paginated_get(path, options = {}) :name => "#{event["refund"]["destination"]["name"]}", } ) - + + when "disbursement" + hash.merge!( + { + :date_completed => Date.parse(event["date_created"]), + :description => "#{event["type"].upcase}", + :amount => event["disbursement"]["amount"], + :name => event["disbursement"]["merchant"]["display_name"], + } + ) + else puts "⚠️ Found unknown event found. Fix directly in your CSV file.\n\n #{event} \n\n" hash.merge!( @@ -190,7 +200,8 @@ def paginated_get(path, options = {}) ) end - transactions << hash if hash[:date_completed] >= @last_date_to_include + date_completed = hash[:date_completed].is_a?(Date) ? hash[:date_completed] : Date.parse(hash[:date_completed]) + transactions << hash if date_completed >= @last_date_to_include } transactions.map { |record|