Code Duplication    Length = 18-18 lines in 2 locations

includes/class-wc-stripe-webhook-handler.php 2 locations

@@ 326-343 (lines=18) @@
323
	 * @version 4.0.0
324
	 * @param object $notification
325
	 */
326
	public function process_webhook_charge_failed( $notification ) {
327
		$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->id );
328
329
		if ( ! $order ) {
330
			WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->id );
331
			return;
332
		}
333
334
		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
335
336
		if ( 'on-hold' !== $order->get_status() ) {
337
			return;
338
		}
339
340
		$order->update_status( 'failed', __( 'This payment failed to clear.', 'woocommerce-gateway-stripe' ) );
341
342
		do_action( 'wc_gateway_stripe_process_webhook_payment_error', $order, $notification );
343
	}
344
345
	/**
346
	 * Process webhook source canceled. This is used for payment methods
@@ 353-370 (lines=18) @@
350
	 * @version 4.0.0
351
	 * @param object $notification
352
	 */
353
	public function process_webhook_source_canceled( $notification ) {
354
		$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->id );
355
356
		if ( ! $order ) {
357
			WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->id );
358
			return;
359
		}
360
361
		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
362
363
		if ( 'on-hold' !== $order->get_status() || 'cancelled' !== $order->get_status() ) {
364
			return;
365
		}
366
367
		$order->update_status( 'cancelled', __( 'This payment has cancelled.', 'woocommerce-gateway-stripe' ) );
368
369
		do_action( 'wc_gateway_stripe_process_webhook_payment_error', $order, $notification );
370
	}
371
372
	/**
373
	 * Process webhook refund.