Advertisement
reggi

quickbooks controller

Mar 26th, 2012
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.91 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2.  
  3. class Quickbooks extends CI_Controller {
  4.  
  5.   public function oauth(){
  6.     $this->load->helper('quickbooks');
  7.     $this->load->library('sq_library');
  8.     $this->config->load('quickbooks');
  9.        
  10.     $qb_other = $this->config->item('qb_other');
  11.     $qb_application = $this->config->item('qb_application');
  12.  
  13.     $dsn = $qb_other['dsn'];
  14.     $encryption_key = $qb_other['encryption_key'];
  15.     $oauth_consumer_key = $qb_application['development']['oauth_key'];
  16.     $oauth_consumer_secret = $qb_application['development']['oauth_secret'];
  17.     $the_username = $qb_other['the_username'];
  18.     $the_tenant = $qb_other['the_tenant'];
  19.    
  20.     $this->sq_library->config();
  21.     if(count($_GET) == 0){
  22.       $this->sq_library->authenticate();
  23.     }else{
  24.       //var_dump($_GET);
  25.       $oauth_token = $_GET['oauth_token'];
  26.       $oauth_verifier = $_GET['oauth_verifier']
  27.       $realmId = $_GET['realmId'];
  28.       $dataSource = $_GET['dataSource']
  29.      
  30.       $IPP = new QuickBooks_IPP($dsn);
  31.      
  32.       $IntuitAnywhere = new QuickBooks_IPP_IntuitAnywhere($dsn, $encryption_key, $oauth_consumer_key, $oauth_consumer_secret);
  33.       $creds = $IntuitAnywhere->load($the_username, $the_tenant);
  34.      
  35.       /*
  36.       $Service = new QuickBooks_IPP_Service_SalesReceipt();
  37.  
  38.       $SalesReceipt = new QuickBooks_IPP_Object_SalesReceipt();
  39.  
  40.       $Header = new QuickBooks_IPP_Object_Header();
  41.       $Header->setDocNumber('TESTabcd');
  42.       $Header->setTxnDate(date('Y-m-d'));
  43.       $Header->setCustomerName('ConsoliBYTE, LLC');
  44.       $SalesReceipt->addHeader($Header);
  45.  
  46.       $Line = new QuickBooks_IPP_Object_Line();
  47.       $Line->setAmount(525);
  48.       $Line->setItemName('Test Item 1');
  49.       $Line->setQty(5);
  50.       $SalesReceipt->addLine($Line);
  51.  
  52.       $ID = $Service->add($Context, $realmID, $SalesReceipt);
  53.       */
  54.      
  55.     }
  56.  
  57.   }
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement