diff --git a/lib/rock_rms/resources/refund.rb b/lib/rock_rms/resources/refund.rb index b54afc1..343af32 100644 --- a/lib/rock_rms/resources/refund.rb +++ b/lib/rock_rms/resources/refund.rb @@ -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 = { @@ -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) diff --git a/spec/rock_rms/resources/refund_spec.rb b/spec/rock_rms/resources/refund_spec.rb index 88f6c2c..4430953 100644 --- a/spec/rock_rms/resources/refund_spec.rb +++ b/spec/rock_rms/resources/refund_spec.rb @@ -71,6 +71,7 @@ ], 'TransactionTypeValueId' => 53, 'SourceTypeValueId' => 10, + 'ScheduledTransactionId' => 1, 'TransactionCode' => nil } } @@ -123,6 +124,7 @@ "EntityId" => nil } ], + 'ScheduledTransactionId' => 1, 'TransactionTypeValueId' => 53, 'SourceTypeValueId' => 10, 'TransactionCode' => nil