Advertisement
reggi

quickbooks library

Mar 26th, 2012
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.19 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class sq_library{
  4.  
  5.   function config(){
  6.     $function =& get_instance();
  7.     $function->config->load('quickbooks');
  8.     $qb_other = $function->config->item('qb_other');
  9.     $dsn = $qb_other['dsn'];
  10.     if(!QuickBooks_Utilities::initialized($dsn)){
  11.       QuickBooks_Utilities::initialize($dsn);
  12.     }
  13.   }
  14.  
  15.   function authenticate(){
  16.     $function =& get_instance();
  17.     $function->config->load('quickbooks');
  18.     $qb_other = $function->config->item('qb_other');
  19.     $qb_application = $function->config->item('qb_application');
  20.     $ia = new QuickBooks_IPP_IntuitAnywhere(
  21.       $qb_other['dsn'],
  22.       $qb_other['encryption_key'],
  23.       $qb_application['development']['oauth_key'],
  24.       $qb_application['development']['oauth_secret'],
  25.       $qb_other['this_url'],
  26.       $qb_other['that_url']
  27.     );
  28.     if($ia->handle($qb_other['the_username'], $qb_other['the_tenant'])){
  29.       //redirects to auth page;
  30.     }else{
  31.       die('Oh no, something bad happened: ' . $ia->errorNumber() . ': ' . $ia->errorMessage());
  32.     }
  33.   }
  34.  
  35. }
  36.  
  37. /* End of file library.php */
  38. /* Location: ./application/libraries/library.php */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement