File: /var/www/html/test.breadsecret.com_bak/test_fcm.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once('wp-load.php');
global $wpdb;
$order_id = 202912;
$user_id = 2161;
$order = new WC_Order( $order_id );
$device_token = get_user_meta($user_id, "device_token", true);
$title = "BSB (TEST)";
$message = "Order# ".$order->get_order_number()." is created";
$type = "TEST BUTTON";
echo "<table style='border-collapse: collapse;' border='1' cellspacing='3' cellpadding='3'>";
echo "<tr><td>user_id</td><td>".$user_id."</td></tr>";
echo "<tr><td>device_token</td><td>".$device_token."</td></tr>";
echo "<tr><td>title</td><td>".$title."</td></tr>";
echo "<tr><td>message</td><td>".$message."</td></tr>";
echo "<tr><td>type</td><td>".$type."</td></tr>";
$wpdb->insert(
'bsb_notification_center',
array(
'hash'=>wp_generate_uuid4(),
'user_id'=>$user_id,
'title'=>$title,
'message'=>$message,
'device_token'=>$device_token,
'type'=>$type,
'reference_id'=>intval(0)
)
);
$notification_id = $wpdb->insert_id;
initPushNotificationAppDevice($title, $message, $device_token, $type, $order_id, $notification_id);
echo "<tr><td>notification_id</td><td>".$notification_id."</td></tr>";
echo "<tr><td>status</td><td>SENT</td></tr>";
echo "</table>";
?>