instant_quote 1.7.27 → 1.7.29
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 +4 -4
- data/Gemfile.lock +1 -1
- data/bin/console +10 -10
- data/lib/instant_quote/adapters/iwoca.rb +6 -4
- data/lib/instant_quote/connection_translators/iwoca.rb +1 -5
- data/lib/instant_quote/decision_parsers/iwoca.rb +8 -7
- data/lib/instant_quote/decision_parsers/iwoca_v2_translator.rb +2 -4
- data/lib/instant_quote/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 909beee5ce464d02860dd308450cce67e83eac2d62f0657209f1eac39c160c1e
|
|
4
|
+
data.tar.gz: fb8d70ff32018f9cc144cbcd9db4430b781cba2bc38b5b93a6baa338337f75c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: edb69faea949be905d2d112bdc97fd50c4252694b0feee1b396fad1ff340d822063343d2a3ab5c4a757ec95ba715bf5140d909b05e5738c5cdb5e3d06d1e2291
|
|
7
|
+
data.tar.gz: 8ca5cb8aa26da747120ecca70777297fde443455f22131ea476ebf572b94898e9907f9f83a1400ab7d15d463731c369aa8eb66c57524d1b717caba518ec317e9
|
data/Gemfile.lock
CHANGED
data/bin/console
CHANGED
|
@@ -12,21 +12,21 @@ require 'capital_on_tap'
|
|
|
12
12
|
require 'iwoca'
|
|
13
13
|
|
|
14
14
|
CapitalOnTap.configure do |config|
|
|
15
|
-
config.client_id = ENV
|
|
16
|
-
config.client_secret = ENV
|
|
17
|
-
config.username = ENV
|
|
18
|
-
config.password = ENV
|
|
15
|
+
config.client_id = ENV.fetch('CAPITAL_ON_TAP_CLIENT_ID')
|
|
16
|
+
config.client_secret = ENV.fetch('CAPITAL_ON_TAP_CLIENT_SECRET')
|
|
17
|
+
config.username = ENV.fetch('CAPITAL_ON_TAP_USERNAME')
|
|
18
|
+
config.password = ENV.fetch('CAPITAL_ON_TAP_PASSWORD')
|
|
19
19
|
config.debug = true
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
Iwoca.configure do |config|
|
|
23
|
-
config.api_key = ENV
|
|
24
|
-
config.webhook_signature = ENV
|
|
23
|
+
config.api_key = ENV.fetch('IWOCA_API_KEY')
|
|
24
|
+
config.webhook_signature = ENV.fetch('IWOCA_WEBHOOK_SIGNATURE')
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
Youlend.configure do |config|
|
|
28
|
-
config.client_id = ENV
|
|
29
|
-
config.client_secret = ENV
|
|
28
|
+
config.client_id = ENV.fetch('YOULEND_CLIENT_ID')
|
|
29
|
+
config.client_secret = ENV.fetch('YOULEND_CLIENT_SECRET')
|
|
30
30
|
config.debug = true
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -39,7 +39,7 @@ I18n.locale = :en
|
|
|
39
39
|
Money.locale_backend = :i18n
|
|
40
40
|
Money.rounding_mode = BigDecimal::ROUND_HALF_EVEN
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def declined_iwoca_v1_json
|
|
43
43
|
json = '{
|
|
44
44
|
"data": {
|
|
45
45
|
"state_key": "[FILTERED]",
|
|
@@ -55,7 +55,7 @@ def declined_v1_json
|
|
|
55
55
|
JSON.parse(json)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
|
-
def
|
|
58
|
+
def approved_iwoca_v1_json
|
|
59
59
|
json = '{
|
|
60
60
|
"data": {
|
|
61
61
|
"state_key": "[FILTERED]",
|
|
@@ -68,12 +68,14 @@ module InstantQuote
|
|
|
68
68
|
requests = params.dig(:data, :requests)
|
|
69
69
|
|
|
70
70
|
# We can only send company and people
|
|
71
|
-
response = ::Iwoca::Customer.create(
|
|
71
|
+
response = ::Iwoca::Customer.create(
|
|
72
72
|
data: {
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
data: {
|
|
74
|
+
company: company,
|
|
75
|
+
people: people
|
|
76
|
+
}
|
|
75
77
|
}
|
|
76
|
-
|
|
78
|
+
)
|
|
77
79
|
|
|
78
80
|
raise_error(response) unless response.success?
|
|
79
81
|
|
|
@@ -42,12 +42,10 @@ module InstantQuote
|
|
|
42
42
|
def proceeds_purpose
|
|
43
43
|
purpose = application.proceeds_purpose&.overview&.name
|
|
44
44
|
case purpose
|
|
45
|
-
when 'Invest in equipment or machinery'
|
|
45
|
+
when 'Invest in equipment or machinery' || 'Buy or refinance vehicle(s)'
|
|
46
46
|
'equipment_purchase'
|
|
47
47
|
when 'Refinance an existing loan'
|
|
48
48
|
'refinancing_debt'
|
|
49
|
-
when 'Buy or refinance vehicle(s)'
|
|
50
|
-
'equipment_purchase'
|
|
51
49
|
else
|
|
52
50
|
'other'
|
|
53
51
|
end
|
|
@@ -55,8 +53,6 @@ module InstantQuote
|
|
|
55
53
|
|
|
56
54
|
def product_name
|
|
57
55
|
case connection.adapter
|
|
58
|
-
when 'iwoca'
|
|
59
|
-
'flexi_loan'
|
|
60
56
|
when 'iwoca_cbils'
|
|
61
57
|
'cbils'
|
|
62
58
|
when 'iwoca_revenue_based_loans'
|
|
@@ -100,11 +100,11 @@ module InstantQuote
|
|
|
100
100
|
@data = super
|
|
101
101
|
|
|
102
102
|
# Just in case (v1 has a lot of key 'data' nesting)
|
|
103
|
-
@data = @data
|
|
103
|
+
@data = @data[:data] if @data.key?(:data)
|
|
104
104
|
|
|
105
105
|
# It's a v1 JSON response, so we need to translate it to v2 first!
|
|
106
|
-
if @data.key?(:state_key)
|
|
107
|
-
puts
|
|
106
|
+
if @data.key?(:state_key) || @data.key?(:approval_status) || @data.key?(:latest_approval_request)
|
|
107
|
+
puts '[iwoca] Translating v1 JSON to v2...'
|
|
108
108
|
@data = DecisionParsers::IwocaV2Translator.translate(@data)
|
|
109
109
|
end
|
|
110
110
|
|
|
@@ -159,17 +159,16 @@ module InstantQuote
|
|
|
159
159
|
unit = suggested_product.dig(:duration, :unit)
|
|
160
160
|
amount = suggested_product.dig(:duration, :amount)
|
|
161
161
|
|
|
162
|
-
|
|
162
|
+
{ unit: unit, amount: amount }
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
def monthly_interest_rate
|
|
166
|
-
puts "Getting monthly interest rate..."
|
|
167
|
-
puts "First offer: #{first_offer}"
|
|
168
|
-
puts "Offers: #{@offers.inspect}"
|
|
169
166
|
first_offer[:interest_rate]
|
|
170
167
|
end
|
|
171
168
|
|
|
172
169
|
def status
|
|
170
|
+
return STATUSES[:not_defined] unless @status
|
|
171
|
+
|
|
173
172
|
@status[:status] || STATUSES[:not_defined]
|
|
174
173
|
end
|
|
175
174
|
|
|
@@ -184,6 +183,8 @@ module InstantQuote
|
|
|
184
183
|
end
|
|
185
184
|
|
|
186
185
|
def status_included?(status, status_keys)
|
|
186
|
+
return false unless status
|
|
187
|
+
|
|
187
188
|
statuses = status_keys.map { |key| STATUSES[key] }
|
|
188
189
|
statuses.include?(status)
|
|
189
190
|
end
|
|
@@ -28,7 +28,7 @@ module InstantQuote
|
|
|
28
28
|
duration: {
|
|
29
29
|
unit: translate_interval(@decision.credit_interval),
|
|
30
30
|
amount: @decision.credit_duration
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
]
|
|
@@ -37,7 +37,7 @@ module InstantQuote
|
|
|
37
37
|
{
|
|
38
38
|
interest_rate: @decision.monthly_interest_rate
|
|
39
39
|
}
|
|
40
|
-
]
|
|
40
|
+
]
|
|
41
41
|
}
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -54,8 +54,6 @@ module InstantQuote
|
|
|
54
54
|
|
|
55
55
|
def translate_interval(v1_interval)
|
|
56
56
|
case v1_interval
|
|
57
|
-
when '1m'
|
|
58
|
-
'months'
|
|
59
57
|
when '1w'
|
|
60
58
|
'weeks'
|
|
61
59
|
when '1d'
|
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.
|
|
4
|
+
version: 1.7.29
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- rikas
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-09-
|
|
11
|
+
date: 2023-09-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|