Skip to content

Commit 01906e3

Browse files
authored
Merge pull request #202 from Raistlfiren/tax-agency-add
Added TaxAgency as facade
2 parents 6e1ddee + 71faf31 commit 01906e3

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

src/Facades/TaxAgency.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
namespace QuickBooksOnline\API\Facades;
3+
4+
class TaxAgency
5+
{
6+
public static function create(array $data, $throwException = TRUE){
7+
if(!isset($data) || empty($data)) throw new \Exception("Passed array for creating TaxAgency is Empty");
8+
$TaxAgencyObject = FacadeHelper::reflectArrayToObject("TaxAgency", $data, $throwException );
9+
return $TaxAgencyObject;
10+
}
11+
}

src/_Samples/TaxAgencyCreation.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
//Replace the line with require "vendor/autoload.php" if you are using the Samples from outside of _Samples folder
3+
//The TaxService is still the old example. Add TaxService Support will be on later release
4+
include('../config.php');
5+
6+
use QuickBooksOnline\API\Core\ServiceContext;
7+
use QuickBooksOnline\API\DataService\DataService;
8+
use QuickBooksOnline\API\PlatformService\PlatformService;
9+
use QuickBooksOnline\API\Core\Http\Serialization\XmlObjectSerializer;
10+
use QuickBooksOnline\API\Facades\TaxAgency;
11+
12+
13+
// Prep Data Services
14+
$dataService = DataService::Configure(array(
15+
'auth_mode' => 'oauth1',
16+
'consumerKey' => "lve2eZN6ZNBrjN0Wp26JVYJbsOOFbF",
17+
'consumerSecret' => "fUhPIeu6jrq1UmNGXSMsIsl0JaHuHzSkFf3tsmrW",
18+
'accessTokenKey' => "qye2etcpyquO3B1t8ydZJI8OTelqJCMiLZlY5LdX7qZunwoo",
19+
'accessTokenSecret' => "2lEUtSEIvXf64CEkMLaGDK5rCwaxE9UvfW1dYrrH",
20+
'QBORealmID' => "193514489870599",
21+
'baseUrl' => "https://qbonline-e2e.api.intuit.com/"
22+
));
23+
24+
$dataService->setLogLocation("/Users/hlu2/Desktop/newFolderForLog");
25+
26+
$taxAgency = TaxAgency::create([
27+
'DisplayName' => 'Indiana Department of Revenue'
28+
]);
29+
30+
var_dump($taxAgency);
31+
$result = $dataService->Add($taxAgency);
32+
$error = $dataService->getLastError();
33+
if ($error) {
34+
echo "The Status code is: " . $error->getHttpStatusCode() . "\n";
35+
echo "The Helper message is: " . $error->getOAuthHelperError() . "\n";
36+
echo "The Response message is: " . $error->getResponseBody() . "\n";
37+
exit();
38+
}
39+
40+
41+
print_r($result->Id);
42+
43+
####
44+
# Var-dump output
45+
####
46+
/**
47+
*
48+
object(IPPTaxAgency)#40 (4) {
49+
}
50+
51+
*/

0 commit comments

Comments
 (0)