instant_quote 1.1.1 → 1.1.2

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: dcc46ad5c55f3fcd548e18ae0ba8a853ce640c77a043762fec33a298cd2a9a2a
4
- data.tar.gz: c17b2fbc98a6637395a757122b0a2d1367bb3b6a0abbce1b2f87416d36b39ff4
3
+ metadata.gz: 5ef7de39482768419b0f8fcceef1a519f9a6f59d806663f87855b112255fb901
4
+ data.tar.gz: 365472c89d076772550acd39988412d8fc6a7501b0684d6a694a88e151802010
5
5
  SHA512:
6
- metadata.gz: bf272f35c66fd55538f199d0220abe1a02d715d852bfd5f0f8bd8013a9eb112f71921745070351ea80658cd4951af6ab7b300865bf9ef4e77ebbb1f42eaf32b4
7
- data.tar.gz: e120faaad9ae5b884d37c1993ae6e79e1b912d4e622c5b2eb83c0b8d15cdd46c0f9b72b90c92806f72bb2aad9d6ea3bdda9bbc861711ee5da1db8aae8a542568
6
+ metadata.gz: 7ba1a1214b4eb23a89b69f90f60195bf7f50d2d45f17b1727571f506dbc033513ec127c56ba18a5061fd93abb6df30b5952cf57bcf0ada33bdda091962fd43b8
7
+ data.tar.gz: 655bec0c02d728f1e2f39ffa32decbad0754359ede1b60dcfa866b65509316cddc1d0e5ea3ded3b279b1e850b89f2b6d0508d26af472d18f1eececf730bf0a2d
data/Gemfile.lock CHANGED
@@ -1,11 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.1.1)
4
+ instant_quote (1.1.2)
5
5
  activesupport
6
6
  capital_on_tap
7
7
  iwoca
8
8
  money
9
+ phonelib
9
10
 
10
11
  GEM
11
12
  remote: https://rubygems.org/
@@ -31,10 +32,10 @@ GEM
31
32
  diff-lcs (1.3)
32
33
  docile (1.3.2)
33
34
  dotenv (2.7.5)
34
- faraday (1.0.0)
35
+ faraday (0.17.3)
35
36
  multipart-post (>= 1.2, < 3)
36
- faraday_middleware (1.0.0.rc1)
37
- faraday (~> 1.0)
37
+ faraday_middleware (0.14.0)
38
+ faraday (>= 0.7.4, < 1.0)
38
39
  i18n (1.8.2)
39
40
  concurrent-ruby (~> 1.0)
40
41
  iwoca (1.0.0)
@@ -53,6 +54,7 @@ GEM
53
54
  parallel (1.19.1)
54
55
  parser (2.7.0.2)
55
56
  ast (~> 2.4.0)
57
+ phonelib (0.6.42)
56
58
  pry (0.12.2)
57
59
  coderay (~> 1.1.0)
58
60
  method_source (~> 0.9.0)
@@ -38,4 +38,5 @@ Gem::Specification.new do |spec|
38
38
  spec.add_dependency 'capital_on_tap'
39
39
  spec.add_dependency 'iwoca'
40
40
  spec.add_dependency 'money'
41
+ spec.add_dependency 'phonelib'
41
42
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'phonelib'
4
+
3
5
  module InstantQuote
4
6
  module ConnectionTranslators
5
7
  class CapitalOnTap < ConnectionTranslator
@@ -12,24 +14,26 @@ module InstantQuote
12
14
  FirstName: app_user.first_name,
13
15
  LastName: app_user.last_name,
14
16
  DateOfBirth: extra_info['date_of_birth'],
15
- MobilePhone: extra_info['applicant_phone_number'],
17
+ MobilePhone: format_phone(extra_info['applicant_phone_number']),
16
18
  EmailAddress: app_user.email,
17
19
  PersonalAddress: translate_address,
18
20
  TradingName: app_org.name,
19
21
  BusinessLegalName: app_org.name,
20
- BusinessLandline: extra_info['business_landline'],
22
+ BusinessLandline: format_phone(extra_info['business_landline']),
21
23
  YearsTrading: app_org.years_in_business,
22
24
  MonthlyTurnOver: translate_turnover,
23
25
  BusinessType: translate_business_type,
24
26
  BusinessAddress: translate_address,
25
- RegistrationNumber: app_org.company_number,
27
+ RegistrationNumber: app_org.company_number
26
28
  }
27
29
 
28
30
  # If the borrower organisation is Sole Trader we need to merge two additional fields.
29
- fields.merge!(
30
- MonthlyIncome: extra_info['monthly_income'],
31
- MonthlyExpenditure: extra_info['monthly_expenditure']
32
- ) if app_org.sole_trader?
31
+ if app_org.sole_trader?
32
+ fields.merge!(
33
+ MonthlyIncome: extra_info['monthly_income'],
34
+ MonthlyExpenditure: extra_info['monthly_expenditure']
35
+ )
36
+ end
33
37
 
34
38
  fields
35
39
  end
@@ -37,6 +41,13 @@ module InstantQuote
37
41
 
38
42
  private
39
43
 
44
+ # Converts phone numbers with country code to local phone numbers, because that's what Capital
45
+ # on Tap expects.
46
+ def format_phone(phone_number)
47
+ phone = Phonelib.parse(phone_number)
48
+ phone.national(false)
49
+ end
50
+
40
51
  def app_user
41
52
  application.primary_user
42
53
  end
@@ -48,7 +59,7 @@ module InstantQuote
48
59
  def translate_address
49
60
  addr = app_org.address
50
61
 
51
- return '' unless addr.present?
62
+ return '' unless addr && addr != ''
52
63
 
53
64
  street_parts = [addr.line_1, addr.line_2, addr.line_3, addr.line_4]
54
65
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstantQuote
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
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.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-10 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: phonelib
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: Instant quote providers gem.
168
182
  email:
169
183
  - oterosantos@gmail.com