rock_rms 5.1.0 → 5.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rock_rms/error.rb +16 -7
- data/lib/rock_rms/resources/recurring_donation.rb +10 -0
- data/lib/rock_rms/resources/refund.rb +3 -1
- data/lib/rock_rms/resources/transaction.rb +4 -0
- data/lib/rock_rms/resources/transaction_detail.rb +2 -1
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/error_spec.rb +3 -1
- data/spec/rock_rms/resources/refund_spec.rb +2 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 870060d86df164090957d778d3927ad9916ade3d
|
4
|
+
data.tar.gz: 1ca9283e89a5f81f974cb9b7acc7393c2be8a31e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4864199c84ee731c9629e657d01fc33d6d7eb607974850f4e06113af0a136c662277051bea3303ecb60f1b8ba4c1f70e2271b1547e2f48e4769931aa8aee5b4
|
7
|
+
data.tar.gz: 37236d2f406bf9b9f748792da70709b2e0a0e20fd226eeebeb33be9309b3a162f9b1fc3092fa5c9e30993681599be7009b1a055d8c4d3ad05be1dbec29732ab4
|
data/lib/rock_rms/error.rb
CHANGED
@@ -5,6 +5,7 @@ module RockRMS
|
|
5
5
|
class GatewayTimeout < Error; end
|
6
6
|
class InternalServerError < Error; end
|
7
7
|
class NotFound < Error; end
|
8
|
+
class ServiceUnavailable < Error; end
|
8
9
|
class Unauthorized < Error; end
|
9
10
|
end
|
10
11
|
|
@@ -16,20 +17,28 @@ module FaradayMiddleware
|
|
16
17
|
def on_complete(env)
|
17
18
|
case env[:status]
|
18
19
|
when 400
|
19
|
-
raise RockRMS::BadRequest,
|
20
|
+
raise RockRMS::BadRequest, error_message(env)
|
20
21
|
when 401
|
21
|
-
raise RockRMS::Unauthorized,
|
22
|
+
raise RockRMS::Unauthorized, error_message(env)
|
22
23
|
when 403
|
23
|
-
raise RockRMS::Forbidden,
|
24
|
+
raise RockRMS::Forbidden, error_message(env)
|
24
25
|
when 404
|
25
|
-
raise RockRMS::NotFound,
|
26
|
+
raise RockRMS::NotFound, error_message(env)
|
26
27
|
when 500
|
27
|
-
raise RockRMS::InternalServerError,
|
28
|
+
raise RockRMS::InternalServerError, error_message(env)
|
29
|
+
when 503
|
30
|
+
raise RockRMS::ServiceUnavailable, error_message(env)
|
28
31
|
when 504
|
29
|
-
raise RockRMS::GatewayTimeout,
|
32
|
+
raise RockRMS::GatewayTimeout, error_message(env)
|
30
33
|
when ERROR_STATUSES
|
31
|
-
raise RockRMS::Error,
|
34
|
+
raise RockRMS::Error, error_message(env)
|
32
35
|
end
|
33
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def error_message(env)
|
41
|
+
"#{env[:status]}: #{env[:url]} #{env[:body]}"
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
@@ -58,6 +58,16 @@ module RockRMS
|
|
58
58
|
patch(recurring_donation_path(id), options)
|
59
59
|
end
|
60
60
|
|
61
|
+
def launch_scheduled_transaction_workflow(
|
62
|
+
id,
|
63
|
+
workflow_type_id:,
|
64
|
+
workflow_name:,
|
65
|
+
attributes: {}
|
66
|
+
)
|
67
|
+
query_string = "?workflowTypeId=#{workflow_type_id}&workflowName=#{workflow_name}"
|
68
|
+
post(recurring_donation_path + "/LaunchWorkflow/#{id}#{query_string}", attributes)
|
69
|
+
end
|
70
|
+
|
61
71
|
private
|
62
72
|
|
63
73
|
def translate_funds(funds)
|
@@ -9,7 +9,8 @@ module RockRMS
|
|
9
9
|
reason_id:,
|
10
10
|
transaction_id:,
|
11
11
|
transaction_code: nil,
|
12
|
-
amount: nil
|
12
|
+
amount: nil,
|
13
|
+
gateway_id: nil
|
13
14
|
)
|
14
15
|
|
15
16
|
old_transaction = list_transactions(
|
@@ -27,6 +28,7 @@ module RockRMS
|
|
27
28
|
'FinancialTransaction' => {
|
28
29
|
'AuthorizedPersonAliasId' => old_transaction[:person_id],
|
29
30
|
'BatchId' => batch_id,
|
31
|
+
'FinancialGatewayId' => gateway_id,
|
30
32
|
'FinancialPaymentDetailId' => old_transaction[:payment_detail_id],
|
31
33
|
'TransactionCode' => transaction_code,
|
32
34
|
'TransactionDateTime' => date,
|
@@ -11,9 +11,10 @@ module RockRMS
|
|
11
11
|
Response::TransactionDetail.format(res)
|
12
12
|
end
|
13
13
|
|
14
|
-
def update_transaction_detail(id, fund_id: nil, fee_amount: nil)
|
14
|
+
def update_transaction_detail(id, fund_id: nil, amount: nil, fee_amount: nil)
|
15
15
|
options = {}
|
16
16
|
options['AccountId'] = fund_id if fund_id
|
17
|
+
options['Amount'] = amount if amount
|
17
18
|
options['FeeAmount'] = fee_amount if fee_amount
|
18
19
|
|
19
20
|
patch(transaction_detail_path(id), options)
|
data/lib/rock_rms/version.rb
CHANGED
data/spec/rock_rms/error_spec.rb
CHANGED
@@ -18,9 +18,11 @@ RSpec.describe RockRMS::Error do
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def expect_failure(code, body)
|
21
|
+
url = 'http://some-rock-uri.com/api/Auth/Login'
|
22
|
+
|
21
23
|
expect {
|
22
24
|
client.get('anything')
|
23
|
-
}.to raise_error(RockRMS::Error, /#{code}: #{body}/)
|
25
|
+
}.to raise_error(RockRMS::Error, /#{code}: #{url} #{body}/)
|
24
26
|
end
|
25
27
|
|
26
28
|
def expect_success
|
@@ -51,6 +51,7 @@ RSpec.describe RockRMS::Client::Refund, type: :model do
|
|
51
51
|
'FinancialTransaction' => {
|
52
52
|
'AuthorizedPersonAliasId' => 120,
|
53
53
|
'BatchId' => 1,
|
54
|
+
'FinancialGatewayId' => nil,
|
54
55
|
'FinancialPaymentDetailId' => 156,
|
55
56
|
'TransactionDateTime' => '2018-02-01',
|
56
57
|
'TransactionDetails' => [{"Amount"=>-10.0, "AccountId"=>23}, {"Amount"=>-90.0, "AccountId"=>24}],
|
@@ -89,6 +90,7 @@ RSpec.describe RockRMS::Client::Refund, type: :model do
|
|
89
90
|
'FinancialTransaction' => {
|
90
91
|
'AuthorizedPersonAliasId' => 120,
|
91
92
|
'BatchId' => 1,
|
93
|
+
'FinancialGatewayId' => nil,
|
92
94
|
'FinancialPaymentDetailId' => 156,
|
93
95
|
'TransactionDateTime' => '2018-02-01',
|
94
96
|
'TransactionDetails' => [{"Amount"=>-7.56, "AccountId"=>23}, {"Amount"=>-67.99, "AccountId"=>24}],
|
@@ -99,9 +101,6 @@ RSpec.describe RockRMS::Client::Refund, type: :model do
|
|
99
101
|
.and_call_original
|
100
102
|
resource
|
101
103
|
end
|
102
|
-
|
103
104
|
end
|
104
|
-
|
105
105
|
end
|
106
|
-
|
107
106
|
end
|
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.6.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: 2020-
|
11
|
+
date: 2020-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|