lago-ruby-client 0.19.0.pre.alpha → 0.20.0.pre.beta

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: '085ca7aa77ca8c79567c84635825a4247e51187a618b2478de6e821ed9437715'
4
- data.tar.gz: 4cf3da3f4824a43d6f88bdb9478a66eb1f96a15869e56e13ff022c670503f07a
3
+ metadata.gz: c0cf426548c5d0e497ead0620d30c4456919c9b57a5d9dbf55ebc17efcb98c96
4
+ data.tar.gz: '0584c626189a813c260488e1f967f4028cd2c416968ad621dbe81f134a4c5049'
5
5
  SHA512:
6
- metadata.gz: 6610b52aa3ea6141aadc21846f56eaff479f7a272d15c421b96042cc34b8d52926168fb5066bb4df404fcd6914afe3bd0eb7ed8ec3954f964879fed143bfbd62
7
- data.tar.gz: 4c6315e059cfbbef32be7250c2f458e497de9cd449d84825cbeb6512728a3c0fd674646a188d29b1bb39c9a36f13578fade96fe21fa71d46dc9dec069cd38caa
6
+ metadata.gz: b4581532927ded6bf68e17797a6b8645c6b0eaf5880d7d1390dc9e508cedc61d0f10c08703f551c960173a571dcd529d77a77482e2ea2ba372cfada516373d17
7
+ data.tar.gz: 31f79a39df9b5a92d38a528b3ba018e8ab8623582769d9d87eba33d8464bc721d688bd8c1d78098055b860315765f6ccbd3d7d79aaac0dea8760270611a70311
@@ -40,7 +40,7 @@ module Lago
40
40
  path = "/api/v1/credit_notes/#{credit_note_id}/download"
41
41
  response = connection.post({}, path)
42
42
 
43
- JSON.parse(response.to_json, object_class: OpenStruct)
43
+ JSON.parse(response.to_json, object_class: OpenStruct).credit_note
44
44
  end
45
45
 
46
46
  def void(credit_note_id)
@@ -51,7 +51,7 @@ module Lago
51
51
  body: {}
52
52
  )
53
53
 
54
- JSON.parse(response.to_json, object_class: OpenStruct)
54
+ JSON.parse(response.to_json, object_class: OpenStruct).credit_note
55
55
  end
56
56
  end
57
57
  end
@@ -21,7 +21,7 @@ module Lago
21
21
 
22
22
  def whitelist_params(params)
23
23
  result_hash = {
24
- external_customer_id: params[:external_customer_id],
24
+ external_id: params[:external_id],
25
25
  address_line1: params[:address_line1],
26
26
  address_line2: params[:address_line2],
27
27
  city: params[:city],
@@ -48,6 +48,7 @@ module Lago
48
48
 
49
49
  def whitelist_billing_configuration(billing_params)
50
50
  (billing_params || {}).slice(
51
+ :invoice_grace_period,
51
52
  :payment_provider,
52
53
  :provider_customer_id,
53
54
  :sync,
@@ -16,6 +16,27 @@ module Lago
16
16
  path = "/api/v1/invoices/#{invoice_id}/download"
17
17
  response = connection.post({}, path)
18
18
 
19
+ JSON.parse(response.to_json, object_class: OpenStruct).invoice
20
+ end
21
+
22
+ def refresh(invoice_id)
23
+ path = "/api/v1/invoices/#{invoice_id}/refresh"
24
+ response = connection.put(path, identifier: nil, body: {})
25
+
26
+ JSON.parse(response.to_json, object_class: OpenStruct).invoice
27
+ end
28
+
29
+ def finalize(invoice_id)
30
+ path = "/api/v1/invoices/#{invoice_id}/finalize"
31
+ response = connection.put(path, identifier: nil, body: {})
32
+
33
+ JSON.parse(response.to_json, object_class: OpenStruct).invoice
34
+ end
35
+
36
+ def retry_payment(invoice_id)
37
+ path = "/api/v1/invoices/#{invoice_id}/retry_payment"
38
+ response = connection.post({}, path)
39
+
19
40
  JSON.parse(response.to_json, object_class: OpenStruct)
20
41
  end
21
42
 
@@ -37,6 +37,7 @@ module Lago
37
37
  def whitelist_billing_configuration(billing_params)
38
38
  (billing_params || {}).slice(
39
39
  :invoice_footer,
40
+ :invoice_grace_period,
40
41
  :vat_rate,
41
42
  )
42
43
  end
@@ -8,11 +8,18 @@ module Lago
8
8
  'webhooks'
9
9
  end
10
10
 
11
+ def root_name
12
+ 'webhook'
13
+ end
14
+
11
15
  def public_key
12
- path = '/api/v1/webhooks/public_key'
16
+ path = '/api/v1/webhooks/json_public_key'
17
+
18
+ response = connection.get(path, identifier: nil)[root_name]
19
+
20
+ webhook_details = JSON.parse(response.to_json, object_class: OpenStruct)
13
21
 
14
- webhooks_public_key = connection.get(path, identifier: nil)
15
- OpenSSL::PKey::RSA.new(Base64.decode64(webhooks_public_key))
22
+ OpenSSL::PKey::RSA.new(Base64.decode64(webhook_details.public_key))
16
23
  end
17
24
 
18
25
  def valid_signature?(signature, webhook_payload, cached_key = public_key)
data/lib/lago/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lago
4
- VERSION = '0.19.0-alpha'
4
+ VERSION = '0.20.0-beta'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lago-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0.pre.alpha
4
+ version: 0.20.0.pre.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovro Colic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  - !ruby/object:Gem::Version
174
174
  version: 1.3.1
175
175
  requirements: []
176
- rubygems_version: 3.1.4
176
+ rubygems_version: 3.3.3
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: Lago Rest API client