@@ -40,7 +40,21 @@ public ManagementWebhooksHandler(String payload) {
4040 * @return an Optional containing the deserialized object, or empty if deserialization fails
4141 */
4242 public Optional <MerchantCreatedNotificationRequest > getMerchantCreatedNotificationRequest () {
43- return getOptionalField (MerchantCreatedNotificationRequest .class );
43+
44+ var optionalMerchantCreatedNotificationRequest =
45+ getOptionalField (MerchantCreatedNotificationRequest .class );
46+
47+ if (optionalMerchantCreatedNotificationRequest .isPresent ()) {
48+ // verify event type
49+ for (var value : MerchantCreatedNotificationRequest .TypeEnum .values ()) {
50+ if (value .equals (optionalMerchantCreatedNotificationRequest .get ().getType ())) {
51+ // found matching event type
52+ return optionalMerchantCreatedNotificationRequest ;
53+ }
54+ }
55+ }
56+
57+ return Optional .empty ();
4458 }
4559
4660 /**
@@ -49,7 +63,21 @@ public Optional<MerchantCreatedNotificationRequest> getMerchantCreatedNotificati
4963 * @return an Optional containing the deserialized object, or empty if deserialization fails
5064 */
5165 public Optional <MerchantUpdatedNotificationRequest > getMerchantUpdatedNotificationRequest () {
52- return getOptionalField (MerchantUpdatedNotificationRequest .class );
66+
67+ var optionalMerchantUpdatedNotificationRequest =
68+ getOptionalField (MerchantUpdatedNotificationRequest .class );
69+
70+ if (optionalMerchantUpdatedNotificationRequest .isPresent ()) {
71+ // verify event type
72+ for (var value : MerchantUpdatedNotificationRequest .TypeEnum .values ()) {
73+ if (value .equals (optionalMerchantUpdatedNotificationRequest .get ().getType ())) {
74+ // found matching event type
75+ return optionalMerchantUpdatedNotificationRequest ;
76+ }
77+ }
78+ }
79+
80+ return Optional .empty ();
5381 }
5482
5583 /**
@@ -59,7 +87,21 @@ public Optional<MerchantUpdatedNotificationRequest> getMerchantUpdatedNotificati
5987 */
6088 public Optional <PaymentMethodCreatedNotificationRequest >
6189 getPaymentMethodCreatedNotificationRequest () {
62- return getOptionalField (PaymentMethodCreatedNotificationRequest .class );
90+
91+ var optionalPaymentMethodCreatedNotificationRequest =
92+ getOptionalField (PaymentMethodCreatedNotificationRequest .class );
93+
94+ if (optionalPaymentMethodCreatedNotificationRequest .isPresent ()) {
95+ // verify event type
96+ for (var value : PaymentMethodCreatedNotificationRequest .TypeEnum .values ()) {
97+ if (value .equals (optionalPaymentMethodCreatedNotificationRequest .get ().getType ())) {
98+ // found matching event type
99+ return optionalPaymentMethodCreatedNotificationRequest ;
100+ }
101+ }
102+ }
103+
104+ return Optional .empty ();
63105 }
64106
65107 /**
@@ -70,7 +112,21 @@ public Optional<MerchantUpdatedNotificationRequest> getMerchantUpdatedNotificati
70112 */
71113 public Optional <PaymentMethodRequestRemovedNotificationRequest >
72114 getPaymentMethodRequestRemovedNotificationRequest () {
73- return getOptionalField (PaymentMethodRequestRemovedNotificationRequest .class );
115+
116+ var optionalPaymentMethodRequestRemovedNotificationRequest =
117+ getOptionalField (PaymentMethodRequestRemovedNotificationRequest .class );
118+
119+ if (optionalPaymentMethodRequestRemovedNotificationRequest .isPresent ()) {
120+ // verify event type
121+ for (var value : PaymentMethodRequestRemovedNotificationRequest .TypeEnum .values ()) {
122+ if (value .equals (optionalPaymentMethodRequestRemovedNotificationRequest .get ().getType ())) {
123+ // found matching event type
124+ return optionalPaymentMethodRequestRemovedNotificationRequest ;
125+ }
126+ }
127+ }
128+
129+ return Optional .empty ();
74130 }
75131
76132 /**
@@ -81,7 +137,22 @@ public Optional<MerchantUpdatedNotificationRequest> getMerchantUpdatedNotificati
81137 */
82138 public Optional <PaymentMethodScheduledForRemovalNotificationRequest >
83139 getPaymentMethodScheduledForRemovalNotificationRequest () {
84- return getOptionalField (PaymentMethodScheduledForRemovalNotificationRequest .class );
140+
141+ var optionalPaymentMethodScheduledForRemovalNotificationRequest =
142+ getOptionalField (PaymentMethodScheduledForRemovalNotificationRequest .class );
143+
144+ if (optionalPaymentMethodScheduledForRemovalNotificationRequest .isPresent ()) {
145+ // verify event type
146+ for (var value : PaymentMethodScheduledForRemovalNotificationRequest .TypeEnum .values ()) {
147+ if (value .equals (
148+ optionalPaymentMethodScheduledForRemovalNotificationRequest .get ().getType ())) {
149+ // found matching event type
150+ return optionalPaymentMethodScheduledForRemovalNotificationRequest ;
151+ }
152+ }
153+ }
154+
155+ return Optional .empty ();
85156 }
86157
87158 /**
@@ -90,7 +161,21 @@ public Optional<MerchantUpdatedNotificationRequest> getMerchantUpdatedNotificati
90161 * @return an Optional containing the deserialized object, or empty if deserialization fails
91162 */
92163 public Optional <TerminalBoardingNotificationRequest > getTerminalBoardingNotificationRequest () {
93- return getOptionalField (TerminalBoardingNotificationRequest .class );
164+
165+ var optionalTerminalBoardingNotificationRequest =
166+ getOptionalField (TerminalBoardingNotificationRequest .class );
167+
168+ if (optionalTerminalBoardingNotificationRequest .isPresent ()) {
169+ // verify event type
170+ for (var value : TerminalBoardingNotificationRequest .TypeEnum .values ()) {
171+ if (value .equals (optionalTerminalBoardingNotificationRequest .get ().getType ())) {
172+ // found matching event type
173+ return optionalTerminalBoardingNotificationRequest ;
174+ }
175+ }
176+ }
177+
178+ return Optional .empty ();
94179 }
95180
96181 /**
@@ -99,7 +184,21 @@ public Optional<TerminalBoardingNotificationRequest> getTerminalBoardingNotifica
99184 * @return an Optional containing the deserialized object, or empty if deserialization fails
100185 */
101186 public Optional <TerminalSettingsNotificationRequest > getTerminalSettingsNotificationRequest () {
102- return getOptionalField (TerminalSettingsNotificationRequest .class );
187+
188+ var optionalTerminalSettingsNotificationRequest =
189+ getOptionalField (TerminalSettingsNotificationRequest .class );
190+
191+ if (optionalTerminalSettingsNotificationRequest .isPresent ()) {
192+ // verify event type
193+ for (var value : TerminalSettingsNotificationRequest .TypeEnum .values ()) {
194+ if (value .equals (optionalTerminalSettingsNotificationRequest .get ().getType ())) {
195+ // found matching event type
196+ return optionalTerminalSettingsNotificationRequest ;
197+ }
198+ }
199+ }
200+
201+ return Optional .empty ();
103202 }
104203
105204 /**
0 commit comments