Code Duplication    Length = 13-15 lines in 3 locations

includes/gateways/stripe/includes/give-stripe-helpers.php 1 location

@@ 1108-1122 (lines=15) @@
1105
				give_send_to_success_page();
1106
1107
			}
1108
		} else {
1109
1110
			// No customer, failed.
1111
			give_record_gateway_error(
1112
				__( 'Stripe Customer Creation Failed', 'give' ),
1113
				sprintf(
1114
					/* translators: %s Donation Data */
1115
					__( 'Customer creation failed while processing the donation. Details: %s', 'give' ),
1116
					wp_json_encode( $donation_data )
1117
				)
1118
			);
1119
			give_set_error( 'stripe_error', __( 'The Stripe Gateway returned an error while processing the donation.', 'give' ) );
1120
			give_send_back_to_checkout( '?payment-mode=' . give_clean( $_POST['payment-mode'] ) );
1121
1122
		} // End if().
1123
	} else {
1124
		give_send_back_to_checkout( '?payment-mode=' . give_clean( $_POST['payment-mode'] ) );
1125
	} // End if().

includes/gateways/stripe/includes/payment-methods/class-give-stripe-card.php 2 locations

@@ 197-209 (lines=13) @@
194
					$donation_id = give_insert_payment( $payment_data );
195
196
					// Return error, if donation id doesn't exists.
197
					if ( ! $donation_id ) {
198
						give_record_gateway_error(
199
							__( 'Donation creating error', 'give' ),
200
							sprintf(
201
								/* translators: %s Donation Data */
202
								__( 'Unable to create a pending donation. Details: %s', 'give' ),
203
								wp_json_encode( $donation_data )
204
							)
205
						);
206
						give_set_error( 'stripe_error', __( 'The Stripe Gateway returned an error while creating a pending donation.', 'give' ) );
207
						give_send_back_to_checkout( '?payment-mode=' . give_clean( $_GET['payment-mode'] ) );
208
						return false;
209
					}
210
211
					// Assign required data to array of donation data for future reference.
212
					$donation_data['donation_id'] = $donation_id;
@@ 281-295 (lines=15) @@
278
						give_send_to_success_page();
279
280
					}
281
				} else {
282
283
					// No customer, failed.
284
					give_record_gateway_error(
285
						__( 'Stripe Customer Creation Failed', 'give' ),
286
						sprintf(
287
							/* translators: %s Donation Data */
288
							__( 'Customer creation failed while processing the donation. Details: %s', 'give' ),
289
							wp_json_encode( $donation_data )
290
						)
291
					);
292
					give_set_error( 'stripe_error', __( 'The Stripe Gateway returned an error while processing the donation.', 'give' ) );
293
					give_send_back_to_checkout( '?payment-mode=' . give_clean( $_GET['payment-mode'] ) );
294
295
				} // End if().
296
			} else {
297
				give_send_back_to_checkout( '?payment-mode=' . give_clean( $_GET['payment-mode'] ) );
298
			} // End if().