Ejemplo n.º 1
0
function post_login_get_acf($user_login, $user)
{
    if (false) {
        // TODO: Why do I need to use the field key, and not the field name, in this instance?
        // Get value in Customer ID ACF field (field key = field_561b01c3cecfb)
        $customerId = get_field('field_561b01c3cecfb', 'user_' . $user->ID);
        include_once TEMPLATEPATH . "/portal/api/Api.php";
        include_once TEMPLATEPATH . "/portal/api/Setting.php";
        include_once TEMPLATEPATH . "/portal/api/RequestParams.php";
        include_once TEMPLATEPATH . "/portal/api/BQ_Base.php";
        include_once TEMPLATEPATH . "/portal/api/BQ_CustomerProfile.php";
        include_once TEMPLATEPATH . "/portal/api/BQ_GetAirtimeBalance.php";
        $Api = new Api();
        $requestParams = new requestParams();
        $BQ = new BQ_CustomerProfile();
        $BQ->set_CustomerId($customerId);
        $requestParams->id = Setting::CLEC_ID;
        $requestParams->firstName = Setting::CLEC_FIRSTNAME;
        $requestParams->lastName = Setting::CLEC_LASTNAME;
        $requestParams->details = $BQ;
        $request = $Api->buildRequest($requestParams);
        $Api->callAPI(Setting::URL, $request);
        $BQ->set_response($Api->response);
        WC()->session->set('fullname', $BQ->get_fullName());
        WC()->session->set('customerId', $customerId);
        // NOTE: Not $BQ->get_customerId()
        WC()->session->set('balance', $BQ->get_balance());
        WC()->session->set('balancePastDue', $BQ->get_balancePastDue());
        WC()->session->set('planName', $BQ->get_planName());
        WC()->session->set('planPrice', $BQ->get_planPrice());
        // WC()->session->set('mdn', $BQ->get_telephoneNumber1());
        // WC()->session->set('daysLeft', $BQ->get_daysLeft());
    }
}
Ejemplo n.º 2
0
    }
}
$user_ID = get_current_user_id();
$customerId = get_field('field_561b01c3cecfb', 'user_' . $user_ID);
$session_customerId = WC()->session->get('customerId');
// If the sessions doesn't already exist... go get it from API
if ($customerId && $session_customerId == '') {
    include_once TEMPLATEPATH . "/portal/api/Api.php";
    include_once TEMPLATEPATH . "/portal/api/Setting.php";
    include_once TEMPLATEPATH . "/portal/api/RequestParams.php";
    include_once TEMPLATEPATH . "/portal/api/BQ_Base.php";
    include_once TEMPLATEPATH . "/portal/api/BQ_CustomerProfile.php";
    include_once TEMPLATEPATH . "/portal/api/BQ_GetAirtimeBalance.php";
    $Api = new Api();
    $requestParams = new requestParams();
    $BQ = new BQ_CustomerProfile();
    $BQ->set_CustomerId($customerId);
    $requestParams->id = Setting::CLEC_ID;
    $requestParams->firstName = Setting::CLEC_FIRSTNAME;
    $requestParams->lastName = Setting::CLEC_LASTNAME;
    $requestParams->details = $BQ;
    $request = $Api->buildRequest($requestParams);
    $Api->callAPI(Setting::URL, $request);
    $BQ->set_response($Api->response);
    WC()->session->set('fullname', $BQ->get_fullname());
    WC()->session->set('customerId', $customerId);
    // $BQ->get_customerId()
    WC()->session->set('balance', $BQ->get_balance());
    WC()->session->set('balanceFloat', $BQ->get_balanceFloat());
    WC()->session->set('balancePastDue', $BQ->get_balancePastDue());
    WC()->session->set('planName', (string) $BQ->get_planName());