dodopayments 1.52.4 → 1.53.2

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.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/models/customers/customer_wallet.rb +43 -0
  5. data/lib/dodopayments/models/customers/wallet_list_params.rb +16 -0
  6. data/lib/dodopayments/models/customers/wallet_list_response.rb +26 -0
  7. data/lib/dodopayments/models/customers/wallets/customer_wallet_transaction.rb +102 -0
  8. data/lib/dodopayments/models/customers/wallets/ledger_entry_create_params.rb +67 -0
  9. data/lib/dodopayments/models/customers/wallets/ledger_entry_list_params.rb +40 -0
  10. data/lib/dodopayments/models/license_activate_response.rb +87 -0
  11. data/lib/dodopayments/models/meter_aggregation.rb +0 -1
  12. data/lib/dodopayments/models/payment.rb +88 -4
  13. data/lib/dodopayments/models/refund.rb +9 -1
  14. data/lib/dodopayments/models/refund_list_response.rb +81 -0
  15. data/lib/dodopayments/models/subscription.rb +57 -1
  16. data/lib/dodopayments/models/subscription_charge_params.rb +32 -1
  17. data/lib/dodopayments/resources/customers/wallets/ledger_entries.rb +75 -0
  18. data/lib/dodopayments/resources/customers/wallets.rb +38 -0
  19. data/lib/dodopayments/resources/customers.rb +4 -0
  20. data/lib/dodopayments/resources/licenses.rb +2 -2
  21. data/lib/dodopayments/resources/refunds.rb +2 -2
  22. data/lib/dodopayments/resources/subscriptions.rb +3 -1
  23. data/lib/dodopayments/version.rb +1 -1
  24. data/lib/dodopayments.rb +10 -0
  25. data/rbi/dodopayments/models/customers/customer_wallet.rbi +66 -0
  26. data/rbi/dodopayments/models/customers/wallet_list_params.rbi +34 -0
  27. data/rbi/dodopayments/models/customers/wallet_list_response.rbi +48 -0
  28. data/rbi/dodopayments/models/customers/wallets/customer_wallet_transaction.rbi +173 -0
  29. data/rbi/dodopayments/models/customers/wallets/ledger_entry_create_params.rbi +119 -0
  30. data/rbi/dodopayments/models/customers/wallets/ledger_entry_list_params.rbi +71 -0
  31. data/rbi/dodopayments/models/license_activate_response.rbi +140 -0
  32. data/rbi/dodopayments/models/meter_aggregation.rbi +0 -5
  33. data/rbi/dodopayments/models/payment.rbi +112 -3
  34. data/rbi/dodopayments/models/refund.rbi +13 -0
  35. data/rbi/dodopayments/models/refund_list_response.rbi +104 -0
  36. data/rbi/dodopayments/models/subscription.rbi +78 -0
  37. data/rbi/dodopayments/models/subscription_charge_params.rbi +74 -0
  38. data/rbi/dodopayments/resources/customers/wallets/ledger_entries.rbi +67 -0
  39. data/rbi/dodopayments/resources/customers/wallets.rbi +32 -0
  40. data/rbi/dodopayments/resources/customers.rbi +3 -0
  41. data/rbi/dodopayments/resources/licenses.rbi +1 -1
  42. data/rbi/dodopayments/resources/refunds.rbi +1 -1
  43. data/rbi/dodopayments/resources/subscriptions.rbi +6 -0
  44. data/sig/dodopayments/models/customers/customer_wallet.rbs +44 -0
  45. data/sig/dodopayments/models/customers/wallet_list_params.rbs +17 -0
  46. data/sig/dodopayments/models/customers/wallet_list_response.rbs +27 -0
  47. data/sig/dodopayments/models/customers/wallets/customer_wallet_transaction.rbs +102 -0
  48. data/sig/dodopayments/models/customers/wallets/ledger_entry_create_params.rbs +61 -0
  49. data/sig/dodopayments/models/customers/wallets/ledger_entry_list_params.rbs +48 -0
  50. data/sig/dodopayments/models/license_activate_response.rbs +62 -0
  51. data/sig/dodopayments/models/meter_aggregation.rbs +1 -2
  52. data/sig/dodopayments/models/payment.rbs +66 -4
  53. data/sig/dodopayments/models/refund.rbs +5 -0
  54. data/sig/dodopayments/models/refund_list_response.rbs +60 -0
  55. data/sig/dodopayments/models/subscription.rbs +52 -0
  56. data/sig/dodopayments/models/subscription_charge_params.rbs +27 -0
  57. data/sig/dodopayments/resources/customers/wallets/ledger_entries.rbs +29 -0
  58. data/sig/dodopayments/resources/customers/wallets.rbs +16 -0
  59. data/sig/dodopayments/resources/customers.rbs +2 -0
  60. data/sig/dodopayments/resources/licenses.rbs +1 -1
  61. data/sig/dodopayments/resources/refunds.rbs +1 -1
  62. data/sig/dodopayments/resources/subscriptions.rbs +1 -0
  63. metadata +32 -2
@@ -0,0 +1,173 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ module Wallets
7
+ class CustomerWalletTransaction < Dodopayments::Internal::Type::BaseModel
8
+ OrHash =
9
+ T.type_alias do
10
+ T.any(
11
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction,
12
+ Dodopayments::Internal::AnyHash
13
+ )
14
+ end
15
+
16
+ sig { returns(String) }
17
+ attr_accessor :id
18
+
19
+ sig { returns(Integer) }
20
+ attr_accessor :after_balance
21
+
22
+ sig { returns(Integer) }
23
+ attr_accessor :amount
24
+
25
+ sig { returns(Integer) }
26
+ attr_accessor :before_balance
27
+
28
+ sig { returns(String) }
29
+ attr_accessor :business_id
30
+
31
+ sig { returns(Time) }
32
+ attr_accessor :created_at
33
+
34
+ sig { returns(Dodopayments::Currency::TaggedSymbol) }
35
+ attr_accessor :currency
36
+
37
+ sig { returns(String) }
38
+ attr_accessor :customer_id
39
+
40
+ sig do
41
+ returns(
42
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
43
+ )
44
+ end
45
+ attr_accessor :event_type
46
+
47
+ sig { returns(T::Boolean) }
48
+ attr_accessor :is_credit
49
+
50
+ sig { returns(T.nilable(String)) }
51
+ attr_accessor :reason
52
+
53
+ sig { returns(T.nilable(String)) }
54
+ attr_accessor :reference_object_id
55
+
56
+ sig do
57
+ params(
58
+ id: String,
59
+ after_balance: Integer,
60
+ amount: Integer,
61
+ before_balance: Integer,
62
+ business_id: String,
63
+ created_at: Time,
64
+ currency: Dodopayments::Currency::OrSymbol,
65
+ customer_id: String,
66
+ event_type:
67
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::OrSymbol,
68
+ is_credit: T::Boolean,
69
+ reason: T.nilable(String),
70
+ reference_object_id: T.nilable(String)
71
+ ).returns(T.attached_class)
72
+ end
73
+ def self.new(
74
+ id:,
75
+ after_balance:,
76
+ amount:,
77
+ before_balance:,
78
+ business_id:,
79
+ created_at:,
80
+ currency:,
81
+ customer_id:,
82
+ event_type:,
83
+ is_credit:,
84
+ reason: nil,
85
+ reference_object_id: nil
86
+ )
87
+ end
88
+
89
+ sig do
90
+ override.returns(
91
+ {
92
+ id: String,
93
+ after_balance: Integer,
94
+ amount: Integer,
95
+ before_balance: Integer,
96
+ business_id: String,
97
+ created_at: Time,
98
+ currency: Dodopayments::Currency::TaggedSymbol,
99
+ customer_id: String,
100
+ event_type:
101
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol,
102
+ is_credit: T::Boolean,
103
+ reason: T.nilable(String),
104
+ reference_object_id: T.nilable(String)
105
+ }
106
+ )
107
+ end
108
+ def to_hash
109
+ end
110
+
111
+ module EventType
112
+ extend Dodopayments::Internal::Type::Enum
113
+
114
+ TaggedSymbol =
115
+ T.type_alias do
116
+ T.all(
117
+ Symbol,
118
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType
119
+ )
120
+ end
121
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
122
+
123
+ PAYMENT =
124
+ T.let(
125
+ :payment,
126
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
127
+ )
128
+ PAYMENT_REVERSAL =
129
+ T.let(
130
+ :payment_reversal,
131
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
132
+ )
133
+ REFUND =
134
+ T.let(
135
+ :refund,
136
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
137
+ )
138
+ REFUND_REVERSAL =
139
+ T.let(
140
+ :refund_reversal,
141
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
142
+ )
143
+ DISPUTE =
144
+ T.let(
145
+ :dispute,
146
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
147
+ )
148
+ DISPUTE_REVERSAL =
149
+ T.let(
150
+ :dispute_reversal,
151
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
152
+ )
153
+ MERCHANT_ADJUSTMENT =
154
+ T.let(
155
+ :merchant_adjustment,
156
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
157
+ )
158
+
159
+ sig do
160
+ override.returns(
161
+ T::Array[
162
+ Dodopayments::Customers::Wallets::CustomerWalletTransaction::EventType::TaggedSymbol
163
+ ]
164
+ )
165
+ end
166
+ def self.values
167
+ end
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
@@ -0,0 +1,119 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ module Wallets
7
+ class LedgerEntryCreateParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ OrHash =
12
+ T.type_alias do
13
+ T.any(
14
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams,
15
+ Dodopayments::Internal::AnyHash
16
+ )
17
+ end
18
+
19
+ sig { returns(Integer) }
20
+ attr_accessor :amount
21
+
22
+ # Currency of the wallet to adjust
23
+ sig { returns(Dodopayments::Currency::OrSymbol) }
24
+ attr_accessor :currency
25
+
26
+ # Type of ledger entry - credit or debit
27
+ sig do
28
+ returns(
29
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType::OrSymbol
30
+ )
31
+ end
32
+ attr_accessor :entry_type
33
+
34
+ # Optional idempotency key to prevent duplicate entries
35
+ sig { returns(T.nilable(String)) }
36
+ attr_accessor :idempotency_key
37
+
38
+ sig { returns(T.nilable(String)) }
39
+ attr_accessor :reason
40
+
41
+ sig do
42
+ params(
43
+ amount: Integer,
44
+ currency: Dodopayments::Currency::OrSymbol,
45
+ entry_type:
46
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType::OrSymbol,
47
+ idempotency_key: T.nilable(String),
48
+ reason: T.nilable(String),
49
+ request_options: Dodopayments::RequestOptions::OrHash
50
+ ).returns(T.attached_class)
51
+ end
52
+ def self.new(
53
+ amount:,
54
+ # Currency of the wallet to adjust
55
+ currency:,
56
+ # Type of ledger entry - credit or debit
57
+ entry_type:,
58
+ # Optional idempotency key to prevent duplicate entries
59
+ idempotency_key: nil,
60
+ reason: nil,
61
+ request_options: {}
62
+ )
63
+ end
64
+
65
+ sig do
66
+ override.returns(
67
+ {
68
+ amount: Integer,
69
+ currency: Dodopayments::Currency::OrSymbol,
70
+ entry_type:
71
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType::OrSymbol,
72
+ idempotency_key: T.nilable(String),
73
+ reason: T.nilable(String),
74
+ request_options: Dodopayments::RequestOptions
75
+ }
76
+ )
77
+ end
78
+ def to_hash
79
+ end
80
+
81
+ # Type of ledger entry - credit or debit
82
+ module EntryType
83
+ extend Dodopayments::Internal::Type::Enum
84
+
85
+ TaggedSymbol =
86
+ T.type_alias do
87
+ T.all(
88
+ Symbol,
89
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType
90
+ )
91
+ end
92
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
93
+
94
+ CREDIT =
95
+ T.let(
96
+ :credit,
97
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType::TaggedSymbol
98
+ )
99
+ DEBIT =
100
+ T.let(
101
+ :debit,
102
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType::TaggedSymbol
103
+ )
104
+
105
+ sig do
106
+ override.returns(
107
+ T::Array[
108
+ Dodopayments::Customers::Wallets::LedgerEntryCreateParams::EntryType::TaggedSymbol
109
+ ]
110
+ )
111
+ end
112
+ def self.values
113
+ end
114
+ end
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -0,0 +1,71 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ module Wallets
7
+ class LedgerEntryListParams < Dodopayments::Internal::Type::BaseModel
8
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
9
+ include Dodopayments::Internal::Type::RequestParameters
10
+
11
+ OrHash =
12
+ T.type_alias do
13
+ T.any(
14
+ Dodopayments::Customers::Wallets::LedgerEntryListParams,
15
+ Dodopayments::Internal::AnyHash
16
+ )
17
+ end
18
+
19
+ # Optional currency filter
20
+ sig { returns(T.nilable(Dodopayments::Currency::OrSymbol)) }
21
+ attr_reader :currency
22
+
23
+ sig { params(currency: Dodopayments::Currency::OrSymbol).void }
24
+ attr_writer :currency
25
+
26
+ sig { returns(T.nilable(Integer)) }
27
+ attr_reader :page_number
28
+
29
+ sig { params(page_number: Integer).void }
30
+ attr_writer :page_number
31
+
32
+ sig { returns(T.nilable(Integer)) }
33
+ attr_reader :page_size
34
+
35
+ sig { params(page_size: Integer).void }
36
+ attr_writer :page_size
37
+
38
+ sig do
39
+ params(
40
+ currency: Dodopayments::Currency::OrSymbol,
41
+ page_number: Integer,
42
+ page_size: Integer,
43
+ request_options: Dodopayments::RequestOptions::OrHash
44
+ ).returns(T.attached_class)
45
+ end
46
+ def self.new(
47
+ # Optional currency filter
48
+ currency: nil,
49
+ page_number: nil,
50
+ page_size: nil,
51
+ request_options: {}
52
+ )
53
+ end
54
+
55
+ sig do
56
+ override.returns(
57
+ {
58
+ currency: Dodopayments::Currency::OrSymbol,
59
+ page_number: Integer,
60
+ page_size: Integer,
61
+ request_options: Dodopayments::RequestOptions
62
+ }
63
+ )
64
+ end
65
+ def to_hash
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,140 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ class LicenseActivateResponse < Dodopayments::Internal::Type::BaseModel
6
+ OrHash =
7
+ T.type_alias do
8
+ T.any(
9
+ Dodopayments::Models::LicenseActivateResponse,
10
+ Dodopayments::Internal::AnyHash
11
+ )
12
+ end
13
+
14
+ # License key instance ID
15
+ sig { returns(String) }
16
+ attr_accessor :id
17
+
18
+ # Business ID
19
+ sig { returns(String) }
20
+ attr_accessor :business_id
21
+
22
+ # Creation timestamp
23
+ sig { returns(Time) }
24
+ attr_accessor :created_at
25
+
26
+ # Limited customer details associated with the license key.
27
+ sig { returns(Dodopayments::CustomerLimitedDetails) }
28
+ attr_reader :customer
29
+
30
+ sig do
31
+ params(customer: Dodopayments::CustomerLimitedDetails::OrHash).void
32
+ end
33
+ attr_writer :customer
34
+
35
+ # Associated license key ID
36
+ sig { returns(String) }
37
+ attr_accessor :license_key_id
38
+
39
+ # Instance name
40
+ sig { returns(String) }
41
+ attr_accessor :name
42
+
43
+ # Related product info. Present if the license key is tied to a product.
44
+ sig { returns(Dodopayments::Models::LicenseActivateResponse::Product) }
45
+ attr_reader :product
46
+
47
+ sig do
48
+ params(
49
+ product:
50
+ Dodopayments::Models::LicenseActivateResponse::Product::OrHash
51
+ ).void
52
+ end
53
+ attr_writer :product
54
+
55
+ sig do
56
+ params(
57
+ id: String,
58
+ business_id: String,
59
+ created_at: Time,
60
+ customer: Dodopayments::CustomerLimitedDetails::OrHash,
61
+ license_key_id: String,
62
+ name: String,
63
+ product:
64
+ Dodopayments::Models::LicenseActivateResponse::Product::OrHash
65
+ ).returns(T.attached_class)
66
+ end
67
+ def self.new(
68
+ # License key instance ID
69
+ id:,
70
+ # Business ID
71
+ business_id:,
72
+ # Creation timestamp
73
+ created_at:,
74
+ # Limited customer details associated with the license key.
75
+ customer:,
76
+ # Associated license key ID
77
+ license_key_id:,
78
+ # Instance name
79
+ name:,
80
+ # Related product info. Present if the license key is tied to a product.
81
+ product:
82
+ )
83
+ end
84
+
85
+ sig do
86
+ override.returns(
87
+ {
88
+ id: String,
89
+ business_id: String,
90
+ created_at: Time,
91
+ customer: Dodopayments::CustomerLimitedDetails,
92
+ license_key_id: String,
93
+ name: String,
94
+ product: Dodopayments::Models::LicenseActivateResponse::Product
95
+ }
96
+ )
97
+ end
98
+ def to_hash
99
+ end
100
+
101
+ class Product < Dodopayments::Internal::Type::BaseModel
102
+ OrHash =
103
+ T.type_alias do
104
+ T.any(
105
+ Dodopayments::Models::LicenseActivateResponse::Product,
106
+ Dodopayments::Internal::AnyHash
107
+ )
108
+ end
109
+
110
+ # Unique identifier for the product.
111
+ sig { returns(String) }
112
+ attr_accessor :product_id
113
+
114
+ # Name of the product, if set by the merchant.
115
+ sig { returns(T.nilable(String)) }
116
+ attr_accessor :name
117
+
118
+ # Related product info. Present if the license key is tied to a product.
119
+ sig do
120
+ params(product_id: String, name: T.nilable(String)).returns(
121
+ T.attached_class
122
+ )
123
+ end
124
+ def self.new(
125
+ # Unique identifier for the product.
126
+ product_id:,
127
+ # Name of the product, if set by the merchant.
128
+ name: nil
129
+ )
130
+ end
131
+
132
+ sig do
133
+ override.returns({ product_id: String, name: T.nilable(String) })
134
+ end
135
+ def to_hash
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
@@ -52,11 +52,6 @@ module Dodopayments
52
52
  COUNT =
53
53
  T.let(:count, Dodopayments::MeterAggregation::Type::TaggedSymbol)
54
54
  SUM = T.let(:sum, Dodopayments::MeterAggregation::Type::TaggedSymbol)
55
- UNIQUE_COUNT =
56
- T.let(
57
- :unique_count,
58
- Dodopayments::MeterAggregation::Type::TaggedSymbol
59
- )
60
55
  MAX = T.let(:max, Dodopayments::MeterAggregation::Type::TaggedSymbol)
61
56
  LAST = T.let(:last, Dodopayments::MeterAggregation::Type::TaggedSymbol)
62
57
 
@@ -57,7 +57,7 @@ module Dodopayments
57
57
  attr_accessor :payment_id
58
58
 
59
59
  # List of refunds issued for this payment
60
- sig { returns(T::Array[Dodopayments::Refund]) }
60
+ sig { returns(T::Array[Dodopayments::Payment::Refund]) }
61
61
  attr_accessor :refunds
62
62
 
63
63
  # The amount that will be credited to your Dodo balance after currency conversion
@@ -93,6 +93,11 @@ module Dodopayments
93
93
  sig { returns(T.nilable(String)) }
94
94
  attr_accessor :card_type
95
95
 
96
+ # If payment is made using a checkout session, this field is set to the id of the
97
+ # session.
98
+ sig { returns(T.nilable(String)) }
99
+ attr_accessor :checkout_session_id
100
+
96
101
  # The discount id if discount is applied
97
102
  sig { returns(T.nilable(String)) }
98
103
  attr_accessor :discount_id
@@ -155,7 +160,7 @@ module Dodopayments
155
160
  disputes: T::Array[Dodopayments::Dispute::OrHash],
156
161
  metadata: T::Hash[Symbol, String],
157
162
  payment_id: String,
158
- refunds: T::Array[Dodopayments::Refund::OrHash],
163
+ refunds: T::Array[Dodopayments::Payment::Refund::OrHash],
159
164
  settlement_amount: Integer,
160
165
  settlement_currency: Dodopayments::Currency::OrSymbol,
161
166
  total_amount: Integer,
@@ -163,6 +168,7 @@ module Dodopayments
163
168
  card_last_four: T.nilable(String),
164
169
  card_network: T.nilable(String),
165
170
  card_type: T.nilable(String),
171
+ checkout_session_id: T.nilable(String),
166
172
  discount_id: T.nilable(String),
167
173
  error_code: T.nilable(String),
168
174
  error_message: T.nilable(String),
@@ -220,6 +226,9 @@ module Dodopayments
220
226
  card_network: nil,
221
227
  # The type of card DEBIT or CREDIT
222
228
  card_type: nil,
229
+ # If payment is made using a checkout session, this field is set to the id of the
230
+ # session.
231
+ checkout_session_id: nil,
223
232
  # The discount id if discount is applied
224
233
  discount_id: nil,
225
234
  # An error code if the payment failed
@@ -262,7 +271,7 @@ module Dodopayments
262
271
  disputes: T::Array[Dodopayments::Dispute],
263
272
  metadata: T::Hash[Symbol, String],
264
273
  payment_id: String,
265
- refunds: T::Array[Dodopayments::Refund],
274
+ refunds: T::Array[Dodopayments::Payment::Refund],
266
275
  settlement_amount: Integer,
267
276
  settlement_currency: Dodopayments::Currency::TaggedSymbol,
268
277
  total_amount: Integer,
@@ -271,6 +280,7 @@ module Dodopayments
271
280
  card_last_four: T.nilable(String),
272
281
  card_network: T.nilable(String),
273
282
  card_type: T.nilable(String),
283
+ checkout_session_id: T.nilable(String),
274
284
  discount_id: T.nilable(String),
275
285
  error_code: T.nilable(String),
276
286
  error_message: T.nilable(String),
@@ -290,6 +300,105 @@ module Dodopayments
290
300
  def to_hash
291
301
  end
292
302
 
303
+ class Refund < Dodopayments::Internal::Type::BaseModel
304
+ OrHash =
305
+ T.type_alias do
306
+ T.any(
307
+ Dodopayments::Payment::Refund,
308
+ Dodopayments::Internal::AnyHash
309
+ )
310
+ end
311
+
312
+ # The unique identifier of the business issuing the refund.
313
+ sig { returns(String) }
314
+ attr_accessor :business_id
315
+
316
+ # The timestamp of when the refund was created in UTC.
317
+ sig { returns(Time) }
318
+ attr_accessor :created_at
319
+
320
+ # If true the refund is a partial refund
321
+ sig { returns(T::Boolean) }
322
+ attr_accessor :is_partial
323
+
324
+ # The unique identifier of the payment associated with the refund.
325
+ sig { returns(String) }
326
+ attr_accessor :payment_id
327
+
328
+ # The unique identifier of the refund.
329
+ sig { returns(String) }
330
+ attr_accessor :refund_id
331
+
332
+ # The current status of the refund.
333
+ sig { returns(Dodopayments::RefundStatus::TaggedSymbol) }
334
+ attr_accessor :status
335
+
336
+ # The refunded amount.
337
+ sig { returns(T.nilable(Integer)) }
338
+ attr_accessor :amount
339
+
340
+ # The currency of the refund, represented as an ISO 4217 currency code.
341
+ sig { returns(T.nilable(Dodopayments::Currency::TaggedSymbol)) }
342
+ attr_accessor :currency
343
+
344
+ # The reason provided for the refund, if any. Optional.
345
+ sig { returns(T.nilable(String)) }
346
+ attr_accessor :reason
347
+
348
+ sig do
349
+ params(
350
+ business_id: String,
351
+ created_at: Time,
352
+ is_partial: T::Boolean,
353
+ payment_id: String,
354
+ refund_id: String,
355
+ status: Dodopayments::RefundStatus::OrSymbol,
356
+ amount: T.nilable(Integer),
357
+ currency: T.nilable(Dodopayments::Currency::OrSymbol),
358
+ reason: T.nilable(String)
359
+ ).returns(T.attached_class)
360
+ end
361
+ def self.new(
362
+ # The unique identifier of the business issuing the refund.
363
+ business_id:,
364
+ # The timestamp of when the refund was created in UTC.
365
+ created_at:,
366
+ # If true the refund is a partial refund
367
+ is_partial:,
368
+ # The unique identifier of the payment associated with the refund.
369
+ payment_id:,
370
+ # The unique identifier of the refund.
371
+ refund_id:,
372
+ # The current status of the refund.
373
+ status:,
374
+ # The refunded amount.
375
+ amount: nil,
376
+ # The currency of the refund, represented as an ISO 4217 currency code.
377
+ currency: nil,
378
+ # The reason provided for the refund, if any. Optional.
379
+ reason: nil
380
+ )
381
+ end
382
+
383
+ sig do
384
+ override.returns(
385
+ {
386
+ business_id: String,
387
+ created_at: Time,
388
+ is_partial: T::Boolean,
389
+ payment_id: String,
390
+ refund_id: String,
391
+ status: Dodopayments::RefundStatus::TaggedSymbol,
392
+ amount: T.nilable(Integer),
393
+ currency: T.nilable(Dodopayments::Currency::TaggedSymbol),
394
+ reason: T.nilable(String)
395
+ }
396
+ )
397
+ end
398
+ def to_hash
399
+ end
400
+ end
401
+
293
402
  class ProductCart < Dodopayments::Internal::Type::BaseModel
294
403
  OrHash =
295
404
  T.type_alias do