-
Notifications
You must be signed in to change notification settings - Fork 401
Expand file tree
/
Copy pathStripeEventNotificationHandler.java
More file actions
631 lines (543 loc) · 28.7 KB
/
Copy pathStripeEventNotificationHandler.java
File metadata and controls
631 lines (543 loc) · 28.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
package com.stripe;
// event-notification-class-imports: The beginning of the section generated from our OpenAPI spec
// - hack because we can't format java files whose imports aren't a single contiguous block
// - so _any_ imports in this file have to come from codegen
// - as do these comments, explaining the whole thing
import com.stripe.events.V1BillingMeterErrorReportTriggeredEventNotification;
import com.stripe.events.V1BillingMeterNoMeterFoundEventNotification;
import com.stripe.events.V2CoreAccountClosedEventNotification;
import com.stripe.events.V2CoreAccountCreatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingDefaultsUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingIdentityUpdatedEventNotification;
import com.stripe.events.V2CoreAccountIncludingRequirementsUpdatedEventNotification;
import com.stripe.events.V2CoreAccountLinkReturnedEventNotification;
import com.stripe.events.V2CoreAccountPersonCreatedEventNotification;
import com.stripe.events.V2CoreAccountPersonDeletedEventNotification;
import com.stripe.events.V2CoreAccountPersonUpdatedEventNotification;
import com.stripe.events.V2CoreAccountUpdatedEventNotification;
import com.stripe.events.V2CoreBatchJobBatchFailedEventNotification;
import com.stripe.events.V2CoreBatchJobCanceledEventNotification;
import com.stripe.events.V2CoreBatchJobCompletedEventNotification;
import com.stripe.events.V2CoreBatchJobCreatedEventNotification;
import com.stripe.events.V2CoreBatchJobReadyForUploadEventNotification;
import com.stripe.events.V2CoreBatchJobTimeoutEventNotification;
import com.stripe.events.V2CoreBatchJobUpdatedEventNotification;
import com.stripe.events.V2CoreBatchJobUploadTimeoutEventNotification;
import com.stripe.events.V2CoreBatchJobValidatingEventNotification;
import com.stripe.events.V2CoreBatchJobValidationFailedEventNotification;
import com.stripe.events.V2CoreEventDestinationPingEventNotification;
import com.stripe.events.V2CoreHealthEventGenerationFailureResolvedEventNotification;
import com.stripe.events.V2MoneyManagementAdjustmentCreatedEventNotification;
import com.stripe.events.V2MoneyManagementFinancialAccountCreatedEventNotification;
import com.stripe.events.V2MoneyManagementFinancialAccountUpdatedEventNotification;
import com.stripe.events.V2MoneyManagementFinancialAddressActivatedEventNotification;
import com.stripe.events.V2MoneyManagementFinancialAddressFailedEventNotification;
import com.stripe.events.V2MoneyManagementInboundTransferAvailableEventNotification;
import com.stripe.events.V2MoneyManagementInboundTransferBankDebitFailedEventNotification;
import com.stripe.events.V2MoneyManagementInboundTransferBankDebitProcessingEventNotification;
import com.stripe.events.V2MoneyManagementInboundTransferBankDebitQueuedEventNotification;
import com.stripe.events.V2MoneyManagementInboundTransferBankDebitReturnedEventNotification;
import com.stripe.events.V2MoneyManagementInboundTransferBankDebitSucceededEventNotification;
import com.stripe.events.V2MoneyManagementOutboundPaymentCanceledEventNotification;
import com.stripe.events.V2MoneyManagementOutboundPaymentCreatedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundPaymentFailedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundPaymentPostedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundPaymentReturnedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundPaymentUpdatedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundTransferCanceledEventNotification;
import com.stripe.events.V2MoneyManagementOutboundTransferCreatedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundTransferFailedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundTransferPostedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundTransferReturnedEventNotification;
import com.stripe.events.V2MoneyManagementOutboundTransferUpdatedEventNotification;
import com.stripe.events.V2MoneyManagementPayoutMethodCreatedEventNotification;
import com.stripe.events.V2MoneyManagementPayoutMethodUpdatedEventNotification;
import com.stripe.events.V2MoneyManagementReceivedCreditAvailableEventNotification;
import com.stripe.events.V2MoneyManagementReceivedCreditFailedEventNotification;
import com.stripe.events.V2MoneyManagementReceivedCreditReturnedEventNotification;
import com.stripe.events.V2MoneyManagementReceivedCreditSucceededEventNotification;
import com.stripe.events.V2MoneyManagementReceivedDebitCanceledEventNotification;
import com.stripe.events.V2MoneyManagementReceivedDebitFailedEventNotification;
import com.stripe.events.V2MoneyManagementReceivedDebitPendingEventNotification;
import com.stripe.events.V2MoneyManagementReceivedDebitSucceededEventNotification;
import com.stripe.events.V2MoneyManagementReceivedDebitUpdatedEventNotification;
import com.stripe.events.V2MoneyManagementTransactionCreatedEventNotification;
import com.stripe.events.V2MoneyManagementTransactionUpdatedEventNotification;
import com.stripe.exception.SignatureVerificationException;
import com.stripe.model.v2.core.EventNotification;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
// event-notification-class-imports: The end of the section generated from our OpenAPI spec
public class StripeEventNotificationHandler {
/**
* Functional interface for callback functions. It describes the signature of the functions you'll
* register on the StripeEventRouter to process incoming event notifications.
*/
@FunctionalInterface
public interface Callback<T extends EventNotification> {
// this is an internal-facing method name that dictates how we call the stored method
void process(T event, StripeClient client);
}
/**
* Functional interface for handling otherwise unhandled events. It's similar to {@link Callback},
* but includes additional information about the unhandled event to help debug it.
*/
@FunctionalInterface
public interface FallbackCallback {
// this is an internal-facing method name that dictates how we call the stored method
void process(
EventNotification event, StripeClient client, UnhandledNotificationDetails details);
}
/**
* Information about an unhandled event notification to make it easier to respond (and potentially
* update your integration).
*/
public static class UnhandledNotificationDetails {
private boolean isKnownEventType;
private UnhandledNotificationDetails(boolean isKnownEventType) {
this.isKnownEventType = isKnownEventType;
}
/**
* If true, the unhandled event's type is known to the SDK (i.e., it was successfully
* deserialized into a specific `EventNotification` subclass).
*/
public boolean isKnownEventType() {
return isKnownEventType;
}
}
// this is intentionally naiive to avoid the performance cost of interacting with `volatile`. We
// expect that registrations are done synchronously at startup time and handling will happen
// async, so thread-safe reads aren't important here.
private boolean hasHandledEvent = false;
private final String webhookSecret;
private final StripeClient client;
private final FallbackCallback fallbackCallback;
private final HashMap<String, Callback<? extends EventNotification>> registeredHandlers =
new HashMap<>();
public StripeEventNotificationHandler(
String webhookSecret, StripeClient client, FallbackCallback fallbackCallback) {
this.webhookSecret = webhookSecret;
this.client = client;
this.fallbackCallback = fallbackCallback;
}
private <T extends EventNotification> StripeEventNotificationHandler register(
String eventType, Callback<T> handler) {
if (hasHandledEvent) {
throw new IllegalStateException("Cannot register handlers after handling an event");
}
if (this.registeredHandlers.containsKey(eventType)) {
throw new IllegalArgumentException("Handler already registered for event type: " + eventType);
}
this.registeredHandlers.put(eventType, handler);
return this;
}
/**
* Handle an incoming webhook event notification.
*
* @param webhookBody the incoming webhook body
* @param sigHeader the incoming webhook signature header
* @throws SignatureVerificationException if the validation of the webhook signature fails
* @throws IllegalArgumentException if no handler is registered for the event type
*/
@SuppressWarnings("unchecked")
public void handle(String webhookBody, String sigHeader) throws SignatureVerificationException {
// setting this naiively isn't technically thread-safe, but we expect the all callbacks to be
// registered syncronously on startup, so this should be fine
hasHandledEvent = true;
EventNotification eventNotification =
this.client.parseEventNotification(webhookBody, sigHeader, this.webhookSecret);
Callback<? extends EventNotification> handler =
registeredHandlers.get(eventNotification.getType());
// Create a new client with the event's context for thread-safe processing
StripeClient eventClient = this.client.withStripeContext(eventNotification.context);
if (handler == null) {
boolean isKnownEventType =
!(eventNotification instanceof com.stripe.events.UnknownEventNotification);
UnhandledNotificationDetails details = new UnhandledNotificationDetails(isKnownEventType);
this.fallbackCallback.process(eventNotification, eventClient, details);
} else {
// this is technically unsafe but we control the registration API so should be ok
((Callback<EventNotification>) handler).process(eventNotification, eventClient);
}
}
// notification-handler-methods: The beginning of the section generated from our OpenAPI spec
public StripeEventNotificationHandler onV1BillingMeterErrorReportTriggered(
Callback<V1BillingMeterErrorReportTriggeredEventNotification> callback) {
this.register("v1.billing.meter.error_report_triggered", callback);
return this;
}
public StripeEventNotificationHandler onV1BillingMeterNoMeterFound(
Callback<V1BillingMeterNoMeterFoundEventNotification> callback) {
this.register("v1.billing.meter.no_meter_found", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountClosed(
Callback<V2CoreAccountClosedEventNotification> callback) {
this.register("v2.core.account.closed", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountCreated(
Callback<V2CoreAccountCreatedEventNotification> callback) {
this.register("v2.core.account.created", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountUpdated(
Callback<V2CoreAccountUpdatedEventNotification> callback) {
this.register("v2.core.account.updated", callback);
return this;
}
public StripeEventNotificationHandler
onV2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdated(
Callback<
V2CoreAccountIncludingConfigurationCustomerCapabilityStatusUpdatedEventNotification>
callback) {
this.register("v2.core.account[configuration.customer].capability_status_updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationCustomerUpdated(
Callback<V2CoreAccountIncludingConfigurationCustomerUpdatedEventNotification> callback) {
this.register("v2.core.account[configuration.customer].updated", callback);
return this;
}
public StripeEventNotificationHandler
onV2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdated(
Callback<
V2CoreAccountIncludingConfigurationMerchantCapabilityStatusUpdatedEventNotification>
callback) {
this.register("v2.core.account[configuration.merchant].capability_status_updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationMerchantUpdated(
Callback<V2CoreAccountIncludingConfigurationMerchantUpdatedEventNotification> callback) {
this.register("v2.core.account[configuration.merchant].updated", callback);
return this;
}
public StripeEventNotificationHandler
onV2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdated(
Callback<
V2CoreAccountIncludingConfigurationRecipientCapabilityStatusUpdatedEventNotification>
callback) {
this.register("v2.core.account[configuration.recipient].capability_status_updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationRecipientUpdated(
Callback<V2CoreAccountIncludingConfigurationRecipientUpdatedEventNotification> callback) {
this.register("v2.core.account[configuration.recipient].updated", callback);
return this;
}
public StripeEventNotificationHandler
onV2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdated(
Callback<
V2CoreAccountIncludingConfigurationStorerCapabilityStatusUpdatedEventNotification>
callback) {
this.register("v2.core.account[configuration.storer].capability_status_updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingConfigurationStorerUpdated(
Callback<V2CoreAccountIncludingConfigurationStorerUpdatedEventNotification> callback) {
this.register("v2.core.account[configuration.storer].updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingDefaultsUpdated(
Callback<V2CoreAccountIncludingDefaultsUpdatedEventNotification> callback) {
this.register("v2.core.account[defaults].updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingFutureRequirementsUpdated(
Callback<V2CoreAccountIncludingFutureRequirementsUpdatedEventNotification> callback) {
this.register("v2.core.account[future_requirements].updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingIdentityUpdated(
Callback<V2CoreAccountIncludingIdentityUpdatedEventNotification> callback) {
this.register("v2.core.account[identity].updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountIncludingRequirementsUpdated(
Callback<V2CoreAccountIncludingRequirementsUpdatedEventNotification> callback) {
this.register("v2.core.account[requirements].updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountLinkReturned(
Callback<V2CoreAccountLinkReturnedEventNotification> callback) {
this.register("v2.core.account_link.returned", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountPersonCreated(
Callback<V2CoreAccountPersonCreatedEventNotification> callback) {
this.register("v2.core.account_person.created", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountPersonDeleted(
Callback<V2CoreAccountPersonDeletedEventNotification> callback) {
this.register("v2.core.account_person.deleted", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreAccountPersonUpdated(
Callback<V2CoreAccountPersonUpdatedEventNotification> callback) {
this.register("v2.core.account_person.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobBatchFailed(
Callback<V2CoreBatchJobBatchFailedEventNotification> callback) {
this.register("v2.core.batch_job.batch_failed", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobCanceled(
Callback<V2CoreBatchJobCanceledEventNotification> callback) {
this.register("v2.core.batch_job.canceled", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobCompleted(
Callback<V2CoreBatchJobCompletedEventNotification> callback) {
this.register("v2.core.batch_job.completed", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobCreated(
Callback<V2CoreBatchJobCreatedEventNotification> callback) {
this.register("v2.core.batch_job.created", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobReadyForUpload(
Callback<V2CoreBatchJobReadyForUploadEventNotification> callback) {
this.register("v2.core.batch_job.ready_for_upload", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobTimeout(
Callback<V2CoreBatchJobTimeoutEventNotification> callback) {
this.register("v2.core.batch_job.timeout", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobUpdated(
Callback<V2CoreBatchJobUpdatedEventNotification> callback) {
this.register("v2.core.batch_job.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobUploadTimeout(
Callback<V2CoreBatchJobUploadTimeoutEventNotification> callback) {
this.register("v2.core.batch_job.upload_timeout", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobValidating(
Callback<V2CoreBatchJobValidatingEventNotification> callback) {
this.register("v2.core.batch_job.validating", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreBatchJobValidationFailed(
Callback<V2CoreBatchJobValidationFailedEventNotification> callback) {
this.register("v2.core.batch_job.validation_failed", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreEventDestinationPing(
Callback<V2CoreEventDestinationPingEventNotification> callback) {
this.register("v2.core.event_destination.ping", callback);
return this;
}
public StripeEventNotificationHandler onV2CoreHealthEventGenerationFailureResolved(
Callback<V2CoreHealthEventGenerationFailureResolvedEventNotification> callback) {
this.register("v2.core.health.event_generation_failure.resolved", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementAdjustmentCreated(
Callback<V2MoneyManagementAdjustmentCreatedEventNotification> callback) {
this.register("v2.money_management.adjustment.created", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementFinancialAccountCreated(
Callback<V2MoneyManagementFinancialAccountCreatedEventNotification> callback) {
this.register("v2.money_management.financial_account.created", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementFinancialAccountUpdated(
Callback<V2MoneyManagementFinancialAccountUpdatedEventNotification> callback) {
this.register("v2.money_management.financial_account.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementFinancialAddressActivated(
Callback<V2MoneyManagementFinancialAddressActivatedEventNotification> callback) {
this.register("v2.money_management.financial_address.activated", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementFinancialAddressFailed(
Callback<V2MoneyManagementFinancialAddressFailedEventNotification> callback) {
this.register("v2.money_management.financial_address.failed", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementInboundTransferAvailable(
Callback<V2MoneyManagementInboundTransferAvailableEventNotification> callback) {
this.register("v2.money_management.inbound_transfer.available", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementInboundTransferBankDebitFailed(
Callback<V2MoneyManagementInboundTransferBankDebitFailedEventNotification> callback) {
this.register("v2.money_management.inbound_transfer.bank_debit_failed", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementInboundTransferBankDebitProcessing(
Callback<V2MoneyManagementInboundTransferBankDebitProcessingEventNotification> callback) {
this.register("v2.money_management.inbound_transfer.bank_debit_processing", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementInboundTransferBankDebitQueued(
Callback<V2MoneyManagementInboundTransferBankDebitQueuedEventNotification> callback) {
this.register("v2.money_management.inbound_transfer.bank_debit_queued", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementInboundTransferBankDebitReturned(
Callback<V2MoneyManagementInboundTransferBankDebitReturnedEventNotification> callback) {
this.register("v2.money_management.inbound_transfer.bank_debit_returned", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementInboundTransferBankDebitSucceeded(
Callback<V2MoneyManagementInboundTransferBankDebitSucceededEventNotification> callback) {
this.register("v2.money_management.inbound_transfer.bank_debit_succeeded", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundPaymentCanceled(
Callback<V2MoneyManagementOutboundPaymentCanceledEventNotification> callback) {
this.register("v2.money_management.outbound_payment.canceled", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundPaymentCreated(
Callback<V2MoneyManagementOutboundPaymentCreatedEventNotification> callback) {
this.register("v2.money_management.outbound_payment.created", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundPaymentFailed(
Callback<V2MoneyManagementOutboundPaymentFailedEventNotification> callback) {
this.register("v2.money_management.outbound_payment.failed", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundPaymentPosted(
Callback<V2MoneyManagementOutboundPaymentPostedEventNotification> callback) {
this.register("v2.money_management.outbound_payment.posted", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundPaymentReturned(
Callback<V2MoneyManagementOutboundPaymentReturnedEventNotification> callback) {
this.register("v2.money_management.outbound_payment.returned", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundPaymentUpdated(
Callback<V2MoneyManagementOutboundPaymentUpdatedEventNotification> callback) {
this.register("v2.money_management.outbound_payment.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundTransferCanceled(
Callback<V2MoneyManagementOutboundTransferCanceledEventNotification> callback) {
this.register("v2.money_management.outbound_transfer.canceled", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundTransferCreated(
Callback<V2MoneyManagementOutboundTransferCreatedEventNotification> callback) {
this.register("v2.money_management.outbound_transfer.created", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundTransferFailed(
Callback<V2MoneyManagementOutboundTransferFailedEventNotification> callback) {
this.register("v2.money_management.outbound_transfer.failed", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundTransferPosted(
Callback<V2MoneyManagementOutboundTransferPostedEventNotification> callback) {
this.register("v2.money_management.outbound_transfer.posted", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundTransferReturned(
Callback<V2MoneyManagementOutboundTransferReturnedEventNotification> callback) {
this.register("v2.money_management.outbound_transfer.returned", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementOutboundTransferUpdated(
Callback<V2MoneyManagementOutboundTransferUpdatedEventNotification> callback) {
this.register("v2.money_management.outbound_transfer.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementPayoutMethodCreated(
Callback<V2MoneyManagementPayoutMethodCreatedEventNotification> callback) {
this.register("v2.money_management.payout_method.created", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementPayoutMethodUpdated(
Callback<V2MoneyManagementPayoutMethodUpdatedEventNotification> callback) {
this.register("v2.money_management.payout_method.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedCreditAvailable(
Callback<V2MoneyManagementReceivedCreditAvailableEventNotification> callback) {
this.register("v2.money_management.received_credit.available", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedCreditFailed(
Callback<V2MoneyManagementReceivedCreditFailedEventNotification> callback) {
this.register("v2.money_management.received_credit.failed", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedCreditReturned(
Callback<V2MoneyManagementReceivedCreditReturnedEventNotification> callback) {
this.register("v2.money_management.received_credit.returned", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedCreditSucceeded(
Callback<V2MoneyManagementReceivedCreditSucceededEventNotification> callback) {
this.register("v2.money_management.received_credit.succeeded", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedDebitCanceled(
Callback<V2MoneyManagementReceivedDebitCanceledEventNotification> callback) {
this.register("v2.money_management.received_debit.canceled", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedDebitFailed(
Callback<V2MoneyManagementReceivedDebitFailedEventNotification> callback) {
this.register("v2.money_management.received_debit.failed", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedDebitPending(
Callback<V2MoneyManagementReceivedDebitPendingEventNotification> callback) {
this.register("v2.money_management.received_debit.pending", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedDebitSucceeded(
Callback<V2MoneyManagementReceivedDebitSucceededEventNotification> callback) {
this.register("v2.money_management.received_debit.succeeded", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementReceivedDebitUpdated(
Callback<V2MoneyManagementReceivedDebitUpdatedEventNotification> callback) {
this.register("v2.money_management.received_debit.updated", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementTransactionCreated(
Callback<V2MoneyManagementTransactionCreatedEventNotification> callback) {
this.register("v2.money_management.transaction.created", callback);
return this;
}
public StripeEventNotificationHandler onV2MoneyManagementTransactionUpdated(
Callback<V2MoneyManagementTransactionUpdatedEventNotification> callback) {
this.register("v2.money_management.transaction.updated", callback);
return this;
}
// notification-handler-methods: The end of the section generated from our OpenAPI spec
/**
* Get a sorted list of all registered event types.
*
* @return A sorted list of event type strings
*/
public List<String> getRegisteredEventTypes() {
List<String> eventTypes = new ArrayList<>(this.registeredHandlers.keySet());
Collections.sort(eventTypes);
return eventTypes;
}
}