rock_rms 8.2.1 → 8.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bdb02d5b368497d5daf3e93739ad54829e51a119019479fb0613bd17bfc2ace
4
- data.tar.gz: b8b78b12624755e1c2fb25555dd981935f15b7838330e239b98dde822d8130fc
3
+ metadata.gz: 99595984bdaa0f88e5c67214510f387e8140da99eb8c19838e157e34fe8cbde5
4
+ data.tar.gz: c52d968559001749f7793259241bc15b7417f8ebb2173d0b057c5c5e0dabfb72
5
5
  SHA512:
6
- metadata.gz: a87fb269749e58b6dd94846b58ea026bf848d91bbddeb58c967039085745cd3d6e0976f57f236c44536ea91b2093aaa2c5b4dbdcf28cf783088362aa1f3cc028
7
- data.tar.gz: ca462b00b2d2888d029a6114274a027e99bc1a6638cb614002231ba7d55e6e9a4c6315c0d2d528bf742d3982fc4238f0e06a5b2d94e10293d9399ce677a568f7
6
+ metadata.gz: 2baef9f7cf2861dbb34d70e978d0a479ca064c4bd95f2408bfbf125e84f3472bfb44991f2f607efd920e9a752e31bf32e36489b1b9beb9c7aa040d97365c7af7
7
+ data.tar.gz: 1ced4bd65ca1ed1669f8a9a64968a889ab04b576c8c4df03e8773d53f04bcbf762035e1bf2b77259689c448dbd5ebbf2cd66be42954da3ad7f818d441fd147ee
@@ -33,7 +33,8 @@ module RockRMS
33
33
  'TransactionCode' => transaction_code,
34
34
  'TransactionDateTime' => date,
35
35
  'TransactionDetails' => refunded_details(old_transaction[:details], transaction_amount, refund_amount),
36
- 'TransactionTypeValueId' => old_transaction[:transaction_type_id]
36
+ 'TransactionTypeValueId' => old_transaction[:transaction_type_id],
37
+ 'SourceTypeValueId' => old_transaction[:source_type_id]
37
38
  }
38
39
  }
39
40
  post(refund_path, params)
@@ -31,6 +31,27 @@ module RockRMS
31
31
  patch(transaction_detail_path(id), options)
32
32
  end
33
33
 
34
+ def create_transaction_detail(
35
+ transaction_id:,
36
+ fund_id:,
37
+ amount:,
38
+ fee_amount: nil,
39
+ fee_coverage_amount: nil,
40
+ entity_type_id: nil,
41
+ entity_id: nil
42
+ )
43
+ options = {}
44
+ options['TransactionId'] = transaction_id
45
+ options['AccountId'] = fund_id
46
+ options['Amount'] = amount
47
+ options['FeeAmount'] = fee_amount if fee_amount
48
+ options['EntityTypeId'] = entity_type_id if entity_type_id
49
+ options['EntityId'] = entity_id if entity_id
50
+ options['FeeCoverageAmount'] = fee_coverage_amount if fee_coverage_amount
51
+
52
+ post(transaction_detail_path, options)
53
+ end
54
+
34
55
  private
35
56
 
36
57
  def transaction_detail_path(id = nil)
@@ -13,7 +13,8 @@ module RockRMS
13
13
  details: 'TransactionDetails',
14
14
  payment_details: 'FinancialPaymentDetail',
15
15
  payment_detail_id: 'FinancialPaymentDetailId',
16
- transaction_type_id: 'TransactionTypeValueId'
16
+ transaction_type_id: 'TransactionTypeValueId',
17
+ source_type_id: 'SourceTypeValueId',
17
18
  }.freeze
18
19
 
19
20
 
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '8.2.1'.freeze
2
+ VERSION = '8.4.0'.freeze
3
3
  end
@@ -70,6 +70,7 @@ RSpec.describe RockRMS::Client::Refund, type: :model do
70
70
  }
71
71
  ],
72
72
  'TransactionTypeValueId' => 53,
73
+ 'SourceTypeValueId' => 10,
73
74
  'TransactionCode' => nil
74
75
  }
75
76
  }
@@ -123,6 +124,7 @@ RSpec.describe RockRMS::Client::Refund, type: :model do
123
124
  }
124
125
  ],
125
126
  'TransactionTypeValueId' => 53,
127
+ 'SourceTypeValueId' => 10,
126
128
  'TransactionCode' => nil
127
129
  }
128
130
  }
@@ -82,5 +82,34 @@ RSpec.describe RockRMS::Client::TransactionDetail, type: :model do
82
82
  end
83
83
  end
84
84
 
85
+ describe '#create_transaction_detail' do
86
+ context 'simple' do
87
+ subject(:resource) do
88
+ client.create_transaction_detail(
89
+ transaction_id: 123,
90
+ fund_id: 2,
91
+ amount: 5.00
92
+ )
93
+ end
94
+
95
+ it 'returns nothing' do
96
+ expect(subject).to eq(12345)
97
+ end
98
+
99
+ it 'passes options' do
100
+ expect(client).to receive(:post)
101
+ .with(
102
+ 'FinancialTransactionDetails',
103
+ {
104
+ 'AccountId' => 2,
105
+ 'Amount' => 5.00,
106
+ 'TransactionId' => 123
107
+ }
108
+ ).and_call_original
109
+ resource
110
+ end
111
+ end
112
+ end
113
+
85
114
  end
86
115
  end
@@ -22,6 +22,7 @@ RSpec.describe RockRMS::Response::Transaction, type: :model do
22
22
  expect(r[:transaction_code]).to eq(p['TransactionCode'])
23
23
  expect(r[:payment_detail_id]).to eq(p['FinancialPaymentDetailId'])
24
24
  expect(r[:transaction_type_id]).to eq(p['TransactionTypeValueId'])
25
+ expect(r[:source_type_id]).to eq(p['SourceTypeValueId'])
25
26
  expect(r[:details]).to eq(
26
27
  RockRMS::Response::TransactionDetail.format(p['TransactionDetails'])
27
28
  )
@@ -66,6 +66,7 @@ class RockMock < Sinatra::Base
66
66
  create_refund: 'FinancialTransactionRefunds',
67
67
  create_refund_reason: 'DefinedValues',
68
68
  create_saved_payment_method: 'FinancialPersonSavedAccounts',
69
+ create_transaction_detail: 'FinancialTransactionDetails',
69
70
  create_recurring_donation_detail: 'FinancialScheduledTransactionDetails',
70
71
  }.each do |json, end_point|
71
72
  post "/api/#{end_point}" 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: 8.2.1
4
+ version: 8.4.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: 2023-02-14 00:00:00.000000000 Z
11
+ date: 2023-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -331,6 +331,7 @@ files:
331
331
  - spec/support/fixtures/create_refund_reason.json
332
332
  - spec/support/fixtures/create_saved_payment_method.json
333
333
  - spec/support/fixtures/create_transaction.json
334
+ - spec/support/fixtures/create_transaction_detail.json
334
335
  - spec/support/fixtures/defined_values.json
335
336
  - spec/support/fixtures/families.json
336
337
  - spec/support/fixtures/gateways.json