lago-ruby-client 1.7.0 → 1.10.0

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: 2c34063ea8038343ad6d3ee6c4de235dbfb920a43f041da7cd3d578b616aae43
4
- data.tar.gz: 012faa373eb04d2861c77a329bd63f1ae9bb8822abcd6a3e34aa15f677c0c387
3
+ metadata.gz: b7d714be8c838702df1fa8cfe4a8ab87cfebf2dfc8b6cecb3f92409293f2d579
4
+ data.tar.gz: 611ad0fe3b6e3978090c0d84d20b54d93d7cbcfcf1dfbd315988e4590b2d6e05
5
5
  SHA512:
6
- metadata.gz: 18c90aa530a176e78c0af1195faff254a96b9de3b54ec4d4094cda5ce53ff85ccc6691e72b69f623a6f5f5589c68a9b3264954e539109a790bbb7ed8f3c036f0
7
- data.tar.gz: 29bbd820a54125edf9d03f3bc813a9abb852968dce42276674be0bc6292246345a3cb30eac2f9d3c8b327027be3ed3b9016fde8845bc04b93ee9e85c1a9886ca
6
+ metadata.gz: 50b62e58757101cd210e4117dfdb64a707184baa2e17faafe9eb45b753197cd8d21f78c0e0beb59d4a0d57b4221dfd64462591de0da46bc58addf908bdd1cad0
7
+ data.tar.gz: 51ca6572c5a9cffa9080a813d5921e2d7e2eb5b1ade7fded76a5256e082b0333a3f3a4be4bde23268bc972a761b0c7680bd4e15da541c8536d4e60d11700ea38
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Lago
4
+ module Api
5
+ module Resources
6
+ class PaymentRequest < Base
7
+ def api_resource
8
+ 'payment_requests'
9
+ end
10
+
11
+ def root_name
12
+ 'payment_request'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -35,6 +35,10 @@ module Lago
35
35
  result_hash[:minimum_commitment] = minimum_commitment
36
36
  end
37
37
 
38
+ whitelist_usage_thresholds(params[:usage_thresholds]).tap do |usage_thresholds|
39
+ result_hash[:usage_thresholds] = usage_thresholds unless usage_thresholds.empty?
40
+ end
41
+
38
42
  { root_name => result_hash }
39
43
  end
40
44
 
@@ -56,6 +60,7 @@ module Lago
56
60
  :charge_model,
57
61
  :pay_in_advance,
58
62
  :invoiceable,
63
+ :regroup_paid_fees,
59
64
  :invoice_display_name,
60
65
  :min_amount_cents,
61
66
  :properties,
@@ -68,6 +73,23 @@ module Lago
68
73
 
69
74
  processed_charges
70
75
  end
76
+
77
+ def whitelist_usage_thresholds(usage_thresholds)
78
+ processed_usage_thresholds = []
79
+
80
+ usage_thresholds&.each do |c|
81
+ result = (c || {}).slice(
82
+ :id,
83
+ :threshold_display_name,
84
+ :amount_cents,
85
+ :recurring,
86
+ )
87
+
88
+ processed_usage_thresholds << result unless result.empty?
89
+ end
90
+
91
+ processed_usage_thresholds
92
+ end
71
93
  end
72
94
  end
73
95
  end
@@ -21,6 +21,8 @@ module Lago
21
21
  granted_credits: params[:granted_credits],
22
22
  currency: params[:currency],
23
23
  expiration_at: params[:expiration_at],
24
+ transaction_metadata: params[:transaction_metadata],
25
+ invoice_requires_successful_payment: params[:invoice_requires_successful_payment],
24
26
  }.compact
25
27
 
26
28
  recurring_rules = whitelist_recurring_rules(params[:recurring_transaction_rules])
@@ -38,11 +40,13 @@ module Lago
38
40
  :paid_credits,
39
41
  :granted_credits,
40
42
  :threshold_credits,
43
+ :invoice_requires_successful_payment,
41
44
  :trigger,
42
45
  :interval,
43
46
  :method,
44
47
  :started_at,
45
48
  :target_ongoing_balance,
49
+ :transaction_metadata
46
50
  )
47
51
 
48
52
  processed_rules << result unless result.empty?
@@ -25,7 +25,9 @@ module Lago
25
25
  wallet_id: params[:wallet_id],
26
26
  paid_credits: params[:paid_credits],
27
27
  granted_credits: params[:granted_credits],
28
- voided_credits: params[:voided_credits]
28
+ voided_credits: params[:voided_credits],
29
+ invoice_requires_successful_payment: params[:invoice_requires_successful_payment],
30
+ metadata: params[:metadata],
29
31
  }.compact
30
32
  }
31
33
  end
data/lib/lago/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lago
4
- VERSION = '1.7.0'
4
+ VERSION = '1.10.0'
5
5
  end
@@ -4,6 +4,7 @@ require 'net/http'
4
4
  require 'uri'
5
5
  require 'json'
6
6
  require 'openssl'
7
+ require 'ostruct'
7
8
  require 'jwt'
8
9
 
9
10
  require 'lago/version'
@@ -27,6 +28,7 @@ require 'lago/api/resources/invoiced_usage'
27
28
  require 'lago/api/resources/mrr'
28
29
  require 'lago/api/resources/organization'
29
30
  require 'lago/api/resources/overdue_balance'
31
+ require 'lago/api/resources/payment_request'
30
32
  require 'lago/api/resources/plan'
31
33
  require 'lago/api/resources/subscription'
32
34
  require 'lago/api/resources/tax'
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: 1.7.0
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovro Colic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -149,6 +149,7 @@ files:
149
149
  - lib/lago/api/resources/mrr.rb
150
150
  - lib/lago/api/resources/organization.rb
151
151
  - lib/lago/api/resources/overdue_balance.rb
152
+ - lib/lago/api/resources/payment_request.rb
152
153
  - lib/lago/api/resources/plan.rb
153
154
  - lib/lago/api/resources/subscription.rb
154
155
  - lib/lago/api/resources/tax.rb