dodopayments 2.27.0 → 2.28.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 (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/dodopayments/internal/type/union.rb +15 -5
  5. data/lib/dodopayments/models/balance_ledger_entry.rb +2 -0
  6. data/lib/dodopayments/models/balance_retrieve_ledger_params.rb +2 -0
  7. data/lib/dodopayments/models/checkout_session_preview_response.rb +10 -1
  8. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rb +1 -1
  9. data/lib/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rb +21 -1
  10. data/lib/dodopayments/models/credit_entitlements/credit_ledger_entry.rb +2 -7
  11. data/lib/dodopayments/models/customers/email_body.rb +57 -0
  12. data/lib/dodopayments/models/customers/email_failure_code.rb +27 -0
  13. data/lib/dodopayments/models/customers/email_list_params.rb +39 -0
  14. data/lib/dodopayments/models/customers/email_log_item.rb +121 -0
  15. data/lib/dodopayments/models/customers/email_log_status.rb +24 -0
  16. data/lib/dodopayments/models/customers/email_policies.rb +45 -0
  17. data/lib/dodopayments/models/customers/email_retrieve_body_params.rb +28 -0
  18. data/lib/dodopayments/models/price.rb +95 -27
  19. data/lib/dodopayments/models/subscription.rb +10 -1
  20. data/lib/dodopayments/models/subscription_create_response.rb +10 -1
  21. data/lib/dodopayments/models/subscription_list_response.rb +10 -1
  22. data/lib/dodopayments/resources/credit_entitlements/balances.rb +1 -0
  23. data/lib/dodopayments/resources/customers/emails.rb +76 -0
  24. data/lib/dodopayments/resources/customers.rb +4 -0
  25. data/lib/dodopayments/version.rb +1 -1
  26. data/lib/dodopayments.rb +8 -0
  27. data/rbi/dodopayments/models/balance_ledger_entry.rbi +10 -0
  28. data/rbi/dodopayments/models/balance_retrieve_ledger_params.rbi +10 -0
  29. data/rbi/dodopayments/models/checkout_session_preview_response.rbi +10 -0
  30. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_params.rbi +2 -2
  31. data/rbi/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rbi +8 -0
  32. data/rbi/dodopayments/models/credit_entitlements/credit_ledger_entry.rbi +2 -6
  33. data/rbi/dodopayments/models/customers/email_body.rbi +88 -0
  34. data/rbi/dodopayments/models/customers/email_failure_code.rbi +70 -0
  35. data/rbi/dodopayments/models/customers/email_list_params.rbi +68 -0
  36. data/rbi/dodopayments/models/customers/email_log_item.rbi +157 -0
  37. data/rbi/dodopayments/models/customers/email_log_status.rbi +46 -0
  38. data/rbi/dodopayments/models/customers/email_policies.rbi +68 -0
  39. data/rbi/dodopayments/models/customers/email_retrieve_body_params.rbi +48 -0
  40. data/rbi/dodopayments/models/price.rbi +124 -25
  41. data/rbi/dodopayments/models/subscription.rbi +10 -0
  42. data/rbi/dodopayments/models/subscription_create_response.rbi +10 -0
  43. data/rbi/dodopayments/models/subscription_list_response.rbi +10 -0
  44. data/rbi/dodopayments/resources/credit_entitlements/balances.rbi +2 -1
  45. data/rbi/dodopayments/resources/customers/emails.rbi +60 -0
  46. data/rbi/dodopayments/resources/customers.rbi +3 -0
  47. data/sig/dodopayments/models/balance_ledger_entry.rbs +4 -0
  48. data/sig/dodopayments/models/balance_retrieve_ledger_params.rbs +4 -0
  49. data/sig/dodopayments/models/checkout_session_preview_response.rbs +5 -0
  50. data/sig/dodopayments/models/credit_entitlements/balance_create_ledger_entry_response.rbs +5 -0
  51. data/sig/dodopayments/models/customers/email_body.rbs +42 -0
  52. data/sig/dodopayments/models/customers/email_failure_code.rbs +30 -0
  53. data/sig/dodopayments/models/customers/email_list_params.rbs +38 -0
  54. data/sig/dodopayments/models/customers/email_log_item.rbs +82 -0
  55. data/sig/dodopayments/models/customers/email_log_status.rbs +20 -0
  56. data/sig/dodopayments/models/customers/email_policies.rbs +37 -0
  57. data/sig/dodopayments/models/customers/email_retrieve_body_params.rbs +30 -0
  58. data/sig/dodopayments/models/price.rbs +52 -17
  59. data/sig/dodopayments/models/subscription.rbs +5 -0
  60. data/sig/dodopayments/models/subscription_create_response.rbs +5 -0
  61. data/sig/dodopayments/models/subscription_list_response.rbs +5 -0
  62. data/sig/dodopayments/resources/customers/emails.rbs +22 -0
  63. data/sig/dodopayments/resources/customers.rbs +2 -0
  64. metadata +26 -2
@@ -0,0 +1,88 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailBody < Dodopayments::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Dodopayments::Customers::EmailBody,
11
+ Dodopayments::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # Whether the merchant wrote this content. It is true for the recovery and dunning
16
+ # emails, which the merchant writes.
17
+ #
18
+ # The content is email HTML. Render it in a sandbox, whatever this value is.
19
+ sig { returns(T::Boolean) }
20
+ attr_accessor :merchant_authored
21
+
22
+ # Why the email did not arrive. It is null unless the email failed.
23
+ sig do
24
+ returns(
25
+ T.nilable(Dodopayments::Customers::EmailFailureCode::TaggedSymbol)
26
+ )
27
+ end
28
+ attr_accessor :failure_code
29
+
30
+ # A sentence that explains `failure_code`. It is null unless the email failed.
31
+ sig { returns(T.nilable(String)) }
32
+ attr_accessor :failure_reason
33
+
34
+ # The stored HTML. It is null on a text-only email.
35
+ sig { returns(T.nilable(String)) }
36
+ attr_accessor :html
37
+
38
+ # The stored plain text.
39
+ sig { returns(T.nilable(String)) }
40
+ attr_accessor :text
41
+
42
+ sig do
43
+ params(
44
+ merchant_authored: T::Boolean,
45
+ failure_code:
46
+ T.nilable(Dodopayments::Customers::EmailFailureCode::OrSymbol),
47
+ failure_reason: T.nilable(String),
48
+ html: T.nilable(String),
49
+ text: T.nilable(String)
50
+ ).returns(T.attached_class)
51
+ end
52
+ def self.new(
53
+ # Whether the merchant wrote this content. It is true for the recovery and dunning
54
+ # emails, which the merchant writes.
55
+ #
56
+ # The content is email HTML. Render it in a sandbox, whatever this value is.
57
+ merchant_authored:,
58
+ # Why the email did not arrive. It is null unless the email failed.
59
+ failure_code: nil,
60
+ # A sentence that explains `failure_code`. It is null unless the email failed.
61
+ failure_reason: nil,
62
+ # The stored HTML. It is null on a text-only email.
63
+ html: nil,
64
+ # The stored plain text.
65
+ text: nil
66
+ )
67
+ end
68
+
69
+ sig do
70
+ override.returns(
71
+ {
72
+ merchant_authored: T::Boolean,
73
+ failure_code:
74
+ T.nilable(
75
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
76
+ ),
77
+ failure_reason: T.nilable(String),
78
+ html: T.nilable(String),
79
+ text: T.nilable(String)
80
+ }
81
+ )
82
+ end
83
+ def to_hash
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,70 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ # Why an email did not reach the recipient.
7
+ #
8
+ # The code is stable. `send_failed` is the catch-all: it covers every failure that
9
+ # the other codes do not name.
10
+ module EmailFailureCode
11
+ extend Dodopayments::Internal::Type::Enum
12
+
13
+ TaggedSymbol =
14
+ T.type_alias do
15
+ T.all(Symbol, Dodopayments::Customers::EmailFailureCode)
16
+ end
17
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
18
+
19
+ MAILBOX_NOT_FOUND =
20
+ T.let(
21
+ :mailbox_not_found,
22
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
23
+ )
24
+ ADDRESS_REJECTED =
25
+ T.let(
26
+ :address_rejected,
27
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
28
+ )
29
+ ADDRESS_SUPPRESSED =
30
+ T.let(
31
+ :address_suppressed,
32
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
33
+ )
34
+ MAILBOX_FULL =
35
+ T.let(
36
+ :mailbox_full,
37
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
38
+ )
39
+ TEMPORARY_FAILURE =
40
+ T.let(
41
+ :temporary_failure,
42
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
43
+ )
44
+ MESSAGE_TOO_LARGE =
45
+ T.let(
46
+ :message_too_large,
47
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
48
+ )
49
+ MARKED_AS_SPAM =
50
+ T.let(
51
+ :marked_as_spam,
52
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
53
+ )
54
+ SEND_FAILED =
55
+ T.let(
56
+ :send_failed,
57
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
58
+ )
59
+
60
+ sig do
61
+ override.returns(
62
+ T::Array[Dodopayments::Customers::EmailFailureCode::TaggedSymbol]
63
+ )
64
+ end
65
+ def self.values
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,68 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailListParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Dodopayments::Customers::EmailListParams,
14
+ Dodopayments::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :customer_id
20
+
21
+ # Which page to return. The default is 0.
22
+ sig { returns(T.nilable(Integer)) }
23
+ attr_reader :page_number
24
+
25
+ sig { params(page_number: Integer).void }
26
+ attr_writer :page_number
27
+
28
+ # How many emails to return. The default is 10 and the maximum is 100.
29
+ sig { returns(T.nilable(Integer)) }
30
+ attr_reader :page_size
31
+
32
+ sig { params(page_size: Integer).void }
33
+ attr_writer :page_size
34
+
35
+ sig do
36
+ params(
37
+ customer_id: String,
38
+ page_number: Integer,
39
+ page_size: Integer,
40
+ request_options: Dodopayments::RequestOptions::OrHash
41
+ ).returns(T.attached_class)
42
+ end
43
+ def self.new(
44
+ customer_id:,
45
+ # Which page to return. The default is 0.
46
+ page_number: nil,
47
+ # How many emails to return. The default is 10 and the maximum is 100.
48
+ page_size: nil,
49
+ request_options: {}
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ customer_id: String,
57
+ page_number: Integer,
58
+ page_size: Integer,
59
+ request_options: Dodopayments::RequestOptions
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,157 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailLogItem < Dodopayments::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Dodopayments::Customers::EmailLogItem,
11
+ Dodopayments::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The group this email belongs to: payments, refunds, subscriptions,
16
+ # dunning_recovery, entitlements or auth.
17
+ sig { returns(String) }
18
+ attr_accessor :category
19
+
20
+ # When this email was sent.
21
+ sig { returns(Time) }
22
+ attr_accessor :created_at
23
+
24
+ # Identifies this email. Use it to read the body or to send it again.
25
+ sig { returns(String) }
26
+ attr_accessor :email_log_id
27
+
28
+ # What kind of email this is, for example `payment_successful`.
29
+ sig { returns(String) }
30
+ attr_accessor :email_type
31
+
32
+ # Whether this email has content to show. The content endpoint can still refuse,
33
+ # because the content is removed after 180 days.
34
+ sig { returns(T::Boolean) }
35
+ attr_accessor :has_preview
36
+
37
+ # What you may do with this email.
38
+ sig { returns(Dodopayments::Customers::EmailPolicies) }
39
+ attr_reader :policies
40
+
41
+ sig do
42
+ params(policies: Dodopayments::Customers::EmailPolicies::OrHash).void
43
+ end
44
+ attr_writer :policies
45
+
46
+ # Where the email got to: sent, delivered, failed, complained or blocked.
47
+ sig { returns(Dodopayments::Customers::EmailLogStatus::TaggedSymbol) }
48
+ attr_accessor :status
49
+
50
+ # Why the email did not arrive. It is null unless the email failed.
51
+ sig do
52
+ returns(
53
+ T.nilable(Dodopayments::Customers::EmailFailureCode::TaggedSymbol)
54
+ )
55
+ end
56
+ attr_accessor :failure_code
57
+
58
+ # A sentence that explains `failure_code`. It is null unless the email failed.
59
+ sig { returns(T.nilable(String)) }
60
+ attr_accessor :failure_reason
61
+
62
+ # The address the email was sent from.
63
+ sig { returns(T.nilable(String)) }
64
+ attr_accessor :from
65
+
66
+ # What the merchant typed, when test mode redirected the send to the business
67
+ # owner.
68
+ sig { returns(T.nilable(String)) }
69
+ attr_accessor :intended_recipient
70
+
71
+ # The address the email reached.
72
+ sig { returns(T.nilable(String)) }
73
+ attr_accessor :recipient
74
+
75
+ # The subject line as it was sent. Empty until the provider replicates.
76
+ sig { returns(T.nilable(String)) }
77
+ attr_accessor :subject
78
+
79
+ sig do
80
+ params(
81
+ category: String,
82
+ created_at: Time,
83
+ email_log_id: String,
84
+ email_type: String,
85
+ has_preview: T::Boolean,
86
+ policies: Dodopayments::Customers::EmailPolicies::OrHash,
87
+ status: Dodopayments::Customers::EmailLogStatus::OrSymbol,
88
+ failure_code:
89
+ T.nilable(Dodopayments::Customers::EmailFailureCode::OrSymbol),
90
+ failure_reason: T.nilable(String),
91
+ from: T.nilable(String),
92
+ intended_recipient: T.nilable(String),
93
+ recipient: T.nilable(String),
94
+ subject: T.nilable(String)
95
+ ).returns(T.attached_class)
96
+ end
97
+ def self.new(
98
+ # The group this email belongs to: payments, refunds, subscriptions,
99
+ # dunning_recovery, entitlements or auth.
100
+ category:,
101
+ # When this email was sent.
102
+ created_at:,
103
+ # Identifies this email. Use it to read the body or to send it again.
104
+ email_log_id:,
105
+ # What kind of email this is, for example `payment_successful`.
106
+ email_type:,
107
+ # Whether this email has content to show. The content endpoint can still refuse,
108
+ # because the content is removed after 180 days.
109
+ has_preview:,
110
+ # What you may do with this email.
111
+ policies:,
112
+ # Where the email got to: sent, delivered, failed, complained or blocked.
113
+ status:,
114
+ # Why the email did not arrive. It is null unless the email failed.
115
+ failure_code: nil,
116
+ # A sentence that explains `failure_code`. It is null unless the email failed.
117
+ failure_reason: nil,
118
+ # The address the email was sent from.
119
+ from: nil,
120
+ # What the merchant typed, when test mode redirected the send to the business
121
+ # owner.
122
+ intended_recipient: nil,
123
+ # The address the email reached.
124
+ recipient: nil,
125
+ # The subject line as it was sent. Empty until the provider replicates.
126
+ subject: nil
127
+ )
128
+ end
129
+
130
+ sig do
131
+ override.returns(
132
+ {
133
+ category: String,
134
+ created_at: Time,
135
+ email_log_id: String,
136
+ email_type: String,
137
+ has_preview: T::Boolean,
138
+ policies: Dodopayments::Customers::EmailPolicies,
139
+ status: Dodopayments::Customers::EmailLogStatus::TaggedSymbol,
140
+ failure_code:
141
+ T.nilable(
142
+ Dodopayments::Customers::EmailFailureCode::TaggedSymbol
143
+ ),
144
+ failure_reason: T.nilable(String),
145
+ from: T.nilable(String),
146
+ intended_recipient: T.nilable(String),
147
+ recipient: T.nilable(String),
148
+ subject: T.nilable(String)
149
+ }
150
+ )
151
+ end
152
+ def to_hash
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -0,0 +1,46 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ # The delivery status of one email.
7
+ #
8
+ # `sent` also covers an email that is still on its way. A status only becomes
9
+ # `delivered`, `failed` or `complained` when the mail server answers.
10
+ module EmailLogStatus
11
+ extend Dodopayments::Internal::Type::Enum
12
+
13
+ TaggedSymbol =
14
+ T.type_alias do
15
+ T.all(Symbol, Dodopayments::Customers::EmailLogStatus)
16
+ end
17
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
18
+
19
+ SENT =
20
+ T.let(:sent, Dodopayments::Customers::EmailLogStatus::TaggedSymbol)
21
+ DELIVERED =
22
+ T.let(
23
+ :delivered,
24
+ Dodopayments::Customers::EmailLogStatus::TaggedSymbol
25
+ )
26
+ FAILED =
27
+ T.let(:failed, Dodopayments::Customers::EmailLogStatus::TaggedSymbol)
28
+ COMPLAINED =
29
+ T.let(
30
+ :complained,
31
+ Dodopayments::Customers::EmailLogStatus::TaggedSymbol
32
+ )
33
+ BLOCKED =
34
+ T.let(:blocked, Dodopayments::Customers::EmailLogStatus::TaggedSymbol)
35
+
36
+ sig do
37
+ override.returns(
38
+ T::Array[Dodopayments::Customers::EmailLogStatus::TaggedSymbol]
39
+ )
40
+ end
41
+ def self.values
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,68 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailPolicies < Dodopayments::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ Dodopayments::Customers::EmailPolicies,
11
+ Dodopayments::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # A permanent failure was recorded, so the same address would be a no-op.
16
+ sig { returns(T::Boolean) }
17
+ attr_accessor :requires_different_address
18
+
19
+ # The row was delivered and may be sent again.
20
+ sig { returns(T::Boolean) }
21
+ attr_accessor :resend_allowed
22
+
23
+ # How many sends are left in this email's chain.
24
+ sig { returns(Integer) }
25
+ attr_accessor :resends_remaining
26
+
27
+ # The row failed and may be sent again.
28
+ sig { returns(T::Boolean) }
29
+ attr_accessor :retry_allowed
30
+
31
+ # What the merchant may do with one row. The server decides; the client never
32
+ # derives eligibility itself.
33
+ sig do
34
+ params(
35
+ requires_different_address: T::Boolean,
36
+ resend_allowed: T::Boolean,
37
+ resends_remaining: Integer,
38
+ retry_allowed: T::Boolean
39
+ ).returns(T.attached_class)
40
+ end
41
+ def self.new(
42
+ # A permanent failure was recorded, so the same address would be a no-op.
43
+ requires_different_address:,
44
+ # The row was delivered and may be sent again.
45
+ resend_allowed:,
46
+ # How many sends are left in this email's chain.
47
+ resends_remaining:,
48
+ # The row failed and may be sent again.
49
+ retry_allowed:
50
+ )
51
+ end
52
+
53
+ sig do
54
+ override.returns(
55
+ {
56
+ requires_different_address: T::Boolean,
57
+ resend_allowed: T::Boolean,
58
+ resends_remaining: Integer,
59
+ retry_allowed: T::Boolean
60
+ }
61
+ )
62
+ end
63
+ def to_hash
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,48 @@
1
+ # typed: strong
2
+
3
+ module Dodopayments
4
+ module Models
5
+ module Customers
6
+ class EmailRetrieveBodyParams < Dodopayments::Internal::Type::BaseModel
7
+ extend Dodopayments::Internal::Type::RequestParameters::Converter
8
+ include Dodopayments::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ Dodopayments::Customers::EmailRetrieveBodyParams,
14
+ Dodopayments::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :customer_id
20
+
21
+ sig { returns(String) }
22
+ attr_accessor :email_log_id
23
+
24
+ sig do
25
+ params(
26
+ customer_id: String,
27
+ email_log_id: String,
28
+ request_options: Dodopayments::RequestOptions::OrHash
29
+ ).returns(T.attached_class)
30
+ end
31
+ def self.new(customer_id:, email_log_id:, request_options: {})
32
+ end
33
+
34
+ sig do
35
+ override.returns(
36
+ {
37
+ customer_id: String,
38
+ email_log_id: String,
39
+ request_options: Dodopayments::RequestOptions
40
+ }
41
+ )
42
+ end
43
+ def to_hash
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end