rock_rms 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rock_rms/resources/payment_method.rb +13 -3
- data/lib/rock_rms/responses/payment_method.rb +24 -0
- data/lib/rock_rms/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d81db433d9edd22ba5fa2148c2b0a82ac7f1150
|
4
|
+
data.tar.gz: 6b4b51e866c128c254aad44755fe03170946fd3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33ffe1335a1d8b40e2388d65d9fdab92419644dd7cbabe9c468873fc9322655c033e77db9f1b92dcaf76e74b97fc7d6ec74ec5f8d446358c41b7267138723afd
|
7
|
+
data.tar.gz: 1c37aa2af141e7ba2e2b68bfcb13c859a7bd5b83e172053f61a5d4e6a8948161631f4667925016d8de44895b6ea71e0fa69e693b726fae78888a38cae07f082b
|
@@ -2,12 +2,13 @@ module RockRMS
|
|
2
2
|
class Client
|
3
3
|
module PaymentMethod
|
4
4
|
def list_payment_methods(options = {})
|
5
|
-
get(payment_method_path, options)
|
5
|
+
res = get(payment_method_path, options)
|
6
|
+
RockRMS::PaymentMethod.format(res)
|
6
7
|
end
|
7
8
|
|
8
|
-
def create_payment_method(
|
9
|
+
def create_payment_method(payment_type:, foreign_key: nil)
|
9
10
|
options = {
|
10
|
-
'CurrencyTypeValueId' =>
|
11
|
+
'CurrencyTypeValueId' => cast_payment_type(payment_type),
|
11
12
|
'ForeignKey' => foreign_key
|
12
13
|
}
|
13
14
|
|
@@ -16,6 +17,15 @@ module RockRMS
|
|
16
17
|
|
17
18
|
private
|
18
19
|
|
20
|
+
def cast_payment_type(payment_type)
|
21
|
+
case payment_type
|
22
|
+
when 'card'
|
23
|
+
156
|
24
|
+
when 'bank account', 'ach'
|
25
|
+
157
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
19
29
|
def payment_method_path(id = nil)
|
20
30
|
id ? "FinancialPaymentDetails/#{id}" : 'FinancialPaymentDetails'
|
21
31
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module RockRMS
|
2
|
+
class PaymentMethod
|
3
|
+
MAP = {
|
4
|
+
id: 'Id',
|
5
|
+
foreign_key: 'ForeignKey',
|
6
|
+
payment_type_id: 'CurrencyTypeValueId',
|
7
|
+
masked_number: 'AccountNumberMasked'
|
8
|
+
}.freeze
|
9
|
+
|
10
|
+
def self.format(data)
|
11
|
+
if data.is_a?(Array)
|
12
|
+
data.map { |object| format_single(object) }
|
13
|
+
else
|
14
|
+
format_single(data)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.format_single(data)
|
19
|
+
MAP.each.with_object({}) do |(l, r), object|
|
20
|
+
object[l] = data[r]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/rock_rms/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Brooks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/rock_rms/resources/transaction_detail.rb
|
193
193
|
- lib/rock_rms/responses/donation.rb
|
194
194
|
- lib/rock_rms/responses/fund.rb
|
195
|
+
- lib/rock_rms/responses/payment_method.rb
|
195
196
|
- lib/rock_rms/responses/person.rb
|
196
197
|
- lib/rock_rms/responses/recurring_donation.rb
|
197
198
|
- lib/rock_rms/responses/recurring_donation_details.rb
|