-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1,598 changed files
with
154,996 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
namespace taxes; | ||
|
||
use com\zoho\api\authenticator\OAuthBuilder; | ||
use com\zoho\crm\api\dc\USDataCenter; | ||
use com\zoho\crm\api\InitializeBuilder; | ||
use com\zoho\crm\api\taxes\APIException; | ||
use com\zoho\crm\api\taxes\ResponseWrapper; | ||
use com\zoho\crm\api\taxes\TaxesOperations; | ||
use com\zoho\crm\api\util\Choice; | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
class GetTax | ||
{ | ||
public static function initialize() | ||
{ | ||
$environment = USDataCenter::PRODUCTION(); | ||
$token = (new OAuthBuilder()) | ||
->clientId("client_id") | ||
->clientSecret("client_secret") | ||
->refreshToken("refresh_token") | ||
->build(); | ||
(new InitializeBuilder()) | ||
->environment($environment) | ||
->token($token) | ||
->initialize(); | ||
} | ||
|
||
/** | ||
* <h3> Get Tax </h3> | ||
* This method is used to get the Organization Tax and print the response. | ||
* @param taxId - The ID of the tax to be obtainted | ||
* @throws Exception | ||
*/ | ||
public static function getTax(string $taxId) | ||
{ | ||
$taxesOperations = new TaxesOperations(); | ||
//Call getTax method that takes taxId as parameter | ||
$response = $taxesOperations->getTax($taxId); | ||
if ($response != null) { | ||
echo ("Status code " . $response->getStatusCode() . "\n"); | ||
if (in_array($response->getStatusCode(), array(204, 304))) { | ||
echo ($response->getStatusCode() == 204 ? "No Content\n" : "Not Modified\n"); | ||
return; | ||
} | ||
$responseHandler = $response->getObject(); | ||
if ($responseHandler instanceof ResponseWrapper) { | ||
$responseWrapper = $responseHandler; | ||
$orgTax = $responseWrapper->getOrgTaxes(); | ||
$taxes = $orgTax->getTaxes(); | ||
if ($taxes != null) { | ||
foreach ($taxes as $tax) { | ||
echo ("Tax DisplayLabel: " . $tax->getDisplayLabel() . "\n"); | ||
echo ("Tax Name: " . $tax->getName() . "\n"); | ||
echo ("Tax Id: " . $tax->getId() . "\n"); | ||
echo ("Tax Value: " . $tax->getValue() . "\n"); | ||
} | ||
} | ||
$preference = $orgTax->getPreference(); | ||
if ($preference != null) { | ||
echo ("Preference AutoPopulateTax: "); | ||
print_r($preference->getAutoPopulateTax()); | ||
echo ("\n"); | ||
echo ("Preference ModifyTaxRates: "); | ||
print_r($preference->getModifyTaxRates()); | ||
echo ("\n"); | ||
} | ||
} | ||
else if ($responseHandler instanceof APIException) { | ||
$exception = $responseHandler; | ||
echo ("Status: " . $exception->getStatus()->getValue() . "\n"); | ||
echo ("Code: " . $exception->getCode()->getValue() . "\n"); | ||
echo ("Details: "); | ||
foreach ($exception->getDetails() as $key => $value) { | ||
echo ($key . " : " . $value . "\n"); | ||
} | ||
echo ("Message : " . ($exception->getMessage() instanceof Choice ? $exception->getMessage()->getValue() : $exception->getMessage())); | ||
} | ||
} | ||
} | ||
} | ||
$taxId = "34773778001"; | ||
GetTax::initialize(); | ||
GetTax::getTax($taxId); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
namespace taxes; | ||
|
||
use com\zoho\api\authenticator\OAuthBuilder; | ||
use com\zoho\crm\api\dc\USDataCenter; | ||
use com\zoho\crm\api\InitializeBuilder; | ||
use com\zoho\crm\api\taxes\APIException; | ||
use com\zoho\crm\api\taxes\ResponseWrapper; | ||
use com\zoho\crm\api\taxes\TaxesOperations; | ||
use com\zoho\crm\api\util\Choice; | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
class GetTaxes | ||
{ | ||
public static function initialize() | ||
{ | ||
$environment = USDataCenter::PRODUCTION(); | ||
$token = (new OAuthBuilder()) | ||
->clientId("client_id") | ||
->clientSecret("client_secret") | ||
->refreshToken("refresh_token") | ||
->build(); | ||
(new InitializeBuilder()) | ||
->environment($environment) | ||
->token($token) | ||
->initialize(); | ||
} | ||
|
||
/** | ||
* <h3> Get Taxes </h3> | ||
* This method is used to get all the Organization Taxes and print the response. | ||
* @throws Exception | ||
*/ | ||
public static function getTaxes() | ||
{ | ||
$taxesOperations = new TaxesOperations(); | ||
//Call getTaxes method | ||
$response = $taxesOperations->getTaxes(); | ||
if ($response != null) { | ||
echo ("Status code " . $response->getStatusCode() . "\n"); | ||
if (in_array($response->getStatusCode(), array(204, 304))) { | ||
echo ($response->getStatusCode() == 204 ? "No Content\n" : "Not Modified\n"); | ||
return; | ||
} | ||
$responseHandler = $response->getObject(); | ||
if ($responseHandler instanceof ResponseWrapper) { | ||
$responseWrapper = $responseHandler; | ||
$orgTax = $responseWrapper->getOrgTaxes(); | ||
$taxes = $orgTax->getTaxes(); | ||
if ($taxes != null) { | ||
foreach ($taxes as $tax) { | ||
echo ("Tax DisplayLabel: " . $tax->getDisplayLabel() . "\n"); | ||
echo ("Tax Name: " . $tax->getName() . "\n"); | ||
echo ("Tax Id: " . $tax->getId() . "\n"); | ||
echo ("Tax Value: " . $tax->getValue() . "\n"); | ||
} | ||
} | ||
$preference = $orgTax->getPreference(); | ||
if ($preference != null) { | ||
echo ("Preference AutoPopulateTax: "); | ||
print_r($preference->getAutoPopulateTax()); | ||
echo ("\n"); | ||
echo ("Preference ModifyTaxRates: "); | ||
print_r($preference->getModifyTaxRates()); | ||
echo ("\n"); | ||
} | ||
} | ||
else if ($responseHandler instanceof APIException) { | ||
$exception = $responseHandler; | ||
echo ("Status: " . $exception->getStatus()->getValue() . "\n"); | ||
echo ("Code: " . $exception->getCode()->getValue() . "\n"); | ||
echo ("Details: "); | ||
foreach ($exception->getDetails() as $key => $value) { | ||
echo ($key . " : " . $value . "\n"); | ||
} | ||
echo ("Message : " . ($exception->getMessage() instanceof Choice ? $exception->getMessage()->getValue() : $exception->getMessage())); | ||
} | ||
} | ||
} | ||
} | ||
GetTaxes::initialize(); | ||
GetTaxes::getTaxes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
<?php | ||
namespace com\zoho\crm\sample\taxes; | ||
|
||
use com\zoho\api\authenticator\OAuthBuilder; | ||
use com\zoho\crm\api\dc\USDataCenter; | ||
use com\zoho\crm\api\InitializeBuilder; | ||
use com\zoho\crm\api\taxes\ActionWrapper; | ||
use com\zoho\crm\api\taxes\APIException; | ||
use com\zoho\crm\api\taxes\BodyWrapper; | ||
use com\zoho\crm\api\taxes\OrgTax; | ||
use com\zoho\crm\api\taxes\Preference; | ||
use com\zoho\crm\api\taxes\TaxesOperations; | ||
use com\zoho\crm\api\taxes\Tax; | ||
use com\zoho\crm\api\taxes\SuccessResponse; | ||
use com\zoho\crm\api\util\Choice; | ||
|
||
require_once "vendor/autoload.php"; | ||
|
||
class UpdateTaxes | ||
{ | ||
public static function initialize() | ||
{ | ||
$environment = USDataCenter::PRODUCTION(); | ||
$token = (new OAuthBuilder()) | ||
->clientId("client_id") | ||
->clientSecret("client_secret") | ||
->refreshToken("refresh_token") | ||
->build(); | ||
(new InitializeBuilder()) | ||
->environment($environment) | ||
->token($token) | ||
->initialize(); | ||
} | ||
/** | ||
* <h3> Update Taxes </h3> | ||
* This method is used to update Organization Taxes and print the response. | ||
* @throws Exception | ||
*/ | ||
public static function updateTaxes() | ||
{ | ||
$taxesOperations = new TaxesOperations(); | ||
$request = new BodyWrapper(); | ||
$orgTax = new OrgTax(); | ||
//List of Tax instances | ||
$taxList = array(); | ||
|
||
/** update tax */ | ||
$tax1 = new Tax(); | ||
$tax1->setId("3477779001"); | ||
$tax1->setName("MyTax435"); | ||
$tax1->setSequenceNumber(1); | ||
$tax1->setValue(15.0); | ||
array_push($taxList, $tax1); | ||
|
||
/** create tax */ | ||
$tax2 = new Tax(); | ||
$tax2->setName("New Tax"); | ||
$tax2->setSequenceNumber(1); | ||
$tax2->setValue(15.0); | ||
array_push($taxList, $tax2); | ||
|
||
/** delete tax */ | ||
$tax3 = new Tax(); | ||
$tax3->setId("34770619001"); | ||
$tax3->setDelete(null); | ||
array_push($taxList, $tax3); | ||
|
||
$orgTax->setTaxes($taxList); | ||
$preference = new Preference(); | ||
$preference->setAutoPopulateTax(false); | ||
$preference->setModifyTaxRates(false); | ||
$orgTax->setPreference($preference); | ||
$request->setOrgTaxes($orgTax); | ||
//Call updateTaxes method that takes BodyWrapper instance as parameter | ||
$response = $taxesOperations->updateTaxes($request); | ||
if ($response != null) { | ||
echo ("Status Code: " . $response->getStatusCode() . "\n"); | ||
$actionHandler = $response->getObject(); | ||
if ($actionHandler instanceof ActionWrapper) { | ||
$actionWrapper = $actionHandler; | ||
$actionResponse = $actionWrapper->getOrgTaxes(); | ||
if ($actionResponse instanceof SuccessResponse) { | ||
$successResponse = $actionResponse; | ||
echo ("Status: " . $successResponse->getStatus()->getValue() . "\n"); | ||
echo ("Code: " . $successResponse->getCode()->getValue() . "\n"); | ||
if ($successResponse->getDetails() != null) { | ||
echo ("Details: "); | ||
foreach ($successResponse->getDetails() as $key => $value) { | ||
echo ($key . " : "); | ||
print_r($value); | ||
echo ("\n"); | ||
} | ||
} | ||
echo ("Message: " . ($successResponse->getMessage() instanceof Choice ? $successResponse->getMessage()->getValue() : $successResponse->getMessage()) . "\n"); | ||
} | ||
else if ($actionResponse instanceof APIException) { | ||
$exception = $actionResponse; | ||
echo ("Status: " . $exception->getStatus()->getValue() . "\n"); | ||
echo ("Code: " . $exception->getCode()->getValue() . "\n"); | ||
echo ("Details: "); | ||
foreach ($exception->getDetails() as $key => $value) { | ||
echo ($key . " : "); print_r($value); echo("\n"); | ||
} | ||
echo ("Message : " . ($exception->getMessage() instanceof Choice ? $exception->getMessage()->getValue() : $exception->getMessage()) . "\n"); | ||
} | ||
} | ||
else if ($actionHandler instanceof APIException) { | ||
$exception = $actionHandler; | ||
echo ("Status: " . $exception->getStatus()->getValue() . "\n"); | ||
echo ("Code: " . $exception->getCode()->getValue() . "\n"); | ||
echo ("Details: "); | ||
foreach ($exception->getDetails() as $key => $value) { | ||
echo ($key . " : " . $value . "\n"); | ||
} | ||
echo ("Message : " . ($exception->getMessage() instanceof Choice ? $exception->getMessage()->getValue() : $exception->getMessage())); | ||
} | ||
} | ||
} | ||
} | ||
UpdateTaxes::initialize(); | ||
UpdateTaxes::updateTaxes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace com\zoho\crm\api\assignmentrules; | ||
|
||
interface ActionResponse | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.