instant_quote 1.7.23 → 1.7.25

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: 62afac47e88f6a0081bf3194e11949baacf153e299705461711a182d7fc68dce
4
- data.tar.gz: d7c9a1854649370bf9e555f9de372df47a1c16755a131403f7ef75340ced090e
3
+ metadata.gz: 86435a0b48194ca542b10e562843b80843db4a4f6d0a369e38855896094bf9b3
4
+ data.tar.gz: 27c57e71d3f01f546a564e3afb73f83c4ae8ac1a62534e286848a1f4a57ea0c5
5
5
  SHA512:
6
- metadata.gz: daec7768578601d6ec787f903226e01ff3b5dffc4e722adebefc528b6f4b68bfbb52821920d2cc6f65e76946c6d09f26addaf08e710f310c30b4bf02f03396d4
7
- data.tar.gz: 9a6c1cbdc841e0edd601cdd1d1697ada57a34d5454b72cddcf61af9c75fa05bf8c1fede1126caa7235d54fe6f12f2879f429b670bd3a3cf8798cfe85eeba1318
6
+ metadata.gz: df0318dd50bb9ec05cb52999a453ee0aba7103a6ab259cd9d42d1dfe77b96538e0497efed33b76574ea2b4f2312f63e1edde0136ccb4b8af3146a2e074b5c78d
7
+ data.tar.gz: 767dd6950755bcdddcfba7904e7683b547c5b9b41dfeb80c32b0d310398b44c8d2a5693554c81ed429a0312379d3b639a4b06ad4ca61e4a05b4a27268f5b7372
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- instant_quote (1.7.23)
4
+ instant_quote (1.7.25)
5
5
  activesupport
6
6
  capital_on_tap (~> 1.0.1)
7
7
  iwoca (~> 1.1.0)
@@ -58,16 +58,34 @@ module InstantQuote
58
58
  ]
59
59
 
60
60
  # Creates the iwoca customer and application and returns the customer_id from the response.
61
+ # The params come from the connection translator that returns 3 hashes:
62
+ # - company: The company information
63
+ # - people: The people information
64
+ # - requests: The requests information
61
65
  def get_quote(params, _connection)
62
- response = ::Iwoca::Customer.create(data: params)
66
+ company = params.dig(:data, :company)
67
+ people = params.dig(:data, :people)
68
+ requests = params.dig(:data, :requests)
69
+
70
+ # We can only send company and people
71
+ response = ::Iwoca::Customer.create(data: {
72
+ data: {
73
+ company: company,
74
+ people: people
75
+ }
76
+ })
63
77
 
64
78
  raise_error(response) unless response.success?
65
79
 
66
80
  customer_id = response.data[:customer_id]
67
81
 
82
+
68
83
  # This returns an application_id but we can't store it since we don't have more than one
69
84
  # external ID field. We shouldn't need it anyway.
70
- ::Iwoca::Application.create(customer_id: response.data[:customer_id], data: params)
85
+ ::Iwoca::Application.create(
86
+ customer_id: response.data[:customer_id],
87
+ data: { data: { requests: requests }}
88
+ )
71
89
 
72
90
  return customer_id if response.success?
73
91
 
@@ -8,6 +8,13 @@ module InstantQuote
8
8
  data: {
9
9
  company: company_information,
10
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
+ ]
11
18
  }
12
19
  }
13
20
  end
@@ -34,7 +41,6 @@ module InstantQuote
34
41
  # rubocop:disable Metrics/AbcSize
35
42
  def company_information
36
43
  information = {
37
- uid: SecureRandom.uuid,
38
44
  registered_company_name: company.name,
39
45
  industry: company.industry.name,
40
46
  company_number: company.company_number.to_s,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InstantQuote
4
- VERSION = '1.7.23'
4
+ VERSION = '1.7.25'
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.23
4
+ version: 1.7.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - rikas
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-31 00:00:00.000000000 Z
11
+ date: 2023-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport