instant_quote 1.7.9 → 1.7.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 020136bd81726c4c518ce0bc6aa07bfb91b8b8e9f0303dce318122e07935ff22
4
- data.tar.gz: c75a46be6ec8041c6d906ba668ef85eb582fea9f4ac0da5c849a817588d97061
3
+ metadata.gz: 4d5a638e0feb5aeef60cdfbe670b9a6e48c6f10563139491f991b72dafb4e285
4
+ data.tar.gz: b613670eb939dccaacfa3a4c1704599242da8d11cb006fd2b6f8758fe8d4748f
5
5
  SHA512:
6
- metadata.gz: 786214591b9250b2cda9fc3a455d1f0e965abc40186e393ca1e20099724ebd3402ff5696065b2a744197c44909947a4f792f2732a7ddada9419648b1db3b7641
7
- data.tar.gz: 8cebf1be41fa00a3d7b9d25e0cb772ea072fb9a19e0c228b133da971992ba1bd216263bb6b33729ce220427486e5a99fb4b0b4d21791d9620d01bce42dcfabe5
6
+ metadata.gz: 1f5c7211f3fc4f4ff66926f8073964231cffc62f2e50e59ff104c1f57503a97727524cea45d4b90771aff88eacad6b2e514b33857678ddc2bbe6918381c851c1
7
+ data.tar.gz: 3d3edba56ad6c702c7607c25eb8c717ecd6b92fc9e153224bd075750d5b2b5f3cecfbe3da5632ea1aee57a76090ac1790f59e409c1c08afdd96a9dda835509d2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.7.9)
4
+ instant_quote (1.7.13)
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,18 +30,22 @@ 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)
@@ -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.49)
78
+ phonelib (0.6.50)
75
79
  pry (0.13.1)
76
80
  coderay (~> 1.1)
77
81
  method_source (~> 1.0)
@@ -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
- return default unless data && !data.empty?
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.9'
4
+ VERSION = '1.7.13'
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.9
4
+ version: 1.7.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-28 00:00:00.000000000 Z
11
+ date: 2021-10-26 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