rock_rms 3.4.1 → 3.5.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: d6d59089afee4e7b6707106985fec8329574032f
4
- data.tar.gz: 863897d8ba5bbd96ab917b664d07777a19243275
3
+ metadata.gz: c00fac217eeef9ea0fab76853ba89e40024b5486
4
+ data.tar.gz: 91246c29a9aae3d94277b2c0aac83818d6ca0de4
5
5
  SHA512:
6
- metadata.gz: fa7e6054abde31dd865dc0d03d33fedd77f5be7d82ec30e6141537e9965eb0c83540b4f5022ac09ab265a9c163ae09dd8e0bd69c15708d98254f5957e2bf8814
7
- data.tar.gz: 5fc9d8d7b84136e763147fc3a97ea26b9b91054ef834702bf32808984e9b29cbaa2b4441969ac0559b8311fae26a474867e67c7eea57ba3998bcd65a5848df72
6
+ metadata.gz: 282322cf79471e4200d3d740db23e39c63b8ae269cba1d01698a31d2c4f1f386ef62b36eeed914541c73bc47c8eee68409d857c597b33c2989c6d1b8f8ff1899
7
+ data.tar.gz: dc93c383cdfc85236f010f9850f0680f88fecdd6e3bade52495f1703997746cd67567eaa710157fca958062ad4eb4e49252d7364f32c9c7a03c9dac2aa100b5a
@@ -18,6 +18,7 @@ module RockRMS
18
18
  include RockRMS::Client::PhoneNumber
19
19
  include RockRMS::Client::RecurringDonation
20
20
  include RockRMS::Client::Refund
21
+ include RockRMS::Client::SavedPaymentMethod
21
22
  include RockRMS::Client::Transaction
22
23
  include RockRMS::Client::TransactionDetail
23
24
 
@@ -11,13 +11,21 @@ module RockRMS
11
11
  Response::Batch.format(res)
12
12
  end
13
13
 
14
- def create_batch(name:, start_time:, end_time:, foreign_key: nil, campus_id: nil)
14
+ def create_batch(
15
+ name:,
16
+ start_time:,
17
+ end_time:,
18
+ foreign_key: nil,
19
+ campus_id: nil,
20
+ status: 1
21
+ )
15
22
  options = {
16
23
  'Name' => name,
17
24
  'BatchStartDateTime' => start_time,
18
25
  'CampusId' => campus_id,
19
26
  'BatchEndDateTime' => end_time,
20
- 'ForeignKey' => foreign_key
27
+ 'ForeignKey' => foreign_key,
28
+ 'Status' => status
21
29
  }
22
30
 
23
31
  post(batches_path, options)
@@ -15,6 +15,10 @@ module RockRMS
15
15
  post(payment_method_path, options)
16
16
  end
17
17
 
18
+ def delete_payment_method(id)
19
+ delete(payment_method_path(id))
20
+ end
21
+
18
22
  private
19
23
 
20
24
  def cast_payment_type(payment_type)
@@ -0,0 +1,20 @@
1
+ module RockRMS
2
+ class Client
3
+ module SavedPaymentMethod
4
+ def list_saved_payment_methods(options = {})
5
+ res = get(saved_payment_method_path, options)
6
+ Response::SavedPaymentMethod.format(res)
7
+ end
8
+
9
+ def delete_saved_payment_method(id)
10
+ delete(saved_payment_method_path(id))
11
+ end
12
+
13
+ private
14
+
15
+ def saved_payment_method_path(id = nil)
16
+ id ? "FinancialPersonSavedAccounts/#{id}" : 'FinancialPersonSavedAccounts'
17
+ end
18
+ end
19
+ end
20
+ end
@@ -10,7 +10,7 @@ module RockRMS
10
10
  end_date: 'BatchEndDateTime',
11
11
  campus_id: 'CampusId',
12
12
  is_campus: 'Campus',
13
- status: 'Status',
13
+ status: 'Status'
14
14
  }.freeze
15
15
 
16
16
  def format_single(data)
@@ -0,0 +1,21 @@
1
+ module RockRMS
2
+ module Response
3
+ class SavedPaymentMethod < Base
4
+ MAP = {
5
+ id: 'Id',
6
+ foreign_key: 'ForeignKey',
7
+ gateway_id: 'FinancialGatewayId',
8
+ name: 'Name',
9
+ payment_details: 'FinancialPaymentDetail',
10
+ payment_detail_id: 'FinancialPaymentDetailId',
11
+ reference_number: 'ReferenceNumber'
12
+ }.freeze
13
+
14
+ def format_single(data)
15
+ response = to_h(MAP, data)
16
+ response[:payment_details] = PaymentMethod.format(response[:payment_details])
17
+ response
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '3.4.1'.freeze
2
+ VERSION = '3.5.0'.freeze
3
3
  end
@@ -73,7 +73,8 @@ RSpec.describe RockRMS::Client::Batch, type: :model do
73
73
  'CampusId' => 1,
74
74
  'BatchStartDateTime' => '1',
75
75
  'BatchEndDateTime' => '1',
76
- 'ForeignKey' => 1
76
+ 'ForeignKey' => 1,
77
+ 'Status' => 1
77
78
  ).and_call_original
78
79
  resource
79
80
  end
@@ -38,4 +38,15 @@ RSpec.describe RockRMS::Client::PaymentMethod, type: :model do
38
38
  resource
39
39
  end
40
40
  end
41
+
42
+ describe '#delete_payment_method' do
43
+ it 'returns nothing' do
44
+ expect(client.delete_payment_method(123)).to eq(nil)
45
+ end
46
+
47
+ it 'passes id' do
48
+ expect(client).to receive(:delete).with('FinancialPaymentDetails/123')
49
+ client.delete_payment_method(123)
50
+ end
51
+ end
41
52
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe RockRMS::Client::SavedPaymentMethod, type: :model do
4
+ include_context 'resource specs'
5
+
6
+ describe '#list_saved_payment_methods' do
7
+ it 'returns a array' do
8
+ resource = client.list_saved_payment_methods
9
+ expect(resource).to be_a(Array)
10
+ expect(resource.first).to be_a(Hash)
11
+ end
12
+ end
13
+
14
+ describe '#delete_saved_payment_method' do
15
+ it 'returns nothing' do
16
+ expect(client.delete_saved_payment_method(123)).to eq(nil)
17
+ end
18
+
19
+ it 'passes id' do
20
+ expect(client).to receive(:delete).with('FinancialPersonSavedAccounts/123')
21
+ client.delete_saved_payment_method(123)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,41 @@
1
+ [
2
+ {
3
+ "FinancialPaymentDetail": {
4
+ "AccountNumberMasked": "************2275",
5
+ "CurrencyTypeValueId": 156,
6
+ "CreditCardTypeValueId": 7,
7
+ "NameOnCardEncrypted": null,
8
+ "ExpirationMonthEncrypted": "EAAAAPzfIIHnzhPkr31/UktbdyZ34dSccQYeK0j9tyJGaeBT",
9
+ "ExpirationYearEncrypted": "EAAAAJKi2w4n7x7AUi/qvdbVVKLTSnmR/FQs1KOEvE8bikxF",
10
+ "BillingLocationId": 53,
11
+ "NameOnCard": "",
12
+ "ExpirationMonth": 4,
13
+ "ExpirationYear": 2019,
14
+ "CreatedDateTime": "2018-03-15T11:37:47.553",
15
+ "ModifiedDateTime": "2018-03-15T11:37:47.553",
16
+ "CreatedByPersonAliasId": 123,
17
+ "ModifiedByPersonAliasId": 123,
18
+ "Id": 123,
19
+ "Guid": "038d7d43-eb25-45d7-85e2-5e8d5008c102",
20
+ "ForeignId": null,
21
+ "ForeignGuid": null,
22
+ "ForeignKey": null
23
+ },
24
+ "PersonAliasId": 123,
25
+ "GroupId": null,
26
+ "ReferenceNumber": "card_8fba20635f520941f21d",
27
+ "Name": "John's Visa",
28
+ "TransactionCode": "chrg_bdf113601b1187452181",
29
+ "FinancialGatewayId": 5,
30
+ "FinancialPaymentDetailId": 123,
31
+ "CreatedDateTime": "2018-03-15T11:37:47.553",
32
+ "ModifiedDateTime": "2018-03-15T11:37:47.553",
33
+ "CreatedByPersonAliasId": 20024,
34
+ "ModifiedByPersonAliasId": 20024,
35
+ "Id": 56,
36
+ "Guid": "6b65a3c9-32e2-41e2-9d07-d9b8b3787364",
37
+ "ForeignId": null,
38
+ "ForeignGuid": null,
39
+ "ForeignKey": null
40
+ }
41
+ ]
@@ -6,6 +6,8 @@ class RockMock < Sinatra::Base
6
6
  # DELETE requests
7
7
  [
8
8
  'FinancialBatches/:id',
9
+ 'FinancialPaymentDetails/:id',
10
+ 'FinancialPersonSavedAccounts/:id',
9
11
  'FinancialTransactions/:id',
10
12
  'GroupMembers/:id'
11
13
  ].each do |end_point|
@@ -31,6 +33,7 @@ class RockMock < Sinatra::Base
31
33
  phone_numbers: 'PhoneNumbers',
32
34
  recurring_donation: 'FinancialScheduledTransactions/:id',
33
35
  recurring_donations: 'FinancialScheduledTransactions',
36
+ saved_payment_methods: 'FinancialPersonSavedAccounts',
34
37
  transaction_detail: 'FinancialTransactionDetails/:id',
35
38
  transaction_details: 'FinancialTransactionDetails'
36
39
  }.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.4.1
4
+ version: 3.5.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-24 00:00:00.000000000 Z
11
+ date: 2018-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -194,6 +194,7 @@ files:
194
194
  - lib/rock_rms/resources/phone_number.rb
195
195
  - lib/rock_rms/resources/recurring_donation.rb
196
196
  - lib/rock_rms/resources/refund.rb
197
+ - lib/rock_rms/resources/saved_payment_method.rb
197
198
  - lib/rock_rms/resources/transaction.rb
198
199
  - lib/rock_rms/resources/transaction_detail.rb
199
200
  - lib/rock_rms/response/base.rb
@@ -208,6 +209,7 @@ files:
208
209
  - lib/rock_rms/response/phone_number.rb
209
210
  - lib/rock_rms/response/recurring_donation.rb
210
211
  - lib/rock_rms/response/recurring_donation_details.rb
212
+ - lib/rock_rms/response/saved_payment_method.rb
211
213
  - lib/rock_rms/response/transaction.rb
212
214
  - lib/rock_rms/response/transaction_detail.rb
213
215
  - lib/rock_rms/version.rb
@@ -223,6 +225,7 @@ files:
223
225
  - spec/rock_rms/resources/phone_number_spec.rb
224
226
  - spec/rock_rms/resources/recurring_donation_spec.rb
225
227
  - spec/rock_rms/resources/refund_spec.rb
228
+ - spec/rock_rms/resources/saved_payment_method_spec.rb
226
229
  - spec/rock_rms/resources/transaction_detail_spec.rb
227
230
  - spec/rock_rms/resources/transaction_spec.rb
228
231
  - spec/rock_rms/response/batch_spec.rb
@@ -263,6 +266,7 @@ files:
263
266
  - spec/support/fixtures/recurring_donation.json
264
267
  - spec/support/fixtures/recurring_donation_details.json
265
268
  - spec/support/fixtures/recurring_donations.json
269
+ - spec/support/fixtures/saved_payment_methods.json
266
270
  - spec/support/fixtures/transaction.json
267
271
  - spec/support/fixtures/transaction_detail.json
268
272
  - spec/support/fixtures/transaction_details.json