rock_rms 3.9.0 → 4.0.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/README.md +1 -1
- data/lib/rock_rms/client.rb +1 -1
- data/lib/rock_rms/resources/payment_detail.rb +56 -0
- data/lib/rock_rms/resources/transaction.rb +2 -2
- data/lib/rock_rms/response/{payment_method.rb → payment_detail.rb} +1 -1
- data/lib/rock_rms/response/recurring_donation.rb +1 -1
- data/lib/rock_rms/response/saved_payment_method.rb +1 -1
- data/lib/rock_rms/response/transaction.rb +1 -1
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/resources/{payment_method_spec.rb → payment_detail_spec.rb} +11 -9
- data/spec/rock_rms/resources/transaction_spec.rb +1 -1
- data/spec/rock_rms/response/{payment_method_spec.rb → payment_detail_spec.rb} +2 -2
- data/spec/support/fixtures/{create_payment_method.json → create_payment_detail.json} +0 -0
- data/spec/support/fixtures/{payment_methods.json → payment_details.json} +0 -0
- data/spec/support/rock_mock.rb +2 -2
- metadata +8 -8
- data/lib/rock_rms/resources/payment_method.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a826c9dad155cd2dde1432bcf622307375bc5e16
|
4
|
+
data.tar.gz: e5053d52043a7c4b7bc5e8a8089c4abc8623b2a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abfce0335816d7d9ec0235fd08424781b75287a13c68acbfd86d4d6bd3c3dd365adafbc013eab222dfb3eb25080466249d8df999a0d57a31190a551b46ddeab2
|
7
|
+
data.tar.gz: 11c7835281d1a541223d726125032d1508a40a054a2d25a659204f5396f8f591972c849a0fd33290c597b936b79a850b57a690faff3319e972d7554ab2d2f09d
|
data/README.md
CHANGED
data/lib/rock_rms/client.rb
CHANGED
@@ -14,7 +14,7 @@ module RockRMS
|
|
14
14
|
include RockRMS::Client::Gateway
|
15
15
|
include RockRMS::Client::Group
|
16
16
|
include RockRMS::Client::GroupMember
|
17
|
-
include RockRMS::Client::
|
17
|
+
include RockRMS::Client::PaymentDetail
|
18
18
|
include RockRMS::Client::Person
|
19
19
|
include RockRMS::Client::PhoneNumber
|
20
20
|
include RockRMS::Client::RecurringDonation
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module RockRMS
|
2
|
+
class Client
|
3
|
+
module PaymentDetail
|
4
|
+
def list_payment_details(options = {})
|
5
|
+
res = get(payment_detail_path, options)
|
6
|
+
Response::PaymentDetail.format(res)
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_payment_detail(payment_type:, foreign_key: nil, card_type: nil)
|
10
|
+
options = {
|
11
|
+
'CurrencyTypeValueId' => cast_payment_type(payment_type),
|
12
|
+
'CreditCardTypeValueId' => cast_card_type(card_type),
|
13
|
+
'ForeignKey' => foreign_key
|
14
|
+
}
|
15
|
+
|
16
|
+
post(payment_detail_path, options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete_payment_detail(id)
|
20
|
+
delete(payment_detail_path(id))
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def cast_payment_type(payment_type)
|
26
|
+
case payment_type
|
27
|
+
when 'card'
|
28
|
+
156
|
29
|
+
when 'bank account', 'ach'
|
30
|
+
157
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def cast_card_type(card_type)
|
35
|
+
case card_type
|
36
|
+
when 'visa'
|
37
|
+
7
|
38
|
+
when 'mastercard'
|
39
|
+
8
|
40
|
+
when 'amex'
|
41
|
+
159
|
42
|
+
when 'discover'
|
43
|
+
160
|
44
|
+
when 'diner'
|
45
|
+
161
|
46
|
+
when 'jcb'
|
47
|
+
162
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def payment_detail_path(id = nil)
|
52
|
+
id ? "FinancialPaymentDetails/#{id}" : 'FinancialPaymentDetails'
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -23,7 +23,7 @@ module RockRMS
|
|
23
23
|
batch_id:,
|
24
24
|
date:,
|
25
25
|
funds:,
|
26
|
-
|
26
|
+
payment_detail_id:,
|
27
27
|
source_type_id: 10,
|
28
28
|
transaction_code: nil,
|
29
29
|
summary: nil,
|
@@ -36,7 +36,7 @@ module RockRMS
|
|
36
36
|
'ScheduledTransactionId' => recurring_donation_id,
|
37
37
|
'BatchId' => batch_id,
|
38
38
|
'FinancialGatewayId' => gateway_id,
|
39
|
-
'FinancialPaymentDetailId' =>
|
39
|
+
'FinancialPaymentDetailId' => payment_detail_id,
|
40
40
|
'TransactionCode' => transaction_code,
|
41
41
|
'TransactionDateTime' => date,
|
42
42
|
'TransactionDetails' => translate_funds(funds),
|
@@ -15,7 +15,7 @@ module RockRMS
|
|
15
15
|
def format_single(data)
|
16
16
|
result = to_h(MAP, data)
|
17
17
|
result[:transaction_details] = RecurringDonationDetails.format(result[:transaction_details])
|
18
|
-
result[:payment_details] =
|
18
|
+
result[:payment_details] = PaymentDetail.format(result[:payment_details])
|
19
19
|
result
|
20
20
|
end
|
21
21
|
end
|
@@ -13,7 +13,7 @@ module RockRMS
|
|
13
13
|
|
14
14
|
def format_single(data)
|
15
15
|
response = to_h(MAP, data)
|
16
|
-
response[:payment_details] =
|
16
|
+
response[:payment_details] = PaymentDetail.format(response[:payment_details])
|
17
17
|
response
|
18
18
|
end
|
19
19
|
end
|
@@ -21,7 +21,7 @@ module RockRMS
|
|
21
21
|
def format_single(data)
|
22
22
|
response = to_h(MAP, data)
|
23
23
|
response[:details] = TransactionDetail.format(response[:details])
|
24
|
-
response[:payment_details] =
|
24
|
+
response[:payment_details] = PaymentDetail.format(response[:payment_details])
|
25
25
|
response[:person] = format_person(response[:person])
|
26
26
|
response[:amount] = calculate_total(response[:details])
|
27
27
|
response
|
data/lib/rock_rms/version.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe RockRMS::Client::
|
3
|
+
RSpec.describe RockRMS::Client::PaymentDetail, type: :model do
|
4
4
|
include_context 'resource specs'
|
5
5
|
|
6
|
-
describe '#
|
6
|
+
describe '#list_payment_details' do
|
7
7
|
it 'returns a array' do
|
8
|
-
resource = client.
|
8
|
+
resource = client.list_payment_details
|
9
9
|
expect(resource).to be_a(Array)
|
10
10
|
expect(resource.first).to be_a(Hash)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
-
describe '#
|
14
|
+
describe '#create_payment_detail' do
|
15
15
|
context 'arguments' do
|
16
16
|
it 'require `payment_type`' do
|
17
|
-
expect { client.
|
17
|
+
expect { client.create_payment_detail }
|
18
18
|
.to raise_error(ArgumentError, /payment_type/)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
subject(:resource) do
|
23
|
-
client.
|
23
|
+
client.create_payment_detail(payment_type: 'card', card_type: 'amex')
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'returns integer' do
|
@@ -32,6 +32,7 @@ RSpec.describe RockRMS::Client::PaymentMethod, type: :model do
|
|
32
32
|
.with(
|
33
33
|
'FinancialPaymentDetails',
|
34
34
|
'CurrencyTypeValueId' => 156,
|
35
|
+
'CreditCardTypeValueId' => 159,
|
35
36
|
'ForeignKey' => nil
|
36
37
|
)
|
37
38
|
.and_call_original
|
@@ -39,14 +40,15 @@ RSpec.describe RockRMS::Client::PaymentMethod, type: :model do
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
42
|
-
describe '#
|
43
|
+
describe '#delete_payment_detail' do
|
43
44
|
it 'returns nothing' do
|
44
|
-
expect(client.
|
45
|
+
expect(client.delete_payment_detail(123)).to eq(nil)
|
45
46
|
end
|
46
47
|
|
47
48
|
it 'passes id' do
|
48
49
|
expect(client).to receive(:delete).with('FinancialPaymentDetails/123')
|
49
|
-
client.
|
50
|
+
client.delete_payment_detail(123)
|
50
51
|
end
|
51
52
|
end
|
53
|
+
|
52
54
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
RSpec.describe RockRMS::Response::
|
4
|
-
let(:parsed) { JSON.parse(FixturesHelper.read('
|
3
|
+
RSpec.describe RockRMS::Response::PaymentDetail, type: :model do
|
4
|
+
let(:parsed) { JSON.parse(FixturesHelper.read('payment_details.json')) }
|
5
5
|
|
6
6
|
describe '.format' do
|
7
7
|
subject(:result) { described_class.format(parsed) }
|
File without changes
|
File without changes
|
data/spec/support/rock_mock.rb
CHANGED
@@ -29,7 +29,7 @@ class RockMock < Sinatra::Base
|
|
29
29
|
gateways: 'FinancialGateways',
|
30
30
|
group: 'Groups/:id',
|
31
31
|
groups: 'Groups',
|
32
|
-
|
32
|
+
payment_details: 'FinancialPaymentDetails',
|
33
33
|
people_search: 'People/Search',
|
34
34
|
person_by_alias: 'People/GetByPersonAliasId/:id',
|
35
35
|
phone_numbers: 'PhoneNumbers',
|
@@ -48,7 +48,7 @@ class RockMock < Sinatra::Base
|
|
48
48
|
{
|
49
49
|
create_group_member: 'GroupMembers',
|
50
50
|
create_transaction: 'FinancialTransactions',
|
51
|
-
|
51
|
+
create_payment_detail: 'FinancialPaymentDetails',
|
52
52
|
create_batch: 'FinancialBatches',
|
53
53
|
create_recurring_donation: 'FinancialScheduledTransactions',
|
54
54
|
create_refund: 'FinancialTransactionRefunds',
|
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:
|
4
|
+
version: 4.0.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: 2018-04-
|
11
|
+
date: 2018-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -190,7 +190,7 @@ files:
|
|
190
190
|
- lib/rock_rms/resources/gateway.rb
|
191
191
|
- lib/rock_rms/resources/group.rb
|
192
192
|
- lib/rock_rms/resources/group_member.rb
|
193
|
-
- lib/rock_rms/resources/
|
193
|
+
- lib/rock_rms/resources/payment_detail.rb
|
194
194
|
- lib/rock_rms/resources/person.rb
|
195
195
|
- lib/rock_rms/resources/phone_number.rb
|
196
196
|
- lib/rock_rms/resources/recurring_donation.rb
|
@@ -208,7 +208,7 @@ files:
|
|
208
208
|
- lib/rock_rms/response/group.rb
|
209
209
|
- lib/rock_rms/response/group_location.rb
|
210
210
|
- lib/rock_rms/response/location.rb
|
211
|
-
- lib/rock_rms/response/
|
211
|
+
- lib/rock_rms/response/payment_detail.rb
|
212
212
|
- lib/rock_rms/response/person.rb
|
213
213
|
- lib/rock_rms/response/phone_number.rb
|
214
214
|
- lib/rock_rms/response/recurring_donation.rb
|
@@ -225,7 +225,7 @@ files:
|
|
225
225
|
- spec/rock_rms/resources/gateway_spec.rb
|
226
226
|
- spec/rock_rms/resources/group_member_spec.rb
|
227
227
|
- spec/rock_rms/resources/group_spec.rb
|
228
|
-
- spec/rock_rms/resources/
|
228
|
+
- spec/rock_rms/resources/payment_detail_spec.rb
|
229
229
|
- spec/rock_rms/resources/person_spec.rb
|
230
230
|
- spec/rock_rms/resources/phone_number_spec.rb
|
231
231
|
- spec/rock_rms/resources/recurring_donation_spec.rb
|
@@ -239,7 +239,7 @@ files:
|
|
239
239
|
- spec/rock_rms/response/group_location_spec.rb
|
240
240
|
- spec/rock_rms/response/group_spec.rb
|
241
241
|
- spec/rock_rms/response/location_spec.rb
|
242
|
-
- spec/rock_rms/response/
|
242
|
+
- spec/rock_rms/response/payment_detail_spec.rb
|
243
243
|
- spec/rock_rms/response/phone_number_spec.rb
|
244
244
|
- spec/rock_rms/response/recurring_donation_details_spec.rb
|
245
245
|
- spec/rock_rms/response/recurring_donation_spec.rb
|
@@ -254,7 +254,7 @@ files:
|
|
254
254
|
- spec/support/fixtures/campuses.json
|
255
255
|
- spec/support/fixtures/create_batch.json
|
256
256
|
- spec/support/fixtures/create_group_member.json
|
257
|
-
- spec/support/fixtures/
|
257
|
+
- spec/support/fixtures/create_payment_detail.json
|
258
258
|
- spec/support/fixtures/create_recurring_donation.json
|
259
259
|
- spec/support/fixtures/create_refund.json
|
260
260
|
- spec/support/fixtures/create_refund_reason.json
|
@@ -269,7 +269,7 @@ files:
|
|
269
269
|
- spec/support/fixtures/groups_with_locations.json
|
270
270
|
- spec/support/fixtures/groups_with_members.json
|
271
271
|
- spec/support/fixtures/locations.json
|
272
|
-
- spec/support/fixtures/
|
272
|
+
- spec/support/fixtures/payment_details.json
|
273
273
|
- spec/support/fixtures/people_search.json
|
274
274
|
- spec/support/fixtures/person_by_alias.json
|
275
275
|
- spec/support/fixtures/phone_numbers.json
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module RockRMS
|
2
|
-
class Client
|
3
|
-
module PaymentMethod
|
4
|
-
def list_payment_methods(options = {})
|
5
|
-
res = get(payment_method_path, options)
|
6
|
-
Response::PaymentMethod.format(res)
|
7
|
-
end
|
8
|
-
|
9
|
-
def create_payment_method(payment_type:, foreign_key: nil)
|
10
|
-
options = {
|
11
|
-
'CurrencyTypeValueId' => cast_payment_type(payment_type),
|
12
|
-
'ForeignKey' => foreign_key
|
13
|
-
}
|
14
|
-
|
15
|
-
post(payment_method_path, options)
|
16
|
-
end
|
17
|
-
|
18
|
-
def delete_payment_method(id)
|
19
|
-
delete(payment_method_path(id))
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def cast_payment_type(payment_type)
|
25
|
-
case payment_type
|
26
|
-
when 'card'
|
27
|
-
156
|
28
|
-
when 'bank account', 'ach'
|
29
|
-
157
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def payment_method_path(id = nil)
|
34
|
-
id ? "FinancialPaymentDetails/#{id}" : 'FinancialPaymentDetails'
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|