Code Duplication    Length = 11-14 lines in 2 locations

includes/gateways/stripe/includes/class-give-stripe-webhooks.php 2 locations

@@ 142-155 (lines=14) @@
139
140
				switch ( $event->type ) {
141
142
					case 'payment_intent.succeeded':
143
						$intent = $event->data->object;
144
145
						if ( 'succeeded' === $intent->status ) {
146
							$donation_id = give_get_purchase_id_by_transaction_id( $intent->id );
147
148
							// Update payment status to donation.
149
							give_update_payment_status( $donation_id, 'publish' );
150
151
							// Insert donation note to inform admin that charge succeeded.
152
							give_insert_payment_note( $donation_id, __( 'Charge succeeded in Stripe.', 'give' ) );
153
						}
154
155
						break;
156
157
					case 'payment_intent.payment_failed':
158
							$intent      = $event->data->object;
@@ 157-167 (lines=11) @@
154
155
						break;
156
157
					case 'payment_intent.payment_failed':
158
							$intent      = $event->data->object;
159
							$donation_id = give_get_purchase_id_by_transaction_id( $intent->id );
160
161
							// Update payment status to donation.
162
							give_update_payment_status( $donation_id, 'failed' );
163
164
							// Insert donation note to inform admin that charge succeeded.
165
							give_insert_payment_note( $donation_id, __( 'Charge failed in Stripe.', 'give' ) );
166
167
						break;
168
169
					case 'charge.refunded':
170
						global $wpdb;