instant_quote 1.7.10 → 1.7.14

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: 740bd06ee687f9d49b421eb19b2c97e89a4e51ded09b72bda693bedb118218bc
4
- data.tar.gz: 345358e0c0cd4aa5a024ad1e4887084d8483f5ece85ded2b1508f7e534e22dff
3
+ metadata.gz: edd5b0a7322b6667c9679054b0936af7c0a9d214660643548174f71e4091c77d
4
+ data.tar.gz: 39fce6e706e835e09dcf032515230460a51dad2395531aa135eef25741b6dab0
5
5
  SHA512:
6
- metadata.gz: ed06a0657a58e5ffea5531d000d26c6b31f9712ac65ec0a944822d4e2d6483a6105368dab79ae358ac05ddb151daa9bb33b7a84db0062ff9184ab39c3befd8a3
7
- data.tar.gz: 22692097c1d1605ac816b3293db21915e9f30a8e977c2a20b2021d735709c6aa6fe48bc50c5f8147a9c0a1981ab64473f578656849c323666e4605c32a0bdc34
6
+ metadata.gz: 0d29a488db3b68c8988f26c8fd6ca326238be4037cfa06ea8e364887d4f599cbd4fc676e61d5ac2992a163eab0611b4939465fc628ad69e969b77d1716c58940
7
+ data.tar.gz: eb5c39b98bbe1ac402c96a33450019ee65bff24e16f420272ba7df8a0a4878170ab0c82d618ed44eb1a1f7a7d0c754934c1d96b1232416ac78e213a15cc99bb6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.7.10)
4
+ instant_quote (1.7.14)
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.3.1)
16
+ activesupport (6.1.4.1)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 1.6, < 2)
19
19
  minitest (>= 5.1)
@@ -30,25 +30,29 @@ GEM
30
30
  multi_json
31
31
  rainbow
32
32
  coderay (1.1.3)
33
- concurrent-ruby (1.1.8)
33
+ concurrent-ruby (1.1.9)
34
34
  crack (0.4.5)
35
35
  rexml
36
36
  diff-lcs (1.4.4)
37
37
  docile (1.3.5)
38
38
  dotenv (2.7.6)
39
- faraday (1.4.1)
39
+ faraday (1.4.2)
40
+ faraday-em_http (~> 1.0)
41
+ faraday-em_synchrony (~> 1.0)
40
42
  faraday-excon (~> 1.1)
41
43
  faraday-net_http (~> 1.0)
42
44
  faraday-net_http_persistent (~> 1.1)
43
45
  multipart-post (>= 1.2, < 3)
44
46
  ruby2_keywords (>= 0.0.4)
47
+ faraday-em_http (1.0.0)
48
+ faraday-em_synchrony (1.0.0)
45
49
  faraday-excon (1.1.0)
46
50
  faraday-net_http (1.0.1)
47
51
  faraday-net_http_persistent (1.1.0)
48
52
  faraday_middleware (1.0.0)
49
53
  faraday (~> 1.0)
50
54
  hashdiff (1.0.1)
51
- i18n (1.8.10)
55
+ i18n (1.8.11)
52
56
  concurrent-ruby (~> 1.0)
53
57
  iwoca (1.0.0)
54
58
  addressable
@@ -58,7 +62,7 @@ GEM
58
62
  rainbow
59
63
  method_source (1.0.0)
60
64
  minitest (5.14.4)
61
- money (6.14.1)
65
+ money (6.16.0)
62
66
  i18n (>= 0.6.4, <= 2)
63
67
  multi_json (1.15.0)
64
68
  multipart-post (2.1.1)
@@ -71,7 +75,7 @@ GEM
71
75
  parallel (1.20.1)
72
76
  parser (3.0.0.0)
73
77
  ast (~> 2.4.1)
74
- phonelib (0.6.50)
78
+ phonelib (0.6.53)
75
79
  pry (0.13.1)
76
80
  coderay (~> 1.1)
77
81
  method_source (~> 1.0)
@@ -133,7 +137,7 @@ GEM
133
137
  faraday_middleware
134
138
  multi_json
135
139
  rainbow
136
- zeitwerk (2.4.2)
140
+ zeitwerk (2.5.1)
137
141
 
138
142
  PLATFORMS
139
143
  ruby
@@ -4,7 +4,7 @@ module InstantQuote
4
4
  class Adapter
5
5
  # This is one additional field that we always want to ask, since we're using it for phone
6
6
  # validating the applicant.
7
- DEFAULT_ADDIONAL_FIELDS = [
7
+ DEFAULT_ADDITIONAL_FIELDS = [
8
8
  {
9
9
  name: 'applicant_phone_number',
10
10
  label: 'Applicant mobile phone',
@@ -13,10 +13,11 @@ module InstantQuote
13
13
  ].freeze
14
14
 
15
15
  def self.additional_fields(fields = [])
16
- return (@additional_fields || DEFAULT_ADDIONAL_FIELDS) if fields.empty?
16
+ return (@additional_fields || DEFAULT_ADDITIONAL_FIELDS) if fields.empty?
17
17
 
18
- @additional_fields ||= DEFAULT_ADDIONAL_FIELDS
18
+ @additional_fields ||= DEFAULT_ADDITIONAL_FIELDS
19
19
  @additional_fields += fields
20
+ @additional_fields.uniq! { |f| f[:name] }
20
21
  end
21
22
 
22
23
  def self.get_link(connection)
@@ -6,7 +6,6 @@ require 'instant_quote/decision_parsers/capital_on_tap'
6
6
  module InstantQuote
7
7
  module Adapters
8
8
  class CapitalOnTap < Adapter
9
- # rubocop:disable Layout/LineLength
10
9
  additional_fields [
11
10
  {
12
11
  name: 'date_of_birth',
@@ -55,7 +54,6 @@ module InstantQuote
55
54
  type: 'checkbox'
56
55
  }
57
56
  ]
58
- # rubocop:enable Layout/LineLength
59
57
 
60
58
  # Creates the quote with the information from instant connection
61
59
  def get_quote(params, _connection)
@@ -34,6 +34,7 @@ module InstantQuote
34
34
  choices: {
35
35
  'Iwoca' => 'iwoca',
36
36
  'Iwoca CBILS' => 'iwoca_cbils',
37
+ 'Iwoca Recovery Loans' => 'iwoca_recovery_loans',
37
38
  'Capital on tap' => 'capital_on_tap',
38
39
  'Optimum' => 'optimum',
39
40
  'Youlend' => 'youlend'
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'iwoca'
4
+ require 'instant_quote/adapters/iwoca'
5
+ require 'instant_quote/decision_parsers/iwoca_recovery_loans'
6
+
7
+ module InstantQuote
8
+ module Adapters
9
+ class IwocaRecoveryLoans < Iwoca
10
+ additional_fields Iwoca.additional_fields
11
+
12
+ # As a result of this we are
13
+ # asking that you do not call the /approval_request/ endpoint after submitting
14
+ # your customer's data to /state/.
15
+ def get_approval(_state_key, _connection)
16
+ true
17
+ end
18
+
19
+ private
20
+
21
+ def decision_parser
22
+ DecisionParsers::IwocaRecoveryLoans
23
+ end
24
+ end
25
+ end
26
+ end
@@ -11,7 +11,8 @@ module InstantQuote
11
11
  name: 'monthly_card_revenue',
12
12
  label: 'Avg. monthly card revenue',
13
13
  required: true,
14
- type: 'money'
14
+ type: 'money',
15
+ minimum: 1_000
15
16
  },
16
17
  {
17
18
  name: 'monthly_revenue_from_invoices',
@@ -13,7 +13,7 @@ module InstantQuote
13
13
  product_name => {
14
14
  approval: {
15
15
  amount: (application.amount_pennies / 100),
16
- duration: 12,
16
+ duration: duration,
17
17
  detailed_purpose: application&.proceeds_purpose&.name
18
18
  }
19
19
  }
@@ -29,6 +29,10 @@ module InstantQuote
29
29
  :credit_facility
30
30
  end
31
31
 
32
+ def duration
33
+ 12
34
+ end
35
+
32
36
  # rubocop:disable Metrics/AbcSize
33
37
  def company_information
34
38
  information = {
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'instant_quote/connection_translators/iwoca'
4
+
5
+ module InstantQuote
6
+ module ConnectionTranslators
7
+ class IwocaRecoveryLoans < Iwoca
8
+ private
9
+
10
+ def product_name
11
+ :recovery_loan
12
+ end
13
+
14
+ def duration
15
+ 60
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'instant_quote/decision_parsers/iwoca'
4
+
5
+ module InstantQuote
6
+ module DecisionParsers
7
+ class IwocaRecoveryLoans < Iwoca
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/hash/indifferent_access'
4
+
3
5
  module InstantQuote
4
6
  module DecisionParsers
5
7
  # Example response:
@@ -18,8 +20,6 @@ module InstantQuote
18
20
  # }
19
21
  class Youlend < DecisionParser
20
22
  def approved?
21
- return false unless status_hash[:loanOptions]
22
-
23
23
  status_hash[:loanOptions].any? && !funded_option.empty?
24
24
  end
25
25
 
@@ -28,6 +28,8 @@ module InstantQuote
28
28
  end
29
29
 
30
30
  def sweep
31
+ return '-' unless approved?
32
+
31
33
  funded_option[:sweep]
32
34
  end
33
35
 
@@ -36,19 +38,19 @@ module InstantQuote
36
38
  end
37
39
 
38
40
  def fee
39
- fee = funded_option[:fee].to_f
41
+ fee = funded_option[:fee].to_f || 0
40
42
 
41
43
  Money.new(fee * 100).format
42
44
  end
43
45
 
44
46
  def loan_amount
45
- amount = funded_option[:loanAmount].to_f
47
+ amount = funded_option[:loanAmount].to_f || 0
46
48
 
47
49
  Money.new(amount * 100).format
48
50
  end
49
51
 
50
52
  def funded_amount
51
- amount = funded_option[:fundedAmount].to_f
53
+ amount = funded_option[:fundedAmount].to_f || 0
52
54
 
53
55
  Money.new(amount * 100).format
54
56
  end
@@ -64,11 +66,11 @@ module InstantQuote
64
66
  end
65
67
 
66
68
  def status_hash
67
- default = { loanOptions: [] }
69
+ default = ActiveSupport::HashWithIndifferentAccess.new({ loanOptions: [] })
68
70
 
69
71
  return default unless data && !data.empty? && !data[:error]
70
72
 
71
- data
73
+ default.merge(data)
72
74
  end
73
75
  end
74
76
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstantQuote
4
- VERSION = '1.7.10'
4
+ VERSION = '1.7.14'
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.10
4
+ version: 1.7.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-04 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -274,6 +274,7 @@ files:
274
274
  - lib/instant_quote/adapters/fake.rb
275
275
  - lib/instant_quote/adapters/iwoca.rb
276
276
  - lib/instant_quote/adapters/iwoca_cbils.rb
277
+ - lib/instant_quote/adapters/iwoca_recovery_loans.rb
277
278
  - lib/instant_quote/adapters/optimum.rb
278
279
  - lib/instant_quote/adapters/youlend.rb
279
280
  - lib/instant_quote/api_error.rb
@@ -282,6 +283,7 @@ files:
282
283
  - lib/instant_quote/connection_translators/fake.rb
283
284
  - lib/instant_quote/connection_translators/iwoca.rb
284
285
  - lib/instant_quote/connection_translators/iwoca_cbils.rb
286
+ - lib/instant_quote/connection_translators/iwoca_recovery_loans.rb
285
287
  - lib/instant_quote/connection_translators/optimum.rb
286
288
  - lib/instant_quote/connection_translators/youlend.rb
287
289
  - lib/instant_quote/decision_parser.rb
@@ -289,6 +291,7 @@ files:
289
291
  - lib/instant_quote/decision_parsers/fake.rb
290
292
  - lib/instant_quote/decision_parsers/iwoca.rb
291
293
  - lib/instant_quote/decision_parsers/iwoca_cbils.rb
294
+ - lib/instant_quote/decision_parsers/iwoca_recovery_loans.rb
292
295
  - lib/instant_quote/decision_parsers/optimum.rb
293
296
  - lib/instant_quote/decision_parsers/youlend.rb
294
297
  - lib/instant_quote/version.rb