dodopayments 1.17.0 → 1.18.0
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/CHANGELOG.md +14 -0
- data/README.md +1 -1
- data/lib/dodopayments/models/subscription.rb +10 -2
- data/lib/dodopayments/models/subscription_change_plan_params.rb +44 -0
- data/lib/dodopayments/resources/subscriptions.rb +22 -0
- data/lib/dodopayments/version.rb +1 -1
- data/lib/dodopayments.rb +1 -0
- data/rbi/lib/dodopayments/models/subscription.rbi +9 -1
- data/rbi/lib/dodopayments/models/subscription_change_plan_params.rbi +65 -0
- data/rbi/lib/dodopayments/resources/subscriptions.rbi +20 -0
- data/sig/dodopayments/models/subscription.rbs +4 -0
- data/sig/dodopayments/models/subscription_change_plan_params.rbs +41 -0
- data/sig/dodopayments/resources/subscriptions.rbs +8 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5893887fb8cc4a7d0167f490b1c1a6d70480c05540d8cece0ce556b38688082a
|
4
|
+
data.tar.gz: f96bf3c63b0a72a140e9e5e5cf46168300a4ce4ba03f46b30cdc2c7932ecb5de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28a0005ba7b8f0e1a0aca68a9fd63e3cb58f1866de67d622fb99c2cf8fe639981a4a311ceb2e7c43bd2c50cb0809474ee76024c0de649ff310a6795b02dca514
|
7
|
+
data.tar.gz: 4856a6d0cb1e1634089fe7e845a6c1a7a356e5b3fc757744343501db4cd9e5857502daa8b17728c1d3f198c0e2c908809185a3f27583ddd0e830c6accac6c1fa
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.18.0 (2025-04-23)
|
4
|
+
|
5
|
+
Full Changelog: [v1.17.0...v1.18.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.17.0...v1.18.0)
|
6
|
+
|
7
|
+
### Features
|
8
|
+
|
9
|
+
* **api:** added change plan api ([fc2cff8](https://github.com/dodopayments/dodopayments-ruby/commit/fc2cff8003f8e95dcac370e321055f1e28527ce3))
|
10
|
+
* **api:** manual updates ([166a9b4](https://github.com/dodopayments/dodopayments-ruby/commit/166a9b4ee8b5321673418e4a50c79e5c80d26295))
|
11
|
+
|
12
|
+
|
13
|
+
### Chores
|
14
|
+
|
15
|
+
* **ci:** add timeout thresholds for CI jobs ([2bf3878](https://github.com/dodopayments/dodopayments-ruby/commit/2bf3878e437abc08274ded07eff6050685a4bcfd))
|
16
|
+
|
3
17
|
## 1.17.0 (2025-04-22)
|
4
18
|
|
5
19
|
Full Changelog: [v1.16.1...v1.17.0](https://github.com/dodopayments/dodopayments-ruby/compare/v1.16.1...v1.17.0)
|
data/README.md
CHANGED
@@ -31,7 +31,8 @@ module Dodopayments
|
|
31
31
|
required :metadata, Dodopayments::Internal::Type::HashOf[String]
|
32
32
|
|
33
33
|
# @!attribute next_billing_date
|
34
|
-
# Timestamp of the next scheduled billing
|
34
|
+
# Timestamp of the next scheduled billing. Indicates the end of current billing
|
35
|
+
# period
|
35
36
|
#
|
36
37
|
# @return [Time]
|
37
38
|
required :next_billing_date, Time
|
@@ -47,6 +48,12 @@ module Dodopayments
|
|
47
48
|
# @return [Symbol, Dodopayments::Models::TimeInterval]
|
48
49
|
required :payment_frequency_interval, enum: -> { Dodopayments::Models::TimeInterval }
|
49
50
|
|
51
|
+
# @!attribute previous_billing_date
|
52
|
+
# Timestamp of the last payment. Indicates the start of current billing period
|
53
|
+
#
|
54
|
+
# @return [Time]
|
55
|
+
required :previous_billing_date, Time
|
56
|
+
|
50
57
|
# @!attribute product_id
|
51
58
|
# Identifier of the product associated with this subscription
|
52
59
|
#
|
@@ -112,7 +119,7 @@ module Dodopayments
|
|
112
119
|
# @return [String, nil]
|
113
120
|
optional :discount_id, String, nil?: true
|
114
121
|
|
115
|
-
# @!method initialize(billing:, created_at:, currency:, customer:, metadata:, next_billing_date:, payment_frequency_count:, payment_frequency_interval:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, discount_id: nil)
|
122
|
+
# @!method initialize(billing:, created_at:, currency:, customer:, metadata:, next_billing_date:, payment_frequency_count:, payment_frequency_interval:, previous_billing_date:, product_id:, quantity:, recurring_pre_tax_amount:, status:, subscription_id:, subscription_period_count:, subscription_period_interval:, tax_inclusive:, trial_period_days:, cancelled_at: nil, discount_id: nil)
|
116
123
|
# Response struct representing subscription details
|
117
124
|
#
|
118
125
|
# @param billing [Dodopayments::Models::BillingAddress]
|
@@ -123,6 +130,7 @@ module Dodopayments
|
|
123
130
|
# @param next_billing_date [Time]
|
124
131
|
# @param payment_frequency_count [Integer]
|
125
132
|
# @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval]
|
133
|
+
# @param previous_billing_date [Time]
|
126
134
|
# @param product_id [String]
|
127
135
|
# @param quantity [Integer]
|
128
136
|
# @param recurring_pre_tax_amount [Integer]
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
# @see Dodopayments::Resources::Subscriptions#change_plan
|
6
|
+
class SubscriptionChangePlanParams < Dodopayments::Internal::Type::BaseModel
|
7
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
8
|
+
include Dodopayments::Internal::Type::RequestParameters
|
9
|
+
|
10
|
+
# @!attribute product_id
|
11
|
+
# Unique identifier of the product to subscribe to
|
12
|
+
#
|
13
|
+
# @return [String]
|
14
|
+
required :product_id, String
|
15
|
+
|
16
|
+
# @!attribute proration_billing_mode
|
17
|
+
#
|
18
|
+
# @return [Symbol, Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode]
|
19
|
+
required :proration_billing_mode,
|
20
|
+
enum: -> { Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode }
|
21
|
+
|
22
|
+
# @!attribute quantity
|
23
|
+
# Number of units to subscribe for. Must be at least 1.
|
24
|
+
#
|
25
|
+
# @return [Integer]
|
26
|
+
required :quantity, Integer
|
27
|
+
|
28
|
+
# @!method initialize(product_id:, proration_billing_mode:, quantity:, request_options: {})
|
29
|
+
# @param product_id [String]
|
30
|
+
# @param proration_billing_mode [Symbol, Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode]
|
31
|
+
# @param quantity [Integer]
|
32
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
|
33
|
+
|
34
|
+
module ProrationBillingMode
|
35
|
+
extend Dodopayments::Internal::Type::Enum
|
36
|
+
|
37
|
+
PRORATED_IMMEDIATELY = :prorated_immediately
|
38
|
+
|
39
|
+
# @!method self.values
|
40
|
+
# @return [Array<Symbol>]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -100,6 +100,28 @@ module Dodopayments
|
|
100
100
|
)
|
101
101
|
end
|
102
102
|
|
103
|
+
# @overload change_plan(subscription_id, product_id:, proration_billing_mode:, quantity:, request_options: {})
|
104
|
+
#
|
105
|
+
# @param subscription_id [String]
|
106
|
+
# @param product_id [String]
|
107
|
+
# @param proration_billing_mode [Symbol, Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode]
|
108
|
+
# @param quantity [Integer]
|
109
|
+
# @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil]
|
110
|
+
#
|
111
|
+
# @return [nil]
|
112
|
+
#
|
113
|
+
# @see Dodopayments::Models::SubscriptionChangePlanParams
|
114
|
+
def change_plan(subscription_id, params)
|
115
|
+
parsed, options = Dodopayments::Models::SubscriptionChangePlanParams.dump_request(params)
|
116
|
+
@client.request(
|
117
|
+
method: :post,
|
118
|
+
path: ["subscriptions/%1$s/change-plan", subscription_id],
|
119
|
+
body: parsed,
|
120
|
+
model: NilClass,
|
121
|
+
options: options
|
122
|
+
)
|
123
|
+
end
|
124
|
+
|
103
125
|
# @overload charge(subscription_id, product_price:, request_options: {})
|
104
126
|
#
|
105
127
|
# @param subscription_id [String]
|
data/lib/dodopayments/version.rb
CHANGED
data/lib/dodopayments.rb
CHANGED
@@ -115,6 +115,7 @@ require_relative "dodopayments/models/refund_list_params"
|
|
115
115
|
require_relative "dodopayments/models/refund_retrieve_params"
|
116
116
|
require_relative "dodopayments/models/refund_status"
|
117
117
|
require_relative "dodopayments/models/subscription"
|
118
|
+
require_relative "dodopayments/models/subscription_change_plan_params"
|
118
119
|
require_relative "dodopayments/models/subscription_charge_params"
|
119
120
|
require_relative "dodopayments/models/subscription_charge_response"
|
120
121
|
require_relative "dodopayments/models/subscription_create_params"
|
@@ -27,7 +27,8 @@ module Dodopayments
|
|
27
27
|
sig { returns(T::Hash[Symbol, String]) }
|
28
28
|
attr_accessor :metadata
|
29
29
|
|
30
|
-
# Timestamp of the next scheduled billing
|
30
|
+
# Timestamp of the next scheduled billing. Indicates the end of current billing
|
31
|
+
# period
|
31
32
|
sig { returns(Time) }
|
32
33
|
attr_accessor :next_billing_date
|
33
34
|
|
@@ -38,6 +39,10 @@ module Dodopayments
|
|
38
39
|
sig { returns(Dodopayments::Models::TimeInterval::TaggedSymbol) }
|
39
40
|
attr_accessor :payment_frequency_interval
|
40
41
|
|
42
|
+
# Timestamp of the last payment. Indicates the start of current billing period
|
43
|
+
sig { returns(Time) }
|
44
|
+
attr_accessor :previous_billing_date
|
45
|
+
|
41
46
|
# Identifier of the product associated with this subscription
|
42
47
|
sig { returns(String) }
|
43
48
|
attr_accessor :product_id
|
@@ -92,6 +97,7 @@ module Dodopayments
|
|
92
97
|
next_billing_date: Time,
|
93
98
|
payment_frequency_count: Integer,
|
94
99
|
payment_frequency_interval: Dodopayments::Models::TimeInterval::OrSymbol,
|
100
|
+
previous_billing_date: Time,
|
95
101
|
product_id: String,
|
96
102
|
quantity: Integer,
|
97
103
|
recurring_pre_tax_amount: Integer,
|
@@ -115,6 +121,7 @@ module Dodopayments
|
|
115
121
|
next_billing_date:,
|
116
122
|
payment_frequency_count:,
|
117
123
|
payment_frequency_interval:,
|
124
|
+
previous_billing_date:,
|
118
125
|
product_id:,
|
119
126
|
quantity:,
|
120
127
|
recurring_pre_tax_amount:,
|
@@ -139,6 +146,7 @@ module Dodopayments
|
|
139
146
|
next_billing_date: Time,
|
140
147
|
payment_frequency_count: Integer,
|
141
148
|
payment_frequency_interval: Dodopayments::Models::TimeInterval::TaggedSymbol,
|
149
|
+
previous_billing_date: Time,
|
142
150
|
product_id: String,
|
143
151
|
quantity: Integer,
|
144
152
|
recurring_pre_tax_amount: Integer,
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# typed: strong
|
2
|
+
|
3
|
+
module Dodopayments
|
4
|
+
module Models
|
5
|
+
class SubscriptionChangePlanParams < Dodopayments::Internal::Type::BaseModel
|
6
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
7
|
+
include Dodopayments::Internal::Type::RequestParameters
|
8
|
+
|
9
|
+
# Unique identifier of the product to subscribe to
|
10
|
+
sig { returns(String) }
|
11
|
+
attr_accessor :product_id
|
12
|
+
|
13
|
+
sig { returns(Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol) }
|
14
|
+
attr_accessor :proration_billing_mode
|
15
|
+
|
16
|
+
# Number of units to subscribe for. Must be at least 1.
|
17
|
+
sig { returns(Integer) }
|
18
|
+
attr_accessor :quantity
|
19
|
+
|
20
|
+
sig do
|
21
|
+
params(
|
22
|
+
product_id: String,
|
23
|
+
proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol,
|
24
|
+
quantity: Integer,
|
25
|
+
request_options: T.any(Dodopayments::RequestOptions, Dodopayments::Internal::AnyHash)
|
26
|
+
)
|
27
|
+
.returns(T.attached_class)
|
28
|
+
end
|
29
|
+
def self.new(product_id:, proration_billing_mode:, quantity:, request_options: {}); end
|
30
|
+
|
31
|
+
sig do
|
32
|
+
override
|
33
|
+
.returns(
|
34
|
+
{
|
35
|
+
product_id: String,
|
36
|
+
proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol,
|
37
|
+
quantity: Integer,
|
38
|
+
request_options: Dodopayments::RequestOptions
|
39
|
+
}
|
40
|
+
)
|
41
|
+
end
|
42
|
+
def to_hash; end
|
43
|
+
|
44
|
+
module ProrationBillingMode
|
45
|
+
extend Dodopayments::Internal::Type::Enum
|
46
|
+
|
47
|
+
TaggedSymbol =
|
48
|
+
T.type_alias { T.all(Symbol, Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode) }
|
49
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
50
|
+
|
51
|
+
PRORATED_IMMEDIATELY =
|
52
|
+
T.let(
|
53
|
+
:prorated_immediately,
|
54
|
+
Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::TaggedSymbol
|
55
|
+
)
|
56
|
+
|
57
|
+
sig do
|
58
|
+
override
|
59
|
+
.returns(T::Array[Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::TaggedSymbol])
|
60
|
+
end
|
61
|
+
def self.values; end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -121,6 +121,26 @@ module Dodopayments
|
|
121
121
|
status: nil,
|
122
122
|
request_options: {}
|
123
123
|
); end
|
124
|
+
sig do
|
125
|
+
params(
|
126
|
+
subscription_id: String,
|
127
|
+
product_id: String,
|
128
|
+
proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::ProrationBillingMode::OrSymbol,
|
129
|
+
quantity: Integer,
|
130
|
+
request_options: T.nilable(T.any(Dodopayments::RequestOptions, Dodopayments::Internal::AnyHash))
|
131
|
+
)
|
132
|
+
.void
|
133
|
+
end
|
134
|
+
def change_plan(
|
135
|
+
# Subscription Id
|
136
|
+
subscription_id,
|
137
|
+
# Unique identifier of the product to subscribe to
|
138
|
+
product_id:,
|
139
|
+
proration_billing_mode:,
|
140
|
+
# Number of units to subscribe for. Must be at least 1.
|
141
|
+
quantity:,
|
142
|
+
request_options: {}
|
143
|
+
); end
|
124
144
|
sig do
|
125
145
|
params(
|
126
146
|
subscription_id: String,
|
@@ -10,6 +10,7 @@ module Dodopayments
|
|
10
10
|
next_billing_date: Time,
|
11
11
|
payment_frequency_count: Integer,
|
12
12
|
payment_frequency_interval: Dodopayments::Models::time_interval,
|
13
|
+
previous_billing_date: Time,
|
13
14
|
product_id: String,
|
14
15
|
quantity: Integer,
|
15
16
|
recurring_pre_tax_amount: Integer,
|
@@ -40,6 +41,8 @@ module Dodopayments
|
|
40
41
|
|
41
42
|
attr_accessor payment_frequency_interval: Dodopayments::Models::time_interval
|
42
43
|
|
44
|
+
attr_accessor previous_billing_date: Time
|
45
|
+
|
43
46
|
attr_accessor product_id: String
|
44
47
|
|
45
48
|
attr_accessor quantity: Integer
|
@@ -71,6 +74,7 @@ module Dodopayments
|
|
71
74
|
next_billing_date: Time,
|
72
75
|
payment_frequency_count: Integer,
|
73
76
|
payment_frequency_interval: Dodopayments::Models::time_interval,
|
77
|
+
previous_billing_date: Time,
|
74
78
|
product_id: String,
|
75
79
|
quantity: Integer,
|
76
80
|
recurring_pre_tax_amount: Integer,
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Dodopayments
|
2
|
+
module Models
|
3
|
+
type subscription_change_plan_params =
|
4
|
+
{
|
5
|
+
product_id: String,
|
6
|
+
proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::proration_billing_mode,
|
7
|
+
quantity: Integer
|
8
|
+
}
|
9
|
+
& Dodopayments::Internal::Type::request_parameters
|
10
|
+
|
11
|
+
class SubscriptionChangePlanParams < Dodopayments::Internal::Type::BaseModel
|
12
|
+
extend Dodopayments::Internal::Type::RequestParameters::Converter
|
13
|
+
include Dodopayments::Internal::Type::RequestParameters
|
14
|
+
|
15
|
+
attr_accessor product_id: String
|
16
|
+
|
17
|
+
attr_accessor proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::proration_billing_mode
|
18
|
+
|
19
|
+
attr_accessor quantity: Integer
|
20
|
+
|
21
|
+
def initialize: (
|
22
|
+
product_id: String,
|
23
|
+
proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::proration_billing_mode,
|
24
|
+
quantity: Integer,
|
25
|
+
?request_options: Dodopayments::request_opts
|
26
|
+
) -> void
|
27
|
+
|
28
|
+
def to_hash: -> Dodopayments::Models::subscription_change_plan_params
|
29
|
+
|
30
|
+
type proration_billing_mode = :prorated_immediately
|
31
|
+
|
32
|
+
module ProrationBillingMode
|
33
|
+
extend Dodopayments::Internal::Type::Enum
|
34
|
+
|
35
|
+
PRORATED_IMMEDIATELY: :prorated_immediately
|
36
|
+
|
37
|
+
def self?.values: -> ::Array[Dodopayments::Models::SubscriptionChangePlanParams::proration_billing_mode]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -43,6 +43,14 @@ module Dodopayments
|
|
43
43
|
?request_options: Dodopayments::request_opts
|
44
44
|
) -> Dodopayments::Internal::DefaultPageNumberPagination[Dodopayments::Models::Subscription]
|
45
45
|
|
46
|
+
def change_plan: (
|
47
|
+
String subscription_id,
|
48
|
+
product_id: String,
|
49
|
+
proration_billing_mode: Dodopayments::Models::SubscriptionChangePlanParams::proration_billing_mode,
|
50
|
+
quantity: Integer,
|
51
|
+
?request_options: Dodopayments::request_opts
|
52
|
+
) -> nil
|
53
|
+
|
46
54
|
def charge: (
|
47
55
|
String subscription_id,
|
48
56
|
product_price: Integer,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dodopayments
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dodo Payments
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-04-
|
11
|
+
date: 2025-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: connection_pool
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/dodopayments/models/refund_retrieve_params.rb
|
124
124
|
- lib/dodopayments/models/refund_status.rb
|
125
125
|
- lib/dodopayments/models/subscription.rb
|
126
|
+
- lib/dodopayments/models/subscription_change_plan_params.rb
|
126
127
|
- lib/dodopayments/models/subscription_charge_params.rb
|
127
128
|
- lib/dodopayments/models/subscription_charge_response.rb
|
128
129
|
- lib/dodopayments/models/subscription_create_params.rb
|
@@ -242,6 +243,7 @@ files:
|
|
242
243
|
- rbi/lib/dodopayments/models/refund_retrieve_params.rbi
|
243
244
|
- rbi/lib/dodopayments/models/refund_status.rbi
|
244
245
|
- rbi/lib/dodopayments/models/subscription.rbi
|
246
|
+
- rbi/lib/dodopayments/models/subscription_change_plan_params.rbi
|
245
247
|
- rbi/lib/dodopayments/models/subscription_charge_params.rbi
|
246
248
|
- rbi/lib/dodopayments/models/subscription_charge_response.rbi
|
247
249
|
- rbi/lib/dodopayments/models/subscription_create_params.rbi
|
@@ -360,6 +362,7 @@ files:
|
|
360
362
|
- sig/dodopayments/models/refund_retrieve_params.rbs
|
361
363
|
- sig/dodopayments/models/refund_status.rbs
|
362
364
|
- sig/dodopayments/models/subscription.rbs
|
365
|
+
- sig/dodopayments/models/subscription_change_plan_params.rbs
|
363
366
|
- sig/dodopayments/models/subscription_charge_params.rbs
|
364
367
|
- sig/dodopayments/models/subscription_charge_response.rbs
|
365
368
|
- sig/dodopayments/models/subscription_create_params.rbs
|