prefixed all paypal related fonctions with fipf

This commit is contained in:
asus
2024-02-25 15:00:21 +01:00
parent 4e094889c7
commit ec18dc60b4
6 changed files with 59 additions and 60 deletions

View File

@@ -38,7 +38,7 @@ add_action('template_redirect', 'check_paypal_request');
function paypal_shortcode_content()
function fipf_paypal_shortcode_content()
{
$fipfcard_paypal = new PLGNTLS_class();
@@ -69,13 +69,13 @@ function paypal_shortcode_content()
* the js file paypal.js needs to be imported as a module to use import
* @see https://developer.wordpress.org/reference/hooks/script_loader_tag/
*/
add_filter( 'script_loader_tag', 'add_id_to_script', 10, 3 );
function add_id_to_script( $tag, $handle, $src ) {
function fipf_add_id_to_script( $tag, $handle, $src ) {
if ( $handle === 'PLGNTLS_paypal_js' ) {
$tag = '<script type="module" src="' . esc_url( $src ) . '" ></script>';
}
return $tag;
}
add_filter( 'script_loader_tag', 'fipf_add_id_to_script', 10, 3 );
// handling routes and endpoints
@@ -85,12 +85,12 @@ function fipf_routes_endpoints()
$base_rest_route = "fipf_plugin/api/v1";
register_rest_route($base_rest_route, '/orders', array(
'methods' => 'POST',
'callback' => 'handle_orders_request',
'callback' => 'fipf_handle_orders_request',
));
// https://local_fipfcard_plugin.com/wp-json/fipf_plugin/api/v1/orders/21T129305J264761D/capture
register_rest_route($base_rest_route, '/orders/(?P<orderID>[a-zA-Z0-9]+)/capture', array(
'methods' => 'POST',
'callback' => 'handle_orders_capture_request',
'callback' => 'fipf_handle_orders_capture_request',
));
};
add_action('rest_api_init', 'fipf_routes_endpoints');