dodopayments 2.25.0 → 2.27.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.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/client.rb +4 -0
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +7 -1
  6. data/lib/dodopayments/models/blocklist/block_by_customer_id.rb +18 -0
  7. data/lib/dodopayments/models/blocklist/block_by_email.rb +18 -0
  8. data/lib/dodopayments/models/blocklist/block_identifier.rb +21 -0
  9. data/lib/dodopayments/models/blocklist/blocked_customer.rb +128 -0
  10. data/lib/dodopayments/models/blocklist/blocked_customer_source.rb +22 -0
  11. data/lib/dodopayments/models/blocklist/create_blocked_customer_request.rb +66 -0
  12. data/lib/dodopayments/models/blocklist/customer_create_params.rb +16 -0
  13. data/lib/dodopayments/models/blocklist/customer_delete_params.rb +22 -0
  14. data/lib/dodopayments/models/blocklist/customer_list_params.rb +64 -0
  15. data/lib/dodopayments/models/blocklist/customer_retrieve_params.rb +22 -0
  16. data/lib/dodopayments/models/blocklist/customers/blocked_customer_note.rb +44 -0
  17. data/lib/dodopayments/models/blocklist/customers/note_create_params.rb +24 -0
  18. data/lib/dodopayments/models/blocklist/customers/note_request.rb +19 -0
  19. data/lib/dodopayments/models/blocklist/customers/note_update_params.rb +30 -0
  20. data/lib/dodopayments/models/customer.rb +22 -1
  21. data/lib/dodopayments/models/dunning_recovered_webhook_event.rb +1 -0
  22. data/lib/dodopayments/models/dunning_started_webhook_event.rb +1 -0
  23. data/lib/dodopayments/models/entitlements/license_key_grant.rb +24 -3
  24. data/lib/dodopayments/models/manual_retry.rb +76 -0
  25. data/lib/dodopayments/models/manual_retry_state.rb +50 -0
  26. data/lib/dodopayments/models/payment_retrieve_retry_state_params.rb +20 -0
  27. data/lib/dodopayments/models/payment_retry_params.rb +20 -0
  28. data/lib/dodopayments/models/price.rb +34 -30
  29. data/lib/dodopayments/models/subscription_active_webhook_event.rb +32 -4
  30. data/lib/dodopayments/models/subscription_cancelled_webhook_event.rb +33 -4
  31. data/lib/dodopayments/models/subscription_change_plan_response.rb +47 -0
  32. data/lib/dodopayments/models/subscription_expired_webhook_event.rb +32 -4
  33. data/lib/dodopayments/models/subscription_failed_webhook_event.rb +32 -4
  34. data/lib/dodopayments/models/subscription_list_params.rb +1 -0
  35. data/lib/dodopayments/models/subscription_on_hold_webhook_event.rb +32 -4
  36. data/lib/dodopayments/models/subscription_past_due_webhook_event.rb +68 -0
  37. data/lib/dodopayments/models/subscription_paused_webhook_event.rb +32 -4
  38. data/lib/dodopayments/models/subscription_plan_changed_webhook_event.rb +33 -4
  39. data/lib/dodopayments/models/subscription_renewed_webhook_event.rb +32 -4
  40. data/lib/dodopayments/models/subscription_status.rb +1 -0
  41. data/lib/dodopayments/models/subscription_unpaused_webhook_event.rb +32 -4
  42. data/lib/dodopayments/models/subscription_update_params.rb +17 -4
  43. data/lib/dodopayments/models/subscription_update_payment_method_webhook_event.rb +34 -4
  44. data/lib/dodopayments/models/subscription_updated_webhook_event.rb +32 -4
  45. data/lib/dodopayments/models/unsafe_unwrap_webhook_event.rb +3 -1
  46. data/lib/dodopayments/models/unwrap_webhook_event.rb +3 -1
  47. data/lib/dodopayments/models/update_subscription_plan_req.rb +35 -1
  48. data/lib/dodopayments/models/webhook_event_type.rb +1 -0
  49. data/lib/dodopayments/models/webhook_payload.rb +19 -1
  50. data/lib/dodopayments/models.rb +12 -0
  51. data/lib/dodopayments/resources/blocklist/customers/notes.rb +68 -0
  52. data/lib/dodopayments/resources/blocklist/customers.rb +107 -0
  53. data/lib/dodopayments/resources/blocklist.rb +18 -0
  54. data/lib/dodopayments/resources/payments.rb +36 -0
  55. data/lib/dodopayments/resources/subscriptions.rb +14 -6
  56. data/lib/dodopayments/resources/webhooks.rb +2 -2
  57. data/lib/dodopayments/version.rb +1 -1
  58. data/lib/dodopayments.rb +24 -1
  59. data/rbi/dodopayments/client.rbi +3 -0
  60. data/rbi/dodopayments/models/balance_ledger_entry.rbi +6 -0
  61. data/rbi/dodopayments/models/blocklist/block_by_customer_id.rbi +32 -0
  62. data/rbi/dodopayments/models/blocklist/block_by_email.rbi +32 -0
  63. data/rbi/dodopayments/models/blocklist/block_identifier.rbi +30 -0
  64. data/rbi/dodopayments/models/blocklist/blocked_customer.rbi +161 -0
  65. data/rbi/dodopayments/models/blocklist/blocked_customer_source.rbi +55 -0
  66. data/rbi/dodopayments/models/blocklist/create_blocked_customer_request.rbi +143 -0
  67. data/rbi/dodopayments/models/blocklist/customer_create_params.rbi +34 -0
  68. data/rbi/dodopayments/models/blocklist/customer_delete_params.rbi +40 -0
  69. data/rbi/dodopayments/models/blocklist/customer_list_params.rbi +88 -0
  70. data/rbi/dodopayments/models/blocklist/customer_retrieve_params.rbi +40 -0
  71. data/rbi/dodopayments/models/blocklist/customers/blocked_customer_note.rbi +66 -0
  72. data/rbi/dodopayments/models/blocklist/customers/note_create_params.rbi +45 -0
  73. data/rbi/dodopayments/models/blocklist/customers/note_request.rbi +30 -0
  74. data/rbi/dodopayments/models/blocklist/customers/note_update_params.rbi +50 -0
  75. data/rbi/dodopayments/models/customer.rbi +20 -0
  76. data/rbi/dodopayments/models/dunning_recovered_webhook_event.rbi +5 -0
  77. data/rbi/dodopayments/models/dunning_started_webhook_event.rbi +5 -0
  78. data/rbi/dodopayments/models/entitlements/license_key_grant.rbi +22 -2
  79. data/rbi/dodopayments/models/manual_retry.rbi +93 -0
  80. data/rbi/dodopayments/models/manual_retry_state.rbi +65 -0
  81. data/rbi/dodopayments/models/payment_retrieve_retry_state_params.rbi +38 -0
  82. data/rbi/dodopayments/models/payment_retry_params.rbi +38 -0
  83. data/rbi/dodopayments/models/price.rbi +47 -30
  84. data/rbi/dodopayments/models/subscription_active_webhook_event.rbi +53 -6
  85. data/rbi/dodopayments/models/subscription_cancelled_webhook_event.rbi +53 -6
  86. data/rbi/dodopayments/models/subscription_change_plan_response.rbi +69 -0
  87. data/rbi/dodopayments/models/subscription_expired_webhook_event.rbi +53 -6
  88. data/rbi/dodopayments/models/subscription_failed_webhook_event.rbi +53 -6
  89. data/rbi/dodopayments/models/subscription_list_params.rbi +5 -0
  90. data/rbi/dodopayments/models/subscription_on_hold_webhook_event.rbi +53 -6
  91. data/rbi/dodopayments/models/subscription_past_due_webhook_event.rbi +114 -0
  92. data/rbi/dodopayments/models/subscription_paused_webhook_event.rbi +53 -6
  93. data/rbi/dodopayments/models/subscription_plan_changed_webhook_event.rbi +53 -6
  94. data/rbi/dodopayments/models/subscription_renewed_webhook_event.rbi +53 -6
  95. data/rbi/dodopayments/models/subscription_status.rbi +2 -0
  96. data/rbi/dodopayments/models/subscription_unpaused_webhook_event.rbi +53 -6
  97. data/rbi/dodopayments/models/subscription_update_params.rbi +33 -4
  98. data/rbi/dodopayments/models/subscription_update_payment_method_webhook_event.rbi +58 -6
  99. data/rbi/dodopayments/models/subscription_updated_webhook_event.rbi +53 -6
  100. data/rbi/dodopayments/models/unsafe_unwrap_webhook_event.rbi +1 -0
  101. data/rbi/dodopayments/models/unwrap_webhook_event.rbi +1 -0
  102. data/rbi/dodopayments/models/update_subscription_plan_req.rbi +58 -0
  103. data/rbi/dodopayments/models/webhook_event_type.rbi +5 -0
  104. data/rbi/dodopayments/models/webhook_payload.rbi +37 -3
  105. data/rbi/dodopayments/models.rbi +14 -0
  106. data/rbi/dodopayments/resources/blocklist/customers/notes.rbi +50 -0
  107. data/rbi/dodopayments/resources/blocklist/customers.rbi +88 -0
  108. data/rbi/dodopayments/resources/blocklist.rbi +15 -0
  109. data/rbi/dodopayments/resources/payments.rbi +26 -0
  110. data/rbi/dodopayments/resources/subscriptions.rbi +63 -3
  111. data/rbi/dodopayments/resources/webhooks.rbi +2 -0
  112. data/sig/dodopayments/client.rbs +2 -0
  113. data/sig/dodopayments/models/balance_ledger_entry.rbs +5 -0
  114. data/sig/dodopayments/models/blocklist/block_by_customer_id.rbs +15 -0
  115. data/sig/dodopayments/models/blocklist/block_by_email.rbs +15 -0
  116. data/sig/dodopayments/models/blocklist/block_identifier.rbs +15 -0
  117. data/sig/dodopayments/models/blocklist/blocked_customer.rbs +87 -0
  118. data/sig/dodopayments/models/blocklist/blocked_customer_source.rbs +20 -0
  119. data/sig/dodopayments/models/blocklist/create_blocked_customer_request.rbs +71 -0
  120. data/sig/dodopayments/models/blocklist/customer_create_params.rbs +17 -0
  121. data/sig/dodopayments/models/blocklist/customer_delete_params.rbs +25 -0
  122. data/sig/dodopayments/models/blocklist/customer_list_params.rbs +53 -0
  123. data/sig/dodopayments/models/blocklist/customer_retrieve_params.rbs +25 -0
  124. data/sig/dodopayments/models/blocklist/customers/blocked_customer_note.rbs +44 -0
  125. data/sig/dodopayments/models/blocklist/customers/note_create_params.rbs +30 -0
  126. data/sig/dodopayments/models/blocklist/customers/note_request.rbs +17 -0
  127. data/sig/dodopayments/models/blocklist/customers/note_update_params.rbs +36 -0
  128. data/sig/dodopayments/models/customer.rbs +10 -0
  129. data/sig/dodopayments/models/dunning_recovered_webhook_event.rbs +2 -1
  130. data/sig/dodopayments/models/dunning_started_webhook_event.rbs +2 -1
  131. data/sig/dodopayments/models/entitlements/license_key_grant.rbs +10 -0
  132. data/sig/dodopayments/models/manual_retry.rbs +55 -0
  133. data/sig/dodopayments/models/manual_retry_state.rbs +40 -0
  134. data/sig/dodopayments/models/payment_retrieve_retry_state_params.rbs +23 -0
  135. data/sig/dodopayments/models/payment_retry_params.rbs +23 -0
  136. data/sig/dodopayments/models/price.rbs +21 -15
  137. data/sig/dodopayments/models/subscription_active_webhook_event.rbs +16 -4
  138. data/sig/dodopayments/models/subscription_cancelled_webhook_event.rbs +16 -4
  139. data/sig/dodopayments/models/subscription_change_plan_response.rbs +35 -0
  140. data/sig/dodopayments/models/subscription_expired_webhook_event.rbs +16 -4
  141. data/sig/dodopayments/models/subscription_failed_webhook_event.rbs +16 -4
  142. data/sig/dodopayments/models/subscription_list_params.rbs +2 -0
  143. data/sig/dodopayments/models/subscription_on_hold_webhook_event.rbs +16 -4
  144. data/sig/dodopayments/models/subscription_past_due_webhook_event.rbs +47 -0
  145. data/sig/dodopayments/models/subscription_paused_webhook_event.rbs +16 -4
  146. data/sig/dodopayments/models/subscription_plan_changed_webhook_event.rbs +16 -4
  147. data/sig/dodopayments/models/subscription_renewed_webhook_event.rbs +16 -4
  148. data/sig/dodopayments/models/subscription_status.rbs +9 -1
  149. data/sig/dodopayments/models/subscription_unpaused_webhook_event.rbs +16 -4
  150. data/sig/dodopayments/models/subscription_update_params.rbs +2 -0
  151. data/sig/dodopayments/models/subscription_update_payment_method_webhook_event.rbs +16 -4
  152. data/sig/dodopayments/models/subscription_updated_webhook_event.rbs +16 -4
  153. data/sig/dodopayments/models/unsafe_unwrap_webhook_event.rbs +1 -0
  154. data/sig/dodopayments/models/unwrap_webhook_event.rbs +1 -0
  155. data/sig/dodopayments/models/update_subscription_plan_req.rbs +14 -0
  156. data/sig/dodopayments/models/webhook_event_type.rbs +2 -0
  157. data/sig/dodopayments/models/webhook_payload.rbs +16 -4
  158. data/sig/dodopayments/models.rbs +12 -0
  159. data/sig/dodopayments/resources/blocklist/customers/notes.rbs +24 -0
  160. data/sig/dodopayments/resources/blocklist/customers.rbs +36 -0
  161. data/sig/dodopayments/resources/blocklist.rbs +9 -0
  162. data/sig/dodopayments/resources/payments.rbs +10 -0
  163. data/sig/dodopayments/resources/subscriptions.rbs +5 -1
  164. data/sig/dodopayments/resources/webhooks.rbs +2 -0
  165. metadata +71 -2
@@ -109,6 +109,7 @@ module Dodopayments
109
109
 
110
110
  ON_HOLD = :on_hold
111
111
  CANCELLED = :cancelled
112
+ PAST_DUE = :past_due
112
113
 
113
114
  # @!method self.values
114
115
  # @return [Array<Symbol>]
@@ -4,8 +4,15 @@ module Dodopayments
4
4
  module Models
5
5
  module Entitlements
6
6
  class LicenseKeyGrant < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ # Identifier of the issued license key.
9
+ #
10
+ # @return [String]
11
+ required :id, String
12
+
7
13
  # @!attribute activations_used
8
- # Number of activations consumed so far.
14
+ # Number of instances currently active. Activation increments it and deactivation
15
+ # decrements it, so it is a live count and not a total.
9
16
  #
10
17
  # @return [Integer]
11
18
  required :activations_used, Integer
@@ -16,6 +23,13 @@ module Dodopayments
16
23
  # @return [String]
17
24
  required :key, String
18
25
 
26
+ # @!attribute status
27
+ # Current status of the license key. Activation fails unless it is `active`, so a
28
+ # client can warn before the customer tries.
29
+ #
30
+ # @return [Symbol, Dodopayments::Models::LicenseKeyStatus]
31
+ required :status, enum: -> { Dodopayments::LicenseKeyStatus }
32
+
19
33
  # @!attribute activations_limit
20
34
  # Maximum activations allowed by the entitlement, when set.
21
35
  #
@@ -28,14 +42,21 @@ module Dodopayments
28
42
  # @return [Time, nil]
29
43
  optional :expires_at, Time, nil?: true
30
44
 
31
- # @!method initialize(activations_used:, key:, activations_limit: nil, expires_at: nil)
45
+ # @!method initialize(id:, activations_used:, key:, status:, activations_limit: nil, expires_at: nil)
46
+ # Some parameter documentations has been truncated, see
47
+ # {Dodopayments::Models::Entitlements::LicenseKeyGrant} for more details.
48
+ #
32
49
  # License-key delivery payload, present on grants for `license_key` entitlements.
33
50
  # The grant's top-level `status` is the source of truth for the grant's lifecycle.
34
51
  #
35
- # @param activations_used [Integer] Number of activations consumed so far.
52
+ # @param id [String] Identifier of the issued license key.
53
+ #
54
+ # @param activations_used [Integer] Number of instances currently active. Activation increments it and
36
55
  #
37
56
  # @param key [String] Issued license key.
38
57
  #
58
+ # @param status [Symbol, Dodopayments::Models::LicenseKeyStatus] Current status of the license key. Activation fails unless it is
59
+ #
39
60
  # @param activations_limit [Integer, nil] Maximum activations allowed by the entitlement, when set.
40
61
  #
41
62
  # @param expires_at [Time, nil] When the license key expires, when applicable.
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Payments#retry_
6
+ class ManualRetry < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute invoice_id
8
+ # The invoice the send charged.
9
+ #
10
+ # @return [String]
11
+ required :invoice_id, String
12
+
13
+ # @!attribute is_manual_retry
14
+ # Always true on this route. Tells the row apart from an automatic attempt.
15
+ #
16
+ # @return [Boolean]
17
+ required :is_manual_retry, Dodopayments::Internal::Type::Boolean
18
+
19
+ # @!attribute payment_id
20
+ # The payment row this send created.
21
+ #
22
+ # @return [String]
23
+ required :payment_id, String
24
+
25
+ # @!attribute retry_attempt
26
+ # Which attempt this send is, counting manual sends on the invoice.
27
+ #
28
+ # @return [Integer]
29
+ required :retry_attempt, Integer
30
+
31
+ # @!attribute sends_allowed
32
+ #
33
+ # @return [Integer]
34
+ required :sends_allowed, Integer
35
+
36
+ # @!attribute sends_used
37
+ # Manual sends spent on this invoice, including this one.
38
+ #
39
+ # @return [Integer]
40
+ required :sends_used, Integer
41
+
42
+ # @!attribute retry_available_at
43
+ # When the next send becomes available. Null when no send is left.
44
+ #
45
+ # @return [Time, nil]
46
+ optional :retry_available_at, Time, nil?: true
47
+
48
+ # @!attribute status
49
+ # Outcome of the charge. `processing` means the processor has not settled it yet,
50
+ # and the payment webhooks report the result.
51
+ #
52
+ # @return [Symbol, Dodopayments::Models::IntentStatus, nil]
53
+ optional :status, enum: -> { Dodopayments::IntentStatus }, nil?: true
54
+
55
+ # @!method initialize(invoice_id:, is_manual_retry:, payment_id:, retry_attempt:, sends_allowed:, sends_used:, retry_available_at: nil, status: nil)
56
+ # Some parameter documentations has been truncated, see
57
+ # {Dodopayments::Models::ManualRetry} for more details.
58
+ #
59
+ # @param invoice_id [String] The invoice the send charged.
60
+ #
61
+ # @param is_manual_retry [Boolean] Always true on this route. Tells the row apart from an automatic attempt.
62
+ #
63
+ # @param payment_id [String] The payment row this send created.
64
+ #
65
+ # @param retry_attempt [Integer] Which attempt this send is, counting manual sends on the invoice.
66
+ #
67
+ # @param sends_allowed [Integer]
68
+ #
69
+ # @param sends_used [Integer] Manual sends spent on this invoice, including this one.
70
+ #
71
+ # @param retry_available_at [Time, nil] When the next send becomes available. Null when no send is left.
72
+ #
73
+ # @param status [Symbol, Dodopayments::Models::IntentStatus, nil] Outcome of the charge. `processing` means the processor has not settled it
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Payments#retrieve_retry_state
6
+ class ManualRetryState < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute can_retry
8
+ #
9
+ # @return [Boolean]
10
+ required :can_retry, Dodopayments::Internal::Type::Boolean
11
+
12
+ # @!attribute sends_allowed
13
+ #
14
+ # @return [Integer]
15
+ required :sends_allowed, Integer
16
+
17
+ # @!attribute sends_used
18
+ #
19
+ # @return [Integer]
20
+ required :sends_used, Integer
21
+
22
+ # @!attribute reason
23
+ # The code `POST` would fail with. Null when `can_retry` is true.
24
+ #
25
+ # @return [String, nil]
26
+ optional :reason, String, nil?: true
27
+
28
+ # @!attribute retry_available_at
29
+ # When the next send becomes available. Null when no send is left, or when the
30
+ # block has nothing to do with the cooldown.
31
+ #
32
+ # @return [Time, nil]
33
+ optional :retry_available_at, Time, nil?: true
34
+
35
+ # @!method initialize(can_retry:, sends_allowed:, sends_used:, reason: nil, retry_available_at: nil)
36
+ # Some parameter documentations has been truncated, see
37
+ # {Dodopayments::Models::ManualRetryState} for more details.
38
+ #
39
+ # @param can_retry [Boolean]
40
+ #
41
+ # @param sends_allowed [Integer]
42
+ #
43
+ # @param sends_used [Integer]
44
+ #
45
+ # @param reason [String, nil] The code `POST` would fail with. Null when `can_retry` is true.
46
+ #
47
+ # @param retry_available_at [Time, nil] When the next send becomes available. Null when no send is left, or when
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Payments#retrieve_retry_state
6
+ class PaymentRetrieveRetryStateParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute payment_id
11
+ #
12
+ # @return [String]
13
+ required :payment_id, String
14
+
15
+ # @!method initialize(payment_id:, request_options: {})
16
+ # @param payment_id [String]
17
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Payments#retry_
6
+ class PaymentRetryParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ # @!attribute payment_id
11
+ #
12
+ # @return [String]
13
+ required :payment_id, String
14
+
15
+ # @!method initialize(payment_id:, request_options: {})
16
+ # @param payment_id [String]
17
+ # @param request_options [Dodopayments::RequestOptions, Hash{Symbol=>Object}]
18
+ end
19
+ end
20
+ end
@@ -40,13 +40,6 @@ module Dodopayments
40
40
  # @return [Integer]
41
41
  required :price, Integer
42
42
 
43
- # @!attribute purchasing_power_parity
44
- # Indicates if purchasing power parity adjustments are applied to the price.
45
- # Purchasing power parity feature is not available as of now.
46
- #
47
- # @return [Boolean]
48
- required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
49
-
50
43
  # @!attribute type
51
44
  #
52
45
  # @return [Symbol, :one_time_price]
@@ -59,6 +52,14 @@ module Dodopayments
59
52
  # @return [Boolean, nil]
60
53
  optional :pay_what_you_want, Dodopayments::Internal::Type::Boolean
61
54
 
55
+ # @!attribute purchasing_power_parity
56
+ # Opts this price in to purchasing power parity. The business must also enable
57
+ # purchasing power parity. The discount percentage per country is always
58
+ # business-wide. Defaults to `false`.
59
+ #
60
+ # @return [Boolean, nil]
61
+ optional :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
62
+
62
63
  # @!attribute suggested_price
63
64
  # A suggested price for the user to pay. This value is only considered if
64
65
  # [`pay_what_you_want`](Self::pay_what_you_want) is `true`. Otherwise, it is
@@ -73,7 +74,7 @@ module Dodopayments
73
74
  # @return [Boolean, nil]
74
75
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
75
76
 
76
- # @!method initialize(currency:, discount:, price:, purchasing_power_parity:, pay_what_you_want: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
77
+ # @!method initialize(currency:, discount:, price:, pay_what_you_want: nil, purchasing_power_parity: nil, suggested_price: nil, tax_inclusive: nil, type: :one_time_price)
77
78
  # Some parameter documentations has been truncated, see
78
79
  # {Dodopayments::Models::Price::OneTimePrice} for more details.
79
80
  #
@@ -85,10 +86,10 @@ module Dodopayments
85
86
  #
86
87
  # @param price [Integer] The payment amount, in the smallest denomination of the currency (e.g., cents fo
87
88
  #
88
- # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
89
- #
90
89
  # @param pay_what_you_want [Boolean] Indicates whether the customer can pay any amount they choose.
91
90
  #
91
+ # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
92
+ #
92
93
  # @param suggested_price [Integer, nil] A suggested price for the user to pay. This value is only considered if
93
94
  #
94
95
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive.
@@ -129,13 +130,6 @@ module Dodopayments
129
130
  # @return [Integer]
130
131
  required :price, Integer
131
132
 
132
- # @!attribute purchasing_power_parity
133
- # Indicates if purchasing power parity adjustments are applied to the price.
134
- # Purchasing power parity feature is not available as of now
135
- #
136
- # @return [Boolean]
137
- required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
138
-
139
133
  # @!attribute subscription_period_count
140
134
  # Number of units for the subscription period. For example, a value of `12` with a
141
135
  # `subscription_period_interval` of `month` represents a one-year subscription.
@@ -154,6 +148,14 @@ module Dodopayments
154
148
  # @return [Symbol, :recurring_price]
155
149
  required :type, const: :recurring_price
156
150
 
151
+ # @!attribute purchasing_power_parity
152
+ # Opts this price in to purchasing power parity. The business must also enable
153
+ # purchasing power parity. The discount percentage per country is always
154
+ # business-wide. Defaults to `false`.
155
+ #
156
+ # @return [Boolean, nil]
157
+ optional :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
158
+
157
159
  # @!attribute tax_inclusive
158
160
  # Indicates if the price is tax inclusive
159
161
  #
@@ -180,7 +182,7 @@ module Dodopayments
180
182
  # @return [Integer, nil]
181
183
  optional :trial_period_days, Integer
182
184
 
183
- # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_period_days: nil, type: :recurring_price)
185
+ # @!method initialize(currency:, discount:, payment_frequency_count:, payment_frequency_interval:, price:, subscription_period_count:, subscription_period_interval:, purchasing_power_parity: nil, tax_inclusive: nil, trial_amount: nil, trial_apply_discounts: nil, trial_period_days: nil, type: :recurring_price)
184
186
  # Some parameter documentations has been truncated, see
185
187
  # {Dodopayments::Models::Price::RecurringPrice} for more details.
186
188
  #
@@ -196,12 +198,12 @@ module Dodopayments
196
198
  #
197
199
  # @param price [Integer] The payment amount. Represented in the lowest denomination of the currency (e.g.
198
200
  #
199
- # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
200
- #
201
201
  # @param subscription_period_count [Integer] Number of units for the subscription period.
202
202
  #
203
203
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
204
204
  #
205
+ # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
206
+ #
205
207
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
206
208
  #
207
209
  # @param trial_amount [Integer, nil] Amount charged today for a paid trial, in the price currency's minor units.
@@ -246,13 +248,6 @@ module Dodopayments
246
248
  # @return [Symbol, Dodopayments::Models::TimeInterval]
247
249
  required :payment_frequency_interval, enum: -> { Dodopayments::TimeInterval }
248
250
 
249
- # @!attribute purchasing_power_parity
250
- # Indicates if purchasing power parity adjustments are applied to the price.
251
- # Purchasing power parity feature is not available as of now
252
- #
253
- # @return [Boolean]
254
- required :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
255
-
256
251
  # @!attribute subscription_period_count
257
252
  # Number of units for the subscription period. For example, a value of `12` with a
258
253
  # `subscription_period_interval` of `month` represents a one-year subscription.
@@ -280,13 +275,22 @@ module Dodopayments
280
275
  },
281
276
  nil?: true
282
277
 
278
+ # @!attribute purchasing_power_parity
279
+ # Opts this price in to purchasing power parity. The business must also enable
280
+ # purchasing power parity. The discount percentage per country is always
281
+ # business-wide. Applies to the fixed fee only, never to metered usage. Defaults
282
+ # to `false`.
283
+ #
284
+ # @return [Boolean, nil]
285
+ optional :purchasing_power_parity, Dodopayments::Internal::Type::Boolean
286
+
283
287
  # @!attribute tax_inclusive
284
288
  # Indicates if the price is tax inclusive
285
289
  #
286
290
  # @return [Boolean, nil]
287
291
  optional :tax_inclusive, Dodopayments::Internal::Type::Boolean, nil?: true
288
292
 
289
- # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, purchasing_power_parity:, subscription_period_count:, subscription_period_interval:, meters: nil, tax_inclusive: nil, type: :usage_based_price)
293
+ # @!method initialize(currency:, discount:, fixed_price:, payment_frequency_count:, payment_frequency_interval:, subscription_period_count:, subscription_period_interval:, meters: nil, purchasing_power_parity: nil, tax_inclusive: nil, type: :usage_based_price)
290
294
  # Some parameter documentations has been truncated, see
291
295
  # {Dodopayments::Models::Price::UsageBasedPrice} for more details.
292
296
  #
@@ -302,14 +306,14 @@ module Dodopayments
302
306
  #
303
307
  # @param payment_frequency_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the payment frequency (e.g., day, month, year).
304
308
  #
305
- # @param purchasing_power_parity [Boolean] Indicates if purchasing power parity adjustments are applied to the price.
306
- #
307
309
  # @param subscription_period_count [Integer] Number of units for the subscription period.
308
310
  #
309
311
  # @param subscription_period_interval [Symbol, Dodopayments::Models::TimeInterval] The time interval for the subscription period (e.g., day, month, year).
310
312
  #
311
313
  # @param meters [Array<Dodopayments::Models::AddMeterToPrice>, nil]
312
314
  #
315
+ # @param purchasing_power_parity [Boolean] Opts this price in to purchasing power parity. The business must also
316
+ #
313
317
  # @param tax_inclusive [Boolean, nil] Indicates if the price is tax inclusive
314
318
  #
315
319
  # @param type [Symbol, :usage_based_price]
@@ -10,10 +10,11 @@ module Dodopayments
10
10
  required :business_id, String
11
11
 
12
12
  # @!attribute data
13
- # Response struct representing subscription details
13
+ # Subscription payload sent on a webhook. It carries every field of
14
+ # `SubscriptionResponse`, plus the grace-period deadline.
14
15
  #
15
- # @return [Dodopayments::Models::Subscription]
16
- required :data, -> { Dodopayments::Subscription }
16
+ # @return [Dodopayments::Models::SubscriptionActiveWebhookEvent::Data]
17
+ required :data, -> { Dodopayments::SubscriptionActiveWebhookEvent::Data }
17
18
 
18
19
  # @!attribute timestamp
19
20
  # The timestamp of when the event occurred
@@ -28,13 +29,40 @@ module Dodopayments
28
29
  required :type, const: :"subscription.active"
29
30
 
30
31
  # @!method initialize(business_id:, data:, timestamp:, type: :"subscription.active")
32
+ # Some parameter documentations has been truncated, see
33
+ # {Dodopayments::Models::SubscriptionActiveWebhookEvent} for more details.
34
+ #
31
35
  # @param business_id [String] The business identifier
32
36
  #
33
- # @param data [Dodopayments::Models::Subscription] Response struct representing subscription details
37
+ # @param data [Dodopayments::Models::SubscriptionActiveWebhookEvent::Data] Subscription payload sent on a webhook. It carries every field of
34
38
  #
35
39
  # @param timestamp [Time] The timestamp of when the event occurred
36
40
  #
37
41
  # @param type [Symbol, :"subscription.active"] The event type
42
+
43
+ # @see Dodopayments::Models::SubscriptionActiveWebhookEvent#data
44
+ class Data < Dodopayments::Models::Subscription
45
+ # @!attribute past_due_ends_at
46
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
47
+ # `cancelled` at this time.
48
+ #
49
+ # Read in the same query as the rest of the payload, so it always comes from the
50
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
51
+ # a window at that moment. A delayed event of another type therefore carries the
52
+ # deadline too, next to a `past_due` status.
53
+ #
54
+ # @return [Time, nil]
55
+ optional :past_due_ends_at, Time, nil?: true
56
+
57
+ # @!method initialize(past_due_ends_at: nil)
58
+ # Some parameter documentations has been truncated, see
59
+ # {Dodopayments::Models::SubscriptionActiveWebhookEvent::Data} for more details.
60
+ #
61
+ # Subscription payload sent on a webhook. It carries every field of
62
+ # `SubscriptionResponse`, plus the grace-period deadline.
63
+ #
64
+ # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
65
+ end
38
66
  end
39
67
  end
40
68
  end
@@ -10,10 +10,11 @@ module Dodopayments
10
10
  required :business_id, String
11
11
 
12
12
  # @!attribute data
13
- # Response struct representing subscription details
13
+ # Subscription payload sent on a webhook. It carries every field of
14
+ # `SubscriptionResponse`, plus the grace-period deadline.
14
15
  #
15
- # @return [Dodopayments::Models::Subscription]
16
- required :data, -> { Dodopayments::Subscription }
16
+ # @return [Dodopayments::Models::SubscriptionCancelledWebhookEvent::Data]
17
+ required :data, -> { Dodopayments::SubscriptionCancelledWebhookEvent::Data }
17
18
 
18
19
  # @!attribute timestamp
19
20
  # The timestamp of when the event occurred
@@ -28,13 +29,41 @@ module Dodopayments
28
29
  required :type, const: :"subscription.cancelled"
29
30
 
30
31
  # @!method initialize(business_id:, data:, timestamp:, type: :"subscription.cancelled")
32
+ # Some parameter documentations has been truncated, see
33
+ # {Dodopayments::Models::SubscriptionCancelledWebhookEvent} for more details.
34
+ #
31
35
  # @param business_id [String] The business identifier
32
36
  #
33
- # @param data [Dodopayments::Models::Subscription] Response struct representing subscription details
37
+ # @param data [Dodopayments::Models::SubscriptionCancelledWebhookEvent::Data] Subscription payload sent on a webhook. It carries every field of
34
38
  #
35
39
  # @param timestamp [Time] The timestamp of when the event occurred
36
40
  #
37
41
  # @param type [Symbol, :"subscription.cancelled"] The event type
42
+
43
+ # @see Dodopayments::Models::SubscriptionCancelledWebhookEvent#data
44
+ class Data < Dodopayments::Models::Subscription
45
+ # @!attribute past_due_ends_at
46
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
47
+ # `cancelled` at this time.
48
+ #
49
+ # Read in the same query as the rest of the payload, so it always comes from the
50
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
51
+ # a window at that moment. A delayed event of another type therefore carries the
52
+ # deadline too, next to a `past_due` status.
53
+ #
54
+ # @return [Time, nil]
55
+ optional :past_due_ends_at, Time, nil?: true
56
+
57
+ # @!method initialize(past_due_ends_at: nil)
58
+ # Some parameter documentations has been truncated, see
59
+ # {Dodopayments::Models::SubscriptionCancelledWebhookEvent::Data} for more
60
+ # details.
61
+ #
62
+ # Subscription payload sent on a webhook. It carries every field of
63
+ # `SubscriptionResponse`, plus the grace-period deadline.
64
+ #
65
+ # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
66
+ end
38
67
  end
39
68
  end
40
69
  end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Dodopayments
4
+ module Models
5
+ # @see Dodopayments::Resources::Subscriptions#change_plan
6
+ class SubscriptionChangePlanResponse < Dodopayments::Internal::Type::BaseModel
7
+ # @!attribute client_secret
8
+ # Client secret for an embedded checkout.
9
+ #
10
+ # @return [String, nil]
11
+ optional :client_secret, String, nil?: true
12
+
13
+ # @!attribute expires_on
14
+ # When the link stops working.
15
+ #
16
+ # @return [Time, nil]
17
+ optional :expires_on, Time, nil?: true
18
+
19
+ # @!attribute payment_id
20
+ # Id of the payment that settles the plan change.
21
+ #
22
+ # @return [String, nil]
23
+ optional :payment_id, String, nil?: true
24
+
25
+ # @!attribute payment_link
26
+ # Checkout page URL. Give this to the customer.
27
+ #
28
+ # @return [String, nil]
29
+ optional :payment_link, String, nil?: true
30
+
31
+ # @!method initialize(client_secret: nil, expires_on: nil, payment_id: nil, payment_link: nil)
32
+ # Handles for a hosted checkout page that settles a plan change.
33
+ #
34
+ # The four fields repeat `UpdatePaymentMethodResponse` and a subset of
35
+ # `CreateSubscriptionResponse`. A shared type would rename the generated SDK types
36
+ # for all three routes, so each route keeps its own.
37
+ #
38
+ # @param client_secret [String, nil] Client secret for an embedded checkout.
39
+ #
40
+ # @param expires_on [Time, nil] When the link stops working.
41
+ #
42
+ # @param payment_id [String, nil] Id of the payment that settles the plan change.
43
+ #
44
+ # @param payment_link [String, nil] Checkout page URL. Give this to the customer.
45
+ end
46
+ end
47
+ end
@@ -10,10 +10,11 @@ module Dodopayments
10
10
  required :business_id, String
11
11
 
12
12
  # @!attribute data
13
- # Response struct representing subscription details
13
+ # Subscription payload sent on a webhook. It carries every field of
14
+ # `SubscriptionResponse`, plus the grace-period deadline.
14
15
  #
15
- # @return [Dodopayments::Models::Subscription]
16
- required :data, -> { Dodopayments::Subscription }
16
+ # @return [Dodopayments::Models::SubscriptionExpiredWebhookEvent::Data]
17
+ required :data, -> { Dodopayments::SubscriptionExpiredWebhookEvent::Data }
17
18
 
18
19
  # @!attribute timestamp
19
20
  # The timestamp of when the event occurred
@@ -28,13 +29,40 @@ module Dodopayments
28
29
  required :type, const: :"subscription.expired"
29
30
 
30
31
  # @!method initialize(business_id:, data:, timestamp:, type: :"subscription.expired")
32
+ # Some parameter documentations has been truncated, see
33
+ # {Dodopayments::Models::SubscriptionExpiredWebhookEvent} for more details.
34
+ #
31
35
  # @param business_id [String] The business identifier
32
36
  #
33
- # @param data [Dodopayments::Models::Subscription] Response struct representing subscription details
37
+ # @param data [Dodopayments::Models::SubscriptionExpiredWebhookEvent::Data] Subscription payload sent on a webhook. It carries every field of
34
38
  #
35
39
  # @param timestamp [Time] The timestamp of when the event occurred
36
40
  #
37
41
  # @param type [Symbol, :"subscription.expired"] The event type
42
+
43
+ # @see Dodopayments::Models::SubscriptionExpiredWebhookEvent#data
44
+ class Data < Dodopayments::Models::Subscription
45
+ # @!attribute past_due_ends_at
46
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
47
+ # `cancelled` at this time.
48
+ #
49
+ # Read in the same query as the rest of the payload, so it always comes from the
50
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
51
+ # a window at that moment. A delayed event of another type therefore carries the
52
+ # deadline too, next to a `past_due` status.
53
+ #
54
+ # @return [Time, nil]
55
+ optional :past_due_ends_at, Time, nil?: true
56
+
57
+ # @!method initialize(past_due_ends_at: nil)
58
+ # Some parameter documentations has been truncated, see
59
+ # {Dodopayments::Models::SubscriptionExpiredWebhookEvent::Data} for more details.
60
+ #
61
+ # Subscription payload sent on a webhook. It carries every field of
62
+ # `SubscriptionResponse`, plus the grace-period deadline.
63
+ #
64
+ # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
65
+ end
38
66
  end
39
67
  end
40
68
  end
@@ -10,10 +10,11 @@ module Dodopayments
10
10
  required :business_id, String
11
11
 
12
12
  # @!attribute data
13
- # Response struct representing subscription details
13
+ # Subscription payload sent on a webhook. It carries every field of
14
+ # `SubscriptionResponse`, plus the grace-period deadline.
14
15
  #
15
- # @return [Dodopayments::Models::Subscription]
16
- required :data, -> { Dodopayments::Subscription }
16
+ # @return [Dodopayments::Models::SubscriptionFailedWebhookEvent::Data]
17
+ required :data, -> { Dodopayments::SubscriptionFailedWebhookEvent::Data }
17
18
 
18
19
  # @!attribute timestamp
19
20
  # The timestamp of when the event occurred
@@ -28,13 +29,40 @@ module Dodopayments
28
29
  required :type, const: :"subscription.failed"
29
30
 
30
31
  # @!method initialize(business_id:, data:, timestamp:, type: :"subscription.failed")
32
+ # Some parameter documentations has been truncated, see
33
+ # {Dodopayments::Models::SubscriptionFailedWebhookEvent} for more details.
34
+ #
31
35
  # @param business_id [String] The business identifier
32
36
  #
33
- # @param data [Dodopayments::Models::Subscription] Response struct representing subscription details
37
+ # @param data [Dodopayments::Models::SubscriptionFailedWebhookEvent::Data] Subscription payload sent on a webhook. It carries every field of
34
38
  #
35
39
  # @param timestamp [Time] The timestamp of when the event occurred
36
40
  #
37
41
  # @param type [Symbol, :"subscription.failed"] The event type
42
+
43
+ # @see Dodopayments::Models::SubscriptionFailedWebhookEvent#data
44
+ class Data < Dodopayments::Models::Subscription
45
+ # @!attribute past_due_ends_at
46
+ # Time when the grace period ends. The subscription moves to `on_hold` or to
47
+ # `cancelled` at this time.
48
+ #
49
+ # Read in the same query as the rest of the payload, so it always comes from the
50
+ # row snapshot that produced `status`. It is set whenever the subscription sits in
51
+ # a window at that moment. A delayed event of another type therefore carries the
52
+ # deadline too, next to a `past_due` status.
53
+ #
54
+ # @return [Time, nil]
55
+ optional :past_due_ends_at, Time, nil?: true
56
+
57
+ # @!method initialize(past_due_ends_at: nil)
58
+ # Some parameter documentations has been truncated, see
59
+ # {Dodopayments::Models::SubscriptionFailedWebhookEvent::Data} for more details.
60
+ #
61
+ # Subscription payload sent on a webhook. It carries every field of
62
+ # `SubscriptionResponse`, plus the grace-period deadline.
63
+ #
64
+ # @param past_due_ends_at [Time, nil] Time when the grace period ends. The subscription moves to `on_hold` or
65
+ end
38
66
  end
39
67
  end
40
68
  end