Code Duplication    Length = 18-18 lines in 2 locations

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

@@ 370-387 (lines=18) @@
367
	 * @version 4.0.0
368
	 * @param object $notification
369
	 */
370
	public function process_webhook_charge_failed( $notification ) {
371
		$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->id );
372
373
		if ( ! $order ) {
374
			WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->id );
375
			return;
376
		}
377
378
		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
379
380
		if ( 'on-hold' !== $order->get_status() ) {
381
			return;
382
		}
383
384
		$order->update_status( 'failed', __( 'This payment failed to clear.', 'woocommerce-gateway-stripe' ) );
385
386
		do_action( 'wc_gateway_stripe_process_webhook_payment_error', $order, $notification );
387
	}
388
389
	/**
390
	 * Process webhook source canceled. This is used for payment methods
@@ 397-414 (lines=18) @@
394
	 * @version 4.0.0
395
	 * @param object $notification
396
	 */
397
	public function process_webhook_source_canceled( $notification ) {
398
		$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->id );
399
400
		if ( ! $order ) {
401
			WC_Stripe_Logger::log( 'Could not find order via charge ID: ' . $notification->data->object->id );
402
			return;
403
		}
404
405
		$order_id = WC_Stripe_Helper::is_pre_30() ? $order->id : $order->get_id();
406
407
		if ( 'on-hold' !== $order->get_status() || 'cancelled' !== $order->get_status() ) {
408
			return;
409
		}
410
411
		$order->update_status( 'cancelled', __( 'This payment has cancelled.', 'woocommerce-gateway-stripe' ) );
412
413
		do_action( 'wc_gateway_stripe_process_webhook_payment_error', $order, $notification );
414
	}
415
416
	/**
417
	 * Process webhook refund.