add_action( 'wp_head', 'redsys_force_mark_order_as_paid_on_thankyou_page_2' ); /** * Force mark order as paid on thank you page. * * @return void */ function redsys_force_mark_order_as_paid_on_thankyou_page_2() { if ( isset( $_GET['key'], $_GET['Ds_MerchantParameters'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $order_key = sanitize_text_field( wp_unslash( $_GET['key'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $order_id = wc_get_order_id_by_order_key( $order_key ); if ( $order_id && is_numeric( $order_id ) ) { sleep( 5 ); $is_redsys_order = WCRed()->is_redsys_order( $order_id ); $is_paid = WCRed()->is_paid( $order_id ); $order = wc_get_order( $order_id ); if ( ( $order && $is_redsys_order && ! $is_paid ) || WCRed()->is_payment_method_change_order( $order_id ) ) { // Check the Redsys URL. if ( isset( $_GET['Ds_MerchantParameters'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $params = array( 'Ds_MerchantParameters' => sanitize_text_field( wp_unslash( $_GET['Ds_MerchantParameters'] ) ), // phpcs:ignore WordPress.Security.NonceVerification.Recommended 'Ds_Signature' => isset( $_GET['Ds_Signature'] ) ? sanitize_text_field( wp_unslash( $_GET['Ds_Signature'] ) ) : '', // phpcs:ignore WordPress.Security.NonceVerification.Recommended ); $payment_method = $order->get_payment_method(); $payment_gateway = WC_Payment_Gateways::instance()->payment_gateways()[ $payment_method ]; if ( $payment_gateway && method_exists( $payment_gateway, 'successful_request' ) ) { $payment_gateway->successful_request( $params ); } } } } } }

Borja Sanfelix

Géneros:

Borja Sanfelix

Descubre todo sobre Borja Sanfelix

Libro Sé tan real que duden de ti

Y si te gustan los libros de Borja Sanfelix...

Libro La brújula de las herencias
Libro Maximiza tu entrenamiento por grupos musculares
Libro ¿Por qué hay tanta controversia entre sanitarios?
Libro El robo de la autoestima