instant_quote 1.7.0 → 1.7.5

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
  SHA256:
3
- metadata.gz: 8db818dd852db347c9e654ed2b793a4e4b8674f94064c3319698fb71a969027b
4
- data.tar.gz: f07a944bffca0e76a445adb2527d1ce74d159cd64c758c0ad8f091525c7724c0
3
+ metadata.gz: d3c6acea05a3366244faddff8a23e6f409970dcaeeeb1f41cf141f3147661291
4
+ data.tar.gz: 2e3cd2251bd0fc37ca3e30ba5c334492c78ec0063405f6573159d85e3bb84506
5
5
  SHA512:
6
- metadata.gz: 2252d3dd9d5be7b52c4866c4fd19cca78d504c54219cd116ad4f35aa642705fe78de677cbfbdfe42a84ee76ed74d3835aea4f41643b81b5b026fad8c35673c68
7
- data.tar.gz: ef828f5ac596f3ccd9a8d2da53b4ff0ce078d7a4b46605968c0e8419451e79fd3af4c5371433bab70ff8a32678fbe5da070244b67f5839cfa4aa79bfe2d1fed8
6
+ metadata.gz: 6a2ccfd041ef7ff938245ad2e12caf1a950343fa1a97f16f7a243120ac9b440f142a88a132e7fe3b4f847e7eef3b6df698a4f22efb2410cc04481a77996bd45c
7
+ data.tar.gz: b5ae81a9e236b5f9e06270094bf76f12824b513a2195cb4983153838497cc05e1452f57bc7804fba36ac4c8e5298aa2938d63589d5f5113038df59d3a6898dd9
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.7.0)
4
+ instant_quote (1.7.5)
5
5
  activesupport
6
6
  capital_on_tap
7
7
  iwoca
@@ -13,7 +13,7 @@ PATH
13
13
  GEM
14
14
  remote: https://rubygems.org/
15
15
  specs:
16
- activesupport (6.1.1)
16
+ activesupport (6.1.3)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
@@ -44,7 +44,7 @@ GEM
44
44
  faraday_middleware (1.0.0)
45
45
  faraday (~> 1.0)
46
46
  hashdiff (1.0.1)
47
- i18n (1.8.8)
47
+ i18n (1.8.9)
48
48
  concurrent-ruby (~> 1.0)
49
49
  iwoca (1.0.0)
50
50
  addressable
@@ -148,4 +148,4 @@ DEPENDENCIES
148
148
  webmock
149
149
 
150
150
  BUNDLED WITH
151
- 2.2.5
151
+ 2.2.11
@@ -39,7 +39,7 @@ module InstantQuote
39
39
  new.get_approval(application_id, connection)
40
40
  end
41
41
 
42
- def get_link(_application_id, _connection)
42
+ def get_link(_connection)
43
43
  raise NotImplementedError, "You must implement '#{self.class.name}#get_link'"
44
44
  end
45
45
 
@@ -51,14 +51,14 @@ module InstantQuote
51
51
  raise NotImplementedError, "You must implement '#{self.class.name}#get_status'"
52
52
  end
53
53
 
54
- # Default for pre approval will be true, override it in the adapter class if needed.
54
+ # Default for pre approval will be success, override it in the adapter class if needed.
55
55
  def get_preapproval(_params, _connection)
56
- true
56
+ OpenStruct.new(success?: true)
57
57
  end
58
58
 
59
- # Default for approval will be true, override it in the adapter class if needed.
59
+ # Default for approval will be success, override it in the adapter class if needed.
60
60
  def get_approval(_application_id, _connection)
61
- true
61
+ OpenStruct.new(success?: true)
62
62
  end
63
63
  end
64
64
  end
@@ -56,7 +56,7 @@ module InstantQuote
56
56
  end
57
57
 
58
58
  def get_approval
59
- adapter.get_approval(connection.external_id)
59
+ adapter.get_approval(connection.external_id, connection)
60
60
  end
61
61
 
62
62
  def additional_fields
@@ -9,7 +9,7 @@ module InstantQuote
9
9
  additional_fields [
10
10
  {
11
11
  name: 'monthly_card_revenue',
12
- label: 'Avg. monthly revenue from card payments',
12
+ label: 'Avg. monthly card revenue',
13
13
  required: true,
14
14
  type: 'money'
15
15
  },
@@ -21,7 +21,7 @@ module InstantQuote
21
21
  },
22
22
  {
23
23
  name: 'applicant_consent',
24
- label: 'Yes, I give my consent for my data to be shared',
24
+ label: 'Yes, I give my consent for my data to be shared with YouLend',
25
25
  required: true,
26
26
  type: 'checkbox'
27
27
  }
@@ -18,43 +18,55 @@ module InstantQuote
18
18
  # }
19
19
  class Youlend < DecisionParser
20
20
  def approved?
21
- status_hash[:loanOptions].any?
21
+ status_hash[:loanOptions].any? && !funded_option.empty?
22
22
  end
23
23
 
24
24
  def declined?
25
- status_hash[:loanOptions].empty?
25
+ !approved?
26
26
  end
27
27
 
28
28
  def sweep
29
- first_option[:sweep]
29
+ funded_option[:sweep]
30
+ end
31
+
32
+ def status
33
+ approved? ? 'approved' : 'declined'
30
34
  end
31
35
 
32
36
  def fee
33
- fee = first_option[:fee].to_f
37
+ fee = funded_option[:fee].to_f
34
38
 
35
39
  Money.new(fee * 100).format
36
40
  end
37
41
 
38
42
  def loan_amount
39
- amount = first_option[:loanAmount].to_f
43
+ amount = funded_option[:loanAmount].to_f
40
44
 
41
45
  Money.new(amount * 100).format
42
46
  end
43
47
 
44
48
  def funded_amount
45
- amount = first_option[:fundedAmount].to_f
49
+ amount = funded_option[:fundedAmount].to_f
46
50
 
47
51
  Money.new(amount * 100).format
48
52
  end
49
53
 
54
+ alias amount funded_amount
55
+
50
56
  private
51
57
 
52
- def first_option
53
- @first_option ||= status_hash[:loanOptions].find { |opt| opt[:fundedAmount].positive? }
58
+ def funded_option
59
+ @funded_option ||= status_hash[:loanOptions].find(-> { {} }) do |opt|
60
+ opt[:fundedAmount].positive?
61
+ end
54
62
  end
55
63
 
56
64
  def status_hash
57
- data.presence || { loanOptions: [] }
65
+ default = { loanOptions: [] }
66
+
67
+ return default unless data && !data.empty?
68
+
69
+ data
58
70
  end
59
71
  end
60
72
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstantQuote
4
- VERSION = '1.7.0'
4
+ VERSION = '1.7.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: instant_quote
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-02-08 00:00:00.000000000 Z
11
+ date: 2021-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -309,7 +309,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
309
  - !ruby/object:Gem::Version
310
310
  version: '0'
311
311
  requirements: []
312
- rubygems_version: 3.0.3
312
+ rubygems_version: 3.2.11
313
313
  signing_key:
314
314
  specification_version: 4
315
315
  summary: Instant quote providers gem.