<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require "vendor/autoload.php";
use QuickBooksOnline\API\DataService\DataService;
use QuickBooksOnline\API\Facades\Invoice;
use QuickBooksOnline\API\Facades\PurchaseOrder;
$dataService = DataService::Configure(array(
'auth_mode' => 'oauth1',
'consumerKey' => " ",
'consumerSecret' => " ",
'accessTokenKey' => " ",
'accessTokenSecret' => " ",
'QBORealmID' => "",
'baseUrl' => "https://quickbooks.api.intuit.com/"
));
for($i = 1; $i<= 3; $i ++){
$LineObj = Line::create([
"Id" => $i,
"LineNum" => $i,
"Description" => "Pest Control Services",
"Amount" => 35.0,
"DetailType" => "SalesItemLineDetail",
"SalesItemLineDetail" => [
"ItemRef" => [
"value" => "1",
"name" => "Pest Control"
],
"UnitPrice" => 35,
"Qty" => 1,
"TaxCodeRef" => [
"value" => "NON"
]
]
]);
$lineArray[] = $LineObj;
}
//Add a new Invoice
$theResourceObj = PurchaseOrder::create([
"Line" => $lineArray,
"CustomerRef"=> [
"value"=> "1"
],
"BillEmail" => [
"Address" => "Familiystore@intuit.com"
],
"BillEmailCc" => [
"Address" => "a@intuit.com"
],
"BillEmailBcc" => [
"Address" => "v@intuit.com"
]
]);
?>
Fatal error: Uncaught Error: Class 'Line' not found in /var/www/html/QuickBooks-V3-PHP-SDK-master/Test2.php:24
purchaseOrder.php:
<?php
//require "vendor/autoload.php";
include('src/config.php');
use QuickBooksOnline\API\DataService\DataService;
use QuickBooksOnline\API\Facades\Invoice;
use QuickBooksOnline\API\Facades\PurchaseOrder;
// OBOT Data service
$dataService = DataService::Configure(array(
'auth_mode' => 'oauth1',
'consumerKey' => " ",
'consumerSecret' => " ",
'accessTokenKey' => " ",
'accessTokenSecret' => " ",
'QBORealmID' => " ",
'baseUrl' => "https://quickbooks.api.intuit.com/"
));
$linedet = new IPPPurchaseOrderItemLineDetail();
$linedet->CustomerRef = 86;
$line = new IPPLine();
$line->Id = 0;
$line->Description = 'test purchase order';
$line->Amount = 2.00;
$line->DetailType= 'ItemBasedExpenseLineDetail ';
$line->ItemBasedExpenseLineDetail = $linedet;
$line->BillableStatus = 'Notbillable';
$line->ItemRef = '19';
$line->UnitPrice = '25';
$line->Qty = '1';
$purchaseOrder = new IPPPurchaseOrder();
$purchaseOrder->Line = $line;
$purchaseOrder->VendorRef = 85;
$purchaseOrder->APAccountRef = 1;
$purchaseOrder->TotalAmt = 200.00;
$result = $dataService->Add($purchaseOrder); //add purchase order
?>
PHP Fatal error: Uncaught Error: Class 'IPPPurchaseOrderItemLineDetail' not found in /var/www/html/QuickBooks-V3-PHP-SDK-master/purchaseOrder.php:20
Why am I getting these errors? is the autoload not working? should I just directly include the class files that I need?