Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 538-552 (lines=15) @@
535
	 * @param object $notification
536
	 */
537
	public function process_review_opened( $notification ) {
538
		if ( isset( $notification->data->object->payment_intent ) ) {
539
			$order = WC_Stripe_Helper::get_order_by_intent_id( $notification->data->object->payment_intent );
540
541
			if ( ! $order ) {
542
				WC_Stripe_Logger::log( '[Review Opened] Could not find order via intent ID: ' . $notification->data->object->payment_intent );
543
				return;
544
			}
545
		} else {
546
			$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->charge );
547
548
			if ( ! $order ) {
549
				WC_Stripe_Logger::log( '[Review Opened] Could not find order via charge ID: ' . $notification->data->object->charge );
550
				return;
551
			}
552
		}
553
554
		/* translators: 1) The URL to the order. 2) The reason type. */
555
		$message = sprintf( __( 'A review has been opened for this order. Action is needed. Please go to your <a href="%1$s" title="Stripe Dashboard" target="_blank">Stripe Dashboard</a> to review the issue. Reason: (%2$s)', 'woocommerce-gateway-stripe' ), $this->get_transaction_url( $order ), $notification->data->object->reason );
@@ 571-585 (lines=15) @@
568
	 * @param object $notification
569
	 */
570
	public function process_review_closed( $notification ) {
571
		if ( isset( $notification->data->object->payment_intent ) ) {
572
			$order = WC_Stripe_Helper::get_order_by_intent_id( $notification->data->object->payment_intent );
573
574
			if ( ! $order ) {
575
				WC_Stripe_Logger::log( '[Review Closed] Could not find order via intent ID: ' . $notification->data->object->payment_intent );
576
				return;
577
			}
578
		} else {
579
			$order = WC_Stripe_Helper::get_order_by_charge_id( $notification->data->object->charge );
580
581
			if ( ! $order ) {
582
				WC_Stripe_Logger::log( '[Review Closed] Could not find order via charge ID: ' . $notification->data->object->charge );
583
				return;
584
			}
585
		}
586
587
		/* translators: 1) The reason type. */
588
		$message = sprintf( __( 'The opened review for this order is now closed. Reason: (%s)', 'woocommerce-gateway-stripe' ), $notification->data->object->reason );