growsurf-ruby 0.6.1 → 0.7.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 (24) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +1 -1
  4. data/lib/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params.rb +28 -0
  5. data/lib/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response.rb +24 -0
  6. data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_params.rb +130 -0
  7. data/lib/growsurf_ruby/models/campaign/participant_refund_transaction_response.rb +81 -0
  8. data/lib/growsurf_ruby/models/campaign/participant_trigger_referral_params.rb +19 -1
  9. data/lib/growsurf_ruby/resources/campaign/participant.rb +98 -3
  10. data/lib/growsurf_ruby/version.rb +1 -1
  11. data/lib/growsurf_ruby.rb +4 -0
  12. data/rbi/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params.rbi +48 -0
  13. data/rbi/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response.rbi +36 -0
  14. data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbi +234 -0
  15. data/rbi/growsurf_ruby/models/campaign/participant_refund_transaction_response.rbi +131 -0
  16. data/rbi/growsurf_ruby/models/campaign/participant_trigger_referral_params.rbi +24 -1
  17. data/rbi/growsurf_ruby/resources/campaign/participant.rbi +94 -0
  18. data/sig/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_params.rbs +30 -0
  19. data/sig/growsurf_ruby/models/campaign/participant_cancel_delayed_referral_response.rbs +20 -0
  20. data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_params.rbs +151 -0
  21. data/sig/growsurf_ruby/models/campaign/participant_refund_transaction_response.rbs +75 -0
  22. data/sig/growsurf_ruby/models/campaign/participant_trigger_referral_params.rbs +7 -1
  23. data/sig/growsurf_ruby/resources/campaign/participant.rbs +28 -0
  24. metadata +14 -2
@@ -0,0 +1,234 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ class ParticipantRefundTransactionParams < GrowsurfRuby::Internal::Type::BaseModel
7
+ extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
8
+ include GrowsurfRuby::Internal::Type::RequestParameters
9
+
10
+ OrHash =
11
+ T.type_alias do
12
+ T.any(
13
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams,
14
+ GrowsurfRuby::Internal::AnyHash
15
+ )
16
+ end
17
+
18
+ sig { returns(String) }
19
+ attr_accessor :id
20
+
21
+ sig { returns(String) }
22
+ attr_accessor :participant_id_or_email
23
+
24
+ sig do
25
+ returns(
26
+ T.nilable(
27
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::OrSymbol
28
+ )
29
+ )
30
+ end
31
+ attr_reader :amendment_type
32
+
33
+ sig do
34
+ params(
35
+ amendment_type:
36
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::OrSymbol
37
+ ).void
38
+ end
39
+ attr_writer :amendment_type
40
+
41
+ sig { returns(T.nilable(Integer)) }
42
+ attr_reader :amount
43
+
44
+ sig { params(amount: Integer).void }
45
+ attr_writer :amount
46
+
47
+ sig { returns(T.nilable(Integer)) }
48
+ attr_reader :amount_refunded
49
+
50
+ sig { params(amount_refunded: Integer).void }
51
+ attr_writer :amount_refunded
52
+
53
+ sig { returns(T.nilable(String)) }
54
+ attr_reader :charge_id
55
+
56
+ sig { params(charge_id: String).void }
57
+ attr_writer :charge_id
58
+
59
+ sig { returns(T.nilable(String)) }
60
+ attr_reader :currency
61
+
62
+ sig { params(currency: String).void }
63
+ attr_writer :currency
64
+
65
+ sig { returns(T.nilable(String)) }
66
+ attr_reader :description
67
+
68
+ sig { params(description: String).void }
69
+ attr_writer :description
70
+
71
+ sig { returns(T.nilable(String)) }
72
+ attr_reader :external_id
73
+
74
+ sig { params(external_id: String).void }
75
+ attr_writer :external_id
76
+
77
+ sig { returns(T.nilable(String)) }
78
+ attr_reader :invoice_id
79
+
80
+ sig { params(invoice_id: String).void }
81
+ attr_writer :invoice_id
82
+
83
+ sig { returns(T.nilable(String)) }
84
+ attr_reader :order_id
85
+
86
+ sig { params(order_id: String).void }
87
+ attr_writer :order_id
88
+
89
+ sig { returns(T.nilable(String)) }
90
+ attr_reader :payment_id
91
+
92
+ sig { params(payment_id: String).void }
93
+ attr_writer :payment_id
94
+
95
+ sig { returns(T.nilable(String)) }
96
+ attr_reader :payment_intent_id
97
+
98
+ sig { params(payment_intent_id: String).void }
99
+ attr_writer :payment_intent_id
100
+
101
+ sig { returns(T.nilable(Integer)) }
102
+ attr_reader :refund_amount
103
+
104
+ sig { params(refund_amount: Integer).void }
105
+ attr_writer :refund_amount
106
+
107
+ sig { returns(T.nilable(String)) }
108
+ attr_reader :refund_id
109
+
110
+ sig { params(refund_id: String).void }
111
+ attr_writer :refund_id
112
+
113
+ sig { returns(T.nilable(String)) }
114
+ attr_reader :refund_status
115
+
116
+ sig { params(refund_status: String).void }
117
+ attr_writer :refund_status
118
+
119
+ sig { returns(T.nilable(String)) }
120
+ attr_reader :transaction_id
121
+
122
+ sig { params(transaction_id: String).void }
123
+ attr_writer :transaction_id
124
+
125
+ sig do
126
+ params(
127
+ id: String,
128
+ participant_id_or_email: String,
129
+ amendment_type:
130
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::OrSymbol,
131
+ amount: Integer,
132
+ amount_refunded: Integer,
133
+ charge_id: String,
134
+ currency: String,
135
+ description: String,
136
+ external_id: String,
137
+ invoice_id: String,
138
+ order_id: String,
139
+ payment_id: String,
140
+ payment_intent_id: String,
141
+ refund_amount: Integer,
142
+ refund_id: String,
143
+ refund_status: String,
144
+ transaction_id: String,
145
+ request_options: GrowsurfRuby::RequestOptions::OrHash
146
+ ).returns(T.attached_class)
147
+ end
148
+ def self.new(
149
+ id:,
150
+ participant_id_or_email:,
151
+ amendment_type: nil,
152
+ amount: nil,
153
+ amount_refunded: nil,
154
+ charge_id: nil,
155
+ currency: nil,
156
+ description: nil,
157
+ external_id: nil,
158
+ invoice_id: nil,
159
+ order_id: nil,
160
+ payment_id: nil,
161
+ payment_intent_id: nil,
162
+ refund_amount: nil,
163
+ refund_id: nil,
164
+ refund_status: nil,
165
+ transaction_id: nil,
166
+ request_options: {}
167
+ )
168
+ end
169
+
170
+ sig do
171
+ override.returns(
172
+ {
173
+ id: String,
174
+ participant_id_or_email: String,
175
+ amendment_type:
176
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::OrSymbol,
177
+ amount: Integer,
178
+ amount_refunded: Integer,
179
+ charge_id: String,
180
+ currency: String,
181
+ description: String,
182
+ external_id: String,
183
+ invoice_id: String,
184
+ order_id: String,
185
+ payment_id: String,
186
+ payment_intent_id: String,
187
+ refund_amount: Integer,
188
+ refund_id: String,
189
+ refund_status: String,
190
+ transaction_id: String,
191
+ request_options: GrowsurfRuby::RequestOptions
192
+ }
193
+ )
194
+ end
195
+ def to_hash
196
+ end
197
+
198
+ module AmendmentType
199
+ extend GrowsurfRuby::Internal::Type::Enum
200
+
201
+ TaggedSymbol =
202
+ T.type_alias do
203
+ T.all(
204
+ Symbol,
205
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType
206
+ )
207
+ end
208
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
209
+
210
+ REFUND =
211
+ T.let(
212
+ :REFUND,
213
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::TaggedSymbol
214
+ )
215
+ CHARGEBACK =
216
+ T.let(
217
+ :CHARGEBACK,
218
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::TaggedSymbol
219
+ )
220
+
221
+ sig do
222
+ override.returns(
223
+ T::Array[
224
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::TaggedSymbol
225
+ ]
226
+ )
227
+ end
228
+ def self.values
229
+ end
230
+ end
231
+ end
232
+ end
233
+ end
234
+ end
@@ -0,0 +1,131 @@
1
+ # typed: strong
2
+
3
+ module GrowsurfRuby
4
+ module Models
5
+ module Campaign
6
+ class ParticipantRefundTransactionResponse < GrowsurfRuby::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse,
11
+ GrowsurfRuby::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ sig { returns(Integer) }
16
+ attr_accessor :adjusted
17
+
18
+ sig do
19
+ returns(
20
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType::TaggedSymbol
21
+ )
22
+ end
23
+ attr_accessor :amendment_type
24
+
25
+ sig { returns(Integer) }
26
+ attr_accessor :deleted
27
+
28
+ sig { returns(Integer) }
29
+ attr_accessor :matched
30
+
31
+ sig { returns(T::Array[String]) }
32
+ attr_accessor :matching_commission_ids
33
+
34
+ sig { returns(String) }
35
+ attr_accessor :message
36
+
37
+ sig { returns(Integer) }
38
+ attr_accessor :reversed
39
+
40
+ sig { returns(T::Boolean) }
41
+ attr_accessor :success
42
+
43
+ sig { returns(T.nilable(T::Boolean)) }
44
+ attr_reader :not_found
45
+
46
+ sig { params(not_found: T::Boolean).void }
47
+ attr_writer :not_found
48
+
49
+ sig do
50
+ params(
51
+ adjusted: Integer,
52
+ amendment_type:
53
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType::OrSymbol,
54
+ deleted: Integer,
55
+ matched: Integer,
56
+ matching_commission_ids: T::Array[String],
57
+ message: String,
58
+ reversed: Integer,
59
+ success: T::Boolean,
60
+ not_found: T::Boolean
61
+ ).returns(T.attached_class)
62
+ end
63
+ def self.new(
64
+ adjusted:,
65
+ amendment_type:,
66
+ deleted:,
67
+ matched:,
68
+ matching_commission_ids:,
69
+ message:,
70
+ reversed:,
71
+ success:,
72
+ not_found: nil
73
+ )
74
+ end
75
+
76
+ sig do
77
+ override.returns(
78
+ {
79
+ adjusted: Integer,
80
+ amendment_type:
81
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType::TaggedSymbol,
82
+ deleted: Integer,
83
+ matched: Integer,
84
+ matching_commission_ids: T::Array[String],
85
+ message: String,
86
+ reversed: Integer,
87
+ success: T::Boolean,
88
+ not_found: T::Boolean
89
+ }
90
+ )
91
+ end
92
+ def to_hash
93
+ end
94
+
95
+ module AmendmentType
96
+ extend GrowsurfRuby::Internal::Type::Enum
97
+
98
+ TaggedSymbol =
99
+ T.type_alias do
100
+ T.all(
101
+ Symbol,
102
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType
103
+ )
104
+ end
105
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
106
+
107
+ REFUND =
108
+ T.let(
109
+ :REFUND,
110
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType::TaggedSymbol
111
+ )
112
+ CHARGEBACK =
113
+ T.let(
114
+ :CHARGEBACK,
115
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType::TaggedSymbol
116
+ )
117
+
118
+ sig do
119
+ override.returns(
120
+ T::Array[
121
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse::AmendmentType::TaggedSymbol
122
+ ]
123
+ )
124
+ end
125
+ def self.values
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
@@ -21,14 +21,36 @@ module GrowsurfRuby
21
21
  sig { returns(String) }
22
22
  attr_accessor :participant_id_or_email
23
23
 
24
+ # Number of whole days to hold referral credit before it is awarded. Useful for
25
+ # honoring a refund window before crediting a referrer. Omit this field to award
26
+ # credit immediately. The credit is awarded automatically once the delay elapses,
27
+ # and can be cancelled before then with the Cancel delayed referral trigger
28
+ # request.
29
+ sig { returns(T.nilable(Integer)) }
30
+ attr_reader :delay_in_days
31
+
32
+ sig { params(delay_in_days: Integer).void }
33
+ attr_writer :delay_in_days
34
+
24
35
  sig do
25
36
  params(
26
37
  id: String,
27
38
  participant_id_or_email: String,
39
+ delay_in_days: Integer,
28
40
  request_options: GrowsurfRuby::RequestOptions::OrHash
29
41
  ).returns(T.attached_class)
30
42
  end
31
- def self.new(id:, participant_id_or_email:, request_options: {})
43
+ def self.new(
44
+ id:,
45
+ participant_id_or_email:,
46
+ # Number of whole days to hold referral credit before it is awarded. Useful for
47
+ # honoring a refund window before crediting a referrer. Omit this field to award
48
+ # credit immediately. The credit is awarded automatically once the delay elapses,
49
+ # and can be cancelled before then with the Cancel delayed referral trigger
50
+ # request.
51
+ delay_in_days: nil,
52
+ request_options: {}
53
+ )
32
54
  end
33
55
 
34
56
  sig do
@@ -36,6 +58,7 @@ module GrowsurfRuby
36
58
  {
37
59
  id: String,
38
60
  participant_id_or_email: String,
61
+ delay_in_days: Integer,
39
62
  request_options: GrowsurfRuby::RequestOptions
40
63
  }
41
64
  )
@@ -332,6 +332,73 @@ module GrowsurfRuby
332
332
  )
333
333
  end
334
334
 
335
+ # Records an amendment (refund, partial refund, refund cancellation, or
336
+ # chargeback) against a previously recorded transaction and reverses or adjusts
337
+ # the referrer's commission.
338
+ sig do
339
+ params(
340
+ participant_id_or_email: String,
341
+ id: String,
342
+ amendment_type:
343
+ GrowsurfRuby::Campaign::ParticipantRefundTransactionParams::AmendmentType::OrSymbol,
344
+ amount: Integer,
345
+ amount_refunded: Integer,
346
+ charge_id: String,
347
+ currency: String,
348
+ description: String,
349
+ external_id: String,
350
+ invoice_id: String,
351
+ order_id: String,
352
+ payment_id: String,
353
+ payment_intent_id: String,
354
+ refund_amount: Integer,
355
+ refund_id: String,
356
+ refund_status: String,
357
+ transaction_id: String,
358
+ request_options: GrowsurfRuby::RequestOptions::OrHash
359
+ ).returns(
360
+ GrowsurfRuby::Models::Campaign::ParticipantRefundTransactionResponse
361
+ )
362
+ end
363
+ def refund_transaction(
364
+ # Path param: GrowSurf participant ID or URL-encoded participant email address.
365
+ participant_id_or_email,
366
+ # Path param: GrowSurf program ID.
367
+ id:,
368
+ # Body param
369
+ amendment_type: nil,
370
+ # Body param
371
+ amount: nil,
372
+ # Body param
373
+ amount_refunded: nil,
374
+ # Body param
375
+ charge_id: nil,
376
+ # Body param
377
+ currency: nil,
378
+ # Body param
379
+ description: nil,
380
+ # Body param
381
+ external_id: nil,
382
+ # Body param
383
+ invoice_id: nil,
384
+ # Body param
385
+ order_id: nil,
386
+ # Body param
387
+ payment_id: nil,
388
+ # Body param
389
+ payment_intent_id: nil,
390
+ # Body param
391
+ refund_amount: nil,
392
+ # Body param
393
+ refund_id: nil,
394
+ # Body param
395
+ refund_status: nil,
396
+ # Body param
397
+ transaction_id: nil,
398
+ request_options: {}
399
+ )
400
+ end
401
+
335
402
  # Sends email invites on behalf of a participant to a list of email addresses.
336
403
  sig do
337
404
  params(
@@ -366,12 +433,39 @@ module GrowsurfRuby
366
433
  params(
367
434
  participant_id_or_email: String,
368
435
  id: String,
436
+ delay_in_days: Integer,
369
437
  request_options: GrowsurfRuby::RequestOptions::OrHash
370
438
  ).returns(
371
439
  GrowsurfRuby::Models::Campaign::ParticipantTriggerReferralResponse
372
440
  )
373
441
  end
374
442
  def trigger_referral(
443
+ # Path param: GrowSurf participant ID or URL-encoded participant email address.
444
+ participant_id_or_email,
445
+ # Path param: GrowSurf program ID.
446
+ id:,
447
+ # Body param: Number of whole days to hold referral credit before it is awarded.
448
+ # Useful for honoring a refund window before crediting a referrer. Omit this field
449
+ # to award credit immediately. The credit is awarded automatically once the delay
450
+ # elapses, and can be cancelled before then with the Cancel delayed referral
451
+ # trigger request.
452
+ delay_in_days: nil,
453
+ request_options: {}
454
+ )
455
+ end
456
+
457
+ # Cancels a pending delayed referral trigger for an existing referred participant
458
+ # by GrowSurf participant ID or email address.
459
+ sig do
460
+ params(
461
+ participant_id_or_email: String,
462
+ id: String,
463
+ request_options: GrowsurfRuby::RequestOptions::OrHash
464
+ ).returns(
465
+ GrowsurfRuby::Models::Campaign::ParticipantCancelDelayedReferralResponse
466
+ )
467
+ end
468
+ def cancel_delayed_referral(
375
469
  # GrowSurf participant ID or URL-encoded participant email address.
376
470
  participant_id_or_email,
377
471
  # GrowSurf program ID.
@@ -0,0 +1,30 @@
1
+ module GrowsurfRuby
2
+ module Models
3
+ module Campaign
4
+ type participant_cancel_delayed_referral_params =
5
+ { id: String, participant_id_or_email: String }
6
+ & GrowsurfRuby::Internal::Type::request_parameters
7
+
8
+ class ParticipantCancelDelayedReferralParams < GrowsurfRuby::Internal::Type::BaseModel
9
+ extend GrowsurfRuby::Internal::Type::RequestParameters::Converter
10
+ include GrowsurfRuby::Internal::Type::RequestParameters
11
+
12
+ attr_accessor id: String
13
+
14
+ attr_accessor participant_id_or_email: String
15
+
16
+ def initialize: (
17
+ id: String,
18
+ participant_id_or_email: String,
19
+ ?request_options: GrowsurfRuby::request_opts
20
+ ) -> void
21
+
22
+ def to_hash: -> {
23
+ id: String,
24
+ participant_id_or_email: String,
25
+ request_options: GrowsurfRuby::RequestOptions
26
+ }
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ module GrowsurfRuby
2
+ module Models
3
+ module Campaign
4
+ type participant_cancel_delayed_referral_response =
5
+ { success: bool, message: String }
6
+
7
+ class ParticipantCancelDelayedReferralResponse < GrowsurfRuby::Internal::Type::BaseModel
8
+ attr_accessor success: bool
9
+
10
+ attr_reader message: String?
11
+
12
+ def message=: (String) -> String
13
+
14
+ def initialize: (success: bool, ?message: String) -> void
15
+
16
+ def to_hash: -> { success: bool, message: String }
17
+ end
18
+ end
19
+ end
20
+ end