コード例 #1
0
echo 'User last name: ' . $current_user->user_lastname . '<br />';
echo 'User display name: ' . $current_user->display_name . '<br />';
echo 'User ID: ' . $current_user->ID . '<br />';
require "bgl360/app/Http/ServiceBgl360.php";
require "bgl360/app/Http/AuthenticationBgl360.php";
require "bgl360/app/Http/ResourceRequestBgl360.php";
require "bgl360/app/Http/Time.php";
//
use App\ServiceBgl360;
use App\AuthenticationBgl360;
use App\ResourceRequestBgl360;
use App\Time;
global $wpdb;
$service_bgl360 = new ServiceBgl360($wpdb, $current_user->ID);
$authentication_bgl360 = new AuthenticationBgl360();
$resource_request_bgl360 = new ResourceRequestBgl360();
$time = new Time();
//Authentication set up
$authentication_bgl360->setRedirectUrlToAuthorizationPage("https://api-staging.bgl360.com.au/oauth/authorize?response_type=code&client_id=5dbf9b2c-981f-44e4-8212-d3b5c74795a1&scope=investment&redirect_uri=https://app.thesmsfacademy.com.au/wp-bgl360-landing.php");
$authentication_bgl360->setMainUri('https://api-staging.bgl360.com.au/oauth/token');
$authentication_bgl360->setAuthorizationCode($authentication_bgl360->getAuthorizationCode());
$authentication_bgl360->setGrantType('authorization_code');
$authentication_bgl360->setScope('investment');
$authentication_bgl360->setClientId('5dbf9b2c-981f-44e4-8212-d3b5c74795a1');
$authentication_bgl360->setClientSecret('b5a0ff39-ef93-4bc7-b5de-e0ace2d7a6fc');
$authentication_bgl360->setRedirectUri('https://app.thesmsfacademy.com.au/wp-bgl360-landing.php');
$authentication_bgl360->setAccessTokenUri($authentication_bgl360->getAccessTokenUri());
echo "Access Token Uri " . $authentication_bgl360->getAccessTokenUri() . '<br>';
//Insert new access token to database print insert token status
//if($service_bgl360->insertNewAccessToken(array('access_token'=>'123123', 'refresh_token'=>'sadasdasd', 'expires_in'=>'123123', 'scope'=> 'investment'))){
//    echo "inserted <br>";
コード例 #2
0
/**
 * Call namespaces
 */
use App\ServiceBgl360;
use App\AuthenticationBgl360;
use App\ResourceRequestBgl360;
use App\Time;
/**
 * Declare local and global variables
 */
global $wpdb;
/**
 * Instantiate classes
 */
$service_bgl360 = new ServiceBgl360($wpdb, $current_user->ID);
$resource_request_bgl360 = new ResourceRequestBgl360();
$document = new \App\Document();
//echo "<pre>";
$current_user = wp_get_current_user();
// get access status if access token is exist
$isExistAccessToken = $service_bgl360->isExistAccessToken();
//check access token status from bgl360
// if access token is expired then
/**
 * Get the users token information from smsf database
 */
$currentUser['bgl360_token'] = $service_bgl360->getCurrentAccessTokenByUser();
$queryData['access_token'] = $currentUser['bgl360_token'][0]['access_token'];
$queryData['token_type'] = $currentUser['bgl360_token'][0]['token_type'];
$queryData['refresh_token'] = $currentUser['bgl360_token'][0]['refresh_token'];
$queryData['expires_in'] = $currentUser['bgl360_token'][0]['expires_in'];
/**
 * Call namespaces
 */
use App\ServiceBgl360;
use App\AuthenticationBgl360;
use App\ResourceRequestBgl360;
/**
 * Declare local and global variables
 */
global $wpdb;
/**
 * Instantiate classes
 */
$current_user = wp_get_current_user();
$service_bgl360 = new ServiceBgl360($wpdb, $current_user->ID);
$resource_request_bgl360 = new ResourceRequestBgl360();
//echo "This is the post data";
//print_r($_REQUEST);
//echo "current user id " .  $current_user->ID . ' <br>';
$fundList = $_REQUEST['fundList'];
$accessToken = $_REQUEST['accessToken'];
$currentUser = $service_bgl360->getCurrentAccessTokenByUser();
//echo "<pre>";
//print_r($currentUser);
//echo "current token of the user " . $currentUser[0]['access_token'] . '<br>';
//echo "access token " . $currentUser[0]['bgl360_token'];
if ($_POST) {
    // echo "<pre>";
    $members = $resource_request_bgl360->getFundMembers($fundList, $currentUser[0]['access_token']);
    // print_r($members);
    echo '<content-label><label for="fundList">Choose Fund Member: </label><content-label>';