Skip to content

Commit 5e2600f

Browse files
Add a note to descriptions for split repayments
1 parent 8fd1aaa commit 5e2600f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

app/controllers/monzo_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ def receive
2929
description << webhook[:data][:merchant][:metadata][:suggested_tags] if webhook[:data][:merchant].try(:[], :metadata).try(:[], :suggested_tags)
3030
end
3131

32+
# If this is a split repayment, then add that to the description
33+
if webhook[:data][:metadata].try(:[], :p2p_initiator) == 'payment-request' && webhook[:data][:merchant].present? && webhook[:data][:counterparty].present?
34+
description << " (Repayment to #{webhook[:data][:counterparty][:name]})"
35+
end
36+
3237
ynab_creator = YNAB::TransactionCreator.new(
3338
id: "M#{webhook[:data][:id]}",
3439
date: Time.parse(webhook[:data][:created]).to_date,

0 commit comments

Comments
 (0)