money_mover 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/lib/money_mover/dwolla/application_token.rb +1 -7
- data/lib/money_mover/dwolla/environment_urls.rb +3 -3
- data/lib/money_mover/dwolla/models/account_funding_source.rb +1 -1
- data/lib/money_mover/dwolla/models/api_resource.rb +2 -2
- data/lib/money_mover/dwolla/models/customer.rb +1 -1
- data/lib/money_mover/dwolla.rb +0 -2
- data/lib/money_mover/version.rb +1 -1
- data/spec/integration/money_mover/dwolla/customers/find_spec.rb +14 -0
- data/spec/support/dwolla_helper.rb +7 -56
- data/spec/support/dwolla_responses/customer_response.json +37 -0
- data/spec/unit/money_mover/dwolla/client_spec.rb +3 -3
- data/spec/unit/money_mover/dwolla/funding_source_spec.rb +1 -1
- data/spec/unit/money_mover/dwolla/microdeposits_initiation_spec.rb +1 -1
- data/spec/unit/money_mover/dwolla/root_account_spec.rb +1 -1
- data/spec/unit/money_mover/dwolla/token_spec.rb +5 -42
- data/spec/unit/money_mover/dwolla/transfer_spec.rb +1 -1
- data/spec/unit/money_mover/dwolla/webhook_subscription_spec.rb +0 -3
- metadata +4 -4
- data/lib/money_mover/dwolla/account_client.rb +0 -9
- data/lib/money_mover/dwolla/account_token.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47b15ecb8c339c01b1412d983414bf5708b07306
|
4
|
+
data.tar.gz: 79c5230ea6f66e8ffdc015fddb5100c69b4caba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7734a020fe839b91c31bf17f56a4a8a08354537301ba486f3e99be87f6ba29821ba1b9eb9d9d2ef308bce293b8db20dd4aa37acef4b7d3aa0bffb8997ceb3d62
|
7
|
+
data.tar.gz: 26269ba9e5f83bc40e65b0ddf8f3330554f0b1e0a643f62d87a1b777cb94e92a3cac2ea3ff10b02bff7d9a91751610a0ed469b69bf51ce9570f75f69e3c0baac
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
money_mover (0.0.
|
4
|
+
money_mover (0.0.12)
|
5
5
|
activemodel (>= 4.0, < 5.1)
|
6
6
|
activesupport (>= 4.0, < 5.1)
|
7
7
|
faraday (~> 0.9)
|
@@ -21,14 +21,14 @@ GEM
|
|
21
21
|
thread_safe (~> 0.3, >= 0.3.4)
|
22
22
|
tzinfo (~> 1.1)
|
23
23
|
addressable (2.4.0)
|
24
|
-
builder (3.2.
|
24
|
+
builder (3.2.3)
|
25
25
|
crack (0.4.3)
|
26
26
|
safe_yaml (~> 1.0.0)
|
27
27
|
diff-lcs (1.2.5)
|
28
|
-
faraday (0.
|
28
|
+
faraday (0.12.2)
|
29
29
|
multipart-post (>= 1.2, < 3)
|
30
|
-
faraday_middleware (0.
|
31
|
-
faraday (>= 0.7.4, < 0
|
30
|
+
faraday_middleware (0.12.2)
|
31
|
+
faraday (>= 0.7.4, < 1.0)
|
32
32
|
hashdiff (0.3.0)
|
33
33
|
i18n (0.7.0)
|
34
34
|
json (1.8.3)
|
@@ -74,4 +74,4 @@ DEPENDENCIES
|
|
74
74
|
webmock (~> 2.1)
|
75
75
|
|
76
76
|
BUNDLED WITH
|
77
|
-
1.
|
77
|
+
1.14.4
|
@@ -2,13 +2,7 @@ module MoneyMover
|
|
2
2
|
module Dwolla
|
3
3
|
class ApplicationToken < Token
|
4
4
|
def access_token
|
5
|
-
|
6
|
-
new_token.access_token
|
7
|
-
end
|
8
|
-
|
9
|
-
## NOTE: application does not have refresh token, hit API again to get new access token
|
10
|
-
def refresh_token
|
11
|
-
access_token
|
5
|
+
@ach_config.account_token_provider.access_token
|
12
6
|
end
|
13
7
|
|
14
8
|
private
|
@@ -8,9 +8,9 @@ module MoneyMover
|
|
8
8
|
:api_url => "https://api.dwolla.com"
|
9
9
|
},
|
10
10
|
:sandbox => {
|
11
|
-
:auth_url => "https://
|
12
|
-
:token_url => "https://
|
13
|
-
:api_url => "https://api-
|
11
|
+
:auth_url => "https://sandbox.dwolla.com/oauth/v2/authenticate",
|
12
|
+
:token_url => "https://sandbox.dwolla.com/oauth/v2/token",
|
13
|
+
:api_url => "https://api-sandbox.dwolla.com"
|
14
14
|
}
|
15
15
|
}
|
16
16
|
|
@@ -7,7 +7,7 @@ module MoneyMover
|
|
7
7
|
|
8
8
|
attr_reader :resource_location, :attrs
|
9
9
|
|
10
|
-
def initialize(attrs = {}, client =
|
10
|
+
def initialize(attrs = {}, client = ApplicationClient.new)
|
11
11
|
@attrs = attrs
|
12
12
|
@id = attrs[:id]
|
13
13
|
@resource_location = attrs[:resource_location]
|
@@ -18,7 +18,7 @@ module MoneyMover
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.fetch
|
21
|
-
client =
|
21
|
+
client = ApplicationClient.new
|
22
22
|
|
23
23
|
response = client.get fetch_endpoint
|
24
24
|
|
data/lib/money_mover/dwolla.rb
CHANGED
@@ -5,8 +5,6 @@ require 'money_mover/dwolla/api_server_response'
|
|
5
5
|
# token stuff
|
6
6
|
require 'money_mover/dwolla/client'
|
7
7
|
require 'money_mover/dwolla/token'
|
8
|
-
require 'money_mover/dwolla/account_client'
|
9
|
-
require 'money_mover/dwolla/account_token'
|
10
8
|
require 'money_mover/dwolla/application_client'
|
11
9
|
require 'money_mover/dwolla/application_token'
|
12
10
|
|
data/lib/money_mover/version.rb
CHANGED
@@ -50,6 +50,20 @@ describe MoneyMover::Dwolla::Customer do
|
|
50
50
|
expect(subject.email).to eq(email)
|
51
51
|
expect(subject.ipAddress).to eq(ipAddress)
|
52
52
|
end
|
53
|
+
|
54
|
+
context 'real response' do
|
55
|
+
let(:customer_token) { '7bc7e791-47f7-457d-b15d-ab4d92d46343' }
|
56
|
+
let(:customer_response_filename) { File.expand_path '../../../../../support/dwolla_responses/customer_response.json', __FILE__ }
|
57
|
+
let(:customer_response_object) { JSON.parse File.read(customer_response_filename), symbolize_names: true }
|
58
|
+
|
59
|
+
it 'returns customer' do
|
60
|
+
expect(subject.id).to eq(customer_token)
|
61
|
+
#expect(subject.resource_location).to eq(dwolla_helper.customer_endpoint(customer_token))
|
62
|
+
expect(subject.firstName).to eq('retry')
|
63
|
+
expect(subject.lastName).to eq('Retrya2 Last Name')
|
64
|
+
expect(subject.email).to eq(email)
|
65
|
+
end
|
66
|
+
end
|
53
67
|
end
|
54
68
|
|
55
69
|
context 'failure' do
|
@@ -5,14 +5,6 @@ class TestConfigProvider
|
|
5
5
|
"X7JyEzy6F85MeDZERFE2cgiLbm9TXIbQNmr16cCfI6y1CtPrak"
|
6
6
|
end
|
7
7
|
|
8
|
-
def refresh_token
|
9
|
-
"Qlj3SFaIGPJmeFrPEJsPI6smKwdXLsPYAYi83lXkqeb8q0MX1P"
|
10
|
-
end
|
11
|
-
|
12
|
-
def application_token
|
13
|
-
"SF8Vxx6H644lekdVKAAHFnqRCFy8WGqltzitpii6w2MVaZp1Nw"
|
14
|
-
end
|
15
|
-
|
16
8
|
def environment
|
17
9
|
:sandbox
|
18
10
|
end
|
@@ -42,10 +34,6 @@ class TestDwollaTokenProvider
|
|
42
34
|
def access_token
|
43
35
|
"X7JyEzy6F85MeDZERFE2cgiLbm9TXIbQNmr16cCfI6y1CtPrak"
|
44
36
|
end
|
45
|
-
|
46
|
-
def refresh_token
|
47
|
-
"Qlj3SFaIGPJmeFrPEJsPI6smKwdXLsPYAYi83lXkqeb8q0MX1P"
|
48
|
-
end
|
49
37
|
end
|
50
38
|
|
51
39
|
class DwollaHelper
|
@@ -59,14 +47,6 @@ class DwollaHelper
|
|
59
47
|
@config_provider.access_token
|
60
48
|
end
|
61
49
|
|
62
|
-
def refresh_token
|
63
|
-
@config_provider.refresh_token
|
64
|
-
end
|
65
|
-
|
66
|
-
def application_token
|
67
|
-
@config_provider.application_token
|
68
|
-
end
|
69
|
-
|
70
50
|
def api_key
|
71
51
|
@config_provider.api_key
|
72
52
|
end
|
@@ -84,7 +64,7 @@ class DwollaHelper
|
|
84
64
|
end
|
85
65
|
|
86
66
|
def api_url
|
87
|
-
"https://api-
|
67
|
+
"https://api-sandbox.dwolla.com"
|
88
68
|
end
|
89
69
|
|
90
70
|
def api_endpoint
|
@@ -226,7 +206,7 @@ class DwollaHelper
|
|
226
206
|
# taken from ach_helper
|
227
207
|
|
228
208
|
def get_token_url
|
229
|
-
"https://
|
209
|
+
"https://sandbox.dwolla.com/oauth/v2/token"
|
230
210
|
end
|
231
211
|
|
232
212
|
def error_response(body_json = {})
|
@@ -237,37 +217,17 @@ class DwollaHelper
|
|
237
217
|
}
|
238
218
|
end
|
239
219
|
|
240
|
-
def stub_get_token_request(token_response = nil)
|
241
|
-
token_response ||= {
|
242
|
-
"access_token": application_token,
|
243
|
-
"token_type": "bearer",
|
244
|
-
"expires_in": 3600,
|
245
|
-
"scope": "AccountInfoFull|ManageAccount|Contacts|Transactions|Balance|Send|Request|Funding"
|
246
|
-
}
|
247
|
-
|
248
|
-
req_body = {
|
249
|
-
grant_type: "client_credentials",
|
250
|
-
client_id: api_key,
|
251
|
-
client_secret: api_secret_key
|
252
|
-
}
|
253
|
-
|
254
|
-
stub_request(:post, get_token_url).
|
255
|
-
with(:body => req_body).
|
256
|
-
to_return(status: 200, body: token_response.to_json, headers: {"Content-Type" => "application/json"})
|
257
|
-
end
|
258
|
-
|
259
220
|
def stub_refresh_token_request(token_response)
|
260
221
|
req_body = {
|
261
|
-
grant_type: "
|
222
|
+
grant_type: "client_credentials",
|
262
223
|
client_id: api_key,
|
263
224
|
client_secret: api_secret_key,
|
264
|
-
refresh_token: refresh_token
|
265
225
|
}
|
266
226
|
|
267
227
|
req_headers = {
|
268
228
|
'Accept'=>'application/vnd.dwolla.v1.hal+json',
|
269
229
|
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
270
|
-
'User-Agent'=>
|
230
|
+
'User-Agent'=>"Faraday v#{Faraday::VERSION}"
|
271
231
|
}
|
272
232
|
|
273
233
|
stub_request(:post, get_token_url).with(body: req_body, headers: req_headers).
|
@@ -284,31 +244,22 @@ class DwollaHelper
|
|
284
244
|
|
285
245
|
def stub_get_webhook_subscriptions_request(stub_response)
|
286
246
|
stub_request(:get, webhook_subscriptions_url).
|
287
|
-
with(headers:
|
247
|
+
with(headers: request_headers).
|
288
248
|
to_return(body: stub_response.to_json, headers: {"Content-Type" => "application/json"})
|
289
249
|
end
|
290
250
|
|
291
251
|
def stub_create_webhook_subscription_request(stub_params, stub_response)
|
292
252
|
stub_request(:post, webhook_subscriptions_url).
|
293
|
-
with(headers:
|
253
|
+
with(headers: request_headers, body: stub_params).
|
294
254
|
to_return(stub_response)
|
295
255
|
end
|
296
256
|
|
297
257
|
def stub_delete_webhook_subscription_request(subscription_id, stub_response)
|
298
258
|
stub_request(:delete, webhook_subscription_url(subscription_id)).
|
299
|
-
with(headers:
|
259
|
+
with(headers: request_headers).
|
300
260
|
to_return(stub_response)
|
301
261
|
end
|
302
262
|
|
303
|
-
def dwolla_application_request_headers
|
304
|
-
{
|
305
|
-
'Accept'=>'application/vnd.dwolla.v1.hal+json',
|
306
|
-
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
|
307
|
-
'Authorization'=>"Bearer #{application_token}",
|
308
|
-
'User-Agent'=>'Faraday v0.9.2'
|
309
|
-
}
|
310
|
-
end
|
311
|
-
|
312
263
|
def create_webhook_success_response(webhook_token)
|
313
264
|
resource_created_response webhook_subscription_url(webhook_token)
|
314
265
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
{
|
2
|
+
"_links": {
|
3
|
+
"self": {
|
4
|
+
"href": "https://api-uat.dwolla.com/customers/7bc7e791-47f7-457d-b15d-ab4d92d46343",
|
5
|
+
"type": "customer"
|
6
|
+
},
|
7
|
+
"edit": {
|
8
|
+
"href": "https://api-uat.dwolla.com/customers/7bc7e791-47f7-457d-b15d-ab4d92d46343",
|
9
|
+
"type": "customer"
|
10
|
+
},
|
11
|
+
"funding-sources": {
|
12
|
+
"href": "https://api-uat.dwolla.com/customers/7bc7e791-47f7-457d-b15d-ab4d92d46343/funding-sources",
|
13
|
+
"type": "funding-source"
|
14
|
+
},
|
15
|
+
"retry-verification": {
|
16
|
+
"href": "https://api-uat.dwolla.com/customers/7bc7e791-47f7-457d-b15d-ab4d92d46343",
|
17
|
+
"type": "customer"
|
18
|
+
},
|
19
|
+
"transfers": {
|
20
|
+
"href": "https://api-uat.dwolla.com/customers/7bc7e791-47f7-457d-b15d-ab4d92d46343/transfers",
|
21
|
+
"type": "transfer"
|
22
|
+
}
|
23
|
+
},
|
24
|
+
"id": "7bc7e791-47f7-457d-b15d-ab4d92d46343",
|
25
|
+
"firstName": "retry",
|
26
|
+
"lastName": "Retrya2 Last Name",
|
27
|
+
"email": "email@example.com",
|
28
|
+
"type": "business",
|
29
|
+
"status": "retry",
|
30
|
+
"created": "2016-09-06T16:05:23.393Z",
|
31
|
+
"address1": "123 Anywhere St.",
|
32
|
+
"city": "St. Louis",
|
33
|
+
"state": "MO",
|
34
|
+
"postalCode": "63103",
|
35
|
+
"businessName": "office Retry 2",
|
36
|
+
"doingBusinessAs": "office Retry 2"
|
37
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MoneyMover::Dwolla::
|
3
|
+
describe MoneyMover::Dwolla::ApplicationClient do
|
4
4
|
let(:expected_response) { double 'expected response' }
|
5
5
|
let(:server_request) { double 'server request' }
|
6
6
|
|
@@ -17,7 +17,7 @@ describe MoneyMover::Dwolla::AccountClient do
|
|
17
17
|
|
18
18
|
before do
|
19
19
|
allow(MoneyMover::Dwolla::ApiConnection).to receive(:new).with(token) { api_connection }
|
20
|
-
allow(MoneyMover::Dwolla::
|
20
|
+
allow(MoneyMover::Dwolla::ApplicationToken).to receive(:new) { dwolla_token_provider }
|
21
21
|
end
|
22
22
|
|
23
23
|
let(:url) { double 'url' }
|
@@ -60,7 +60,7 @@ describe MoneyMover::Dwolla::AccountClient do
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
describe MoneyMover::Dwolla::
|
63
|
+
describe MoneyMover::Dwolla::ApplicationClient do
|
64
64
|
describe '#post' do
|
65
65
|
let(:url) { '/customers' }
|
66
66
|
|
@@ -26,7 +26,7 @@ describe MoneyMover::Dwolla::CustomerFundingSource do
|
|
26
26
|
let(:resource_id) { double 'resource id' }
|
27
27
|
|
28
28
|
before do
|
29
|
-
allow(MoneyMover::Dwolla::
|
29
|
+
allow(MoneyMover::Dwolla::ApplicationClient).to receive(:new) { dwolla_client }
|
30
30
|
end
|
31
31
|
|
32
32
|
it { should validate_presence_of(:name) }
|
@@ -12,7 +12,7 @@ describe MoneyMover::Dwolla::MicroDepositInitiation do
|
|
12
12
|
subject { described_class.new(funding_source_id: funding_source_id) }
|
13
13
|
|
14
14
|
before do
|
15
|
-
allow(MoneyMover::Dwolla::
|
15
|
+
allow(MoneyMover::Dwolla::ApplicationClient).to receive(:new) { ach_client }
|
16
16
|
end
|
17
17
|
|
18
18
|
context 'success' do
|
@@ -69,7 +69,7 @@ describe MoneyMover::Dwolla::RootAccount do
|
|
69
69
|
end
|
70
70
|
|
71
71
|
before do
|
72
|
-
allow(MoneyMover::Dwolla::
|
72
|
+
allow(MoneyMover::Dwolla::ApplicationClient).to receive(:new) { client }
|
73
73
|
allow(client).to receive(:get).with('/') { account_response }
|
74
74
|
allow(client).to receive(:get).with("/accounts/#{account_token}/funding-sources") { funding_response }
|
75
75
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe MoneyMover::Dwolla::
|
3
|
+
describe MoneyMover::Dwolla::ApplicationToken do
|
4
4
|
let(:ach_config) { double 'ach config', api_key: ach_config_api_key, api_secret_key: ach_config_api_secret_key, environment: ach_config_environment, account_token_provider: account_token_provider }
|
5
5
|
let(:ach_config_api_key) { double 'ach config api key' }
|
6
6
|
let(:ach_config_api_secret_key) { double 'ach config api secret' }
|
7
7
|
let(:ach_config_environment) { double 'ach config environment' }
|
8
|
-
let(:account_token_provider) { double 'account token provider', access_token: account_access_token
|
8
|
+
let(:account_token_provider) { double 'account token provider', access_token: account_access_token }
|
9
9
|
let(:account_access_token) { double 'account access token' }
|
10
|
-
let(:account_refresh_token) { double 'account refresh token' }
|
11
10
|
|
12
11
|
let(:attrs) {{}}
|
13
12
|
|
@@ -18,52 +17,18 @@ describe MoneyMover::Dwolla::AccountToken do
|
|
18
17
|
expect(subject.access_token).to eq(account_access_token)
|
19
18
|
end
|
20
19
|
end
|
21
|
-
|
22
|
-
describe '#refresh_token' do
|
23
|
-
it 'returns account token from account token provider' do
|
24
|
-
expect(subject.refresh_token).to eq(account_refresh_token)
|
25
|
-
end
|
26
|
-
end
|
27
20
|
end
|
28
21
|
|
29
22
|
# INTEGRATION TEST
|
30
|
-
describe MoneyMover::Dwolla::
|
31
|
-
let(:invalid_refresh_token_response) {{
|
32
|
-
"error": "access_denied",
|
33
|
-
"error_description": "Invalid refresh token."
|
34
|
-
}}
|
35
|
-
|
36
|
-
let(:expired_refresh_token_error) {{
|
37
|
-
"error": "access_denied",
|
38
|
-
"error_description": "Expired refresh token."
|
39
|
-
}}
|
40
|
-
|
23
|
+
describe MoneyMover::Dwolla::ApplicationToken do
|
41
24
|
let(:refresh_token_request_params) {{
|
42
25
|
"client_id": "JCGQXLrlfuOqdUYdTcLz3rBiCZQDRvdWIUPkw++GMuGhkem9Bo",
|
43
26
|
"client_secret": "g7QLwvO37aN2HoKx1amekWi8a2g7AIuPbD5C/JSLqXIcDOxfTr",
|
44
|
-
"
|
45
|
-
"grant_type": "refresh_token"
|
27
|
+
"grant_type": "client_credentials"
|
46
28
|
}}
|
47
29
|
|
48
|
-
#let(:refresh_token_success_response) {{
|
49
|
-
#"_links": {
|
50
|
-
#"account": {
|
51
|
-
#"href": "https://api-uat.dwolla.com/accounts/ca32853c-48fa-40be-ae75-77b37504581b"
|
52
|
-
#}
|
53
|
-
#},
|
54
|
-
#"access_token": "F3jK4rg7FGlq4yRQ7vWECoXVD4zQq9Xg26VnxzMbHGusZqr7dF",
|
55
|
-
#"expires_in": 3600,
|
56
|
-
#"refresh_token": "DRlqGJ0IFsRK8xzjkKhjTOgz3meet6E91T2oacGCefHGU4h1hj",
|
57
|
-
#"refresh_expires_in": 5184000,
|
58
|
-
#"token_type": "bearer",
|
59
|
-
#"scope": "send|transactions|funding|managecustomers",
|
60
|
-
#"account_id": "ca32853c-48fa-40be-ae75-77b37504581b"
|
61
|
-
#}}
|
62
|
-
|
63
|
-
|
64
30
|
let(:account_id) { "7da912eb-5976-4e5c-b5ab-a5df35ac661b" }
|
65
31
|
let(:new_access_token) { "oNGSeXqucdVxTLAwSRNc1WjG5BTHWNS5z7hccJGUTGvCXusmbC" }
|
66
|
-
let(:new_refresh_token) { "Et380Ps1y9tyiW3A8yf0ws1lbfGUVXl5DLIHfDDELXC0ls7hie" }
|
67
32
|
|
68
33
|
let(:refresh_token_success_response) {{
|
69
34
|
"_links": {
|
@@ -73,7 +38,6 @@ describe MoneyMover::Dwolla::AccountToken do
|
|
73
38
|
},
|
74
39
|
"access_token": new_access_token,
|
75
40
|
"expires_in":3600,
|
76
|
-
"refresh_token": new_refresh_token,
|
77
41
|
"refresh_expires_in":5184000,
|
78
42
|
"token_type":"bearer",
|
79
43
|
"scope":"accountinfofull|contacts|transactions|balance|send|request|funding|manageaccount|scheduled|email|managecustomers",
|
@@ -88,13 +52,12 @@ describe MoneyMover::Dwolla::AccountToken do
|
|
88
52
|
end
|
89
53
|
|
90
54
|
context 'success' do
|
91
|
-
it 'updates
|
55
|
+
it 'updates token' do
|
92
56
|
new_token = subject.request_new_token!
|
93
57
|
|
94
58
|
expect(new_token.account_id).to eq(account_id)
|
95
59
|
expect(new_token.expires_in).to eq(3600)
|
96
60
|
expect(new_token.access_token).to eq(new_access_token)
|
97
|
-
expect(new_token.refresh_token).to eq(new_refresh_token)
|
98
61
|
end
|
99
62
|
end
|
100
63
|
end
|
@@ -26,7 +26,7 @@ describe MoneyMover::Dwolla::Transfer do
|
|
26
26
|
subject { described_class.new(attrs) }
|
27
27
|
|
28
28
|
before do
|
29
|
-
allow(MoneyMover::Dwolla::
|
29
|
+
allow(MoneyMover::Dwolla::ApplicationClient).to receive(:new) { dwolla_client }
|
30
30
|
end
|
31
31
|
|
32
32
|
it { should validate_presence_of(:sender_funding_source_token) }
|
@@ -115,7 +115,6 @@ describe MoneyMover::Dwolla::WebhookSubscription do
|
|
115
115
|
subject { described_class }
|
116
116
|
|
117
117
|
before do
|
118
|
-
dwolla_helper.stub_get_token_request
|
119
118
|
dwolla_helper.stub_get_webhook_subscriptions_request(webhooks_response)
|
120
119
|
end
|
121
120
|
|
@@ -145,7 +144,6 @@ describe MoneyMover::Dwolla::WebhookSubscription do
|
|
145
144
|
subject { described_class.new(url: callback_url, secret: webhook_secret_key) }
|
146
145
|
|
147
146
|
before do
|
148
|
-
dwolla_helper.stub_get_token_request
|
149
147
|
dwolla_helper.stub_create_webhook_subscription_request(create_params, create_response)
|
150
148
|
end
|
151
149
|
|
@@ -175,7 +173,6 @@ describe MoneyMover::Dwolla::WebhookSubscription do
|
|
175
173
|
subject { described_class.new(id: subscription_id) }
|
176
174
|
|
177
175
|
before do
|
178
|
-
dwolla_helper.stub_get_token_request
|
179
176
|
dwolla_helper.stub_delete_webhook_subscription_request(subscription_id, delete_response)
|
180
177
|
end
|
181
178
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money_mover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Errante
|
@@ -180,8 +180,6 @@ files:
|
|
180
180
|
- Gemfile.lock
|
181
181
|
- lib/money_mover.rb
|
182
182
|
- lib/money_mover/dwolla.rb
|
183
|
-
- lib/money_mover/dwolla/account_client.rb
|
184
|
-
- lib/money_mover/dwolla/account_token.rb
|
185
183
|
- lib/money_mover/dwolla/api_connection.rb
|
186
184
|
- lib/money_mover/dwolla/api_server_response.rb
|
187
185
|
- lib/money_mover/dwolla/application_client.rb
|
@@ -222,6 +220,7 @@ files:
|
|
222
220
|
- spec/integration/money_mover/dwolla/transfers/create_spec.rb
|
223
221
|
- spec/spec_helper.rb
|
224
222
|
- spec/support/dwolla_helper.rb
|
223
|
+
- spec/support/dwolla_responses/customer_response.json
|
225
224
|
- spec/support/fixtures/sample.jpg
|
226
225
|
- spec/unit/money_mover/dwolla/client_spec.rb
|
227
226
|
- spec/unit/money_mover/dwolla/config_spec.rb
|
@@ -253,7 +252,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
252
|
version: '0'
|
254
253
|
requirements: []
|
255
254
|
rubyforge_project:
|
256
|
-
rubygems_version: 2.
|
255
|
+
rubygems_version: 2.5.2
|
257
256
|
signing_key:
|
258
257
|
specification_version: 4
|
259
258
|
summary: Money Mover
|
@@ -270,6 +269,7 @@ test_files:
|
|
270
269
|
- spec/integration/money_mover/dwolla/transfers/create_spec.rb
|
271
270
|
- spec/spec_helper.rb
|
272
271
|
- spec/support/dwolla_helper.rb
|
272
|
+
- spec/support/dwolla_responses/customer_response.json
|
273
273
|
- spec/support/fixtures/sample.jpg
|
274
274
|
- spec/unit/money_mover/dwolla/client_spec.rb
|
275
275
|
- spec/unit/money_mover/dwolla/config_spec.rb
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module MoneyMover
|
2
|
-
module Dwolla
|
3
|
-
class AccountToken < Token
|
4
|
-
def access_token
|
5
|
-
@ach_config.account_token_provider.access_token
|
6
|
-
end
|
7
|
-
|
8
|
-
def refresh_token
|
9
|
-
@ach_config.account_token_provider.refresh_token
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def create_params
|
15
|
-
{
|
16
|
-
grant_type: :refresh_token,
|
17
|
-
client_id: @ach_config.api_key,
|
18
|
-
client_secret: @ach_config.api_secret_key,
|
19
|
-
refresh_token: refresh_token
|
20
|
-
}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|