instant_quote 1.7.15 → 1.7.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +12 -0
- data/Gemfile.lock +18 -44
- data/instant_quote.gemspec +2 -13
- data/lib/instant_quote/adapters/fake.rb +1 -0
- data/lib/instant_quote/adapters/iwoca.rb +22 -17
- data/lib/instant_quote/adapters/iwoca_flexi24.rb +26 -0
- data/lib/instant_quote/connection_translator.rb +2 -1
- data/lib/instant_quote/connection_translators/iwoca.rb +23 -18
- data/lib/instant_quote/connection_translators/iwoca_flexi24.rb +19 -0
- data/lib/instant_quote/decision_parsers/iwoca.rb +125 -58
- data/lib/instant_quote/decision_parsers/iwoca_flexi24.rb +10 -0
- data/lib/instant_quote/version.rb +1 -1
- metadata +17 -154
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19454a70498604788bc4110eadf6a962ff046275e71a0b8866ca36ade4ed4d44
|
4
|
+
data.tar.gz: 323ff981b6b9fdfca6d9ebfe3b4909d33e72da4d0040d07ae733593f026f2cc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37fb3af73715324f3524a81d486dde377ee0e252e61d1d7998e13bc316bbbeb8013681604cc7298d62398ee9443ee706c94a5bd9fd92449ff7a2cc6d32b5d2a3
|
7
|
+
data.tar.gz: a441fd8800d994fac3b58e24dcf91b393eeaac13b43d97d3674d01431ea7818bdc78d34efc11b6c72983077f2a4e230f3cea425b9097dbaaf8c2b8856ffc42f2
|
data/Gemfile
CHANGED
@@ -10,3 +10,15 @@ source 'https://rubygems.org'
|
|
10
10
|
|
11
11
|
# Specify your gem's dependencies in instant-quotes.gemspec
|
12
12
|
gemspec
|
13
|
+
|
14
|
+
# Development dependencies
|
15
|
+
gem 'bundler', '~> 2.0'
|
16
|
+
gem 'dotenv'
|
17
|
+
gem 'pry-byebug'
|
18
|
+
gem 'rake', '~> 10.0'
|
19
|
+
gem 'rspec', '~> 3.0'
|
20
|
+
gem 'rubocop'
|
21
|
+
gem 'rubocop-rake'
|
22
|
+
gem 'rubocop-rspec'
|
23
|
+
gem 'simplecov'
|
24
|
+
gem 'webmock'
|
data/Gemfile.lock
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
instant_quote (1.7.
|
4
|
+
instant_quote (1.7.17)
|
5
5
|
activesupport
|
6
|
-
capital_on_tap
|
7
|
-
iwoca
|
6
|
+
capital_on_tap (~> 1.0.1)
|
7
|
+
iwoca (~> 1.1.0)
|
8
8
|
money
|
9
9
|
optimum
|
10
10
|
phonelib
|
@@ -23,10 +23,9 @@ GEM
|
|
23
23
|
public_suffix (>= 2.0.2, < 5.0)
|
24
24
|
ast (2.4.2)
|
25
25
|
byebug (11.1.3)
|
26
|
-
capital_on_tap (1.0.
|
26
|
+
capital_on_tap (1.0.1)
|
27
27
|
addressable
|
28
|
-
faraday
|
29
|
-
faraday_middleware
|
28
|
+
faraday (~> 2.7)
|
30
29
|
multi_json
|
31
30
|
rainbow
|
32
31
|
coderay (1.1.3)
|
@@ -36,51 +35,28 @@ GEM
|
|
36
35
|
diff-lcs (1.4.4)
|
37
36
|
docile (1.3.5)
|
38
37
|
dotenv (2.7.6)
|
39
|
-
faraday (
|
40
|
-
faraday-
|
41
|
-
faraday-em_synchrony (~> 1.0)
|
42
|
-
faraday-excon (~> 1.1)
|
43
|
-
faraday-httpclient (~> 1.0)
|
44
|
-
faraday-multipart (~> 1.0)
|
45
|
-
faraday-net_http (~> 1.0)
|
46
|
-
faraday-net_http_persistent (~> 1.0)
|
47
|
-
faraday-patron (~> 1.0)
|
48
|
-
faraday-rack (~> 1.0)
|
49
|
-
faraday-retry (~> 1.0)
|
38
|
+
faraday (2.7.8)
|
39
|
+
faraday-net_http (>= 2.0, < 3.1)
|
50
40
|
ruby2_keywords (>= 0.0.4)
|
51
|
-
faraday-
|
52
|
-
faraday-em_synchrony (1.0.0)
|
53
|
-
faraday-excon (1.1.0)
|
54
|
-
faraday-httpclient (1.0.1)
|
55
|
-
faraday-multipart (1.0.3)
|
56
|
-
multipart-post (>= 1.2, < 3)
|
57
|
-
faraday-net_http (1.0.1)
|
58
|
-
faraday-net_http_persistent (1.2.0)
|
59
|
-
faraday-patron (1.0.0)
|
60
|
-
faraday-rack (1.0.0)
|
61
|
-
faraday-retry (1.0.3)
|
62
|
-
faraday_middleware (1.2.0)
|
63
|
-
faraday (~> 1.0)
|
41
|
+
faraday-net_http (3.0.2)
|
64
42
|
hashdiff (1.0.1)
|
65
43
|
i18n (1.10.0)
|
66
44
|
concurrent-ruby (~> 1.0)
|
67
|
-
iwoca (1.
|
45
|
+
iwoca (1.1.0)
|
68
46
|
addressable
|
69
|
-
faraday
|
70
|
-
|
71
|
-
multi_json
|
47
|
+
faraday (~> 2.7)
|
48
|
+
json-schema
|
72
49
|
rainbow
|
50
|
+
json-schema (2.8.1)
|
51
|
+
addressable (>= 2.4)
|
73
52
|
method_source (1.0.0)
|
74
53
|
minitest (5.15.0)
|
75
54
|
money (6.16.0)
|
76
55
|
i18n (>= 0.6.4, <= 2)
|
77
56
|
multi_json (1.15.0)
|
78
|
-
|
79
|
-
optimum (1.1.0)
|
57
|
+
optimum (1.1.1)
|
80
58
|
addressable
|
81
|
-
faraday
|
82
|
-
faraday_middleware
|
83
|
-
multi_json
|
59
|
+
faraday (~> 2.7)
|
84
60
|
rainbow
|
85
61
|
parallel (1.20.1)
|
86
62
|
parser (3.0.0.0)
|
@@ -141,11 +117,9 @@ GEM
|
|
141
117
|
addressable (>= 2.3.6)
|
142
118
|
crack (>= 0.3.2)
|
143
119
|
hashdiff (>= 0.4.0, < 2.0.0)
|
144
|
-
youlend (1.1.
|
120
|
+
youlend (1.1.4)
|
145
121
|
addressable
|
146
|
-
faraday
|
147
|
-
faraday_middleware
|
148
|
-
multi_json
|
122
|
+
faraday (~> 2.7)
|
149
123
|
rainbow
|
150
124
|
zeitwerk (2.5.4)
|
151
125
|
|
@@ -166,4 +140,4 @@ DEPENDENCIES
|
|
166
140
|
webmock
|
167
141
|
|
168
142
|
BUNDLED WITH
|
169
|
-
2.
|
143
|
+
2.4.7
|
data/instant_quote.gemspec
CHANGED
@@ -27,20 +27,9 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_development_dependency 'bundler', '~> 2.0'
|
31
|
-
spec.add_development_dependency 'dotenv'
|
32
|
-
spec.add_development_dependency 'pry-byebug'
|
33
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
34
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
35
|
-
spec.add_development_dependency 'rubocop'
|
36
|
-
spec.add_development_dependency 'rubocop-rake'
|
37
|
-
spec.add_development_dependency 'rubocop-rspec'
|
38
|
-
spec.add_development_dependency 'simplecov'
|
39
|
-
spec.add_development_dependency 'webmock'
|
40
|
-
|
41
30
|
spec.add_dependency 'activesupport'
|
42
|
-
spec.add_dependency 'capital_on_tap'
|
43
|
-
spec.add_dependency 'iwoca'
|
31
|
+
spec.add_dependency 'capital_on_tap', '~> 1.0.1'
|
32
|
+
spec.add_dependency 'iwoca', '~> 1.1.0'
|
44
33
|
spec.add_dependency 'money'
|
45
34
|
spec.add_dependency 'optimum'
|
46
35
|
spec.add_dependency 'phonelib'
|
@@ -36,6 +36,7 @@ module InstantQuote
|
|
36
36
|
'Iwoca CBILS' => 'iwoca_cbils',
|
37
37
|
'Iwoca Recovery Loans' => 'iwoca_recovery_loans',
|
38
38
|
'Iwoca Revenue Based Loans' => 'iwoca_revenue_based_loans',
|
39
|
+
'Iwoca Flexi24' => 'iwoca_flexi24',
|
39
40
|
'Capital on tap' => 'capital_on_tap',
|
40
41
|
'Optimum' => 'optimum',
|
41
42
|
'Youlend' => 'youlend'
|
@@ -57,40 +57,45 @@ module InstantQuote
|
|
57
57
|
}
|
58
58
|
]
|
59
59
|
|
60
|
-
# Creates the iwoca customer and returns the
|
60
|
+
# Creates the iwoca customer and application and returns the customer_id from the response.
|
61
61
|
def get_quote(params, _connection)
|
62
|
-
response = ::Iwoca::
|
62
|
+
response = ::Iwoca::Customer.create(data: params)
|
63
63
|
|
64
|
-
|
64
|
+
raise_error(response) unless response.success?
|
65
|
+
|
66
|
+
customer_id = response.data[:customer_id]
|
67
|
+
|
68
|
+
# This returns an application_id but we can't store it since we don't have more than one
|
69
|
+
# external ID field. We shouldn't need it anyway.
|
70
|
+
::Iwoca::Application.create(customer_id: response.data[:customer_id], data: params)
|
71
|
+
|
72
|
+
return customer_id if response.success?
|
65
73
|
|
66
74
|
raise_error(response)
|
67
75
|
end
|
68
76
|
|
69
|
-
# Get the current status for the created
|
70
|
-
def get_status(
|
71
|
-
|
77
|
+
# Get the current status for the created application.
|
78
|
+
def get_status(customer_id, _connection)
|
79
|
+
status_response = ::Iwoca::Application.latest(customer_id: customer_id)
|
72
80
|
|
73
|
-
raise_error(
|
81
|
+
raise_error(status_response) unless status_response.success?
|
74
82
|
|
75
|
-
|
83
|
+
# Get the offers for the application.
|
84
|
+
app_id = status_response.data[:application_id]
|
85
|
+
offers_response = ::Iwoca::Application.offers(application_id: app_id)
|
86
|
+
|
87
|
+
decision_parser.new({ status: status_response.data, offers: offers_response.data })
|
76
88
|
end
|
77
89
|
|
78
|
-
# Gets the URL for the given
|
90
|
+
# Gets the URL for the given customer_id.
|
79
91
|
def get_link(connection)
|
80
|
-
|
81
|
-
|
82
|
-
response = ::Iwoca::Quote.login_link(state_key)
|
92
|
+
response = ::Iwoca::Customer.login_link(customer_id: connection.external_id)
|
83
93
|
|
84
94
|
return response.data[:login_link] if response.success?
|
85
95
|
|
86
96
|
raise_error(response)
|
87
97
|
end
|
88
98
|
|
89
|
-
def get_approval(state_key, _connection)
|
90
|
-
response = ::Iwoca::Quote.approval(state_key)
|
91
|
-
response.success?
|
92
|
-
end
|
93
|
-
|
94
99
|
private
|
95
100
|
|
96
101
|
def decision_parser
|
@@ -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_flexi24'
|
6
|
+
|
7
|
+
module InstantQuote
|
8
|
+
module Adapters
|
9
|
+
class IwocaFlexi24 < 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::IwocaFlexi24
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -7,13 +7,14 @@ module InstantQuote
|
|
7
7
|
# be sent to the service you're integrating. You'll have access to `application` and `extra_info`
|
8
8
|
# from the application's record.
|
9
9
|
class ConnectionTranslator
|
10
|
-
attr_accessor :application, :extra_info
|
10
|
+
attr_accessor :connection, :application, :extra_info
|
11
11
|
|
12
12
|
def self.translate(connection)
|
13
13
|
new(connection).translate
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize(connection)
|
17
|
+
@connection = connection
|
17
18
|
@application = connection.finance_application
|
18
19
|
@extra_info = ActiveSupport::HashWithIndifferentAccess.new(connection.extra_info)
|
19
20
|
end
|
@@ -6,19 +6,15 @@ module InstantQuote
|
|
6
6
|
def translate
|
7
7
|
{
|
8
8
|
data: {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
9
|
+
company: company_information,
|
10
|
+
people: [person_information],
|
11
|
+
requests: [
|
12
|
+
amount: (application.amount_pennies / 100),
|
13
|
+
duration: { amount: 12, unit: 'months' },
|
14
|
+
purpose: application&.proceeds_purpose&.name,
|
15
|
+
product_type: product_name,
|
16
|
+
urgency: 'asap'
|
17
|
+
]
|
22
18
|
}
|
23
19
|
}
|
24
20
|
end
|
@@ -26,11 +22,20 @@ module InstantQuote
|
|
26
22
|
private
|
27
23
|
|
28
24
|
def product_name
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
case connection.adapter
|
26
|
+
when 'iwoca'
|
27
|
+
'flexi_loan'
|
28
|
+
when 'iwoca_cbils'
|
29
|
+
'cbils'
|
30
|
+
when 'iwoca_revenue_based_loans'
|
31
|
+
'revenue_based_loan'
|
32
|
+
when 'iwoca_flexi24'
|
33
|
+
'flexi24'
|
34
|
+
when 'iwoca_recovery_loans'
|
35
|
+
'recovery_loan'
|
36
|
+
else
|
37
|
+
'flexi_loan'
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
# rubocop:disable Metrics/AbcSize
|
@@ -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 IwocaFlexi24 < Iwoca
|
8
|
+
private
|
9
|
+
|
10
|
+
def product_name
|
11
|
+
:flexi24
|
12
|
+
end
|
13
|
+
|
14
|
+
def duration
|
15
|
+
24
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -2,110 +2,177 @@
|
|
2
2
|
|
3
3
|
module InstantQuote
|
4
4
|
module DecisionParsers
|
5
|
-
# Example response:
|
6
|
-
|
7
|
-
# {
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
# {
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
5
|
+
# Example status response:
|
6
|
+
#--------------------------------------------
|
7
|
+
# {
|
8
|
+
# status: "open",
|
9
|
+
# application_id: "0affceb4-1fbe-4b42-b027-5b1f340b34df",
|
10
|
+
# is_closed: false,
|
11
|
+
# requests: [
|
12
|
+
# {
|
13
|
+
# amount: 1500.0,
|
14
|
+
# duration: { unit: "months", amount: 12.0 },
|
15
|
+
# product_type: "flexi_loan",
|
16
|
+
# purpose: "equipment_purchase",
|
17
|
+
# detailed_purpose: nil,
|
18
|
+
# requested_cash_amount: nil,
|
19
|
+
# requested_lower_interest: false,
|
20
|
+
# urgency: "asap",
|
21
|
+
# suggested_product: {
|
22
|
+
# amount: 1500.0,
|
23
|
+
# duration: { unit: "days", amount: 365 },
|
24
|
+
# product_type: "flexi_loan"
|
25
|
+
# }
|
26
|
+
# }
|
27
|
+
# ],
|
28
|
+
# last_12_months_turnover: {
|
29
|
+
# amount: 70000,
|
30
|
+
# valid_from: "2019-08-24T14:15:22Z"
|
24
31
|
# }
|
25
32
|
# }
|
33
|
+
#
|
34
|
+
# Example offers response:
|
35
|
+
#--------------------------------------------
|
36
|
+
# {
|
37
|
+
# offers: [
|
38
|
+
# {
|
39
|
+
# product_type: "flexi_loan",
|
40
|
+
# duration: { unit: "days", amount: 365 },
|
41
|
+
# max_amount: 15000.0,
|
42
|
+
# is_suggested: true,
|
43
|
+
# offer_id: "14c9addf-b7bd-43bb-b8b0-6ad6b0b6397f",
|
44
|
+
# offer_type: "sample",
|
45
|
+
# timeout: "2023-07-29T00:00:00+0000",
|
46
|
+
# data_requirements: [
|
47
|
+
# {
|
48
|
+
# category: "personal_data",
|
49
|
+
# actions: [
|
50
|
+
# { name: "complete_personal_credit_check" },
|
51
|
+
# { name: "check_director_as_guarantor" },
|
52
|
+
# { name: "check_director_as_applicant" },
|
53
|
+
# { name: "check_directors_match_companies_house" }
|
54
|
+
# ]
|
55
|
+
# },
|
56
|
+
# {
|
57
|
+
# category: "company_data",
|
58
|
+
# actions: [
|
59
|
+
# { name: "complete_business_credit_check" }
|
60
|
+
# ]
|
61
|
+
# },
|
62
|
+
# {
|
63
|
+
# category: "enhanced_security_check",
|
64
|
+
# actions: [
|
65
|
+
# { name: "contact_iwoca" }
|
66
|
+
# ]
|
67
|
+
# }
|
68
|
+
# ],
|
69
|
+
# interest_rate: 0.03
|
70
|
+
# }
|
71
|
+
# ],
|
72
|
+
# offer_creation_status: "offers_available"
|
73
|
+
# }
|
26
74
|
class Iwoca < DecisionParser
|
75
|
+
# Check the details on all the statuses here:
|
76
|
+
# https://iwoca.stoplight.io/docs/lapi-uk/3fc78424792f2-make-an-application
|
27
77
|
STATUSES = {
|
28
|
-
|
29
|
-
|
78
|
+
funded: 'funded',
|
79
|
+
expired: 'expired',
|
80
|
+
talking_to_customer: 'talking_to_customer',
|
81
|
+
offered: 'offered',
|
30
82
|
declined: 'declined',
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
83
|
+
deferred: 'deferred',
|
84
|
+
in_underwriting: 'in_underwriting',
|
85
|
+
awaiting_underwriter: 'awaiting_underwriter',
|
86
|
+
open: 'open',
|
87
|
+
action_required: 'action_required',
|
88
|
+
offer_revoked: 'offer_revoked',
|
89
|
+
customer_to_link_open_banking: 'customer_to_link_open_banking',
|
90
|
+
conditional_offer: 'conditional_offer',
|
91
|
+
offer_rejected: 'offer_rejected',
|
92
|
+
conditional_offer_criteria_met: 'conditional_offer_criteria_met',
|
93
|
+
not_defined: 'not_defined' # this is the default status, not a iwoca status
|
42
94
|
}.freeze
|
43
95
|
|
44
|
-
#
|
45
|
-
#
|
96
|
+
# The data object has two responses in two different keys:
|
97
|
+
# status - the response of the application status
|
98
|
+
# offers - the response of the available offers
|
46
99
|
def initialize(data = {})
|
47
100
|
@data = super
|
48
|
-
@
|
101
|
+
@status = @data[:status] if @data.key?(:status)
|
102
|
+
@offers = @data[:offers] if @data.key?(:offers)
|
49
103
|
end
|
50
104
|
|
51
105
|
def pending?
|
52
|
-
status == STATUSES[:
|
106
|
+
status == STATUSES[:open]
|
53
107
|
end
|
54
108
|
|
55
109
|
def approved?
|
56
|
-
status
|
110
|
+
status_included?(status, %i[offered funded])
|
57
111
|
end
|
58
112
|
|
59
113
|
def declined?
|
60
|
-
status
|
114
|
+
status_included?(status, %i[declined offer_revoked offer_rejected])
|
61
115
|
end
|
62
116
|
|
63
117
|
def manual_review?
|
64
|
-
|
118
|
+
manual_review_statuses = %i[
|
119
|
+
deferred
|
120
|
+
action_required
|
121
|
+
talking_to_customer
|
122
|
+
]
|
123
|
+
|
124
|
+
status_included?(status, manual_review_statuses)
|
65
125
|
end
|
66
126
|
|
67
127
|
def no_decision_possible?
|
68
|
-
status
|
128
|
+
status_included?(status, %i[expired])
|
69
129
|
end
|
70
130
|
|
71
131
|
def loan_started?
|
72
|
-
|
132
|
+
started_statuses = %i[
|
133
|
+
in_underwriting
|
134
|
+
awaiting_underwriter
|
135
|
+
talking_to_customer
|
136
|
+
customer_to_link_open_banking
|
137
|
+
]
|
138
|
+
|
139
|
+
status_included?(status, started_statuses)
|
73
140
|
end
|
74
141
|
|
75
142
|
def amount
|
76
|
-
amount_approved =
|
143
|
+
amount_approved = suggested_product[:amount] || 0
|
77
144
|
|
78
145
|
Money.new(amount_approved * 100).format
|
79
146
|
end
|
80
147
|
|
81
148
|
def credit_duration
|
82
|
-
|
83
|
-
|
149
|
+
unit = suggested_product.dig(:duration, :unit)
|
150
|
+
amount = suggested_product.dig(:duration, :amount)
|
84
151
|
|
85
|
-
|
86
|
-
status_hash.dig(:approved, :interval)
|
152
|
+
return { unit: unit, amount: amount }
|
87
153
|
end
|
88
154
|
|
89
155
|
def monthly_interest_rate
|
90
|
-
|
91
|
-
|
92
|
-
return 0 unless rates&.any?
|
93
|
-
|
94
|
-
rate_info = rates.first[:rates]&.first
|
95
|
-
|
96
|
-
return 0 unless rate_info
|
97
|
-
|
98
|
-
rate_info[:rate]
|
156
|
+
first_offer&.interest_rate
|
99
157
|
end
|
100
158
|
|
101
159
|
def status
|
102
|
-
|
160
|
+
@status[:status] || STATUSES[:not_defined]
|
103
161
|
end
|
104
162
|
|
105
163
|
private
|
106
164
|
|
107
|
-
def
|
108
|
-
|
165
|
+
def suggested_product
|
166
|
+
@status[:requests]&.first&.dig(:suggested_product)
|
167
|
+
end
|
168
|
+
|
169
|
+
def first_offer
|
170
|
+
@offers.dig(:offers)&.first
|
171
|
+
end
|
172
|
+
|
173
|
+
def status_included?(status, status_keys)
|
174
|
+
statuses = status_keys.map { |key| STATUSES[key] }
|
175
|
+
statuses.include?(status)
|
109
176
|
end
|
110
177
|
end
|
111
178
|
end
|
metadata
CHANGED
@@ -1,155 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: instant_quote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- rikas
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: dotenv
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: pry-byebug
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rspec
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '3.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '3.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop-rake
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-rspec
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: simplecov
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ">="
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ">="
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: webmock
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ">="
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ">="
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
13
|
- !ruby/object:Gem::Dependency
|
154
14
|
name: activesupport
|
155
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,30 +28,30 @@ dependencies:
|
|
168
28
|
name: capital_on_tap
|
169
29
|
requirement: !ruby/object:Gem::Requirement
|
170
30
|
requirements:
|
171
|
-
- - "
|
31
|
+
- - "~>"
|
172
32
|
- !ruby/object:Gem::Version
|
173
|
-
version:
|
33
|
+
version: 1.0.1
|
174
34
|
type: :runtime
|
175
35
|
prerelease: false
|
176
36
|
version_requirements: !ruby/object:Gem::Requirement
|
177
37
|
requirements:
|
178
|
-
- - "
|
38
|
+
- - "~>"
|
179
39
|
- !ruby/object:Gem::Version
|
180
|
-
version:
|
40
|
+
version: 1.0.1
|
181
41
|
- !ruby/object:Gem::Dependency
|
182
42
|
name: iwoca
|
183
43
|
requirement: !ruby/object:Gem::Requirement
|
184
44
|
requirements:
|
185
|
-
- - "
|
45
|
+
- - "~>"
|
186
46
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
47
|
+
version: 1.1.0
|
188
48
|
type: :runtime
|
189
49
|
prerelease: false
|
190
50
|
version_requirements: !ruby/object:Gem::Requirement
|
191
51
|
requirements:
|
192
|
-
- - "
|
52
|
+
- - "~>"
|
193
53
|
- !ruby/object:Gem::Version
|
194
|
-
version:
|
54
|
+
version: 1.1.0
|
195
55
|
- !ruby/object:Gem::Dependency
|
196
56
|
name: money
|
197
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -274,6 +134,7 @@ files:
|
|
274
134
|
- lib/instant_quote/adapters/fake.rb
|
275
135
|
- lib/instant_quote/adapters/iwoca.rb
|
276
136
|
- lib/instant_quote/adapters/iwoca_cbils.rb
|
137
|
+
- lib/instant_quote/adapters/iwoca_flexi24.rb
|
277
138
|
- lib/instant_quote/adapters/iwoca_recovery_loans.rb
|
278
139
|
- lib/instant_quote/adapters/iwoca_revenue_based_loans.rb
|
279
140
|
- lib/instant_quote/adapters/optimum.rb
|
@@ -284,6 +145,7 @@ files:
|
|
284
145
|
- lib/instant_quote/connection_translators/fake.rb
|
285
146
|
- lib/instant_quote/connection_translators/iwoca.rb
|
286
147
|
- lib/instant_quote/connection_translators/iwoca_cbils.rb
|
148
|
+
- lib/instant_quote/connection_translators/iwoca_flexi24.rb
|
287
149
|
- lib/instant_quote/connection_translators/iwoca_recovery_loans.rb
|
288
150
|
- lib/instant_quote/connection_translators/iwoca_revenue_based_loans.rb
|
289
151
|
- lib/instant_quote/connection_translators/optimum.rb
|
@@ -293,6 +155,7 @@ files:
|
|
293
155
|
- lib/instant_quote/decision_parsers/fake.rb
|
294
156
|
- lib/instant_quote/decision_parsers/iwoca.rb
|
295
157
|
- lib/instant_quote/decision_parsers/iwoca_cbils.rb
|
158
|
+
- lib/instant_quote/decision_parsers/iwoca_flexi24.rb
|
296
159
|
- lib/instant_quote/decision_parsers/iwoca_recovery_loans.rb
|
297
160
|
- lib/instant_quote/decision_parsers/iwoca_revenue_based_loans.rb
|
298
161
|
- lib/instant_quote/decision_parsers/optimum.rb
|
@@ -303,7 +166,7 @@ homepage: https://finpoint.co.uk
|
|
303
166
|
licenses: []
|
304
167
|
metadata:
|
305
168
|
homepage_uri: https://finpoint.co.uk
|
306
|
-
post_install_message:
|
169
|
+
post_install_message:
|
307
170
|
rdoc_options: []
|
308
171
|
require_paths:
|
309
172
|
- lib
|
@@ -318,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
318
181
|
- !ruby/object:Gem::Version
|
319
182
|
version: '0'
|
320
183
|
requirements: []
|
321
|
-
rubygems_version: 3.2.
|
322
|
-
signing_key:
|
184
|
+
rubygems_version: 3.2.3
|
185
|
+
signing_key:
|
323
186
|
specification_version: 4
|
324
187
|
summary: Instant quote providers gem.
|
325
188
|
test_files: []
|