/**
  * Subscribes to Infusionsoft list. Returns either "success" string or error message.
  * @return string
  */
 function subscribe_infusionsoft($api_key, $app_id, $list_id, $email, $name = '', $last_name = '')
 {
     if (!function_exists('curl_init')) {
         return __('curl_init is not defined ', 'rapidology');
     }
     if (!class_exists('iSDK')) {
         require_once RAD_RAPIDOLOGY_PLUGIN_DIR . 'subscription/infusionsoft/isdk.php';
     }
     try {
         $infusion_app = new iSDK();
         $infusion_app->cfgCon($app_id, $api_key, 'throw');
     } catch (iSDKException $e) {
         $error_message = $e->getMessage();
     }
     $contact_details = array('FirstName' => $name, 'LastName' => $last_name, 'Email' => $email);
     $new_contact_id = $infusion_app->addWithDupCheck($contact_details, $checkType = 'Email');
     $infusion_app->optIn($contact_details['Email']);
     $response = $infusion_app->grpAssign($new_contact_id, $list_id);
     if ($response) {
         $error_message = 'success';
     } else {
         $error_message = esc_html__('Already In List', 'rapidology');
     }
     return $error_message;
 }
 public static function donation_button_infusionsoft_handler($posted)
 {
     $is_api_key = get_option("infusionsoft_api_key");
     $app_name = get_option("infusionsoft_api_app_name");
     $is_list_id = get_option("infusionsoft_lists");
     $fname = isset($posted['first_name']) ? $posted['first_name'] : '';
     $lname = isset($posted['last_name']) ? $posted['last_name'] : '';
     $email = isset($posted['payer_email']) ? $posted['payer_email'] : $posted['receiver_email'];
     $debug = get_option('log_enable_infusionsoft') == 'yes' ? 'yes' : 'no';
     if ('yes' == $debug) {
         $log = new Donation_Button_Logger();
     }
     if (isset($is_api_key) && !empty($is_api_key) && (isset($app_name) && !empty($app_name)) && (isset($is_list_id) && !empty($is_list_id))) {
         include_once DBP_PLUGIN_DIR_PATH . '/admin/partials/lib/infusionsoft/isdk.php';
         $app = new iSDK();
         try {
             if ($app->cfgCon($app_name, $is_api_key)) {
                 $contactid = $app->addCon(array('FirstName' => $fname, 'LastName' => $lname, 'Email' => $email));
                 $infusionsoft_result = $app->campAssign($contactid, $is_list_id);
                 if ('yes' == $debug) {
                     $log->add('Infusionsoft', print_r($infusionsoft_result, true));
                 }
             }
         } catch (Exception $e) {
             if ('yes' == $debug) {
                 $log->add('Infusionsoft', print_r($e, true));
             }
         }
     }
 }
Ejemplo n.º 3
0
 public function getClient()
 {
     if (null === $this->client) {
         $this->client = new iSDK();
         $this->client->cfgCon($this->accountId, $this->apiKey);
     }
     return $this->client;
 }
 public function register(Application $app)
 {
     $app['isdk'] = $app->share(function () use($app) {
         $isdk = new \iSDK();
         $isdk->cfgCon($app['isdk.appName'], $app['isdk.key']);
         return $isdk;
     });
 }
Ejemplo n.º 5
0
 /**
  * Total paid to affiliates
  */
 public function paidToAffiliates()
 {
     return "0";
     $from = strtotime("midnight", strtotime($this->_search_params['from']));
     $to = strtotime("tomorrow", strtotime($this->_search_params['to'])) - 1;
     if ($this->_search_params['affiliate'] and $this->_search_params['affiliate'] != "no-affiliate") {
         $cache_key = "paidToAffiliates_" . $from . "_" . $to . "_" . $this->_search_params['affiliate'];
     } else {
         $cache_key = "paidToAffiliates_" . $from . "_" . $to;
     }
     if (Cache::has($cache_key)) {
         return Cache::get($cache_key);
     }
     $amount = 0;
     $start = date('Ymd\\TH:i:s', $from);
     $finish = date('Ymd\\TH:i:s', $to);
     // Get all affilaites from DK DB
     $affiliates = Affiliate::get();
     // Add InfusionSoft Library
     require_once app_path() . "/libraries/infusionsoft/isdk.php";
     $isapp = new iSDK();
     // Create Connection
     if ($isapp->cfgCon("comissionTracker")) {
         if ($this->_search_params['affiliate'] and $this->_search_params['affiliate'] != "no-affiliate") {
             $pays = $isapp->affPayouts($this->_search_params['affiliate'], $start, $finish);
             foreach ($pays as $payout) {
                 $amount = $amount + $payout['PayAmt'];
             }
         } else {
             foreach ($affiliates as $affiliate) {
                 $affiliateId = $affiliate->id;
                 $pays = $isapp->affPayouts($affiliateId, $start, $finish);
                 foreach ($pays as $payout) {
                     $amount = $amount + $payout['PayAmt'];
                 }
             }
         }
     }
     $amount = number_format($amount);
     Cache::put($cache_key, $amount, 10);
     return $amount;
 }
 /**
  * Override of parent::achieveGoal to support auto-retry
  *
  * @param  string  $integration  The integration name of the API Goal
  * @param  string  $call_name    The call name of the API Goal
  * @param  uint    $contact_id   The contact ID of the contact on which to execute
  * @return mixed[]
  */
 public function achieveGoal($integration, $call_name, $contact_id)
 {
     $tries = 0;
     do {
         $result = parent::achieveGoal($integration, $call_name, $contact_id);
     } while ((!is_array($result) || !$result[0]['success']) && ++$tries < 3);
     if (!is_array($result) || !$result[0]['success']) {
         file_put_contents(dirname(__FILE__) . '/log.txt', "Call to achieveGoal failed ({$tries} tries): " . PHP_EOL . print_r($integration, TRUE) . PHP_EOL . print_r($call_name, TRUE) . PHP_EOL . print_r($contact_id, TRUE) . PHP_EOL . print_r($result, TRUE) . PHP_EOL . PHP_EOL, FILE_APPEND);
     }
     return $result;
 }
Ejemplo n.º 7
0
 public function getTest()
 {
     //require_once app_path() .  DIRECTORY_SEPARATOR . "";
     require_once app_path() . "/libraries/infusionsoft/isdk.php";
     $isapp = new iSDK();
     // Get Affiliate ID from Cookie
     $affiliate_id = Cookie::get('_dks_isa');
     // Create Connection
     if ($isapp->cfgCon("comissionTracker")) {
         // find contact by email
         $contacts = $isapp->findByEmail('*****@*****.**', array('Id', 'Email'));
         // If contact found
         if (!empty($contacts[0]['Id'])) {
             $contact_id = $contacts[0]['Id'];
         } else {
             // Create new contact
             $contactData = array('Email' => '*****@*****.**');
             $contact_id = $isapp->addCon($contactData);
         }
         echo $contact_id;
         echo "<br><br>";
         // Testing Order Through Invoice
         //Sets current date
         $currentDate = date("d-m-Y");
         $oDate = $isapp->infuDate($currentDate);
         echo "date set<br/>";
         //Creates blank order
         $newOrder = $isapp->blankOrder($contact_id, "New Order for Contact {$contact_id}", $oDate, NULL, $affiliate_id);
         echo "newOrder=" . $newOrder . "<br/>";
         //$newOrder = 710;
         // Add Order Item - Product ID
         // type = 4 or 9 (Product or Subscription)
         $result = $isapp->addOrderItem($newOrder, 24, 4, 50.0, 1, "Sale Made From API", "Generated Through API");
         echo "item added<br/>";
         //print_r($result);
         // Add Manual Payment - since CC charged with Stripe
         $payment = $isapp->manualPmt($newOrder, 50.0, $oDate, "credit", "Order done through API / Stripe", false);
         print_r($payment);
     } else {
         echo "Connection Failed";
     }
     //$affiliate_id = Cookie::get('_dks_isa');
     //echo "hi " . app_path();
 }
<?php

require_once "../src/isdk.php";
$app = new iSDK();
if ($app->cfgCon("connectionName", "api-key", "throw")) {
    echo "connected<br/>";
    echo "app connected<br/>";
    $qry = array("FakeColumn" => "FakeValue");
    try {
        $r = $app->dsQuery("FakeTable", 1, 0, $qry, array("FakeColumn"));
    } catch (iSDKException $e) {
        echo "iSDKException code {$e->getCode()}, message: {$e->getMessage()}\n";
        exit;
    }
    echo "Test failed: exception should have been thrown\n";
    exit(1);
} else {
    echo "connection failed";
}
Ejemplo n.º 9
0
<?php

require_once "../src/isdk.php";
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    echo "connected<br/>";
    echo "app connected<br/>";
    $cid = 36;
    $returnFields = array('Email', 'FirstName', 'LastName');
    $conDat = $app->loadCon($cid, $returnFields);
    echo "<pre>";
    print_r($conDat);
    echo "</pre>";
} else {
    echo "Connection Failed";
}
<?php

require_once "../src/isdk.php";
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    echo "connected<br/>";
    echo "app connected<br/>";
    $tmpId = $app->addEmailTemplate("This is my API template", 'Test', '*****@*****.**', '*****@*****.**', '', '', 'This is my API Template', 'Test Text Body', '', 'TEXT', 'Contact');
    echo "Template " . $tmpId . " has been created!";
} else {
    echo "Connection Failed";
}
Ejemplo n.º 11
0
}
//*=================
//* INCLUDES
//*=================
//INFUSIONSOFT
include 'includes/isdk.php';
//WISHLISTMEMBER
include '../members/wp-config.php';
include '../members/wp-includes/pluggable.php';
//*=================
//*=================
//* CONFIGURATION
//*=================
//INFUSIONSOFT
$connInfo = array('main:mojo:i:679c2a2a6aef93984f48e3ec4794db26:Mojo Video');
$infusion = new iSDK();
$infusion->cfgCon("main");
//*=================
//* WISHLIST
//*=================
//WISHLISTMEMBER
$wishlist = new wlmapiclass('http://www.mojoleadmastery.com/members', 'LXbfqw59CFNUWaexLXbfqw59CFNUWaex');
$wishlist->return_format = 'php';
// <- value can also be xml or json
//*===============================
//* GET USER INFORMATION FROM IS
//*===============================
$returnFields = array('contactId');
$query = array('Id' => $order_id);
$contacts = $infusion->dsQuery("Job", 1, 0, $query, $returnFields);
$fields = array('FirstName', 'LastName', 'Email', 'Phone1', 'Company', 'Username', 'Password');
Ejemplo n.º 12
0
 /**
  * Subscribes to Infusionsoft list. Returns either "success" string or error message.
  * @return string
  */
 function subscribe_infusionsoft($api_key, $app_id, $list_id, $email, $name = '', $last_name = '')
 {
     if (!function_exists('curl_init')) {
         return __('curl_init is not defined ', 'bloom');
     }
     if (!class_exists('iSDK')) {
         require_once ET_BLOOM_PLUGIN_DIR . 'subscription/infusionsoft/isdk.php';
     }
     try {
         $infusion_app = new iSDK();
         $infusion_app->cfgCon($app_id, $api_key, 'throw');
     } catch (iSDKException $e) {
         $error_message = $e->getMessage();
     }
     if (empty($error_message)) {
         $contact_data = $infusion_app->dsQuery('Contact', 1, 0, array('Email' => $email), array('Id', 'Groups'));
         if (0 < count($contact_data)) {
             if (false === strpos($contact_data[0]['Groups'], $list_id)) {
                 $infusion_app->grpAssign($contact_data[0]['Id'], $list_id);
                 $error_message = 'success';
             } else {
                 $error_message = __('Already subscribed', 'bloom');
             }
         } else {
             $contact_details = array('FirstName' => $name, 'LastName' => $last_name, 'Email' => $email);
             $new_contact_id = $infusion_app->dsAdd('Contact', $contact_details);
             $infusion_app->grpAssign($new_contact_id, $list_id);
             $error_message = 'success';
         }
     }
     return $error_message;
 }
Ejemplo n.º 13
0
<?php

//include the SDK
require_once "../../src/isdk.php";
//build our application object
$app = new iSDK();
//connect to the API - change demo to be whatever your connectionName is!
if ($app->cfgCon("demo")) {
    //action set Id number to run on the posted contact
    $actionId = 123;
    //grab our posted contact fields
    $contact = array('Email' => $_POST['Contact0Email'], 'FirstName' => $_POST['Contact0FirstName'], 'LastName' => $_POST['Contact0LastName']);
    //grab the returnURL
    $returnURL = $_POST['returnURL'];
    //dup check on email if it exists.
    if (!empty($contact['Email'])) {
        //check for existing contact;
        $returnFields = array('Id');
        $dups = $app->findByEmail($contact['Email'], $returnFields);
        if (!empty($dups)) {
            //update contact
            $app->updateCon($dups[0]['Id'], $contact);
            //run an action set on the contact
            $app->runAS($dups[0]['Id'], $actionId);
        } else {
            //Add new contact
            $newCon = $app->addCon($contact);
            //run an action set on the contact
            $app->runAS($newCon, $actionId);
        }
        //Send them to the success page
Ejemplo n.º 14
0
    $niveau = $niveau . $array[count($array) - 1] . ", ";
    //recuperer le dernier élément du tableau qui correspond au niveaux
}
if (isset($presi_dg)) {
    $array = explode(',', $presi_dg);
    //Extraire les éléments séprés par des virgule et les mettre dans un tableau
    $niveau = $niveau . $array[count($array) - 1] . ", ";
    //recuperer le dernier élément du tableau qui correspond au niveaux
}
//pour l'anglais
$array = explode(',', $anglais);
//Extraire les éléments séprés par des virgule et les mettre dans un tableau
$anglais_champs = $anglais_champs . $array[count($array) - 1] . ", ";
//recuperer le dernier élément du tableau qui correspond au niveaux
//echo "tous les niveaux".utf8_encode($niveau);
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    if (find_id_by_email($email, $app) != 0) {
        $exist = true;
        $contactLeadId = '';
    } else {
        $exist = false;
        $contactLeadId = 22;
    }
    if (is_uploaded_file($_FILES['fichiercv']['tmp_name'])) {
        $url = file_upload($filename, enlever_accents($nom), enlever_accents($prenom), $telephone1);
    }
    $contact = array("FirstName" => $nom, "LastName" => $prenom, "Email" => $email, "Phone1" => $telephone1, "Phone2" => $telephone2, "State" => $province, "StreetAddress1" => $adresse, "PostalCode" => $codepostal, "City" => $ville, "ContactNotes" => $commentaire, "Website" => $url, "ContactType" => 'ANCIA Candidat', "LeadSourceId" => $contactLeadId, "_Formation" => utf8_encode(remove_underscor($f)), "_Experienceprofessionnelle" => utf8_encode($tous_dpartement), "_Niveauhirarchique" => $niveau, "_Langue" => $anglais_champs);
    //$url_cv='http://emploi.lefebvrefortier.ca/'.file_upload($filename,$nom,$prenom,$telephone1);
    //$CID=ajoutContact($contact);
    //créer le tag pour postuler
Ejemplo n.º 15
0
<?php

require_once "../src/isdk.php";
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    echo "connected<br/>";
    echo "app connected<br/>";
    $qry = array('JobTitle' => 'New Order for Contact 123');
    $rets = array('Id');
    $cards = $app->dsQuery("Job", 100, 0, $qry, $rets);
    echo "<pre>";
    print_r($cards);
    echo "</pre>";
} else {
    echo "Connection Failed";
}
Ejemplo n.º 16
0
if ($level == "") {
    die("No level specified.");
}
//*=================
//* INCLUDES
//*=================
//INFUSIONSOFT
include 'includes/isdk.php';
//WISHLISTMEMBER
include 'includes/wlmapiclass.php';
//*=================
//* CONFIGURATION
//*=================
//INFUSIONSOFT
$connInfo = array('main:mojo:i:679c2a2a6aef93984f48e3ec4794db26:Mojo Video');
$infusion = new iSDK();
$infusion->cfgCon("main");
//WISHLISTMEMBER
$wishlist = new wlmapiclass('http://www.mojovideouniversity.com/', 'LXbfqw59CFNUWaexLXbfqw59CFNUWaex');
$wishlist->return_format = 'php';
// <- value can also be xml or json
//*===============================
//* GET USER INFORMATION FROM IS
//*===============================
$fields = array('FirstName', 'LastName', 'Email', 'Phone1', 'Company', 'Username', 'Password');
$IS_DATA = $infusion->loadCon((int) $contactId, $fields);
//*==============================================
//* POST TO MOJO VIDEO UNIVERSITY
//* http://mojovideouniversity.com/
//*==============================================
//SET LEVEL
<?php

require_once "../src/isdk.php";
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    echo "connected<br/>";
    echo "app connected<br/>";
    $cid = 36;
    $groupId = 99;
    $result = $app->grpAssign($cid, $groupId);
    echo "tag applied to contact . " . $cid . "<br/>";
    $campId = 83;
    $result = $app->campAssign($cid, $campId);
    echo "Added " . $cid . " to Followup Sequence " . $campId . "<br/>";
} else {
    echo "Connection Failed";
}
Ejemplo n.º 18
0
<?php

require_once "../src/isdk.php";
$app = new iSDK();
echo "created object<br/>";
if ($app->cfgCon("connectionName")) {
    echo "app connected<br/>";
    $cid = 36;
    $tagId = 184;
    $result = $app->grpAssign($cid, $tagId);
} else {
    echo "connection failed!<br/>";
}
Ejemplo n.º 19
0
    <?php 
include 'config.php';
require "src/isdk.php";
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    echo "app connected<br/>";
    $contactId = (int) $_POST['contactId'];
    $number = (int) $_POST['number'];
    $field = $_POST['field'];
    // Get Value of Current Field
    $counter = $app->loadCon($contactId, array("{$field}"));
    $countervalue = $counter[$field];
    // Do Some Math
    $newvalue = $countervalue + $number;
    echo "Old value = {$countervalue} <br> New Value = {$newvalue} <br> Field Incrased by {$number}";
    // Update The field With New Value
    $conDat = array($field => $newvalue);
    $app->updateCon($contactId, $conDat);
} else {
    echo "Connection to API failed";
}
Ejemplo n.º 20
0
 * 
 * Author : John W. Borelli with The Plan B Club, LLC for Rob Drummond and his
 * 			client, Ian Ashfield of Ashland Chemicals.
 * 
 * Inputs : All input is extracted via .csv file reads
 * 
 * Outputs: All output will be found in the form of resulting data being
 * 			imported into the appropriate Infusionsoft app.
 * 
******************************************************************************/
// Include required support files
include_once 'EKMConfig.php';
require_once 'Infusionsoft/infusionsoft.php';
require_once 'src/isdk.php';
// Instantiate all required objects
$app = new iSDK();
$eml = new Infusionsoft_EmailService();
$contact = new Infusionsoft_Contact();
$contactgroup = new Infusionsoft_ContactGroupAssign();
// Global initializations
$app->cfgCon($appname, $appkey);
$tName = 'Contact';
$query = array('Id' => '%');
$limit = 1000;
$page = 0;
$rFields = array('Email', 'Id');
$count = 0;
$prodcount = 0;
$concount = 0;
$found = false;
$sel = -1;
Ejemplo n.º 21
0
<?php

require_once "src/isdk.php";
$app = new iSDK();
$app_name = '';
// Replace with Your Infusionsoft APP Name
$app_key = '';
// Replace with Your Infusionsoft API Key
if (empty($app_name)) {
    echo 'Your APP Name is empty. Please set your app name to your Infusionsoft API name.<br>';
    return;
}
if (empty($app_key)) {
    echo 'Your APP key is empty. Please set your app key to your Infusionsoft API key.<br>';
    return;
}
if ($app->cfgCon($app_name, $app_key)) {
    // Connected to Infusionsoft - Run Your Code Below
    echo 'Connected to Infusionsoft<br>';
} else {
    echo 'Error connecting to Infusionsoft. Please make sure your keys are correct.';
}
 public static function donation_button_get_infusionsoft_lists()
 {
     $infusionsoft_lists = array();
     $enable_infusionsoft = get_option('enable_infusionsoft');
     if (isset($enable_infusionsoft) && $enable_infusionsoft == 'yes') {
         $infusionsoft_debug = get_option('log_enable_infusionsoft') == 'yes' ? 'yes' : 'no';
         $log = new Donation_Button_Logger();
         $infusionsoft_lists = unserialize(get_transient('donation_button_infusionsoft_list'));
         if (empty($infusionsoft_lists) || get_option('donation_button_infusionsoft_force_refresh') == 'yes') {
             include_once DBP_PLUGIN_DIR_PATH . '/admin/partials/lib/infusionsoft/isdk.php';
             $infusionsoft_api_key = get_option('infusionsoft_api_key');
             $infusionsoft_api_app_name = get_option('infusionsoft_api_app_name');
             if (isset($infusionsoft_api_key) && !empty($infusionsoft_api_key) && (isset($infusionsoft_api_app_name) && !empty($infusionsoft_api_app_name))) {
                 $app = new iSDK();
                 try {
                     if ($app->cfgCon($infusionsoft_api_app_name, $infusionsoft_api_key)) {
                         $returnFields = array('Id', 'Name');
                         $query = array('Id' => '%');
                         $lists = $app->dsQuery("Campaign", 1000, 0, $query, $returnFields);
                     }
                 } catch (Exception $e) {
                     unset($infusionsoft_lists);
                     $infusionsoft_lists['false'] = $e->getMessage();
                 }
                 if (count($lists) > 0 and is_array($lists)) {
                     unset($infusionsoft_lists);
                     foreach ($lists as $list) {
                         $infusionsoft_lists[$list['Id']] = $list['Name'];
                     }
                     delete_transient('donation_button_infusionsoft_list');
                     set_transient('donation_button_infusionsoft_list', serialize($infusionsoft_lists), 86400);
                     if ('yes' == $infusionsoft_debug) {
                         $log->add('Infusionsoft', 'Infusionsoft Get List Success..');
                     }
                     update_option('donation_button_infusionsoft_force_refresh', 'no');
                 } else {
                     if ('yes' == $infusionsoft_debug) {
                         $log->add('Infusionsoft', 'Infusionsoft API Key And Application Name Please Check.');
                     }
                 }
             } else {
                 if ('yes' == $infusionsoft_debug) {
                     $log->add('Infusionsoft', 'Required information is empty.');
                 }
                 $infusionsoft_lists['false'] = __("Required information is empty.", 'donation-button');
             }
         }
     }
     return $infusionsoft_lists;
 }
Ejemplo n.º 23
0
 * 
 * Author : John W. Borelli with The Plan B Club, LLC for Rob Drummond and his
 * 			client, Ian Ashland of Ashland Chemicals.
 * 
 * Inputs : All input is extracted via .csv file reads
 * 
 * Outputs: All output will be found in the form of resulting data being
 * 			imported into the appropriate Infusionsoft app.
 * 
******************************************************************************/
// Include required support files
include_once 'EKMConfig.php';
require_once 'Infusionsoft/infusionsoft.php';
require_once 'src/isdk.php';
// Instantiate all required objects
$thisapp = new iSDK();
$thisapp->cfgCon($appname, $appkey);
$data = new Infusionsoft_DataService();
/*$order=new Infusionsoft_Job();

$order->JobTitle='This is a test order';
$order->ContactId=50005;
$order->ShipCity='Phoenix';
$order->ShipFirstName='Joe';
$order->ShipLastName='Blow';
$order->ShipPhone='6026168008';
$order->ShipState='AZ';
$order->ShipStreet1='3825 W Anthem Way #3151';
$order->ShipZip='85086';
$order->save();*/
/*
Ejemplo n.º 24
0
 * 				   using the infusionsoft api.
 * 
 * Author : John W. Borelli with The Plan B Club, LLC for Rob Drummond and his
 * 			client, Ian Ashland of Ashland Chemicals.
 * 
 * Inputs : All input is extracted via .csv file reads
 * 
 * Outputs: All output will be found in the form of resulting data being
 * 			imported into the appropriate Infusionsoft app.
 * 
******************************************************************************/
// Include required support files
require_once 'Infusionsoft/infusionsoft.php';
require_once 'src/isdk.php';
// Instantiate all required objects
$app = new iSDK();
$products = new Infusionsoft_Product();
$orderitems = new Infusionsoft_OrderItem();
$invoices = new Infusionsoft_Invoice();
$invoiceitems = new Infusionsoft_InvoiceItem();
$invoicepayments = new Infusionsoft_InvoicePayment();
$invoiceservice = new Infusionsoft_InvoiceService();
$contact = new Infusionsoft_Contact();
$contactgroup = new Infusionsoft_ContactGroupAssign();
// Global initializations
$app->cfgCon('yo243', 'c959c2b28a10eb74a2d5af154ba1986d');
$tName = 'Product';
$query = array('Id' => '%');
$limit = 1000;
$page = 0;
$rFields = array('ShortDescription');
function NotifyCompleteProfileByInfusionsoftID($infusionsoft_id)
{
    //this is used for appylying a infusionsoft group (tag) for customers who complete their profile.
    //auth.php will access this function
    require_once 'isdk.php';
    $app = new iSDK();
    if ($app->cfgCon("mps")) {
        $app->grpAssign($infusionsoft_id, 314);
    }
}
if ($level == "") {
    die("No level specified.");
}
//*=================
//* INCLUDES
//*=================
//INFUSIONSOFT
include 'includes/isdk.php';
//WISHLISTMEMBER
include 'includes/wlmapiclass.php';
//*=================
//* INFUSIONSOFT
//*=================
//INFUSIONSOFT
$connInfo = array('main:mojo:i:679c2a2a6aef93984f48e3ec4794db26:Mojo Video');
$infusion = new iSDK();
$infusion->cfgCon("main");
//*=================
//* WISHLIST
//*=================
if ($membership === 'mojoleadmastery') {
    $wishlist = new wlmapiclass('http://www.mojoleadmastery.com/', '5ae8c42d96a15001cfd6b70de330b70b');
} else {
    if (!is_object($wishlist)) {
        die('Invalid membership program specified.');
    }
}
$wishlist->return_format = 'php';
//*===============================
//* GET USER INFORMATION FROM IS
//*===============================
Ejemplo n.º 27
0
<meta charset="UTF-8">
</head>
<body>

<?php 
if (!isset($_GET['email'])) {
    print_r("pas d'email");
    exit;
}
if (!isset($_GET['autre'])) {
    print_r("erreur dans l'url");
    exit;
}
$email = test_input(urldecode($_GET['email']));
$id = test_input($_GET['autre']);
$app = new iSDK();
if ($app->cfgCon("connectionName")) {
    if (find_email($id, $app) != $email) {
        echo "erreur de chargement de données!";
        exit;
    }
    $returnFields = array('FirstName', 'LastName', 'Id', 'Email');
    $conDat = $app->dsLoad("Contact", $id, $returnFields);
} else {
    echo "Erreur de connexion ifst";
    exit;
}
?>


<div class="col-md-12 ">
Ejemplo n.º 28
0
}
$contactId = $_REQUEST['Id'];
if ($contactId == "") {
    die("No contact ID was specified.");
}
//*=================
//* INCLUDES
//*=================
//INFUSIONSOFT
include 'includes/isdk.php';
//*=================
//* CONFIGURATION
//*=================
//INFUSIONSOFT
$connInfo = array('main:mojo:i:679c2a2a6aef93984f48e3ec4794db26:Mojo Video');
$app = new iSDK();
$app->cfgCon("main");
//*===============================
//* GET USER INFORMATION FROM IS
//*===============================
$fields = array('FirstName', 'LastName', 'Email', 'Phone1', 'Company', '_PlanCode', '_UserId', '_WishListId', '_WishListLevels');
$IS_DATA = $app->loadCon((int) $contactId, $fields);
//*==============================================
//* CANCEL MOJO VIDEO UNIVERSITY ACCOUNT
//* http://mojovideouniversity.com/
//*==============================================
//KEY
$Secret = "LXbfqw59CFNUWaex";
//PARAMETERS
$fxn = 'DeleteUserLevels';
$WishListId = $IS_DATA['_WishListId'];
 public function shoppingcart()
 {
     if (isset($_POST['first_name'])) {
         $app = new \iSDK();
         if ($app->cfgCon("connectionName")) {
             $qry = array('Email' => $_POST['emailAddress']);
             $ret = array("Id");
             $dups = $app->dsQuery("Contact", 1, 0, $qry, $ret);
             if (empty($dups)) {
                 $contact = array("FirstName" => $_POST['first_name'], "LastName" => $_POST['last_name'], "State" => $_POST['state'], "Phone1" => $_POST['phoneNumber'], "City" => $_POST['city'], "Email" => $_POST['emailAddress'], "Address1Type" => $_POST['addressLine1'], "ZipFour1" => $_POST['last_name'], "Country" => $_POST['last_name'], "Company" => $_POST['company']);
                 $date = date('d/m/y');
                 $cid = $app->addCon($contact);
             } else {
                 $cid = $dups[0]['Id'];
                 $contact = array("FirstName" => $_POST['first_name'], "LastName" => $_POST['last_name'], "State" => $_POST['state'], "Phone1" => $_POST['phoneNumber'], "City" => $_POST['city'], "Email" => $_POST['emailAddress'], "Address1Type" => $_POST['addressLine1'], "ZipFour1" => $_POST['last_name'], "Country" => $_POST['last_name'], "Company" => $_POST['company']);
                 $contact_ID = $app->updateCon($cid, $contact);
             }
             $fullname = explode(" ", $_POST['nameoncard']);
             $card['FirstName'] = $fullname[0];
             $card['LastName'] = $fullname[1];
             $card['CardNumber'] = $_POST['cnumber'];
             $card['ExpirationMonth'] = $_POST['cardmonth'];
             $card['ExpirationYear'] = $_POST['cardyear'];
             $card['CVV2'] = $_POST['CVV'];
             $result = $app->validateCard($card);
             if ($result['Valid'] == 'false') {
                 $msg = "Order cancel due to credit card";
                 return view('licenses.shoppingcart', compact('msg'));
             } else {
                 $ccid = $app->dsAdd("CreditCard", $card);
                 //$timezone = new DateTimeZone( "America/New_York" );
                 //$date = new DateTime();
                 //$date->setTimezone( $timezone );
                 $currentDate = date('Y-m-d H:i:s');
                 $oDate = $app->infuDate($currentDate);
                 try {
                     $invID = $app->blankOrder($cid, "Order for Licenses" . $cid, $oDate, 0, 0);
                 } catch (Exception $e) {
                     echo 'Caught exception: ', $e->getMessage(), "\n";
                 }
                 $ord = $app->getOrderId($invID);
                 $Quantity = $_POST['Quantity'];
                 $subID = array();
                 for ($i = 1; $i <= $Quantity; $i++) {
                     $app->addOrderItem((int) $invID, (int) 50, (int) 4, (double) 0.1, (int) 1, 'Licenses Item' . $i, '');
                     $_intproductid = $app->addRecurringAdv((int) $cid, true, (int) 34, (int) 1, (double) 0.1, false, (int) 2, (int) $ccid, (int) 0, (int) 30);
                     $_nextBillDate = date("d-m-Y", strtotime("1 Months + 1 day"));
                     $subID[$i] = $_intproductid;
                     $thedate = $app->infuDate($_nextBillDate);
                     $app->updateSubscriptionNextBillDate($_intproductid, $thedate);
                     $service["Frequency"] = 1;
                     $service["BillingCycle"] = 2;
                     $app->dsUpdate("RecurringOrder", $_intproductid, $service);
                 }
                 $payStat = $app->chargeInvoice((int) $invID, "Payment Via API", (int) $ccid, (int) 2, false);
                 if (substr($payStat['Message'], 0, 2) == "91") {
                     $payStat = $app->chargeInvoice((int) $invID, "Payment Via API", (int) $ccid, (int) 2, false);
                 }
                 if ($payStat['RefNum'] != "E" && $payStat['Code'] == "APPROVED") {
                     $msg = "Thanks For Order";
                     $user_id = Auth::user()->id;
                     $users = User::findOrFail($user_id);
                     for ($i = 1; $i <= $Quantity; $i++) {
                         $date = new \DateTime();
                         $license = new License();
                         $license->life = 1;
                         $license->license_key = $subID[$i];
                         $license->company_id = $users->company_id;
                         $license->user_id = 0;
                         $license->status = 'ACTIVE';
                         $license->created_by = Auth::user()->id;
                         $license->created_at = $date;
                         $license->updated_at = $date;
                         $license->save();
                     }
                     return view('licenses.shoppingcart', compact('msg'));
                 } else {
                     $msg = "Order cancel due payment";
                     return view('licenses.shoppingcart', compact('msg'));
                 }
             }
         }
     }
     $msg = "";
     return view('licenses.shoppingcart', compact('msg'));
 }
 if (is_array($d)) {
 /*
 * Return array converted to object
 * Using __FUNCTION__ (Magic constant)
 * for recursive call
 */
 return array_map(__FUNCTION__, $d);
 }
 else {
 // Return array
 return $d;
 }
 }

require_once("infusionsoft/src/isdk.php");
$app = new iSDK;
$MFSUnbounceInfusionsoft = get_option( 'MFSUnbounceInfusionsoft' );
$app_name = $MFSUnbounceInfusionsoft['infusionsoft_app'];
$app_key = $MFSUnbounceInfusionsoft['infusionsoft_key'];
if(empty($app_name)) {
  echo 'Your APP Name is empty. Please set your app name to your Infusionsoft API name.<br>';
  return;
}
if(empty($app_key)) {
  echo 'Your APP key is empty. Please set your app key to your Infusionsoft API key.<br>';
  return;
}
if ($app->cfgCon($app_name, $app_key)) {
  // Connected to Infusionsoft - Run Your Code Below
  //echo 'Connected to Infusionsoft<br>';
    $data = ubobjectToArray(json_decode($_REQUEST['data_json']));