rock_rms 5.7.1 → 5.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rock_rms/client.rb +13 -1
- data/lib/rock_rms/resources/recurring_donation.rb +4 -0
- data/lib/rock_rms/resources/recurring_donation_detail.rb +21 -0
- data/lib/rock_rms/resources/transaction.rb +3 -1
- data/lib/rock_rms/resources/transaction_detail.rb +13 -4
- data/lib/rock_rms/response/recurring_donation.rb +2 -1
- data/lib/rock_rms/response/recurring_donation_details.rb +3 -1
- data/lib/rock_rms/response/transaction_detail.rb +3 -1
- data/lib/rock_rms/version.rb +1 -1
- data/rock_rms.gemspec +1 -1
- data/spec/rock_rms/resources/recurring_donation_detail_spec.rb +59 -0
- data/spec/rock_rms/resources/recurring_donation_spec.rb +1 -1
- data/spec/rock_rms/resources/transaction_spec.rb +1 -1
- data/spec/rock_rms/response/recurring_donation_spec.rb +1 -0
- data/spec/rock_rms/response/transaction_detail_spec.rb +2 -0
- data/spec/support/fixtures/create_recurring_donation_detail.json +1 -0
- data/spec/support/rock_mock.rb +3 -1
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3f32473b27446f60af760e2f113670a7a92bf7126bb27f77aea8eba4d0d71ff3
|
|
4
|
+
data.tar.gz: 7ab84e4e37918f83c6aceddb3a744a7b0af8093425bd7a10073a8d2eb50b42a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89cf493e25aa3bf163db43abb8f18c0319c8f1d41c7beedc78afd2b65689163358c75d604966b5eb02a02f73afe2bec115c15079e11f13b6ffa813252182332f
|
|
7
|
+
data.tar.gz: 0c80f3bcfaa5cfb38a87f40e4039494b865fb672e221af7448d7138e441cde9d7ecfcf679f4fc5a9c32efc5609d936db0b2d979491d737b27d817b02bf83ff06
|
data/lib/rock_rms/client.rb
CHANGED
|
@@ -75,8 +75,20 @@ module RockRMS
|
|
|
75
75
|
private
|
|
76
76
|
|
|
77
77
|
def auth
|
|
78
|
+
begin
|
|
79
|
+
auth_request('Auth/Login')
|
|
80
|
+
rescue Faraday::Error::ParsingError => e
|
|
81
|
+
if e.message.include?('Document Moved')
|
|
82
|
+
auth_request('auth/login')
|
|
83
|
+
else
|
|
84
|
+
raise e
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def auth_request(path)
|
|
78
90
|
connection.post(
|
|
79
|
-
|
|
91
|
+
path,
|
|
80
92
|
'Username' => username,
|
|
81
93
|
'Password' => password,
|
|
82
94
|
'Persisted' => true
|
|
@@ -1,6 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
module RockRMS
|
|
2
4
|
class Client
|
|
3
5
|
module RecurringDonationDetail
|
|
6
|
+
def create_recurring_donation_detail(
|
|
7
|
+
recurring_donation_id:,
|
|
8
|
+
fund_id:,
|
|
9
|
+
amount:
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
options = {
|
|
13
|
+
'AccountId' => fund_id,
|
|
14
|
+
'Amount' => amount,
|
|
15
|
+
'ScheduledTransactionId' => recurring_donation_id
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
post(recurring_donation_detail_path, options)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def delete_recurring_donation_detail(id)
|
|
22
|
+
delete(recurring_donation_detail_path(id))
|
|
23
|
+
end
|
|
24
|
+
|
|
4
25
|
def update_recurring_donation_detail(id, fund_id: nil, amount: nil)
|
|
5
26
|
options = {}
|
|
6
27
|
options['AccountId'] = fund_id if fund_id
|
|
@@ -11,11 +11,20 @@ module RockRMS
|
|
|
11
11
|
Response::TransactionDetail.format(res)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def update_transaction_detail(
|
|
14
|
+
def update_transaction_detail(
|
|
15
|
+
id,
|
|
16
|
+
fund_id: nil,
|
|
17
|
+
amount: nil,
|
|
18
|
+
fee_amount: nil,
|
|
19
|
+
entity_type_id: nil,
|
|
20
|
+
entity_id: nil
|
|
21
|
+
)
|
|
15
22
|
options = {}
|
|
16
|
-
options['AccountId']
|
|
17
|
-
options['Amount']
|
|
18
|
-
options['FeeAmount']
|
|
23
|
+
options['AccountId'] = fund_id if fund_id
|
|
24
|
+
options['Amount'] = amount if amount
|
|
25
|
+
options['FeeAmount'] = fee_amount if fee_amount
|
|
26
|
+
options['EntityTypeId'] = entity_type_id if entity_type_id
|
|
27
|
+
options['EntityId'] = entity_id if entity_id
|
|
19
28
|
|
|
20
29
|
patch(transaction_detail_path(id), options)
|
|
21
30
|
end
|
|
@@ -13,7 +13,8 @@ module RockRMS
|
|
|
13
13
|
person_id: 'AuthorizedPersonAliasId',
|
|
14
14
|
start_date: 'StartDate',
|
|
15
15
|
transaction_details: 'ScheduledTransactionDetails',
|
|
16
|
-
transaction_code: 'TransactionCode'
|
|
16
|
+
transaction_code: 'TransactionCode',
|
|
17
|
+
summary: 'Summary'
|
|
17
18
|
}.freeze
|
|
18
19
|
|
|
19
20
|
def format_single(data)
|
data/lib/rock_rms/version.rb
CHANGED
data/rock_rms.gemspec
CHANGED
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
|
28
28
|
s.add_development_dependency 'bundler', '~> 2.0'
|
|
29
29
|
s.add_development_dependency 'dotenv'
|
|
30
30
|
s.add_development_dependency 'pry'
|
|
31
|
-
s.add_development_dependency 'rake', '~>
|
|
31
|
+
s.add_development_dependency 'rake', '~> 12.3.3'
|
|
32
32
|
s.add_development_dependency 'rspec', '~> 3.7'
|
|
33
33
|
s.add_development_dependency 'sinatra', '~> 2.0'
|
|
34
34
|
s.add_development_dependency 'webmock', '~> 3.1'
|
|
@@ -3,6 +3,50 @@ require 'spec_helper'
|
|
|
3
3
|
RSpec.describe RockRMS::Client::RecurringDonationDetail, type: :model do
|
|
4
4
|
include_context 'resource specs'
|
|
5
5
|
|
|
6
|
+
describe '#create_recurring_donation_detail' do
|
|
7
|
+
context 'arguments' do
|
|
8
|
+
it 'require `fund_id`' do
|
|
9
|
+
expect { client.create_recurring_donation_detail }
|
|
10
|
+
.to raise_error(ArgumentError, /fund_id/)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
it 'require `amount`' do
|
|
14
|
+
expect { client.create_recurring_donation_detail }
|
|
15
|
+
.to raise_error(ArgumentError, /amount/)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it 'require `recurring_donation_id`' do
|
|
19
|
+
expect { client.create_recurring_donation_detail }
|
|
20
|
+
.to raise_error(ArgumentError, /recurring_donation_id/)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
subject(:resource) do
|
|
26
|
+
client.create_recurring_donation_detail(
|
|
27
|
+
fund_id: 1,
|
|
28
|
+
amount: 5.00,
|
|
29
|
+
recurring_donation_id: 1
|
|
30
|
+
)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'returns integer' do
|
|
34
|
+
expect(resource).to be_a(Integer)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'passes options' do
|
|
38
|
+
expect(client).to receive(:post)
|
|
39
|
+
.with(
|
|
40
|
+
'FinancialScheduledTransactionDetails',
|
|
41
|
+
'AccountId' => 1,
|
|
42
|
+
'ScheduledTransactionId' => 1,
|
|
43
|
+
'Amount' => 5.00,
|
|
44
|
+
)
|
|
45
|
+
.and_call_original
|
|
46
|
+
resource
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
6
50
|
describe '#update_recurring_donation_detail' do
|
|
7
51
|
subject(:resource) do
|
|
8
52
|
client.update_recurring_donation_detail(
|
|
@@ -26,4 +70,19 @@ RSpec.describe RockRMS::Client::RecurringDonationDetail, type: :model do
|
|
|
26
70
|
resource
|
|
27
71
|
end
|
|
28
72
|
end
|
|
73
|
+
|
|
74
|
+
describe '#delete_recurring_donation_detail' do
|
|
75
|
+
subject(:resource) do
|
|
76
|
+
client.delete_recurring_donation_detail(123)
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it 'returns nothing' do
|
|
80
|
+
expect(client.delete_recurring_donation_detail(123)).to eq(nil)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'passes options' do
|
|
84
|
+
expect(client).to receive(:delete).with('FinancialScheduledTransactionDetails/123').and_call_original
|
|
85
|
+
resource
|
|
86
|
+
end
|
|
87
|
+
end
|
|
29
88
|
end
|
|
@@ -139,7 +139,7 @@ RSpec.describe RockRMS::Client::RecurringDonation, type: :model do
|
|
|
139
139
|
'FinancialGatewayId' => nil,
|
|
140
140
|
'FinancialPaymentDetailId' => nil,
|
|
141
141
|
'TransactionCode' => 'asdf',
|
|
142
|
-
'ScheduledTransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2 }],
|
|
142
|
+
'ScheduledTransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2, 'EntityId' => nil, 'EntityTypeId' => nil }],
|
|
143
143
|
'GatewayScheduleId' => nil,
|
|
144
144
|
'SourceTypeValueId' => 10,
|
|
145
145
|
'ForeignKey' => nil
|
|
@@ -85,7 +85,7 @@ RSpec.describe RockRMS::Client::Transaction, type: :model do
|
|
|
85
85
|
'FinancialPaymentDetailId' => 1,
|
|
86
86
|
'TransactionCode' => 'asdf',
|
|
87
87
|
'TransactionDateTime' => 1,
|
|
88
|
-
'TransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2 }],
|
|
88
|
+
'TransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2, 'EntityTypeId' => nil, 'EntityId' => nil }],
|
|
89
89
|
'TransactionTypeValueId' => 53,
|
|
90
90
|
'SourceTypeValueId' => 10,
|
|
91
91
|
'Summary' => 'taco tuesday'
|
|
@@ -17,6 +17,8 @@ RSpec.describe RockRMS::Response::TransactionDetail, type: :model do
|
|
|
17
17
|
expect(r[:id]).to eq(p['Id'])
|
|
18
18
|
expect(r[:fund_id]).to eq(p['AccountId'])
|
|
19
19
|
expect(r[:amount]).to eq(p['Amount'])
|
|
20
|
+
expect(r[:entity_type_id]).to eq(p['EntityTypeId'])
|
|
21
|
+
expect(r[:entity_id]).to eq(p['EntityId'])
|
|
20
22
|
end
|
|
21
23
|
end
|
|
22
24
|
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
12345
|
data/spec/support/rock_mock.rb
CHANGED
|
@@ -9,6 +9,7 @@ class RockMock < Sinatra::Base
|
|
|
9
9
|
'FinancialPaymentDetails/:id',
|
|
10
10
|
'FinancialPersonSavedAccounts/:id',
|
|
11
11
|
'FinancialTransactions/:id',
|
|
12
|
+
'FinancialScheduledTransactionDetails/:id',
|
|
12
13
|
'GroupMembers/:id'
|
|
13
14
|
].each do |end_point|
|
|
14
15
|
delete "/api/#{end_point}" do
|
|
@@ -64,7 +65,8 @@ class RockMock < Sinatra::Base
|
|
|
64
65
|
create_recurring_donation: 'FinancialScheduledTransactions',
|
|
65
66
|
create_refund: 'FinancialTransactionRefunds',
|
|
66
67
|
create_refund_reason: 'DefinedValues',
|
|
67
|
-
create_saved_payment_method: 'FinancialPersonSavedAccounts'
|
|
68
|
+
create_saved_payment_method: 'FinancialPersonSavedAccounts',
|
|
69
|
+
create_recurring_donation_detail: 'FinancialScheduledTransactionDetails',
|
|
68
70
|
}.each do |json, end_point|
|
|
69
71
|
post "/api/#{end_point}" do
|
|
70
72
|
json_response 201, "#{json}.json"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rock_rms
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.9.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Taylor Brooks
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-04-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -114,14 +114,14 @@ dependencies:
|
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
117
|
+
version: 12.3.3
|
|
118
118
|
type: :development
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version:
|
|
124
|
+
version: 12.3.3
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: rspec
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -300,6 +300,7 @@ files:
|
|
|
300
300
|
- spec/support/fixtures/create_payment_detail.json
|
|
301
301
|
- spec/support/fixtures/create_phone_number.json
|
|
302
302
|
- spec/support/fixtures/create_recurring_donation.json
|
|
303
|
+
- spec/support/fixtures/create_recurring_donation_detail.json
|
|
303
304
|
- spec/support/fixtures/create_refund.json
|
|
304
305
|
- spec/support/fixtures/create_refund_reason.json
|
|
305
306
|
- spec/support/fixtures/create_saved_payment_method.json
|