rock_rms 3.1.0 → 3.2.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
  SHA1:
3
- metadata.gz: 0ce2e3c0428ddbc12f3f61174a80bfe26a118396
4
- data.tar.gz: 486cfc3c44790ec1e12641653189edef93919e6f
3
+ metadata.gz: f0cae4d173508c911eed0f4b4f42bb066733ef4c
4
+ data.tar.gz: 0d3693d923644c81c47d00346f658f3b96a9704d
5
5
  SHA512:
6
- metadata.gz: 545647157dcd6a2ac1e0092adbd0b232ed48be5db15b5634a89af339ebbc988db094757cfb46dcf91d1fcb7ce688da76b6533e107c89af81949092dd8d176d24
7
- data.tar.gz: 734b379adb815d742ed2373497752ff454c961d9a8223d6e90b2a5db28a038f2a3ccb1aabb79f2db0c10ff687c73e9324add58a9f975674203f8389d12e4d7e6
6
+ metadata.gz: 4cbcc9c63f6f55faba9306674e95873821b274c543136cce124a8e46adeffe4438a4721fe4619cceaa5ce7e92c20f9e9b7dd9353752abde5398f361001b2aeb3
7
+ data.tar.gz: 837493f64846af3869877c167f43733b05a252201e4cf2e3ba64b527e558e153d6880e1ee93f53b50ff12f3288dc9e41f3c586aae9af12515b89fadecf7a5204
@@ -3,7 +3,7 @@ module RockRMS
3
3
  module PaymentMethod
4
4
  def list_payment_methods(options = {})
5
5
  res = get(payment_method_path, options)
6
- RockRMS::PaymentMethod.format(res)
6
+ Response::PaymentMethod.format(res)
7
7
  end
8
8
 
9
9
  def create_payment_method(payment_type:, foreign_key: nil)
@@ -11,6 +11,10 @@ module RockRMS
11
11
  Response::Person.format(res)
12
12
  end
13
13
 
14
+ def find_person_by_alias_id(id)
15
+ Response::Person.format(get("People/GetByPersonAliasId/#{id}"))
16
+ end
17
+
14
18
  def find_person_by_email(email)
15
19
  res = get("People/GetByEmail/#{email}")
16
20
  Response::Person.format(res)
@@ -3,6 +3,8 @@ module RockRMS
3
3
  class PaymentMethod < Base
4
4
  MAP = {
5
5
  id: 'Id',
6
+ exp_month: 'ExpirationMonth',
7
+ exp_year: 'ExpirationYear',
6
8
  foreign_key: 'ForeignKey',
7
9
  payment_type_id: 'CurrencyTypeValueId',
8
10
  masked_number: 'AccountNumberMasked'
@@ -5,6 +5,7 @@ module RockRMS
5
5
  id: 'Id',
6
6
  foreign_key: 'ForeignKey',
7
7
  next_payment_date: 'NextPaymentDate',
8
+ payment_details: 'FinancialPaymentDetail',
8
9
  person_id: 'AuthorizedPersonAliasId',
9
10
  transaction_details: 'ScheduledTransactionDetails',
10
11
  transaction_code: 'TransactionCode'
@@ -13,6 +14,7 @@ module RockRMS
13
14
  def format_single(data)
14
15
  result = to_h(MAP, data)
15
16
  result[:transaction_details] = RecurringDonationDetails.format(result[:transaction_details])
17
+ result[:payment_details] = PaymentMethod.format(result[:payment_details])
16
18
  result
17
19
  end
18
20
  end
@@ -10,15 +10,17 @@ module RockRMS
10
10
  summary: 'Summary',
11
11
  transaction_code: 'TransactionCode',
12
12
  details: 'TransactionDetails',
13
+ payment_details: 'FinancialPaymentDetail',
13
14
  payment_detail_id: 'FinancialPaymentDetailId',
14
15
  transaction_type_id: 'TransactionTypeValueId'
15
16
  }.freeze
16
17
 
17
18
 
18
19
  def format_single(data)
19
- response = to_h(MAP, data)
20
- response[:details] = TransactionDetail.format(response[:details])
21
- response[:amount] = calculate_total(response[:details])
20
+ response = to_h(MAP, data)
21
+ response[:details] = TransactionDetail.format(response[:details])
22
+ response[:payment_details] = PaymentMethod.format(response[:payment_details])
23
+ response[:amount] = calculate_total(response[:details])
22
24
  response
23
25
  end
24
26
 
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '3.1.0'.freeze
2
+ VERSION = '3.2.0'.freeze
3
3
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  s.executables = s.files.grep(%r{^bin/}).map { |f| File.basename(f) }
17
17
  s.test_files = s.files.grep(%r{^(test)/})
18
18
 
19
- s.required_ruby_version = '~> 2.2'
19
+ s.required_ruby_version = '~> 2.3'
20
20
 
21
21
  s.require_paths = ['lib']
22
22
 
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe RockRMS::Client::PaymentMethod, type: :model do
4
+ include_context 'resource specs'
5
+
6
+ describe '#list_payment_methods' do
7
+ it 'returns a array' do
8
+ resource = client.list_payment_methods
9
+ expect(resource).to be_a(Array)
10
+ expect(resource.first).to be_a(Hash)
11
+ end
12
+ end
13
+
14
+ describe '#create_payment_method' do
15
+ context 'arguments' do
16
+ it 'require `payment_type`' do
17
+ expect { client.create_payment_method }
18
+ .to raise_error(ArgumentError, /payment_type/)
19
+ end
20
+ end
21
+
22
+ subject(:resource) do
23
+ client.create_payment_method(payment_type: 'card')
24
+ end
25
+
26
+ it 'returns integer' do
27
+ expect(resource).to be_a(Integer)
28
+ end
29
+
30
+ it 'passes options' do
31
+ expect(client).to receive(:post)
32
+ .with(
33
+ 'FinancialPaymentDetails',
34
+ 'CurrencyTypeValueId' => 156,
35
+ 'ForeignKey' => nil
36
+ )
37
+ .and_call_original
38
+ resource
39
+ end
40
+ end
41
+ end
@@ -3,6 +3,27 @@ require 'spec_helper'
3
3
  RSpec.describe RockRMS::Client::Person, type: :model do
4
4
  include_context 'resource specs'
5
5
 
6
+ describe '#find_person_by_alias_id(id)' do
7
+ it 'returns a Hash' do
8
+ resource = client.find_person_by_alias_id(1234)
9
+ expect(resource).to be_a(Hash)
10
+ end
11
+
12
+ it 'queries for person with alias id' do
13
+ expect(client).to receive(:get)
14
+ .with('People/GetByPersonAliasId/1234')
15
+ .and_call_original
16
+ client.find_person_by_alias_id(1234)
17
+ end
18
+
19
+ it 'formats with Person' do
20
+ response = double
21
+ expect(RockRMS::Response::Person).to receive(:format).with(response)
22
+ allow(client).to receive(:get).and_return(response)
23
+ client.find_person_by_alias_id(1234)
24
+ end
25
+ end
26
+
6
27
  describe '#find_person_by_name(full_name)' do
7
28
  it 'returns a array of hashes' do
8
29
  resource = client.find_person_by_name('Some Name')
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe RockRMS::Response::PaymentMethod, type: :model do
4
+ let(:parsed) { JSON.parse(FixturesHelper.read('payment_methods.json')) }
5
+
6
+ describe '.format' do
7
+ subject(:result) { described_class.format(parsed) }
8
+
9
+ context 'when response is array' do
10
+ it 'returns an array' do
11
+ expect(described_class.format([])).to be_a(Array)
12
+ end
13
+ end
14
+
15
+ it 'translates keys' do
16
+ result.zip(parsed) do |r, p|
17
+ expect(r[:id]).to eq(p['Id'])
18
+ expect(r[:exp_month]).to eq(p['ExpirationMonth'])
19
+ expect(r[:exp_year]).to eq(p['ExpirationYear'])
20
+ expect(r[:foreign_key]).to eq(p['ForeignKey'])
21
+ expect(r[:payment_type_id]).to eq(p['CurrencyTypeValueId'])
22
+ expect(r[:masked_number]).to eq(p['AccountNumberMasked'])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,29 @@
1
+ [
2
+ {
3
+ "AccountNumberMasked": "************1111",
4
+ "CurrencyTypeValueId": 156,
5
+ "CreditCardTypeValueId": 7,
6
+ "NameOnCardEncrypted": "EAAAAIZOotKRjRcqVcy3zbJRy095Kr33m7CyddIM4y2HIsSX",
7
+ "ExpirationMonthEncrypted": "EAAAAP3V+qVlIG+A+1WHGwfYg9uN2mRZVXQWpTODxG/6LeJV",
8
+ "ExpirationYearEncrypted": "EAAAAO8zsLLFj7ObDUBd7EeSUOIORulOs8xXv4Plsrsl5L9F",
9
+ "BillingLocationId": 14,
10
+ "NameOnCard": "Elvis Presley",
11
+ "ExpirationMonth": 1,
12
+ "ExpirationYear": 2018,
13
+ "CurrencyTypeValue": null,
14
+ "CreditCardTypeValue": null,
15
+ "BillingLocation": null,
16
+ "CreatedDateTime": "2017-12-19T14:48:02.553",
17
+ "ModifiedDateTime": "2017-12-19T14:48:02.553",
18
+ "CreatedByPersonAliasId": 12,
19
+ "ModifiedByPersonAliasId": 12,
20
+ "ModifiedAuditValuesAlreadyUpdated": false,
21
+ "Attributes": null,
22
+ "AttributeValues": null,
23
+ "Id": 1,
24
+ "Guid": "3685e8d5-052e-458d-ba9c-62328b7c3853",
25
+ "ForeignId": null,
26
+ "ForeignGuid": null,
27
+ "ForeignKey": null
28
+ }
29
+ ]
@@ -0,0 +1,71 @@
1
+ {
2
+ "IsSystem": false,
3
+ "RecordTypeValueId": 1,
4
+ "RecordStatusValueId": 3,
5
+ "RecordStatusLastModifiedDateTime": null,
6
+ "RecordStatusReasonValueId": null,
7
+ "ConnectionStatusValueId": 65,
8
+ "ReviewReasonValueId": null,
9
+ "IsDeceased": false,
10
+ "TitleValueId": null,
11
+ "FirstName": "Some",
12
+ "NickName": "Some",
13
+ "MiddleName": "",
14
+ "LastName": "Guy",
15
+ "SuffixValueId": null,
16
+ "PhotoId": null,
17
+ "BirthDay": 2,
18
+ "BirthMonth": 6,
19
+ "BirthYear": 1956,
20
+ "Gender": 1,
21
+ "MaritalStatusValueId": 144,
22
+ "AnniversaryDate": null,
23
+ "GraduationYear": 2001,
24
+ "GivingGroupId": 1234,
25
+ "GivingId": "G33403",
26
+ "GivingLeaderId": 1234,
27
+ "Email": "some",
28
+ "IsEmailActive": true,
29
+ "EmailNote": null,
30
+ "EmailPreference": 0,
31
+ "ReviewReasonNote": null,
32
+ "InactiveReasonNote": "",
33
+ "SystemNote": null,
34
+ "ViewedCount": null,
35
+ "PrimaryAliasId": 12345,
36
+ "FullName": "Some Guy",
37
+ "BirthdayDayOfWeek": "Saturday",
38
+ "BirthdayDayOfWeekShort": "Sat",
39
+ "Users": [],
40
+ "PhoneNumbers": [],
41
+ "MaritalStatusValue": null,
42
+ "ConnectionStatusValue": null,
43
+ "ReviewReasonValue": null,
44
+ "RecordStatusValue": null,
45
+ "RecordStatusReasonValue": null,
46
+ "RecordTypeValue": null,
47
+ "SuffixValue": null,
48
+ "TitleValue": null,
49
+ "Photo": null,
50
+ "BirthDate": "1988-06-02T00:00:00",
51
+ "DaysUntilBirthday": 107,
52
+ "Age": 45,
53
+ "NextBirthDay": "2018-06-02T00:00:00",
54
+ "DaysToBirthday": 107,
55
+ "NextAnniversary": null,
56
+ "GradeOffset": -12,
57
+ "HasGraduated": true,
58
+ "GradeFormatted": "",
59
+ "CreatedDateTime": "2014-01-23T17:26:35.677",
60
+ "ModifiedDateTime": "2017-12-07T10:03:13.61",
61
+ "CreatedByPersonAliasId": null,
62
+ "ModifiedByPersonAliasId": 623789,
63
+ "ModifiedAuditValuesAlreadyUpdated": false,
64
+ "Attributes": null,
65
+ "AttributeValues": null,
66
+ "Id": 1234,
67
+ "Guid": "fca817b9-3174-49f8-a6ef",
68
+ "ForeignId": 123456,
69
+ "ForeignGuid": null,
70
+ "ForeignKey": null
71
+ }
@@ -24,7 +24,9 @@ class RockMock < Sinatra::Base
24
24
  families: 'Groups/GetFamilies/:id',
25
25
  group: 'Groups/:id',
26
26
  groups: 'Groups',
27
+ payment_methods: 'FinancialPaymentDetails',
27
28
  people_search: 'People/Search',
29
+ person_by_alias: 'People/GetByPersonAliasId/:id',
28
30
  phone_numbers: 'PhoneNumbers',
29
31
  recurring_donation: 'FinancialScheduledTransactions/:id',
30
32
  recurring_donations: 'FinancialScheduledTransactions',
@@ -40,6 +42,7 @@ class RockMock < Sinatra::Base
40
42
  {
41
43
  create_group_member: 'GroupMembers',
42
44
  create_transaction: 'FinancialTransactions',
45
+ create_payment_method: 'FinancialPaymentDetails',
43
46
  create_batch: 'FinancialBatches',
44
47
  create_refund: 'FinancialTransactionRefunds'
45
48
  }.each do |json, end_point|
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: 3.1.0
4
+ version: 3.2.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-02-06 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -216,6 +216,7 @@ files:
216
216
  - spec/rock_rms/resources/batch_spec.rb
217
217
  - spec/rock_rms/resources/group_member_spec.rb
218
218
  - spec/rock_rms/resources/group_spec.rb
219
+ - spec/rock_rms/resources/payment_method_spec.rb
219
220
  - spec/rock_rms/resources/person_spec.rb
220
221
  - spec/rock_rms/resources/phone_number_spec.rb
221
222
  - spec/rock_rms/resources/recurring_donation_spec.rb
@@ -227,6 +228,7 @@ files:
227
228
  - spec/rock_rms/response/group_location_spec.rb
228
229
  - spec/rock_rms/response/group_spec.rb
229
230
  - spec/rock_rms/response/location_spec.rb
231
+ - spec/rock_rms/response/payment_method_spec.rb
230
232
  - spec/rock_rms/response/phone_number_spec.rb
231
233
  - spec/rock_rms/response/recurring_donation_details_spec.rb
232
234
  - spec/rock_rms/response/recurring_donation_spec.rb
@@ -240,6 +242,7 @@ files:
240
242
  - spec/support/fixtures/campuses.json
241
243
  - spec/support/fixtures/create_batch.json
242
244
  - spec/support/fixtures/create_group_member.json
245
+ - spec/support/fixtures/create_payment_method.json
243
246
  - spec/support/fixtures/create_refund.json
244
247
  - spec/support/fixtures/create_transaction.json
245
248
  - spec/support/fixtures/families.json
@@ -250,7 +253,9 @@ files:
250
253
  - spec/support/fixtures/groups_with_locations.json
251
254
  - spec/support/fixtures/groups_with_members.json
252
255
  - spec/support/fixtures/locations.json
256
+ - spec/support/fixtures/payment_methods.json
253
257
  - spec/support/fixtures/people_search.json
258
+ - spec/support/fixtures/person_by_alias.json
254
259
  - spec/support/fixtures/phone_numbers.json
255
260
  - spec/support/fixtures/recurring_donation.json
256
261
  - spec/support/fixtures/recurring_donation_details.json
@@ -273,7 +278,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
278
  requirements:
274
279
  - - "~>"
275
280
  - !ruby/object:Gem::Version
276
- version: '2.2'
281
+ version: '2.3'
277
282
  required_rubygems_version: !ruby/object:Gem::Requirement
278
283
  requirements:
279
284
  - - ">="