rock_rms 9.32.0 → 9.33.0
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/.github/workflows/test.yml +1 -0
- data/lib/rock_rms/resources/refund.rb +15 -14
- data/lib/rock_rms/resources/transaction.rb +1 -0
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/resources/refund_spec.rb +45 -0
- data/spec/rock_rms/resources/transaction_spec.rb +20 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52ef97fc950fc82099df84057de05eb60ac5be90be48d5d8adc5e7113b13bb66
|
|
4
|
+
data.tar.gz: 15346c8eabf48b48142830a968dff06957053375255aa31ce17975bb3383afd0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5f36b4d339975854b718174a937e6993aaf2f086f9f18f4ae6a5bbc40ce3f68cfaed5dc1c4c4fa824498672ccba16f1ffad889f7c651a8d5b0dc9f71d7b72d63
|
|
7
|
+
data.tar.gz: 0da5c0f20259abd6081fdf923c4a5c4bb9bad503559a2e249e320c96d2793546d79e5f3318a8e46013a46a55c2a1d3d062f160c3c561ed4656bab223d5ed6b35
|
data/.github/workflows/test.yml
CHANGED
|
@@ -12,7 +12,6 @@ module RockRMS
|
|
|
12
12
|
amount: nil,
|
|
13
13
|
gateway_id: nil
|
|
14
14
|
)
|
|
15
|
-
|
|
16
15
|
old_transaction = list_transactions(
|
|
17
16
|
'$expand' => 'TransactionDetails',
|
|
18
17
|
'$filter' => "Id eq #{transaction_id}"
|
|
@@ -20,24 +19,26 @@ module RockRMS
|
|
|
20
19
|
|
|
21
20
|
transaction_amount = old_transaction[:details].map{|d| d[:amount]}.reduce(0.0){|sum,x| sum + x }
|
|
22
21
|
|
|
23
|
-
|
|
24
22
|
refund_amount = amount || transaction_amount
|
|
25
23
|
|
|
24
|
+
financial_transaction = {
|
|
25
|
+
'AuthorizedPersonAliasId' => old_transaction[:person_id],
|
|
26
|
+
'BatchId' => batch_id,
|
|
27
|
+
'FinancialGatewayId' => gateway_id,
|
|
28
|
+
'FinancialPaymentDetailId' => old_transaction[:payment_detail_id],
|
|
29
|
+
'TransactionCode' => transaction_code,
|
|
30
|
+
'TransactionDateTime' => date,
|
|
31
|
+
'TransactionDetails' => refunded_details(old_transaction[:details], transaction_amount, refund_amount),
|
|
32
|
+
'TransactionTypeValueId' => old_transaction[:transaction_type_id],
|
|
33
|
+
'SourceTypeValueId' => old_transaction[:source_type_id],
|
|
34
|
+
'ScheduledTransactionId' => old_transaction[:recurring_donation_id]
|
|
35
|
+
}
|
|
36
|
+
financial_transaction['ShowAsAnonymous'] = true if old_transaction[:show_as_anonymous]
|
|
37
|
+
|
|
26
38
|
params = {
|
|
27
39
|
'OriginalTransactionId' => transaction_id,
|
|
28
40
|
'RefundReasonValueId' => reason_id,
|
|
29
|
-
'FinancialTransaction' =>
|
|
30
|
-
'AuthorizedPersonAliasId' => old_transaction[:person_id],
|
|
31
|
-
'BatchId' => batch_id,
|
|
32
|
-
'FinancialGatewayId' => gateway_id,
|
|
33
|
-
'FinancialPaymentDetailId' => old_transaction[:payment_detail_id],
|
|
34
|
-
'TransactionCode' => transaction_code,
|
|
35
|
-
'TransactionDateTime' => date,
|
|
36
|
-
'TransactionDetails' => refunded_details(old_transaction[:details], transaction_amount, refund_amount),
|
|
37
|
-
'TransactionTypeValueId' => old_transaction[:transaction_type_id],
|
|
38
|
-
'SourceTypeValueId' => old_transaction[:source_type_id],
|
|
39
|
-
'ScheduledTransactionId' => old_transaction[:recurring_donation_id]
|
|
40
|
-
}
|
|
41
|
+
'FinancialTransaction' => financial_transaction
|
|
41
42
|
}
|
|
42
43
|
post(refund_path, params)
|
|
43
44
|
end
|
data/lib/rock_rms/version.rb
CHANGED
|
@@ -135,5 +135,50 @@ RSpec.describe RockRMS::Client::Refund, type: :model do
|
|
|
135
135
|
resource
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
|
+
|
|
139
|
+
context 'show_as_anonymous' do
|
|
140
|
+
subject(:resource) do
|
|
141
|
+
client.create_refund(
|
|
142
|
+
transaction_id: 3000,
|
|
143
|
+
batch_id: 1,
|
|
144
|
+
date: '2018-02-01',
|
|
145
|
+
reason_id: 1
|
|
146
|
+
)
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
before do
|
|
150
|
+
allow(client).to receive(:list_transactions).and_wrap_original do |original, *args|
|
|
151
|
+
original.call(*args).map { |t| t.merge(show_as_anonymous: original_flag) }
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
context 'when the original transaction is anonymous' do
|
|
156
|
+
let(:original_flag) { true }
|
|
157
|
+
|
|
158
|
+
it 'passes ShowAsAnonymous' do
|
|
159
|
+
expect(client).to receive(:post)
|
|
160
|
+
.with(
|
|
161
|
+
'FinancialTransactionRefunds',
|
|
162
|
+
hash_including('FinancialTransaction' => hash_including('ShowAsAnonymous' => true))
|
|
163
|
+
)
|
|
164
|
+
.and_call_original
|
|
165
|
+
resource
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
context 'when the original transaction is not anonymous' do
|
|
170
|
+
let(:original_flag) { false }
|
|
171
|
+
|
|
172
|
+
it 'leaves ShowAsAnonymous out' do
|
|
173
|
+
expect(client).to receive(:post)
|
|
174
|
+
.with(
|
|
175
|
+
'FinancialTransactionRefunds',
|
|
176
|
+
hash_including('FinancialTransaction' => hash_excluding('ShowAsAnonymous'))
|
|
177
|
+
)
|
|
178
|
+
.and_call_original
|
|
179
|
+
resource
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
138
183
|
end
|
|
139
184
|
end
|
|
@@ -95,6 +95,26 @@ RSpec.describe RockRMS::Client::Transaction, type: :model do
|
|
|
95
95
|
.and_call_original
|
|
96
96
|
resource
|
|
97
97
|
end
|
|
98
|
+
|
|
99
|
+
context 'with show_as_anonymous' do
|
|
100
|
+
subject(:resource) do
|
|
101
|
+
client.create_transaction(
|
|
102
|
+
authorized_person_id: 1,
|
|
103
|
+
batch_id: 1,
|
|
104
|
+
date: 1,
|
|
105
|
+
funds: [{ amount: 450, fund_id: 2 }],
|
|
106
|
+
payment_detail_id: 1,
|
|
107
|
+
show_as_anonymous: true
|
|
108
|
+
)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it 'passes ShowAsAnonymous' do
|
|
112
|
+
expect(client).to receive(:post)
|
|
113
|
+
.with('FinancialTransactions', hash_including('ShowAsAnonymous' => true))
|
|
114
|
+
.and_call_original
|
|
115
|
+
resource
|
|
116
|
+
end
|
|
117
|
+
end
|
|
98
118
|
end
|
|
99
119
|
|
|
100
120
|
describe '#update_transaction' do
|
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: 9.
|
|
4
|
+
version: 9.33.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Taylor Brooks
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|