diff --git a/lib/rock_rms/resources/recurring_donation.rb b/lib/rock_rms/resources/recurring_donation.rb index 54c0ffe..89a339c 100644 --- a/lib/rock_rms/resources/recurring_donation.rb +++ b/lib/rock_rms/resources/recurring_donation.rb @@ -73,7 +73,7 @@ def update_recurring_donation( options['EndDate'] = end_date if end_date options['Summary'] = summary if summary options['Status'] = status if status - options['StatusMessage'] = status_message if status_message + options['StatusMessage'] = status_message if status_message || status_message == '' patch(recurring_donation_path(id), options) end diff --git a/spec/rock_rms/resources/recurring_donation_spec.rb b/spec/rock_rms/resources/recurring_donation_spec.rb index c3e4499..1b91d9c 100644 --- a/spec/rock_rms/resources/recurring_donation_spec.rb +++ b/spec/rock_rms/resources/recurring_donation_spec.rb @@ -66,6 +66,25 @@ expect(resource).to be_nil end + it 'updates status_message with nil' do + expect(client).to receive(:patch) + .with( + 'FinancialScheduledTransactions/123', + { + 'NextPaymentDate' => '2018-01-01', + 'StatusMessage' => '' + } + ).and_call_original + + resource = client.update_recurring_donation( + 123, + next_payment_date: '2018-01-01', + status_message: '' + ) + + expect(resource).to be_nil + end + context 'arguments' do it 'require `id`' do expect { client.update_recurring_donation }