Skip to content

Commit

Permalink
send ScheduledTransactionId on refunds (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshcrews authored Mar 20, 2024
1 parent cedfde2 commit 99b08c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rock_rms/resources/refund.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ def create_refund(

transaction_amount = old_transaction[:details].map{|d| d[:amount]}.reduce(0.0){|sum,x| sum + x }

scheduled_transaction_id = old_transaction[:recurring_donation_id]

refund_amount = amount || transaction_amount

params = {
Expand All @@ -34,7 +36,8 @@ def create_refund(
'TransactionDateTime' => date,
'TransactionDetails' => refunded_details(old_transaction[:details], transaction_amount, refund_amount),
'TransactionTypeValueId' => old_transaction[:transaction_type_id],
'SourceTypeValueId' => old_transaction[:source_type_id]
'SourceTypeValueId' => old_transaction[:source_type_id],
'ScheduledTransactionId' => scheduled_transaction_id,
}
}
post(refund_path, params)
Expand Down
2 changes: 2 additions & 0 deletions spec/rock_rms/resources/refund_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
],
'TransactionTypeValueId' => 53,
'SourceTypeValueId' => 10,
'ScheduledTransactionId' => 1,
'TransactionCode' => nil
}
}
Expand Down Expand Up @@ -123,6 +124,7 @@
"EntityId" => nil
}
],
'ScheduledTransactionId' => 1,
'TransactionTypeValueId' => 53,
'SourceTypeValueId' => 10,
'TransactionCode' => nil
Expand Down

0 comments on commit 99b08c6

Please sign in to comment.