if ( ! function_exists( 'tb_booking_tbank_init_payment' ) ) {
    function tb_booking_tbank_init_payment( int $order_post_id, array $data ) {
        if ( ! tb_booking_tbank_is_configured() ) {
            return new WP_Error( 'tbank_not_configured', 'T-Bank credentials are not configured.' );
        }

        $amount = absint( $data['price_rub'] ?? 0 ) * 100;

        if ( $amount <= 0 ) {
            return new WP_Error( 'empty_amount', 'Payment amount is empty.' );
        }

        $order_id = 'TB-' . $order_post_id . '-' . time();
        update_post_meta( $order_post_id, 'tb_booking_tbank_order_id', $order_id );

        $payload = array(
            'TerminalKey'     => (string) constant( 'TBANK_TERMINAL_KEY' ),
            'Amount'          => $amount,
            'OrderId'         => $order_id,
            'Description'     => 'Трансфер Taxi Berlin',
            'PayType'         => 'O',
            // ИСПРАВЛЕННЫЙ АДРЕС УВЕДОМЛЕНИЙ:
            'NotificationURL' => get_rest_url( null, 'tb/v1/tbank-callback' ),
            'SuccessURL'      => add_query_arg( array( 'booking_status' => 'payment_success', 'order_id' => $order_post_id ), home_url( '/booking/' ) ),
            'FailURL'         => add_query_arg( array( 'booking_status' => 'payment_fail', 'order_id' => $order_post_id ), home_url( '/booking/' ) ),
        );

        $payload['Token'] = tb_booking_tbank_token( $payload );

        $response = wp_remote_post(
            'https://securepay.tinkoff.ru/v2/Init',
            array(
                'timeout' => 20,
                'headers' => array( 'Content-Type' => 'application/json; charset=utf-8' ),
                'body'    => wp_json_encode( $payload, JSON_UNESCAPED_UNICODE ),
            )
        );

        if ( is_wp_error( $response ) ) return $response;

        $body = json_decode( wp_remote_retrieve_body( $response ), true );
        update_post_meta( $order_post_id, 'tb_booking_tbank_init_response', wp_json_encode( $body, JSON_UNESCAPED_UNICODE ) );

        if ( empty( $body['Success'] ) || empty( $body['PaymentURL'] ) ) {
            return new WP_Error( 'tbank_init_failed', 'T-Bank Init failed.' );
        }

        if ( ! empty( $body['PaymentId'] ) ) {
            update_post_meta( $order_post_id, 'tb_booking_tbank_payment_id', sanitize_text_field( $body['PaymentId'] ) );
        }

        update_post_meta( $order_post_id, 'tb_booking_status', 'payment_pending' );

        return esc_url_raw( $body['PaymentURL'] );
    }
}<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="https://taxiberlin.ru/wp-content/plugins/slim-seo/src/Sitemaps/style.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://taxiberlin.ru/sitemap-post-type-post.xml</loc>
	</sitemap>
	<sitemap>
		<loc>https://taxiberlin.ru/sitemap-post-type-page.xml</loc>
	</sitemap>
	<sitemap>
		<loc>https://taxiberlin.ru/sitemap-post-type-auto.xml</loc>
	</sitemap>
</sitemapindex>