コード例 #1
0
function add_nsf_order($entry, $form)
{
    $current_user = wp_get_current_user();
    $email = $current_user->user_email;
    //connect to Infusionsoft
    //try{
    $infusionsoft = new iSDK_enhanced();
    $infusionsoft->connect('nq129', '3c8479365cbf050e5017cb77b5d45fdb', $dbOn = 'on', $type = 'i');
    $returnfields = array('ID', 'Firstname', 'Lastname');
    $data = $infusionsoft->findbyemail($email, $returnfields);
    $cid = $data[0]['ID'];
    $product_id = 201;
    //$fund_name = 'Test Fund';
    $price = floatval(rgar($entry, '426'));
    if ($price < 1) {
        $price = '0.00';
    }
    $fund_name = rgar($entry, '2');
    $currentDate = date("d-m-Y");
    $invDate = date('Y-m-d', strtotime($currentDate));
    $oDate = $infusionsoft->infuDate($currentDate);
    //Creates blank order
    $newOrder = $infusionsoft->blankOrder($cid, "New Fund - " . $fund_name, $oDate, 0, 0);
    $newOrder = (int) $newOrder;
    //Adds item to order
    $addItem = $infusionsoft->addOrderItem($newOrder, $product_id, 4, floatval($price), 1, $fund_name, $notes);
    $infusionsoft->manualPmt($newOrder, floatval($price), $oDate, "Campus", "Via API", false);
    //todo: apply manual payment
    //  }
    //catch (Exception $e) {
    //  Logger::write('Could not instantiate Infusionsoft API: ' . $e->getMessage());
    // return FALSE;
    //  }
}
コード例 #2
0
function call_infusion_complet_module($cid, $module_id)
{
    require_once TEMPLATEPATH . '/Services/Infusionsoft/isdk.enhanced.php';
    require_once TEMPLATEPATH . '/Services/Logger/Logger.php';
    Logger::$path = TEMPLATEPATH . '/Services/Logger/log.txt';
    $infusionsoft = new iSDK_enhanced($cid);
    if ($infusionsoft->connect('cl978')) {
        Logger::write('Running - Connected to Infusionsoft. Module: ' . $module_id . ' Contact: ' . $cid);
        $infusionsoft->achieveGoal("cl978", "finishedModule" . $module_id, $cid);
    } else {
        Logger::write('Running - Failed to connected to Infusionsoft. ');
    }
}