Code Duplication    Length = 18-18 lines in 2 locations

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

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