Code Duplication    Length = 18-18 lines in 2 locations

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

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