rock_rms 5.1.0 → 5.6.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9cdeba8c6445c28a97f6ae95e91b65731de96d4b
4
- data.tar.gz: 8c6fd406588607a4c3f445f89c27a023ef3f78d1
3
+ metadata.gz: 870060d86df164090957d778d3927ad9916ade3d
4
+ data.tar.gz: 1ca9283e89a5f81f974cb9b7acc7393c2be8a31e
5
5
  SHA512:
6
- metadata.gz: e87c92795588370db7d42df6ced5654be5c365a457df0e1a343ee80e1e79e5605203977ad2e160725097e10b7c2543cf5f58e3371b6b6b51fb3b64e0149fd9af
7
- data.tar.gz: 818a07c9b3fa588175a9ad62c686e5c08342dc3971d2ff62b6a3b178ae566a55b715fe1b935582a738cd185dd6ee274e1896e09de6d421da17bb7bd4235ade8c
6
+ metadata.gz: a4864199c84ee731c9629e657d01fc33d6d7eb607974850f4e06113af0a136c662277051bea3303ecb60f1b8ba4c1f70e2271b1547e2f48e4769931aa8aee5b4
7
+ data.tar.gz: 37236d2f406bf9b9f748792da70709b2e0a0e20fd226eeebeb33be9309b3a162f9b1fc3092fa5c9e30993681599be7009b1a055d8c4d3ad05be1dbec29732ab4
@@ -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, "#{env[:status]}: #{env[:body]} #{env[:url]}"
20
+ raise RockRMS::BadRequest, error_message(env)
20
21
  when 401
21
- raise RockRMS::Unauthorized, "#{env[:status]}: #{env[:body]} #{env[:url]}"
22
+ raise RockRMS::Unauthorized, error_message(env)
22
23
  when 403
23
- raise RockRMS::Forbidden, "#{env[:status]}: #{env[:body]} #{env[:url]}"
24
+ raise RockRMS::Forbidden, error_message(env)
24
25
  when 404
25
- raise RockRMS::NotFound, "#{env[:status]}: #{env[:body]} #{env[:url]}"
26
+ raise RockRMS::NotFound, error_message(env)
26
27
  when 500
27
- raise RockRMS::InternalServerError, "#{env[:status]}: #{env[:body]} #{env[:url]}"
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, "#{env[:status]}: #{env[:body]} #{env[:url]}"
32
+ raise RockRMS::GatewayTimeout, error_message(env)
30
33
  when ERROR_STATUSES
31
- raise RockRMS::Error, "#{env[:status]}: #{env[:body]} #{env[:url]}"
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,
@@ -77,6 +77,10 @@ module RockRMS
77
77
  delete(transaction_path(id))
78
78
  end
79
79
 
80
+ def refund_transaction(id)
81
+ post(transaction_path + "/Refund/#{id}")
82
+ end
83
+
80
84
  def launch_transaction_workflow(
81
85
  id,
82
86
  workflow_type_id:,
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '5.1.0'.freeze
2
+ VERSION = '5.6.0'.freeze
3
3
  end
@@ -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.1.0
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-06-19 00:00:00.000000000 Z
11
+ date: 2020-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday